mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-23 17:46:33 -04:00
drm/display: hdmi-state-helper: Try subsampling in mode_valid
drm_hdmi_connector_mode_valid assumes modes are only valid if they work
with RGB. The reality is more complex however: YCbCr 4:2:0
chroma-subsampled modes only require half the pixel clock that the same
mode would require in RGB.
This leads to drm_hdmi_connector_mode_valid rejecting perfectly valid
420-only or 420-also modes.
Fix this by checking whether the mode is 420-capable first. If so, then
proceed by checking it with DRM_OUTPUT_COLOR_FORMAT_YCBCR420 so long as
the connector has legalized 420, otherwise error out. If the mode is not
420-capable, check with RGB as was previously always the case.
Fixes: 47368ab437 ("drm/display: hdmi: add generic mode_valid helper")
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
Link: https://patch.msgid.link/20260609-color-format-v17-9-35739b5782cc@collabora.com
Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
committed by
Daniel Stone
parent
cb5c6b7e7b
commit
f532dc0ea5
@@ -943,8 +943,21 @@ drm_hdmi_connector_mode_valid(struct drm_connector *connector,
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
unsigned long long clock;
|
||||
enum drm_output_color_format fmt;
|
||||
|
||||
clock = drm_hdmi_compute_mode_clock(mode, 8, DRM_OUTPUT_COLOR_FORMAT_RGB444);
|
||||
if (drm_mode_is_420_only(&connector->display_info, mode)) {
|
||||
if (connector->ycbcr_420_allowed)
|
||||
fmt = DRM_OUTPUT_COLOR_FORMAT_YCBCR420;
|
||||
else
|
||||
return MODE_NO_420;
|
||||
} else if (drm_mode_is_420_also(&connector->display_info, mode) &&
|
||||
connector->ycbcr_420_allowed) {
|
||||
fmt = DRM_OUTPUT_COLOR_FORMAT_YCBCR420;
|
||||
} else {
|
||||
fmt = DRM_OUTPUT_COLOR_FORMAT_RGB444;
|
||||
}
|
||||
|
||||
clock = drm_hdmi_compute_mode_clock(mode, 8, fmt);
|
||||
if (!clock)
|
||||
return MODE_ERROR;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user