[PATCH][SRU][HWE-5.8/HWE-5.11] Make AMD gpus choose YCbCr420 encoding automatically when required for 4k 60Hz output

Werner Sembach wse at tuxedocomputers.com
Tue Apr 27 16:42:22 UTC 2021


SRU Justification:

Impact:
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, causing the check to fail and discarding 4k60Hz from the list of
possible display modes.

Fix:
This patch fixes the problem by retrying to find a display mode with YCbCr420
enforced and using it, if it is valid.

Testcase:
Tested on an Clevo NL50RU. General: Find a PC with a current AMD Radeon GPU, but
only a hdmi 1.4 output (e.g. current Clevo laptops with AMD APU's). Connect a
4k at 60Hz display supporting YCbCr420 encoding to the hdmi port. Without the patch
the maximum that can be set via xrandr is 3840 × 2160 30Hz. With the Patch
3840 × 2160 60Hz can be selected which will use YCbCr420 automatically.

Patch already got accepted upstream for linux-next:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=14e4a095b29fd290a9b80f6e553adcfcf01672d1
and applies without modifications to ubuntu-focal/hwe-5.8 and hwe-5.11

Commit-hash: 14e4a095b29fd290a9b80f6e553adcfcf01672d1

Signed-off-by: Werner Sembach <wse at tuxedocomputers.com>
---

>From 87afe9a830b44bbf42c3a2a7330bc76275bbca32 Mon Sep 17 00:00:00 2001
From: Werner Sembach <wse at tuxedocomputers.com>
Date: Tue, 27 Apr 2021 18:29:53 +0200
Subject: [PATCH] Retry forcing YCbCr420 color on failed encoder validation

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index ad4afbc37d51..efa12ad4da72 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -5738,6 +5738,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;
 }
 
-- 
2.25.1




More information about the kernel-team mailing list