summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/vivid/vivid-tpg.c
diff options
context:
space:
mode:
authorHans Verkuil2015-03-07 17:57:27 +0100
committerMauro Carvalho Chehab2015-04-03 01:38:04 +0200
commitba01f673e031ade4f60583ab1ac4f06dd260a972 (patch)
tree6cac2150d9897e01e3737d4eb5a2eb959a5d9e6b /drivers/media/platform/vivid/vivid-tpg.c
parent[media] vivid-tpg: add helper functions for single buffer planar formats (diff)
downloadkernel-qcow2-linux-ba01f673e031ade4f60583ab1ac4f06dd260a972.tar.gz
kernel-qcow2-linux-ba01f673e031ade4f60583ab1ac4f06dd260a972.tar.xz
kernel-qcow2-linux-ba01f673e031ade4f60583ab1ac4f06dd260a972.zip
[media] vivid-tpg: add hor/vert downsampling fields
This is step one of supporting horizontal and vertical downsampling. This just adds support for the h/vdownsampling fields and it increases the maximum number of planes to 3. Currently none of the planar formats need horizontal or vertical downsampling, so this change has no effect at the moment. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/vivid/vivid-tpg.c')
-rw-r--r--drivers/media/platform/vivid/vivid-tpg.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/media/platform/vivid/vivid-tpg.c b/drivers/media/platform/vivid/vivid-tpg.c
index 66df19d02b34..fa50a1f8a6c1 100644
--- a/drivers/media/platform/vivid/vivid-tpg.c
+++ b/drivers/media/platform/vivid/vivid-tpg.c
@@ -172,6 +172,8 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
tpg->planes = 1;
tpg->buffers = 1;
tpg->recalc_colors = true;
+ tpg->vdownsampling[0] = 1;
+ tpg->hdownsampling[0] = 1;
switch (fourcc) {
case V4L2_PIX_FMT_RGB565:
@@ -192,6 +194,8 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
break;
case V4L2_PIX_FMT_NV16M:
case V4L2_PIX_FMT_NV61M:
+ tpg->vdownsampling[1] = 1;
+ tpg->hdownsampling[1] = 1;
tpg->buffers = 2;
tpg->planes = 2;
/* fall-through */
@@ -273,7 +277,8 @@ void tpg_reset_source(struct tpg_data *tpg, unsigned width, unsigned height,
tpg->compose.width = width;
tpg->compose.height = tpg->buf_height;
for (p = 0; p < tpg->planes; p++)
- tpg->bytesperline[p] = width * tpg->twopixelsize[p] / 2;
+ tpg->bytesperline[p] = (width * tpg->twopixelsize[p]) /
+ (2 * tpg->hdownsampling[p]);
tpg->recalc_square_border = true;
}