Skip to content

Commit 9c63afc

Browse files
Sylwester NawrockiMauro Carvalho Chehab
Sylwester Nawrocki
authored and
Mauro Carvalho Chehab
committed
[media] s5p-fimc: Adjust pixel height alignments according to the IP revision
Minimum vertical pixel size alignment for input and output DMA and the scaler depend on color format, rotation, the IP instance and revision. Make vertical pixel size of format and crop better fit for each SoC revision and the IP instance by adding min_vsize_align attribute to the FIMC variant data structure. It's now common for the DMA engines and the scaler. Signed-off-by: Sylwester Nawrocki <[email protected]> Signed-off-by: Kyungmin Park <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 5cbf6f1 commit 9c63afc

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

drivers/media/video/s5p-fimc/fimc-capture.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ static struct fimc_fmt *fimc_capture_try_format(struct fimc_ctx *ctx,
526526
max_w = rotation ? pl->out_rot_en_w : pl->out_rot_dis_w;
527527
min_w = ctx->state & FIMC_DST_CROP ? dst->width : var->min_out_pixsize;
528528
min_h = ctx->state & FIMC_DST_CROP ? dst->height : var->min_out_pixsize;
529-
if (fimc->id == 1 && var->pix_hoff)
529+
if (var->min_vsize_align == 1 && !rotation)
530530
align_h = fimc_fmt_is_rgb(ffmt->color) ? 0 : 1;
531531

532532
depth = fimc_get_format_depth(ffmt);

drivers/media/video/s5p-fimc/fimc-core.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,12 +1038,11 @@ static int fimc_try_fmt_mplane(struct fimc_ctx *ctx, struct v4l2_format *f)
10381038
mod_x = 6; /* 64 x 32 pixels tile */
10391039
mod_y = 5;
10401040
} else {
1041-
if (fimc->id == 1 && variant->pix_hoff)
1041+
if (variant->min_vsize_align == 1)
10421042
mod_y = fimc_fmt_is_rgb(fmt->color) ? 0 : 1;
10431043
else
1044-
mod_y = mod_x;
1044+
mod_y = ffs(variant->min_vsize_align) - 1;
10451045
}
1046-
dbg("mod_x: %d, mod_y: %d, max_w: %d", mod_x, mod_y, max_w);
10471046

10481047
v4l_bound_align_image(&pix->width, 16, max_w, mod_x,
10491048
&pix->height, 8, variant->pix_limit->scaler_dis_w, mod_y, 0);
@@ -1226,10 +1225,10 @@ static int fimc_m2m_try_crop(struct fimc_ctx *ctx, struct v4l2_crop *cr)
12261225
fimc->variant->min_inp_pixsize : fimc->variant->min_out_pixsize;
12271226

12281227
/* Get pixel alignment constraints. */
1229-
if (fimc->id == 1 && fimc->variant->pix_hoff)
1228+
if (fimc->variant->min_vsize_align == 1)
12301229
halign = fimc_fmt_is_rgb(f->fmt->color) ? 0 : 1;
12311230
else
1232-
halign = ffs(min_size) - 1;
1231+
halign = ffs(fimc->variant->min_vsize_align) - 1;
12331232

12341233
for (i = 0; i < f->fmt->colplanes; i++)
12351234
depth += f->fmt->depth[i];
@@ -1834,6 +1833,7 @@ static struct samsung_fimc_variant fimc0_variant_s5p = {
18341833
.min_inp_pixsize = 16,
18351834
.min_out_pixsize = 16,
18361835
.hor_offs_align = 8,
1836+
.min_vsize_align = 16,
18371837
.out_buf_count = 4,
18381838
.pix_limit = &s5p_pix_limit[0],
18391839
};
@@ -1843,6 +1843,7 @@ static struct samsung_fimc_variant fimc2_variant_s5p = {
18431843
.min_inp_pixsize = 16,
18441844
.min_out_pixsize = 16,
18451845
.hor_offs_align = 8,
1846+
.min_vsize_align = 16,
18461847
.out_buf_count = 4,
18471848
.pix_limit = &s5p_pix_limit[1],
18481849
};
@@ -1855,6 +1856,7 @@ static struct samsung_fimc_variant fimc0_variant_s5pv210 = {
18551856
.min_inp_pixsize = 16,
18561857
.min_out_pixsize = 16,
18571858
.hor_offs_align = 8,
1859+
.min_vsize_align = 16,
18581860
.out_buf_count = 4,
18591861
.pix_limit = &s5p_pix_limit[1],
18601862
};
@@ -1868,6 +1870,7 @@ static struct samsung_fimc_variant fimc1_variant_s5pv210 = {
18681870
.min_inp_pixsize = 16,
18691871
.min_out_pixsize = 16,
18701872
.hor_offs_align = 1,
1873+
.min_vsize_align = 1,
18711874
.out_buf_count = 4,
18721875
.pix_limit = &s5p_pix_limit[2],
18731876
};
@@ -1878,6 +1881,7 @@ static struct samsung_fimc_variant fimc2_variant_s5pv210 = {
18781881
.min_inp_pixsize = 16,
18791882
.min_out_pixsize = 16,
18801883
.hor_offs_align = 8,
1884+
.min_vsize_align = 16,
18811885
.out_buf_count = 4,
18821886
.pix_limit = &s5p_pix_limit[2],
18831887
};
@@ -1892,6 +1896,7 @@ static struct samsung_fimc_variant fimc0_variant_exynos4 = {
18921896
.min_inp_pixsize = 16,
18931897
.min_out_pixsize = 16,
18941898
.hor_offs_align = 2,
1899+
.min_vsize_align = 1,
18951900
.out_buf_count = 32,
18961901
.pix_limit = &s5p_pix_limit[1],
18971902
};
@@ -1904,6 +1909,7 @@ static struct samsung_fimc_variant fimc3_variant_exynos4 = {
19041909
.min_inp_pixsize = 16,
19051910
.min_out_pixsize = 16,
19061911
.hor_offs_align = 2,
1912+
.min_vsize_align = 1,
19071913
.out_buf_count = 32,
19081914
.pix_limit = &s5p_pix_limit[3],
19091915
};

drivers/media/video/s5p-fimc/fimc-core.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ struct fimc_pix_limit {
377377
* @min_inp_pixsize: minimum input pixel size
378378
* @min_out_pixsize: minimum output pixel size
379379
* @hor_offs_align: horizontal pixel offset aligment
380+
* @min_vsize_align: minimum vertical pixel size alignment
380381
* @out_buf_count: the number of buffers in output DMA sequence
381382
*/
382383
struct samsung_fimc_variant {
@@ -390,6 +391,7 @@ struct samsung_fimc_variant {
390391
u16 min_inp_pixsize;
391392
u16 min_out_pixsize;
392393
u16 hor_offs_align;
394+
u16 min_vsize_align;
393395
u16 out_buf_count;
394396
};
395397

0 commit comments

Comments
 (0)