drm/rockchip: rk3399 vop: add support more color space

add support following color space:
    V4L2_COLORSPACE_SMPTE240M
    V4L2_COLORSPACE_470_SYSTEM_M
    V4L2_COLORSPACE_470_SYSTEM_BG

now can support following color space:
bt601 limit:
    V4L2_COLORSPACE_SMPTE170M
    V4L2_COLORSPACE_470_SYSTEM_M
    V4L2_COLORSPACE_470_SYSTEM_BG
bt601 full:
    V4L2_COLORSPACE_JPEG
bt709 limit:
    V4L2_COLORSPACE_SMPTE240M
    V4L2_COLORSPACE_REC709
    V4L2_COLORSPACE_DEFAULT
bt2020:
    V4L2_COLORSPACE_BT2020

Change-Id: Ia51b7aa9959f69efdd8bad3371395b2fceaccaaa
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
This commit is contained in:
Sandy Huang
2020-06-23 17:18:02 +08:00
committed by Tao Huang
parent b45bed1253
commit 14cae36363
2 changed files with 18 additions and 5 deletions

View File

@@ -951,8 +951,11 @@ static int to_vop_csc_mode(int csc_mode)
{
switch (csc_mode) {
case V4L2_COLORSPACE_SMPTE170M:
case V4L2_COLORSPACE_470_SYSTEM_M:
case V4L2_COLORSPACE_470_SYSTEM_BG:
return CSC_BT601L;
case V4L2_COLORSPACE_REC709:
case V4L2_COLORSPACE_SMPTE240M:
case V4L2_COLORSPACE_DEFAULT:
return CSC_BT709L;
case V4L2_COLORSPACE_JPEG:
@@ -1041,10 +1044,15 @@ static int vop_setup_csc_table(const struct vop_csc_table *csc_table,
*r2r_table = csc_table->r2r_bt2020_to_bt709;
if (!is_input_yuv || *y2r_table) {
if (output_csc == V4L2_COLORSPACE_REC709 ||
output_csc == V4L2_COLORSPACE_SMPTE240M ||
output_csc == V4L2_COLORSPACE_DEFAULT)
*r2y_table = csc_table->r2y_bt709;
else if (output_csc == V4L2_COLORSPACE_SMPTE170M ||
output_csc == V4L2_COLORSPACE_470_SYSTEM_M ||
output_csc == V4L2_COLORSPACE_470_SYSTEM_BG)
*r2y_table = csc_table->r2y_bt601_12_235; /* bt601 limit */
else
*r2y_table = csc_table->r2y_bt601;
*r2y_table = csc_table->r2y_bt601; /* bt601 full */
}
}
} else {
@@ -1059,11 +1067,16 @@ static int vop_setup_csc_table(const struct vop_csc_table *csc_table,
if (input_csc == V4L2_COLORSPACE_BT2020)
*y2r_table = csc_table->y2r_bt2020;
else if ((input_csc == V4L2_COLORSPACE_REC709) ||
(input_csc == V4L2_COLORSPACE_DEFAULT))
else if (input_csc == V4L2_COLORSPACE_REC709 ||
input_csc == V4L2_COLORSPACE_SMPTE240M ||
input_csc == V4L2_COLORSPACE_DEFAULT)
*y2r_table = csc_table->y2r_bt709;
else if (input_csc == V4L2_COLORSPACE_SMPTE170M ||
input_csc == V4L2_COLORSPACE_470_SYSTEM_M ||
input_csc == V4L2_COLORSPACE_470_SYSTEM_BG)
*y2r_table = csc_table->y2r_bt601_12_235; /* bt601 limit */
else
*y2r_table = csc_table->y2r_bt601;
*y2r_table = csc_table->y2r_bt601; /* bt601 full */
if (input_csc == V4L2_COLORSPACE_BT2020)
/*

View File

@@ -506,7 +506,7 @@ static const struct vop_data rk3366_vop = {
static const uint32_t vop_csc_y2r_bt601[] = {
0x00000400, 0x0400059c, 0xfd25fea0, 0x07170400,
0x00000000, 0xfffecab4, 0x00087932, 0xfff1d4f2,
0x00000000, 0xfff4cab4, 0x00087932, 0xfff1d4f2,
};
static const uint32_t vop_csc_y2r_bt601_12_235[] = {