drm/rockchip: dw_hdmi: Updated the auto color policy

When the TV doesn't support the current color, switch
to 'auto' color format, YUV444 is preferred.

Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
Change-Id: I4201012c27e9e1abae3dc87a036771b33109de75
This commit is contained in:
Algea Cao
2022-07-15 18:10:07 +08:00
committed by Tao Huang
parent 0e95e08982
commit 55f74a244a

View File

@@ -1832,6 +1832,15 @@ dw_hdmi_rockchip_select_output(struct drm_connector_state *conn_state,
DRM_MODE_FLAG_3D_FRAME_PACKING)
pixclock *= 2;
if (hdmi->is_hdmi_qp) {
if (mode.clock >= 600000) {
*color_format = RK_IF_FORMAT_YCBCR420;
} else if (mode.clock >= 340000) {
if (drm_mode_is_420(info, &mode))
*color_format = RK_IF_FORMAT_YCBCR420;
}
}
if (*color_format == RK_IF_FORMAT_YCBCR422 || color_depth == 8)
tmdsclock = pixclock;
else
@@ -1846,7 +1855,11 @@ dw_hdmi_rockchip_select_output(struct drm_connector_state *conn_state,
max_tmds_clock = min(max_tmds_clock, hdmi->max_tmdsclk);
if ((tmdsclock > max_tmds_clock) && !hdmi->is_hdmi_qp) {
if (hdmi->is_hdmi_qp && hdmi->link_cfg.rate_per_lane && mode.clock > 600000)
max_tmds_clock =
hdmi->link_cfg.frl_lanes * hdmi->link_cfg.rate_per_lane * 1000000;
if (tmdsclock > max_tmds_clock) {
if (max_tmds_clock >= 594000) {
color_depth = 8;
} else if (max_tmds_clock > 340000) {
@@ -1859,19 +1872,6 @@ dw_hdmi_rockchip_select_output(struct drm_connector_state *conn_state,
}
}
if (hdmi->is_hdmi_qp) {
if (mode.clock >= 340000) {
if (drm_mode_is_420(info, &mode))
*color_format = RK_IF_FORMAT_YCBCR420;
else
*color_format = RK_IF_FORMAT_RGB;
} else if (tmdsclock > max_tmds_clock) {
color_depth = 8;
if (drm_mode_is_420(info, &mode))
*color_format = RK_IF_FORMAT_YCBCR420;
}
}
if (*color_format == RK_IF_FORMAT_YCBCR420) {
*output_mode = ROCKCHIP_OUT_MODE_YUV420;
if (color_depth > 8)