提交 def52393 编写于 作者: M Magnus Damm 提交者: Mauro Carvalho Chehab

V4L/DVB (9239): Add support for rgb555 pixel formats to vivi

This patch adds RGB555 pixel format support to the vivi driver. Both
little endian and big endian versions are added. The driver follows
the RGB pixel format described in Table 2-2 of the V4L2 API spec,
_not_ the older BGR interpretation described in Table 2-1.
Signed-off-by: NMagnus Damm <damm@igel.co.jp>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 aeadb5d4
...@@ -149,6 +149,16 @@ static struct vivi_fmt formats[] = { ...@@ -149,6 +149,16 @@ static struct vivi_fmt formats[] = {
.fourcc = V4L2_PIX_FMT_RGB565X, /* rrrrrggg gggbbbbb */ .fourcc = V4L2_PIX_FMT_RGB565X, /* rrrrrggg gggbbbbb */
.depth = 16, .depth = 16,
}, },
{
.name = "RGB555 (LE)",
.fourcc = V4L2_PIX_FMT_RGB555, /* gggbbbbb arrrrrgg */
.depth = 16,
},
{
.name = "RGB555 (BE)",
.fourcc = V4L2_PIX_FMT_RGB555X, /* arrrrrgg gggbbbbb */
.depth = 16,
},
}; };
static struct vivi_fmt *get_format(struct v4l2_format *f) static struct vivi_fmt *get_format(struct v4l2_format *f)
...@@ -335,6 +345,30 @@ static void gen_twopix(struct vivi_fh *fh, unsigned char *buf, int colorpos) ...@@ -335,6 +345,30 @@ static void gen_twopix(struct vivi_fh *fh, unsigned char *buf, int colorpos)
break; break;
} }
break; break;
case V4L2_PIX_FMT_RGB555:
switch (color) {
case 0:
case 2:
*p = (g_u << 5) | b_v;
break;
case 1:
case 3:
*p = (r_y << 2) | (g_u >> 3);
break;
}
break;
case V4L2_PIX_FMT_RGB555X:
switch (color) {
case 0:
case 2:
*p = (r_y << 2) | (g_u >> 3);
break;
case 1:
case 3:
*p = (g_u << 5) | b_v;
break;
}
break;
} }
} }
} }
...@@ -818,6 +852,12 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, ...@@ -818,6 +852,12 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
g >>= 2; g >>= 2;
b >>= 3; b >>= 3;
break; break;
case V4L2_PIX_FMT_RGB555:
case V4L2_PIX_FMT_RGB555X:
r >>= 3;
g >>= 3;
b >>= 3;
break;
} }
if (is_yuv) { if (is_yuv) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册