mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-29 21:56:39 +07:00
[media] vivid: add 10 and 12 bit Bayer formats
Add support for 10 and 12 bit Bayer formats to the test pattern generator and the vivid driver. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
parent
d5beb67bc7
commit
b96c544f44
@ -193,6 +193,14 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
|
||||
case V4L2_PIX_FMT_SGBRG8:
|
||||
case V4L2_PIX_FMT_SGRBG8:
|
||||
case V4L2_PIX_FMT_SRGGB8:
|
||||
case V4L2_PIX_FMT_SBGGR10:
|
||||
case V4L2_PIX_FMT_SGBRG10:
|
||||
case V4L2_PIX_FMT_SGRBG10:
|
||||
case V4L2_PIX_FMT_SRGGB10:
|
||||
case V4L2_PIX_FMT_SBGGR12:
|
||||
case V4L2_PIX_FMT_SGBRG12:
|
||||
case V4L2_PIX_FMT_SGRBG12:
|
||||
case V4L2_PIX_FMT_SRGGB12:
|
||||
tpg->interleaved = true;
|
||||
tpg->vdownsampling[1] = 1;
|
||||
tpg->hdownsampling[1] = 1;
|
||||
@ -349,6 +357,17 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
|
||||
tpg->twopixelsize[0] = 2;
|
||||
tpg->twopixelsize[1] = 2;
|
||||
break;
|
||||
case V4L2_PIX_FMT_SRGGB10:
|
||||
case V4L2_PIX_FMT_SGRBG10:
|
||||
case V4L2_PIX_FMT_SGBRG10:
|
||||
case V4L2_PIX_FMT_SBGGR10:
|
||||
case V4L2_PIX_FMT_SRGGB12:
|
||||
case V4L2_PIX_FMT_SGRBG12:
|
||||
case V4L2_PIX_FMT_SGBRG12:
|
||||
case V4L2_PIX_FMT_SBGGR12:
|
||||
tpg->twopixelsize[0] = 4;
|
||||
tpg->twopixelsize[1] = 4;
|
||||
break;
|
||||
case V4L2_PIX_FMT_YUV422P:
|
||||
case V4L2_PIX_FMT_YUV420:
|
||||
case V4L2_PIX_FMT_YVU420:
|
||||
@ -1112,6 +1131,70 @@ static void gen_twopix(struct tpg_data *tpg,
|
||||
buf[0][offset] = odd ? g_u : r_y;
|
||||
buf[1][offset] = odd ? b_v : g_u;
|
||||
break;
|
||||
case V4L2_PIX_FMT_SBGGR10:
|
||||
buf[0][offset] = odd ? g_u << 2 : b_v << 2;
|
||||
buf[0][offset + 1] = odd ? g_u >> 6 : b_v >> 6;
|
||||
buf[1][offset] = odd ? r_y << 2 : g_u << 2;
|
||||
buf[1][offset + 1] = odd ? r_y >> 6 : g_u >> 6;
|
||||
buf[0][offset] |= (buf[0][offset] >> 2) & 3;
|
||||
buf[1][offset] |= (buf[1][offset] >> 2) & 3;
|
||||
break;
|
||||
case V4L2_PIX_FMT_SGBRG10:
|
||||
buf[0][offset] = odd ? b_v << 2 : g_u << 2;
|
||||
buf[0][offset + 1] = odd ? b_v >> 6 : g_u >> 6;
|
||||
buf[1][offset] = odd ? g_u << 2 : r_y << 2;
|
||||
buf[1][offset + 1] = odd ? g_u >> 6 : r_y >> 6;
|
||||
buf[0][offset] |= (buf[0][offset] >> 2) & 3;
|
||||
buf[1][offset] |= (buf[1][offset] >> 2) & 3;
|
||||
break;
|
||||
case V4L2_PIX_FMT_SGRBG10:
|
||||
buf[0][offset] = odd ? r_y << 2 : g_u << 2;
|
||||
buf[0][offset + 1] = odd ? r_y >> 6 : g_u >> 6;
|
||||
buf[1][offset] = odd ? g_u << 2 : b_v << 2;
|
||||
buf[1][offset + 1] = odd ? g_u >> 6 : b_v >> 6;
|
||||
buf[0][offset] |= (buf[0][offset] >> 2) & 3;
|
||||
buf[1][offset] |= (buf[1][offset] >> 2) & 3;
|
||||
break;
|
||||
case V4L2_PIX_FMT_SRGGB10:
|
||||
buf[0][offset] = odd ? g_u << 2 : r_y << 2;
|
||||
buf[0][offset + 1] = odd ? g_u >> 6 : r_y >> 6;
|
||||
buf[1][offset] = odd ? b_v << 2 : g_u << 2;
|
||||
buf[1][offset + 1] = odd ? b_v >> 6 : g_u >> 6;
|
||||
buf[0][offset] |= (buf[0][offset] >> 2) & 3;
|
||||
buf[1][offset] |= (buf[1][offset] >> 2) & 3;
|
||||
break;
|
||||
case V4L2_PIX_FMT_SBGGR12:
|
||||
buf[0][offset] = odd ? g_u << 4 : b_v << 4;
|
||||
buf[0][offset + 1] = odd ? g_u >> 4 : b_v >> 4;
|
||||
buf[1][offset] = odd ? r_y << 4 : g_u << 4;
|
||||
buf[1][offset + 1] = odd ? r_y >> 4 : g_u >> 4;
|
||||
buf[0][offset] |= (buf[0][offset] >> 4) & 0xf;
|
||||
buf[1][offset] |= (buf[1][offset] >> 4) & 0xf;
|
||||
break;
|
||||
case V4L2_PIX_FMT_SGBRG12:
|
||||
buf[0][offset] = odd ? b_v << 4 : g_u << 4;
|
||||
buf[0][offset + 1] = odd ? b_v >> 4 : g_u >> 4;
|
||||
buf[1][offset] = odd ? g_u << 4 : r_y << 4;
|
||||
buf[1][offset + 1] = odd ? g_u >> 4 : r_y >> 4;
|
||||
buf[0][offset] |= (buf[0][offset] >> 4) & 0xf;
|
||||
buf[1][offset] |= (buf[1][offset] >> 4) & 0xf;
|
||||
break;
|
||||
case V4L2_PIX_FMT_SGRBG12:
|
||||
buf[0][offset] = odd ? r_y << 4 : g_u << 4;
|
||||
buf[0][offset + 1] = odd ? r_y >> 4 : g_u >> 4;
|
||||
buf[1][offset] = odd ? g_u << 4 : b_v << 4;
|
||||
buf[1][offset + 1] = odd ? g_u >> 4 : b_v >> 4;
|
||||
buf[0][offset] |= (buf[0][offset] >> 4) & 0xf;
|
||||
buf[1][offset] |= (buf[1][offset] >> 4) & 0xf;
|
||||
break;
|
||||
case V4L2_PIX_FMT_SRGGB12:
|
||||
buf[0][offset] = odd ? g_u << 4 : r_y << 4;
|
||||
buf[0][offset + 1] = odd ? g_u >> 4 : r_y >> 4;
|
||||
buf[1][offset] = odd ? b_v << 4 : g_u << 4;
|
||||
buf[1][offset + 1] = odd ? b_v >> 4 : g_u >> 4;
|
||||
buf[0][offset] |= (buf[0][offset] >> 4) & 0xf;
|
||||
buf[1][offset] |= (buf[1][offset] >> 4) & 0xf;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1122,6 +1205,14 @@ unsigned tpg_g_interleaved_plane(const struct tpg_data *tpg, unsigned buf_line)
|
||||
case V4L2_PIX_FMT_SGBRG8:
|
||||
case V4L2_PIX_FMT_SGRBG8:
|
||||
case V4L2_PIX_FMT_SRGGB8:
|
||||
case V4L2_PIX_FMT_SBGGR10:
|
||||
case V4L2_PIX_FMT_SGBRG10:
|
||||
case V4L2_PIX_FMT_SGRBG10:
|
||||
case V4L2_PIX_FMT_SRGGB10:
|
||||
case V4L2_PIX_FMT_SBGGR12:
|
||||
case V4L2_PIX_FMT_SGBRG12:
|
||||
case V4L2_PIX_FMT_SGRBG12:
|
||||
case V4L2_PIX_FMT_SRGGB12:
|
||||
return buf_line & 1;
|
||||
default:
|
||||
return 0;
|
||||
|
@ -389,6 +389,62 @@ struct vivid_fmt vivid_formats[] = {
|
||||
.planes = 1,
|
||||
.buffers = 1,
|
||||
},
|
||||
{
|
||||
.fourcc = V4L2_PIX_FMT_SBGGR10, /* Bayer BG/GR */
|
||||
.vdownsampling = { 1 },
|
||||
.bit_depth = { 16 },
|
||||
.planes = 1,
|
||||
.buffers = 1,
|
||||
},
|
||||
{
|
||||
.fourcc = V4L2_PIX_FMT_SGBRG10, /* Bayer GB/RG */
|
||||
.vdownsampling = { 1 },
|
||||
.bit_depth = { 16 },
|
||||
.planes = 1,
|
||||
.buffers = 1,
|
||||
},
|
||||
{
|
||||
.fourcc = V4L2_PIX_FMT_SGRBG10, /* Bayer GR/BG */
|
||||
.vdownsampling = { 1 },
|
||||
.bit_depth = { 16 },
|
||||
.planes = 1,
|
||||
.buffers = 1,
|
||||
},
|
||||
{
|
||||
.fourcc = V4L2_PIX_FMT_SRGGB10, /* Bayer RG/GB */
|
||||
.vdownsampling = { 1 },
|
||||
.bit_depth = { 16 },
|
||||
.planes = 1,
|
||||
.buffers = 1,
|
||||
},
|
||||
{
|
||||
.fourcc = V4L2_PIX_FMT_SBGGR12, /* Bayer BG/GR */
|
||||
.vdownsampling = { 1 },
|
||||
.bit_depth = { 16 },
|
||||
.planes = 1,
|
||||
.buffers = 1,
|
||||
},
|
||||
{
|
||||
.fourcc = V4L2_PIX_FMT_SGBRG12, /* Bayer GB/RG */
|
||||
.vdownsampling = { 1 },
|
||||
.bit_depth = { 16 },
|
||||
.planes = 1,
|
||||
.buffers = 1,
|
||||
},
|
||||
{
|
||||
.fourcc = V4L2_PIX_FMT_SGRBG12, /* Bayer GR/BG */
|
||||
.vdownsampling = { 1 },
|
||||
.bit_depth = { 16 },
|
||||
.planes = 1,
|
||||
.buffers = 1,
|
||||
},
|
||||
{
|
||||
.fourcc = V4L2_PIX_FMT_SRGGB12, /* Bayer RG/GB */
|
||||
.vdownsampling = { 1 },
|
||||
.bit_depth = { 16 },
|
||||
.planes = 1,
|
||||
.buffers = 1,
|
||||
},
|
||||
{
|
||||
.fourcc = V4L2_PIX_FMT_NV16M,
|
||||
.vdownsampling = { 1, 1 },
|
||||
|
Loading…
Reference in New Issue
Block a user