From: Ivan Lipski <[email protected]>

[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 <[email protected]>
Reviewed-by: Leo Li <[email protected]>
Signed-off-by: Ivan Lipski <[email protected]>
Signed-off-by: Chenyu Chen <[email protected]>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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 4fb992871b95..c9c8db972922 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
@@ -2289,7 +2289,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.
         */
        if (drm_mode_is_420_only(info, drm_mode) ||
            aconnector->force_yuv_pixel_format == PIXEL_ENCODING_YCBCR420) {
@@ -2301,6 +2303,8 @@ amdgpu_dm_create_validate_stream_for_sink(struct 
drm_connector *connector,
                   (info->color_formats & 
BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444)) &&
                   is_hdmi_ep) {
                encoding_mask = BIT(PIXEL_ENCODING_YCBCR444);
+       } else if (aconnector->force_yuv_pixel_format == PIXEL_ENCODING_RGB) {
+               encoding_mask = BIT(PIXEL_ENCODING_RGB);
        } else {
                encoding_mask = BIT(PIXEL_ENCODING_RGB);
 
-- 
2.43.0

Reply via email to