]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/i915/dp: Fix DSC sink's slice count capability check
authorImre Deak <imre.deak@intel.com>
Mon, 15 Dec 2025 19:23:43 +0000 (21:23 +0200)
committerImre Deak <imre.deak@intel.com>
Fri, 19 Dec 2025 14:46:40 +0000 (16:46 +0200)
A DSC sink supporting DSC slice count N, not necessarily supports slice
counts less than N. Hence the driver should check the sink's support for
a particular slice count before using that slice count, fix
intel_dp_dsc_get_slice_count() accordingly.

Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patch.msgid.link/20251215192357.172201-4-imre.deak@intel.com
drivers/gpu/drm/i915/display/intel_dp.c

index c27e9186a754a601674466622bf9cbe8efb8fb63..10ad1ef9a9ddcab57e292dcf133650d4b3a84ff8 100644 (file)
@@ -1014,6 +1014,8 @@ u8 intel_dp_dsc_get_slice_count(const struct intel_connector *connector,
                                int num_joined_pipes)
 {
        struct intel_display *display = to_intel_display(connector);
+       u32 sink_slice_count_mask =
+               drm_dp_dsc_sink_slice_count_mask(connector->dp.dsc_dpcd, false);
        u8 min_slice_count, i;
        int max_slice_width;
        int tp_rgb_yuv444;
@@ -1085,9 +1087,9 @@ u8 intel_dp_dsc_get_slice_count(const struct intel_connector *connector,
                    (!HAS_DSC_3ENGINES(display) || num_joined_pipes != 4))
                        continue;
 
-               if (test_slice_count >
-                   drm_dp_dsc_sink_max_slice_count(connector->dp.dsc_dpcd, false))
-                       break;
+               if (!(drm_dp_dsc_slice_count_to_mask(test_slice_count) &
+                     sink_slice_count_mask))
+                       continue;
 
                 /*
                  * Bigjoiner needs small joiner to be enabled.
@@ -1104,8 +1106,14 @@ u8 intel_dp_dsc_get_slice_count(const struct intel_connector *connector,
                        return test_slice_count;
        }
 
-       drm_dbg_kms(display->drm, "Unsupported Slice Count %d\n",
-                   min_slice_count);
+       /* Print slice count 1,2,4,..24 if bit#0,1,3,..23 is set in the mask. */
+       sink_slice_count_mask <<= 1;
+       drm_dbg_kms(display->drm,
+                   "[CONNECTOR:%d:%s] Unsupported slice count (min: %d, sink supported: %*pbl)\n",
+                   connector->base.base.id, connector->base.name,
+                   min_slice_count,
+                   (int)BITS_PER_TYPE(sink_slice_count_mask), &sink_slice_count_mask);
+
        return 0;
 }