}
/* Shading table size per color */
- if (st->width > SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR ||
- st->height > SH_CSS_MAX_SCTBL_HEIGHT_PER_COLOR) {
- dev_err(asd->isp->dev, "shading table w/h validate failed!");
- return -EINVAL;
+ if (!atomisp_hw_is_isp2401) {
+ if (st->width > ISP2400_SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR ||
+ st->height > ISP2400_SH_CSS_MAX_SCTBL_HEIGHT_PER_COLOR) {
+ dev_err(asd->isp->dev, "shading table w/h validate failed!");
+ return -EINVAL;
+ }
+ } else {
+ if (st->width > ISP2401_SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR ||
+ st->height > ISP2401_SH_CSS_MAX_SCTBL_HEIGHT_PER_COLOR) {
+ dev_err(asd->isp->dev, "shading table w/h validate failed!");
+ return -EINVAL;
+ }
}
shading_table = atomisp_css_shading_table_alloc(st->width, st->height);
}
/* Shading table size per color */
- if (user_shading_table->width > SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR ||
- user_shading_table->height > SH_CSS_MAX_SCTBL_HEIGHT_PER_COLOR)
- return -EINVAL;
+ if (!atomisp_hw_is_isp2401) {
+ if (user_shading_table->width > ISP2400_SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR ||
+ user_shading_table->height > ISP2400_SH_CSS_MAX_SCTBL_HEIGHT_PER_COLOR)
+ return -EINVAL;
+ } else {
+ if (user_shading_table->width > ISP2401_SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR ||
+ user_shading_table->height > ISP2401_SH_CSS_MAX_SCTBL_HEIGHT_PER_COLOR)
+ return -EINVAL;
+ }
shading_table = atomisp_css_shading_table_alloc(
user_shading_table->width, user_shading_table->height);
struct ia_css_binary vf_pp_binary;
struct ia_css_binary *yuv_scaler_binary;
struct ia_css_frame *delay_frames[MAX_NUM_VIDEO_DELAY_FRAMES];
-#ifndef ISP2401
- struct ia_css_frame *tnr_frames[NUM_VIDEO_TNR_FRAMES];
-#else
struct ia_css_frame *tnr_frames[NUM_TNR_FRAMES];
-#endif
struct ia_css_frame *vf_pp_in_frame;
struct ia_css_pipe *copy_pipe;
struct ia_css_pipe *capture_pipe;
#include "type_support.h"
-#ifdef ISP2401
/* To position the shading center grid point on the center of output image,
* one more grid cell is needed as margin. */
#define SH_CSS_SCTBL_CENTERING_MARGIN 1
/* The shading table width and height are the number of grids, not cells. The last grid should be counted. */
#define SH_CSS_SCTBL_LAST_GRID_COUNT 1
+#ifdef ISP2401
/* Number of horizontal grids per color in the shading table. */
#define _ISP_SCTBL_WIDTH_PER_COLOR(input_width, deci_factor_log2) \
(ISP_BQ_GRID_WIDTH(input_width, deci_factor_log2) + \
#define _ISP_SCTBL_HEIGHT(input_height, deci_factor_log2) \
(ISP_BQ_GRID_HEIGHT(input_height, deci_factor_log2) + \
SH_CSS_SCTBL_CENTERING_MARGIN + SH_CSS_SCTBL_LAST_GRID_COUNT)
+#endif
/* Legacy API: Number of horizontal grids per color in the shading table. */
#define _ISP_SCTBL_LEGACY_WIDTH_PER_COLOR(input_width, deci_factor_log2) \
#define _ISP_SCTBL_LEGACY_HEIGHT(input_height, deci_factor_log2) \
(ISP_BQ_GRID_HEIGHT(input_height, deci_factor_log2) + SH_CSS_SCTBL_LAST_GRID_COUNT)
-#endif
/* SC (Shading Corrction) */
struct sh_css_isp_sc_params {
s32 gain_shift;
};
-#ifdef ISP2401
/* Number of horizontal slice times for interpolated gain:
*
* The start position of the internal frame does not match the start position of the shading table.
u32 internal_frame_origin_y_bqs_on_sctbl;
};
-#endif
#endif /* __IA_CSS_SC_PARAM_H */
ia_css_dma_configure_from_info(&to->port_b, &from->tnr_frames[0]->info);
to->width_a_over_b = elems_a / to->port_b.elems;
to->frame_height = from->tnr_frames[0]->info.res.height;
-#ifndef ISP2401
- for (i = 0; i < NUM_VIDEO_TNR_FRAMES; i++) {
-#else
for (i = 0; i < NUM_TNR_FRAMES; i++) {
-#endif
to->tnr_frame_addr[i] = from->tnr_frames[i]->data +
from->tnr_frames[i]->planes.yuyv.offset;
}
struct ia_css_tnr_configuration config;
unsigned int i;
-#ifndef ISP2401
- for (i = 0; i < NUM_VIDEO_TNR_FRAMES; i++)
-#else
for (i = 0; i < NUM_TNR_FRAMES; i++)
-#endif
config.tnr_frames[i] = frames[i];
ia_css_configure_tnr(binary, &config);
{
(void)size;
-#ifndef ISP2401
- assert(NUM_VIDEO_TNR_FRAMES >= 2);
-#endif
+ assert(NUM_TNR_FRAMES >= 2);
assert(sizeof(*state) == size);
state->tnr_in_buf_idx = 0;
state->tnr_out_buf_idx = 1;
};
struct ia_css_tnr_configuration {
-#ifndef ISP2401
- const struct ia_css_frame *tnr_frames[NUM_VIDEO_TNR_FRAMES];
-#else
const struct ia_css_frame *tnr_frames[NUM_TNR_FRAMES];
-#endif
};
struct sh_css_isp_tnr_isp_config {
u32 width_a_over_b;
u32 frame_height;
struct dma_port_config port_b;
-#ifndef ISP2401
- hrt_vaddress tnr_frame_addr[NUM_VIDEO_TNR_FRAMES];
-#else
hrt_vaddress tnr_frame_addr[NUM_TNR_FRAMES];
-#endif
};
#endif /* __IA_CSS_TNR_PARAM_H */
/* [isp vmem] table size[vectors] per line per color (GR,R,B,GB),
multiples of NWAY */
-#define SCTBL_VECTORS_PER_LINE_PER_COLOR \
- CEIL_DIV(SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR, ISP_VEC_NELEMS)
+#define ISP2400_SCTBL_VECTORS_PER_LINE_PER_COLOR \
+ CEIL_DIV(ISP2400_SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR, ISP_VEC_NELEMS)
+#define ISP2401_SCTBL_VECTORS_PER_LINE_PER_COLOR \
+ CEIL_DIV(ISP2401_SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR, ISP_VEC_NELEMS)
/* [isp vmem] table size[vectors] per line for 4colors (GR,R,B,GB),
multiples of NWAY */
#define SCTBL_VECTORS_PER_LINE \
int sctbl_width_per_color;
int sctbl_aligned_width_per_color;
int sctbl_height;
-#ifdef ISP2401
int sctbl_legacy_width_per_color;
int sctbl_legacy_height;
-#endif
struct ia_css_sdis_info dis;
struct ia_css_resolution dvs_envelope;
bool online;
if (info->enable.sc)
{
- binary->sctbl_width_per_color =
-#ifndef ISP2401
- _ISP_SCTBL_WIDTH_PER_COLOR(sc_3a_dis_padded_width,
- s3a_log_deci);
-#else
- _ISP_SCTBL_WIDTH_PER_COLOR(isp_internal_width, s3a_log_deci);
-#endif
- binary->sctbl_aligned_width_per_color =
- SH_CSS_MAX_SCTBL_ALIGNED_WIDTH_PER_COLOR;
- binary->sctbl_height =
-#ifndef ISP2401
- _ISP_SCTBL_HEIGHT(sc_3a_dis_height, s3a_log_deci);
-#else
- _ISP_SCTBL_HEIGHT(isp_internal_height, s3a_log_deci);
- binary->sctbl_legacy_width_per_color =
- _ISP_SCTBL_LEGACY_WIDTH_PER_COLOR(sc_3a_dis_padded_width, s3a_log_deci);
- binary->sctbl_legacy_height =
- _ISP_SCTBL_LEGACY_HEIGHT(sc_3a_dis_height, s3a_log_deci);
+ if (!atomisp_hw_is_isp2401) {
+ binary->sctbl_width_per_color = _ISP_SCTBL_WIDTH_PER_COLOR(sc_3a_dis_padded_width, s3a_log_deci);
+ binary->sctbl_aligned_width_per_color = ISP2400_SH_CSS_MAX_SCTBL_ALIGNED_WIDTH_PER_COLOR;
+ binary->sctbl_height = _ISP_SCTBL_HEIGHT(sc_3a_dis_height, s3a_log_deci);
+ } else {
+ binary->sctbl_width_per_color = _ISP_SCTBL_WIDTH_PER_COLOR(isp_internal_width, s3a_log_deci);
+ binary->sctbl_aligned_width_per_color = ISP2401_SH_CSS_MAX_SCTBL_ALIGNED_WIDTH_PER_COLOR;
+ binary->sctbl_height = _ISP_SCTBL_HEIGHT(isp_internal_height, s3a_log_deci);
+#ifdef ISP2401
+ binary->sctbl_legacy_width_per_color = _ISP_SCTBL_LEGACY_WIDTH_PER_COLOR(sc_3a_dis_padded_width, s3a_log_deci);
+ binary->sctbl_legacy_height = _ISP_SCTBL_LEGACY_HEIGHT(sc_3a_dis_height, s3a_log_deci);
#endif
+ }
} else
{
binary->sctbl_width_per_color = 0;
binary->sctbl_aligned_width_per_color = 0;
binary->sctbl_height = 0;
-#ifdef ISP2401
- binary->sctbl_legacy_width_per_color = 0;
- binary->sctbl_legacy_height = 0;
-#endif
+ if (atomisp_hw_is_isp2401) {
+ binary->sctbl_legacy_width_per_color = 0;
+ binary->sctbl_legacy_height = 0;
+ }
}
ia_css_sdis_init_info(&binary->dis,
sc_3a_dis_width,
"in", true);
}
-#ifndef ISP2401
- for (i = 0; i < NUM_VIDEO_TNR_FRAMES; i++) {
-#else
for (i = 0; i < NUM_TNR_FRAMES; i++) {
-#endif
if (stage->args.tnr_frames[i]) {
ia_css_debug_pipe_graph_dump_frame(
stage->args.tnr_frames[i], id,
{
unsigned int i;
-#ifndef ISP2401
- for (i = 0; i < NUM_VIDEO_TNR_FRAMES; i++)
-#else
for (i = 0; i < NUM_TNR_FRAMES; i++)
-#endif
args->tnr_frames[i] = NULL;
for (i = 0; i < MAX_NUM_VIDEO_DELAY_FRAMES; i++)
args->delay_frames[i] = NULL;
}
}
#ifndef ISP2401
- ia_css_frame_free_multiple(NUM_VIDEO_TNR_FRAMES,
+ ia_css_frame_free_multiple(NUM_TNR_FRAMES,
pipe->pipe_settings.video.tnr_frames);
#else
ia_css_frame_free_multiple(NUM_TNR_FRAMES,
if (video_stage) {
int frm;
#ifndef ISP2401
- for (frm = 0; frm < NUM_VIDEO_TNR_FRAMES; frm++) {
+ for (frm = 0; frm < NUM_TNR_FRAMES; frm++) {
#else
for (frm = 0; frm < NUM_TNR_FRAMES; frm++) {
#endif
tnr_info.raw_bit_depth = SH_CSS_TNR_BIT_DEPTH;
#ifndef ISP2401
- for (i = 0; i < NUM_VIDEO_TNR_FRAMES; i++) {
+ for (i = 0; i < NUM_TNR_FRAMES; i++) {
#else
for (i = 0; i < NUM_TNR_FRAMES; i++) {
#endif
#define SH_CSS_MIN_SENSOR_WIDTH 2
#define SH_CSS_MIN_SENSOR_HEIGHT 2
-#if defined(IS_ISP_2400_SYSTEM)
-/* MAX width and height set to the same to allow for rotated
- * resolutions. */
-#define SH_CSS_MAX_VF_WIDTH 1920
-#define SH_CSS_MAX_VF_HEIGHT 1920
-#else
-#define SH_CSS_MAX_VF_WIDTH 1280
-#define SH_CSS_MAX_VF_HEIGHT 960
-#endif
/*
#define SH_CSS_MAX_VF_WIDTH_DEC 1920
#define SH_CSS_MAX_VF_HEIGHT_DEC 1080
#define SH_CSS_MORPH_TABLE_ELEMS_PER_DDR_WORD \
(HIVE_ISP_DDR_WORD_BYTES / SH_CSS_MORPH_TABLE_ELEM_BYTES)
-#ifndef ISP2401
-#define SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR (SH_CSS_MAX_BQ_GRID_WIDTH + 1)
-#define SH_CSS_MAX_SCTBL_HEIGHT_PER_COLOR (SH_CSS_MAX_BQ_GRID_HEIGHT + 1)
-#else
+
+#define ISP2400_SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR (SH_CSS_MAX_BQ_GRID_WIDTH + 1)
+#define ISP2400_SH_CSS_MAX_SCTBL_HEIGHT_PER_COLOR (SH_CSS_MAX_BQ_GRID_HEIGHT + 1)
+
+#define ISP2400_SH_CSS_MAX_SCTBL_ALIGNED_WIDTH_PER_COLOR \
+ CEIL_MUL(ISP2400_SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR, ISP_VEC_NELEMS)
+
/* TODO: I will move macros of "*_SCTBL_*" to SC kernel.
"+ 2" should be "+ SH_CSS_SCTBL_CENTERING_MARGIN + SH_CSS_SCTBL_LAST_GRID_COUNT". (michie, Sep/23/2014) */
-#define SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR (SH_CSS_MAX_BQ_GRID_WIDTH + 2)
-#define SH_CSS_MAX_SCTBL_HEIGHT_PER_COLOR (SH_CSS_MAX_BQ_GRID_HEIGHT + 2)
-#endif
-#define SH_CSS_MAX_SCTBL_ALIGNED_WIDTH_PER_COLOR \
- CEIL_MUL(SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR, ISP_VEC_NELEMS)
+#define ISP2401_SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR (SH_CSS_MAX_BQ_GRID_WIDTH + 2)
+#define ISP2401_SH_CSS_MAX_SCTBL_HEIGHT_PER_COLOR (SH_CSS_MAX_BQ_GRID_HEIGHT + 2)
+
+#define ISP2401_SH_CSS_MAX_SCTBL_ALIGNED_WIDTH_PER_COLOR \
+ CEIL_MUL(ISP2400_SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR, ISP_VEC_NELEMS)
/* Each line of this table is aligned to the maximum line width. */
#define SH_CSS_MAX_S3ATBL_WIDTH SH_CSS_MAX_BQ_GRID_WIDTH
-#ifndef ISP2401
-/* The video binary supports a delay of 1 or 2 */
-#define MAX_DVS_FRAME_DELAY 2
-/* We always need one additional frame because the video binary
- * reads the previous and writes the current frame concurrently */
-#define MAX_NUM_VIDEO_DELAY_FRAMES (MAX_DVS_FRAME_DELAY + 1)
-#define NUM_VIDEO_TNR_FRAMES 2
-
-#define NUM_TNR_FRAMES 2 /* FIXME */
-
-#define MAX_NUM_DELAY_FRAMES MAX_NUM_VIDEO_DELAY_FRAMES
-
-#else
/* Video mode specific DVS define */
/* The video binary supports a delay of 1 or 2 frames */
#define VIDEO_FRAME_DELAY 2
*/
#define NUM_VALID_TNR_REF_FRAMES (1) /* At least one valid TNR reference frame is required */
#define NUM_TNR_FRAMES_PER_REF_BUF_SET (2)
-
/* In luma-only mode alternate illuminated frames are supported, that requires two double buffers */
#define NUM_TNR_REF_BUF_SETS (1)
#define NUM_TNR_FRAMES (NUM_TNR_FRAMES_PER_REF_BUF_SET * NUM_TNR_REF_BUF_SETS)
-#define MAX_NUM_DELAY_FRAMES MAX(MAX_NUM_VIDEO_DELAY_FRAMES, NUM_PREVIEW_DVS_FRAMES)
+#define NUM_VIDEO_TNR_FRAMES 2
-#endif
+#define MAX_NUM_DELAY_FRAMES MAX(MAX_NUM_VIDEO_DELAY_FRAMES, NUM_PREVIEW_DVS_FRAMES)
/* Note that this is the define used to configure all data structures common for all modes */
/* It should be equal or bigger to the max number of DVS frames for all possible modes */
CEIL_MUL(_ISP_MORPH_TABLE_WIDTH(width), \
SH_CSS_MORPH_TABLE_ELEMS_PER_DDR_WORD)
-#ifndef ISP2401
#define _ISP_SCTBL_WIDTH_PER_COLOR(input_width, deci_factor_log2) \
(ISP_BQ_GRID_WIDTH(input_width, deci_factor_log2) + 1)
#define _ISP_SCTBL_HEIGHT(input_height, deci_factor_log2) \
CEIL_MUL(_ISP_SCTBL_WIDTH_PER_COLOR(input_width, deci_factor_log2), \
ISP_VEC_NELEMS)
-#endif
+
/* *****************************************************************
* Statistics for 3A (Auto Focus, Auto White Balance, Auto Exposure)
* *****************************************************************/
struct ia_css_frame *in_frame; /* input frame */
struct ia_css_frame
*delay_frames[MAX_NUM_VIDEO_DELAY_FRAMES]; /* reference input frame */
-#ifndef ISP2401
- struct ia_css_frame *tnr_frames[NUM_VIDEO_TNR_FRAMES]; /* tnr frames */
-#else
struct ia_css_frame *tnr_frames[NUM_TNR_FRAMES]; /* tnr frames */
-#endif
struct ia_css_frame
*out_frame[IA_CSS_BINARY_MAX_OUTPUT_PORTS]; /* output frame */
struct ia_css_frame *out_vf_frame; /* viewfinder output frame */