]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/i915: Make wm latencies monotonic
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 19 Sep 2025 19:29:58 +0000 (22:29 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 23 Sep 2025 15:12:01 +0000 (18:12 +0300)
Some systems (eg. LNL Lenovo Thinkapd X1 Carbon) declare
semi-bogus non-monotonic WM latency values:
 WM0 latency not provided
 WM1 latency 100 usec
 WM2 latency 100 usec
 WM3 latency 100 usec
 WM4 latency 93 usec
 WM5 latency 100 usec

Apparently Windows just papers over the issue by bumping the
latencies for the higher watermark levels to make them monotonic
again. Do the same.

Cc: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250919193000.17665-12-ville.syrjala@linux.intel.com
Reviewed-by: Luca Coelho <luciano.coelho@intel.com>
drivers/gpu/drm/i915/display/skl_watermark.c

index d83772c6ea9a38f95f3caf780e69ed60c0380172..2a40c135cb96a46871a9c27537bd7afaa509e864 100644 (file)
@@ -3236,6 +3236,19 @@ static void sanitize_wm_latency(struct intel_display *display)
                wm[level] = 0;
 }
 
+static void make_wm_latency_monotonic(struct intel_display *display)
+{
+       u16 *wm = display->wm.skl_latency;
+       int level, num_levels = display->wm.num_levels;
+
+       for (level = 1; level < num_levels; level++) {
+               if (wm[level] == 0)
+                       break;
+
+               wm[level] = max(wm[level], wm[level-1]);
+       }
+}
+
 static void
 adjust_wm_latency(struct intel_display *display)
 {
@@ -3246,6 +3259,8 @@ adjust_wm_latency(struct intel_display *display)
 
        sanitize_wm_latency(display);
 
+       make_wm_latency_monotonic(display);
+
        /*
         * WaWmMemoryReadLatency
         *