]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drm/amd/display: Try YCbCr420 color when YCbCr444 fails
authorWerner Sembach <wse@tuxedocomputers.com>
Wed, 17 Mar 2021 15:13:48 +0000 (16:13 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 9 Apr 2021 20:49:11 +0000 (16:49 -0400)
When encoder validation of a display mode fails, retry with less bandwidth
heavy YCbCr420 color mode, if available. This enables some HDMI 1.4 setups
to support 4k60Hz output, which previously failed silently.

On some setups, while the monitor and the gpu support display modes with
pixel clocks of up to 600MHz, the link encoder might not. This prevents
YCbCr444 and RGB encoding for 4k60Hz, but YCbCr420 encoding might still be
possible. However, which color mode is used is decided before the link
encoder capabilities are checked. This patch fixes the problem by retrying
to find a display mode with YCbCr420 enforced and using it, if it is
valid.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index 10efd53825112aac08a65215bae888918b419fd8..aeeebce60ba4b8774afd57d8261a481a1be05272 100644 (file)
@@ -6161,6 +6161,15 @@ create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector,
 
        } while (stream == NULL && requested_bpc >= 6);
 
+       if (dc_result == DC_FAIL_ENC_VALIDATE && !aconnector->force_yuv420_output) {
+               DRM_DEBUG_KMS("Retry forcing YCbCr420 encoding\n");
+
+               aconnector->force_yuv420_output = true;
+               stream = create_validate_stream_for_sink(aconnector, drm_mode,
+                                               dm_state, old_stream);
+               aconnector->force_yuv420_output = false;
+       }
+
        return stream;
 }