From 5bfc935af5352b8db7a512c3cb97c9fe76ca0618 Mon Sep 17 00:00:00 2001 From: Ivan Lipski Date: Tue, 1 Sep 2026 15:39:11 -0400 Subject: [PATCH] drm/amd/display: Honor forced RGB pixel encoding [Why&How] Forcing RGB format via debugfs on a monitor supporting YUV444 is ignored. Similarly to YUV format forcing, only use RGB pixel encoding if it is specified in the force_yuv_pixel_formats debugfs. Reviewed-by: Jerry Zuo Reviewed-by: Leo Li Signed-off-by: Ivan Lipski Signed-off-by: Chenyu Chen Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c index eba77a6f50e2..fd5bb9004f6c 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c @@ -2326,7 +2326,9 @@ amdgpu_dm_create_validate_stream_for_sink(struct drm_connector *connector, * (drm_mode_is_420_also() clear), as required for HDMI compliance * testing; dc_validate_stream() still rejects anything the link * genuinely cannot carry. The YCbCr422/YCbCr444 forces stay gated on - * the sink's advertised caps. + * the sink's advertised caps. An RGB force pins to RGB alone and is + * always honoured, since RGB is the mandatory baseline every sink + * (DP or HDMI) supports. */ want_420 = (aconnector->force_yuv_pixel_format == PIXEL_ENCODING_YCBCR420) || (drm_state && drm_state->color_format == DRM_CONNECTOR_COLOR_FORMAT_YCBCR420); @@ -2346,7 +2348,8 @@ amdgpu_dm_create_validate_stream_for_sink(struct drm_connector *connector, (info->color_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444)) && is_dp_or_hdmi) { encoding_mask = BIT(PIXEL_ENCODING_YCBCR444); - } else if (drm_state && drm_state->color_format == DRM_CONNECTOR_COLOR_FORMAT_RGB444) { + } else if ((aconnector->force_yuv_pixel_format == PIXEL_ENCODING_RGB) || + (drm_state && drm_state->color_format == DRM_CONNECTOR_COLOR_FORMAT_RGB444)) { encoding_mask = BIT(PIXEL_ENCODING_RGB); } else { encoding_mask = BIT(PIXEL_ENCODING_RGB);