diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2015-03-12 14:40:36 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-04-02 20:04:51 -0400 |
commit | 71491063b85c04e6b68803db52cca7a9f14a945e (patch) | |
tree | d83a3346c21df9805948f2db27ea0cb534c450fa /drivers/media/platform/vivid/vivid-tpg.c | |
parent | dde72bd773dfce36fd0fb193d8ac5096f31e041c (diff) |
[media] vivid: add support for PIX_FMT_RGB332
Add support for the one-byte-per-pixel RGB332 format.
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.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/media/platform/vivid/vivid-tpg.c b/drivers/media/platform/vivid/vivid-tpg.c index 0d31532f7f42..fd28c6a5f8e9 100644 --- a/drivers/media/platform/vivid/vivid-tpg.c +++ b/drivers/media/platform/vivid/vivid-tpg.c | |||
@@ -188,6 +188,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc) | |||
188 | tpg->hmask[2] = ~0; | 188 | tpg->hmask[2] = ~0; |
189 | 189 | ||
190 | switch (fourcc) { | 190 | switch (fourcc) { |
191 | case V4L2_PIX_FMT_RGB332: | ||
191 | case V4L2_PIX_FMT_RGB565: | 192 | case V4L2_PIX_FMT_RGB565: |
192 | case V4L2_PIX_FMT_RGB565X: | 193 | case V4L2_PIX_FMT_RGB565X: |
193 | case V4L2_PIX_FMT_RGB444: | 194 | case V4L2_PIX_FMT_RGB444: |
@@ -274,6 +275,9 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc) | |||
274 | } | 275 | } |
275 | 276 | ||
276 | switch (fourcc) { | 277 | switch (fourcc) { |
278 | case V4L2_PIX_FMT_RGB332: | ||
279 | tpg->twopixelsize[0] = 2; | ||
280 | break; | ||
277 | case V4L2_PIX_FMT_RGB565: | 281 | case V4L2_PIX_FMT_RGB565: |
278 | case V4L2_PIX_FMT_RGB565X: | 282 | case V4L2_PIX_FMT_RGB565X: |
279 | case V4L2_PIX_FMT_RGB444: | 283 | case V4L2_PIX_FMT_RGB444: |
@@ -717,6 +721,11 @@ static void precalculate_color(struct tpg_data *tpg, int k) | |||
717 | b = (b * 219) / 255 + (16 << 4); | 721 | b = (b * 219) / 255 + (16 << 4); |
718 | } | 722 | } |
719 | switch (tpg->fourcc) { | 723 | switch (tpg->fourcc) { |
724 | case V4L2_PIX_FMT_RGB332: | ||
725 | r >>= 9; | ||
726 | g >>= 9; | ||
727 | b >>= 10; | ||
728 | break; | ||
720 | case V4L2_PIX_FMT_RGB565: | 729 | case V4L2_PIX_FMT_RGB565: |
721 | case V4L2_PIX_FMT_RGB565X: | 730 | case V4L2_PIX_FMT_RGB565X: |
722 | r >>= 7; | 731 | r >>= 7; |
@@ -890,6 +899,9 @@ static void gen_twopix(struct tpg_data *tpg, | |||
890 | buf[0][0] = b_v; | 899 | buf[0][0] = b_v; |
891 | buf[0][2] = g_u; | 900 | buf[0][2] = g_u; |
892 | break; | 901 | break; |
902 | case V4L2_PIX_FMT_RGB332: | ||
903 | buf[0][offset] = (r_y << 5) | (g_u << 2) | b_v; | ||
904 | break; | ||
893 | case V4L2_PIX_FMT_RGB565: | 905 | case V4L2_PIX_FMT_RGB565: |
894 | buf[0][offset] = (g_u << 5) | b_v; | 906 | buf[0][offset] = (g_u << 5) | b_v; |
895 | buf[0][offset + 1] = (r_y << 3) | (g_u >> 3); | 907 | buf[0][offset + 1] = (r_y << 3) | (g_u >> 3); |