aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2011-05-27 12:12:23 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-11-24 18:03:03 -0500
commit9c63afcb02b4313838d83c3660e45544d9fc9976 (patch)
treee33eaca2ddde2be8ac8aec4ff56208320abfe6e7 /drivers/media/video
parent5cbf6f16ecc07e9f73107c1adf95013bce9f2cf6 (diff)
[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 <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/s5p-fimc/fimc-capture.c2
-rw-r--r--drivers/media/video/s5p-fimc/fimc-core.c16
-rw-r--r--drivers/media/video/s5p-fimc/fimc-core.h2
3 files changed, 14 insertions, 6 deletions
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c
index 70f741f7659f..82d9ab6984eb 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -526,7 +526,7 @@ static struct fimc_fmt *fimc_capture_try_format(struct fimc_ctx *ctx,
526 max_w = rotation ? pl->out_rot_en_w : pl->out_rot_dis_w; 526 max_w = rotation ? pl->out_rot_en_w : pl->out_rot_dis_w;
527 min_w = ctx->state & FIMC_DST_CROP ? dst->width : var->min_out_pixsize; 527 min_w = ctx->state & FIMC_DST_CROP ? dst->width : var->min_out_pixsize;
528 min_h = ctx->state & FIMC_DST_CROP ? dst->height : var->min_out_pixsize; 528 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)
530 align_h = fimc_fmt_is_rgb(ffmt->color) ? 0 : 1; 530 align_h = fimc_fmt_is_rgb(ffmt->color) ? 0 : 1;
531 531
532 depth = fimc_get_format_depth(ffmt); 532 depth = fimc_get_format_depth(ffmt);
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c
index 9c3a8c51da4f..7c22d78b0569 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.c
+++ b/drivers/media/video/s5p-fimc/fimc-core.c
@@ -1038,12 +1038,11 @@ static int fimc_try_fmt_mplane(struct fimc_ctx *ctx, struct v4l2_format *f)
1038 mod_x = 6; /* 64 x 32 pixels tile */ 1038 mod_x = 6; /* 64 x 32 pixels tile */
1039 mod_y = 5; 1039 mod_y = 5;
1040 } else { 1040 } else {
1041 if (fimc->id == 1 && variant->pix_hoff) 1041 if (variant->min_vsize_align == 1)
1042 mod_y = fimc_fmt_is_rgb(fmt->color) ? 0 : 1; 1042 mod_y = fimc_fmt_is_rgb(fmt->color) ? 0 : 1;
1043 else 1043 else
1044 mod_y = mod_x; 1044 mod_y = ffs(variant->min_vsize_align) - 1;
1045 } 1045 }
1046 dbg("mod_x: %d, mod_y: %d, max_w: %d", mod_x, mod_y, max_w);
1047 1046
1048 v4l_bound_align_image(&pix->width, 16, max_w, mod_x, 1047 v4l_bound_align_image(&pix->width, 16, max_w, mod_x,
1049 &pix->height, 8, variant->pix_limit->scaler_dis_w, mod_y, 0); 1048 &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)
1226 fimc->variant->min_inp_pixsize : fimc->variant->min_out_pixsize; 1225 fimc->variant->min_inp_pixsize : fimc->variant->min_out_pixsize;
1227 1226
1228 /* Get pixel alignment constraints. */ 1227 /* Get pixel alignment constraints. */
1229 if (fimc->id == 1 && fimc->variant->pix_hoff) 1228 if (fimc->variant->min_vsize_align == 1)
1230 halign = fimc_fmt_is_rgb(f->fmt->color) ? 0 : 1; 1229 halign = fimc_fmt_is_rgb(f->fmt->color) ? 0 : 1;
1231 else 1230 else
1232 halign = ffs(min_size) - 1; 1231 halign = ffs(fimc->variant->min_vsize_align) - 1;
1233 1232
1234 for (i = 0; i < f->fmt->colplanes; i++) 1233 for (i = 0; i < f->fmt->colplanes; i++)
1235 depth += f->fmt->depth[i]; 1234 depth += f->fmt->depth[i];
@@ -1834,6 +1833,7 @@ static struct samsung_fimc_variant fimc0_variant_s5p = {
1834 .min_inp_pixsize = 16, 1833 .min_inp_pixsize = 16,
1835 .min_out_pixsize = 16, 1834 .min_out_pixsize = 16,
1836 .hor_offs_align = 8, 1835 .hor_offs_align = 8,
1836 .min_vsize_align = 16,
1837 .out_buf_count = 4, 1837 .out_buf_count = 4,
1838 .pix_limit = &s5p_pix_limit[0], 1838 .pix_limit = &s5p_pix_limit[0],
1839}; 1839};
@@ -1843,6 +1843,7 @@ static struct samsung_fimc_variant fimc2_variant_s5p = {
1843 .min_inp_pixsize = 16, 1843 .min_inp_pixsize = 16,
1844 .min_out_pixsize = 16, 1844 .min_out_pixsize = 16,
1845 .hor_offs_align = 8, 1845 .hor_offs_align = 8,
1846 .min_vsize_align = 16,
1846 .out_buf_count = 4, 1847 .out_buf_count = 4,
1847 .pix_limit = &s5p_pix_limit[1], 1848 .pix_limit = &s5p_pix_limit[1],
1848}; 1849};
@@ -1855,6 +1856,7 @@ static struct samsung_fimc_variant fimc0_variant_s5pv210 = {
1855 .min_inp_pixsize = 16, 1856 .min_inp_pixsize = 16,
1856 .min_out_pixsize = 16, 1857 .min_out_pixsize = 16,
1857 .hor_offs_align = 8, 1858 .hor_offs_align = 8,
1859 .min_vsize_align = 16,
1858 .out_buf_count = 4, 1860 .out_buf_count = 4,
1859 .pix_limit = &s5p_pix_limit[1], 1861 .pix_limit = &s5p_pix_limit[1],
1860}; 1862};
@@ -1868,6 +1870,7 @@ static struct samsung_fimc_variant fimc1_variant_s5pv210 = {
1868 .min_inp_pixsize = 16, 1870 .min_inp_pixsize = 16,
1869 .min_out_pixsize = 16, 1871 .min_out_pixsize = 16,
1870 .hor_offs_align = 1, 1872 .hor_offs_align = 1,
1873 .min_vsize_align = 1,
1871 .out_buf_count = 4, 1874 .out_buf_count = 4,
1872 .pix_limit = &s5p_pix_limit[2], 1875 .pix_limit = &s5p_pix_limit[2],
1873}; 1876};
@@ -1878,6 +1881,7 @@ static struct samsung_fimc_variant fimc2_variant_s5pv210 = {
1878 .min_inp_pixsize = 16, 1881 .min_inp_pixsize = 16,
1879 .min_out_pixsize = 16, 1882 .min_out_pixsize = 16,
1880 .hor_offs_align = 8, 1883 .hor_offs_align = 8,
1884 .min_vsize_align = 16,
1881 .out_buf_count = 4, 1885 .out_buf_count = 4,
1882 .pix_limit = &s5p_pix_limit[2], 1886 .pix_limit = &s5p_pix_limit[2],
1883}; 1887};
@@ -1892,6 +1896,7 @@ static struct samsung_fimc_variant fimc0_variant_exynos4 = {
1892 .min_inp_pixsize = 16, 1896 .min_inp_pixsize = 16,
1893 .min_out_pixsize = 16, 1897 .min_out_pixsize = 16,
1894 .hor_offs_align = 2, 1898 .hor_offs_align = 2,
1899 .min_vsize_align = 1,
1895 .out_buf_count = 32, 1900 .out_buf_count = 32,
1896 .pix_limit = &s5p_pix_limit[1], 1901 .pix_limit = &s5p_pix_limit[1],
1897}; 1902};
@@ -1904,6 +1909,7 @@ static struct samsung_fimc_variant fimc3_variant_exynos4 = {
1904 .min_inp_pixsize = 16, 1909 .min_inp_pixsize = 16,
1905 .min_out_pixsize = 16, 1910 .min_out_pixsize = 16,
1906 .hor_offs_align = 2, 1911 .hor_offs_align = 2,
1912 .min_vsize_align = 1,
1907 .out_buf_count = 32, 1913 .out_buf_count = 32,
1908 .pix_limit = &s5p_pix_limit[3], 1914 .pix_limit = &s5p_pix_limit[3],
1909}; 1915};
diff --git a/drivers/media/video/s5p-fimc/fimc-core.h b/drivers/media/video/s5p-fimc/fimc-core.h
index a6936dad5b10..c7f01c47b20f 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.h
+++ b/drivers/media/video/s5p-fimc/fimc-core.h
@@ -377,6 +377,7 @@ struct fimc_pix_limit {
377 * @min_inp_pixsize: minimum input pixel size 377 * @min_inp_pixsize: minimum input pixel size
378 * @min_out_pixsize: minimum output pixel size 378 * @min_out_pixsize: minimum output pixel size
379 * @hor_offs_align: horizontal pixel offset aligment 379 * @hor_offs_align: horizontal pixel offset aligment
380 * @min_vsize_align: minimum vertical pixel size alignment
380 * @out_buf_count: the number of buffers in output DMA sequence 381 * @out_buf_count: the number of buffers in output DMA sequence
381 */ 382 */
382struct samsung_fimc_variant { 383struct samsung_fimc_variant {
@@ -390,6 +391,7 @@ struct samsung_fimc_variant {
390 u16 min_inp_pixsize; 391 u16 min_inp_pixsize;
391 u16 min_out_pixsize; 392 u16 min_out_pixsize;
392 u16 hor_offs_align; 393 u16 hor_offs_align;
394 u16 min_vsize_align;
393 u16 out_buf_count; 395 u16 out_buf_count;
394}; 396};
395 397