drm/bridge: synopsys: dw-hdmi: Fix color abnormal of RGB to YCBCR 10bit

Change-Id: Ia045ef5c36db806dd702193dc9188cb303ac9284
Signed-off-by: Shunqing Chen <csq@rock-chips.com>
This commit is contained in:
Shunqing Chen
2020-07-15 16:58:20 +08:00
committed by Tao Huang
parent e87a9de45c
commit 7e7bfdb784

View File

@@ -153,12 +153,24 @@ static const u16 csc_coeff_rgb_in_eitu601[3][4] = {
{ 0x6acd, 0x7534, 0x2000, 0x0200 }
};
static const u16 csc_coeff_rgb_in_eitu601_10bit[3][4] = {
{ 0x2591, 0x1322, 0x074b, 0x0000 },
{ 0x6535, 0x2000, 0x7acc, 0x0800 },
{ 0x6acd, 0x7534, 0x2000, 0x0800 }
};
static const u16 csc_coeff_rgb_in_eitu709[3][4] = {
{ 0x2dc5, 0x0d9b, 0x049e, 0x0000 },
{ 0x62f0, 0x2000, 0x7d11, 0x0200 },
{ 0x6756, 0x78ab, 0x2000, 0x0200 }
};
static const u16 csc_coeff_rgb_in_eitu709_10bit[3][4] = {
{ 0x2dc5, 0x0d9b, 0x049e, 0x0000 },
{ 0x62f0, 0x2000, 0x7d11, 0x0800 },
{ 0x6756, 0x78ab, 0x2000, 0x0800 }
};
static const u16 csc_coeff_full_to_limited[3][4] = {
{ 0x36f7, 0x0000, 0x0000, 0x0040 },
{ 0x0000, 0x36f7, 0x0000, 0x0040 },
@@ -1123,9 +1135,11 @@ static void dw_hdmi_update_csc_coeffs(struct dw_hdmi *hdmi)
unsigned i;
u32 csc_scale = 1;
int enc_out_rgb, enc_in_rgb;
int color_depth;
enc_out_rgb = hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format);
enc_in_rgb = hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_in_bus_format);
color_depth = hdmi_bus_fmt_color_depth(hdmi->hdmi_data.enc_out_bus_format);
if (is_color_space_conversion(hdmi)) {
if (enc_out_rgb && enc_in_rgb) {
@@ -1139,10 +1153,17 @@ static void dw_hdmi_update_csc_coeffs(struct dw_hdmi *hdmi)
csc_coeff = &csc_coeff_rgb_out_eitu709;
} else if (enc_in_rgb) {
if (hdmi->hdmi_data.enc_out_encoding ==
V4L2_YCBCR_ENC_601)
csc_coeff = &csc_coeff_rgb_in_eitu601;
else
csc_coeff = &csc_coeff_rgb_in_eitu709;
V4L2_YCBCR_ENC_601) {
if (color_depth == 10)
csc_coeff = &csc_coeff_rgb_in_eitu601_10bit;
else
csc_coeff = &csc_coeff_rgb_in_eitu601;
} else {
if (color_depth == 10)
csc_coeff = &csc_coeff_rgb_in_eitu709_10bit;
else
csc_coeff = &csc_coeff_rgb_in_eitu709;
}
csc_scale = 0;
}
}