Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/i915/alpm: Compute LOBF late after guardband is already determined

Currently intel_alpm_lobf_compute_config() tries to account for
guardband +SCL requirements during encoder->compute_config() phase,
even before guardband is computed.
Also, LOBF depends on crtc_state->has_psr which can be modified in
encoder->compute_config_late().

Account for lobf requirements while optimizing the guardband and add
checks for final guardband in encoder->compute_config_late() phase after
the guardband and the final state of crtc_state->has_psr are already
computed.

Use crtc_state->vrr.guardband and crtc_state->set_context_latency for
the computation and add more documentation for the dependency of first
sdp position, guardband, set context latency and wake lines.

v2: Add helper to use min guardband required for lobf.
v3: Remove unrelated inadvertent changes. (Michał)
v4: Add a #FIXME note for computing wakelines based on feature. (Jouni)

Bspec:71041
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Michał Grzelak <michal.grzelak@intel.com>
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://patch.msgid.link/20260204050250.762718-2-ankit.k.nautiyal@intel.com

+63 -14
+56 -14
drivers/gpu/drm/i915/display/intel_alpm.c
··· 15 15 #include "intel_dp_aux.h" 16 16 #include "intel_psr.h" 17 17 #include "intel_psr_regs.h" 18 + #include "intel_vrr.h" 18 19 19 20 #define SILENCE_PERIOD_MIN_TIME 80 20 21 #define SILENCE_PERIOD_MAX_TIME 180 ··· 249 248 return true; 250 249 } 251 250 251 + int intel_alpm_lobf_min_guardband(struct intel_crtc_state *crtc_state) 252 + { 253 + struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode; 254 + int first_sdp_position = adjusted_mode->crtc_vtotal - 255 + adjusted_mode->crtc_vsync_start; 256 + int waketime_in_lines; 257 + 258 + /* 259 + * #FIXME: Need to check if io_wake_lines or aux_less_wake_lines 260 + * is applicable. Currently this information is not readily 261 + * available in crtc_state, so max will suffice for now. 262 + */ 263 + waketime_in_lines = max(crtc_state->alpm_state.io_wake_lines, 264 + crtc_state->alpm_state.aux_less_wake_lines); 265 + 266 + if (!crtc_state->has_lobf) 267 + return 0; 268 + 269 + return first_sdp_position + waketime_in_lines + crtc_state->set_context_latency; 270 + } 271 + 272 + void intel_alpm_lobf_compute_config_late(struct intel_dp *intel_dp, 273 + struct intel_crtc_state *crtc_state) 274 + { 275 + struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode; 276 + int waketime_in_lines, first_sdp_position; 277 + 278 + if (!crtc_state->has_lobf) 279 + return; 280 + 281 + /* 282 + * LOBF can only be enabled if the time from the start of the SCL+Guardband 283 + * window to the position of the first SDP is greater than the time it takes 284 + * to wake the main link. 285 + * 286 + * Position of first sdp : vsync_start 287 + * start of scl + guardband : vtotal - (scl + guardband) 288 + * time in lines to wake main link : waketime_in_lines 289 + * 290 + * Position of first sdp - start of (scl + guardband) > time in lines to wake main link 291 + * vsync_start - (vtotal - (scl + guardband)) > waketime_in_lines 292 + * vsync_start - vtotal + scl + guardband > waketime_in_lines 293 + * scl + guardband > waketime_in_lines + (vtotal - vsync_start) 294 + */ 295 + first_sdp_position = adjusted_mode->crtc_vtotal - adjusted_mode->crtc_vsync_start; 296 + if (intel_alpm_aux_less_wake_supported(intel_dp)) 297 + waketime_in_lines = crtc_state->alpm_state.io_wake_lines; 298 + else 299 + waketime_in_lines = crtc_state->alpm_state.aux_less_wake_lines; 300 + 301 + crtc_state->has_lobf = (crtc_state->set_context_latency + crtc_state->vrr.guardband) > 302 + (first_sdp_position + waketime_in_lines); 303 + } 304 + 252 305 void intel_alpm_lobf_compute_config(struct intel_dp *intel_dp, 253 306 struct intel_crtc_state *crtc_state, 254 307 struct drm_connector_state *conn_state) 255 308 { 256 309 struct intel_display *display = to_intel_display(intel_dp); 257 - struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode; 258 - int waketime_in_lines, first_sdp_position; 259 - int context_latency, guardband; 260 310 261 311 if (intel_dp->alpm.lobf_disable_debug) { 262 312 drm_dbg_kms(display->drm, "LOBF is disabled by debug flag\n"); ··· 340 288 if (!intel_alpm_compute_params(intel_dp, crtc_state)) 341 289 return; 342 290 343 - context_latency = adjusted_mode->crtc_vblank_start - adjusted_mode->crtc_vdisplay; 344 - guardband = adjusted_mode->crtc_vtotal - 345 - adjusted_mode->crtc_vdisplay - context_latency; 346 - first_sdp_position = adjusted_mode->crtc_vtotal - adjusted_mode->crtc_vsync_start; 347 - if (intel_alpm_aux_less_wake_supported(intel_dp)) 348 - waketime_in_lines = crtc_state->alpm_state.io_wake_lines; 349 - else 350 - waketime_in_lines = crtc_state->alpm_state.aux_less_wake_lines; 351 - 352 - crtc_state->has_lobf = (context_latency + guardband) > 353 - (first_sdp_position + waketime_in_lines); 291 + crtc_state->has_lobf = true; 354 292 } 355 293 356 294 static void lnl_alpm_configure(struct intel_dp *intel_dp,
+3
drivers/gpu/drm/i915/display/intel_alpm.h
··· 38 38 const struct intel_crtc_state *crtc_state); 39 39 void intel_alpm_disable(struct intel_dp *intel_dp); 40 40 bool intel_alpm_get_error(struct intel_dp *intel_dp); 41 + void intel_alpm_lobf_compute_config_late(struct intel_dp *intel_dp, 42 + struct intel_crtc_state *crtc_state); 43 + int intel_alpm_lobf_min_guardband(struct intel_crtc_state *crtc_state); 41 44 #endif
+2
drivers/gpu/drm/i915/display/intel_dp.c
··· 7163 7163 if (ret) 7164 7164 return ret; 7165 7165 7166 + intel_alpm_lobf_compute_config_late(intel_dp, crtc_state); 7167 + 7166 7168 return 0; 7167 7169 } 7168 7170
+2
drivers/gpu/drm/i915/display/intel_vrr.c
··· 6 6 7 7 #include <drm/drm_print.h> 8 8 9 + #include "intel_alpm.h" 9 10 #include "intel_crtc.h" 10 11 #include "intel_de.h" 11 12 #include "intel_display_regs.h" ··· 521 520 if (intel_crtc_has_dp_encoder(crtc_state)) { 522 521 guardband = max(guardband, intel_psr_min_guardband(crtc_state)); 523 522 guardband = max(guardband, intel_dp_sdp_min_guardband(crtc_state, true)); 523 + guardband = max(guardband, intel_alpm_lobf_min_guardband(crtc_state)); 524 524 } 525 525 526 526 return guardband;