summaryrefslogtreecommitdiff
path: root/drivers/media/platform
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2015-06-05 09:45:38 +0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-06-06 13:34:52 +0300
commitafeef4ee23b4865d6c3bf294b5ac9d55dbff5b82 (patch)
tree57faa559191a8c0823b4a30ba07f8c67b31102e1 /drivers/media/platform
parent4d38cde776185a78b96f5e3a3e653450050600bd (diff)
downloadlinux-afeef4ee23b4865d6c3bf294b5ac9d55dbff5b82.tar.xz
[media] vivid-tpg: improve Y16 color setup
Currently the colors for the Y16 and Y16_BE pixelformats are in the range 0x0000-0xff00. So pure white (0xffff) is never created. Improve this by making white really white. For other colors the lsb remains 0 so vivid can be used to detect endian problems. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Ricardo Ribalda <ricardo.ribalda@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r--drivers/media/platform/vivid/vivid-tpg.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/media/platform/vivid/vivid-tpg.c b/drivers/media/platform/vivid/vivid-tpg.c
index 32ebf0d90d10..1458c7955547 100644
--- a/drivers/media/platform/vivid/vivid-tpg.c
+++ b/drivers/media/platform/vivid/vivid-tpg.c
@@ -900,12 +900,19 @@ static void gen_twopix(struct tpg_data *tpg,
buf[0][offset] = r_y;
break;
case V4L2_PIX_FMT_Y16:
- buf[0][offset] = 0;
+ /*
+ * Ideally both bytes should be set to r_y, but then you won't
+ * be able to detect endian problems. So keep it 0 except for
+ * the corner case where r_y is 0xff so white really will be
+ * white (0xffff).
+ */
+ buf[0][offset] = r_y == 0xff ? r_y : 0;
buf[0][offset+1] = r_y;
break;
case V4L2_PIX_FMT_Y16_BE:
+ /* See comment for V4L2_PIX_FMT_Y16 above */
buf[0][offset] = r_y;
- buf[0][offset+1] = 0;
+ buf[0][offset+1] = r_y == 0xff ? r_y : 0;
break;
case V4L2_PIX_FMT_YUV422P:
case V4L2_PIX_FMT_YUV420: