]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/i915: Reject modes with linetime > 64 usec
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 14 Oct 2025 19:18:01 +0000 (22:18 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 16 Oct 2025 15:19:41 +0000 (18:19 +0300)
Reject modes whose linetime exceeds 64 usec.

First reason being that WM_LINETIME is limited to (nearly) 64 usec.

Additionally knowing the linetime is bounded will help with
determining whether overflows may be a concern during various
calculations.

I decided to round up, and accept the linetime==64 case. We use
various rounding directions for this in other parts of the code,
so I feel this provides the most consistent result all around.

Reviewed-by: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20251014191808.12326-3-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/display/intel_display.c

index 65a7da694ef6b3c0c941ca0ca0e6a8f20045dc06..4367ecfab2b3bc7a8ec9a775150a5174cd5493db 100644 (file)
@@ -7978,6 +7978,14 @@ enum drm_mode_status intel_mode_valid(struct drm_device *dev,
            mode->vtotal > vtotal_max)
                return MODE_V_ILLEGAL;
 
+       /*
+        * WM_LINETIME only goes up to (almost) 64 usec, and also
+        * knowing that the linetime is always bounded will ease the
+        * mind during various calculations.
+        */
+       if (DIV_ROUND_UP(mode->htotal * 1000, mode->clock) > 64)
+               return MODE_H_ILLEGAL;
+
        return MODE_OK;
 }