Skip to content

Commit

Permalink
drm/rockchip: rk3399 vop: add support more color space
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
sandy-huang authored and rkhuangtao committed Jul 8, 2020
1 parent 03a7b36 commit b95f1f0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
21 changes: 17 additions & 4 deletions drivers/gpu/drm/rockchip/rockchip_drm_vop.c
Original file line number Diff line number Diff line change
Expand Up @@ -911,8 +911,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:
Expand Down Expand Up @@ -1001,10 +1004,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 {
Expand All @@ -1019,11 +1027,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)
/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/rockchip/rockchip_vop_reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,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[] = {
Expand Down

0 comments on commit b95f1f0

Please sign in to comment.