drm/i915: Extract sanitize_wm_latency()

Pull the "zero out invalid WM latencies" stuff into a helper.
Mainly to avoid mixing higher level and lower level stuff in
the same adjust_wm_latency() function.

Reviewed-by: 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-10-ville.syrjala@linux.intel.com
This commit is contained in:
Ville Syrjälä
2025-09-19 22:29:56 +03:00
parent 84953731f9
commit e407ea78ab

View File

@@ -3217,14 +3217,10 @@ static int wm_read_latency(struct intel_display *display)
return 2;
}
static void
adjust_wm_latency(struct intel_display *display)
static void sanitize_wm_latency(struct intel_display *display)
{
u16 *wm = display->wm.skl_latency;
int i, level, num_levels = display->wm.num_levels;
if (display->platform.dg2)
multiply_wm_latency(display, 2);
int level, num_levels = display->wm.num_levels;
/*
* If a level n (n > 1) has a 0us latency, all levels m (m >= n)
@@ -3233,11 +3229,24 @@ adjust_wm_latency(struct intel_display *display)
*/
for (level = 1; level < num_levels; level++) {
if (wm[level] == 0) {
int i;
for (i = level + 1; i < num_levels; i++)
wm[i] = 0;
break;
return;
}
}
}
static void
adjust_wm_latency(struct intel_display *display)
{
u16 *wm = display->wm.skl_latency;
if (display->platform.dg2)
multiply_wm_latency(display, 2);
sanitize_wm_latency(display);
/*
* WaWmMemoryReadLatency