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

drm/i915: Eliminate intel_compute_sagv_mask()

intel_compute_sagv_mask() has become pointless. Just inline
its contents into the existing loop in skl_compute_wm().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250326162544.3642-15-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>

+24 -40
+24 -40
drivers/gpu/drm/i915/display/skl_watermark.c
··· 458 458 return bw_state->pipe_sagv_reject == 0; 459 459 } 460 460 461 - static int intel_compute_sagv_mask(struct intel_atomic_state *state) 462 - { 463 - struct intel_display *display = to_intel_display(state); 464 - struct drm_i915_private *i915 = to_i915(state->base.dev); 465 - struct intel_crtc *crtc; 466 - struct intel_crtc_state *new_crtc_state; 467 - int i; 468 - 469 - for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) { 470 - struct skl_pipe_wm *pipe_wm = &new_crtc_state->wm.skl.optimal; 471 - 472 - /* 473 - * We store use_sagv_wm in the crtc state rather than relying on 474 - * that bw state since we have no convenient way to get at the 475 - * latter from the plane commit hooks (especially in the legacy 476 - * cursor case). 477 - * 478 - * drm_atomic_check_only() gets upset if we pull more crtcs 479 - * into the state, so we have to calculate this based on the 480 - * individual intel_crtc_can_enable_sagv() rather than 481 - * the overall intel_can_enable_sagv(). Otherwise the 482 - * crtcs not included in the commit would not switch to the 483 - * SAGV watermarks when we are about to enable SAGV, and that 484 - * would lead to underruns. This does mean extra power draw 485 - * when only a subset of the crtcs are blocking SAGV as the 486 - * other crtcs can't be allowed to use the more optimal 487 - * normal (ie. non-SAGV) watermarks. 488 - */ 489 - pipe_wm->use_sagv_wm = !HAS_HW_SAGV_WM(display) && 490 - DISPLAY_VER(i915) >= 12 && 491 - intel_crtc_can_enable_sagv(new_crtc_state); 492 - } 493 - 494 - return 0; 495 - } 496 - 497 461 static u16 skl_ddb_entry_init(struct skl_ddb_entry *entry, 498 462 u16 start, u16 end) 499 463 { ··· 2992 3028 static int 2993 3029 skl_compute_wm(struct intel_atomic_state *state) 2994 3030 { 3031 + struct intel_display *display = to_intel_display(state); 2995 3032 struct intel_crtc *crtc; 2996 3033 struct intel_crtc_state __maybe_unused *new_crtc_state; 2997 3034 int ret, i; ··· 3007 3042 if (ret) 3008 3043 return ret; 3009 3044 3010 - ret = intel_compute_sagv_mask(state); 3011 - if (ret) 3012 - return ret; 3013 - 3014 3045 /* 3015 3046 * skl_compute_ddb() will have adjusted the final watermarks 3016 3047 * based on how much ddb is available. Now we can actually 3017 3048 * check if the final watermarks changed. 3018 3049 */ 3019 3050 for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) { 3051 + struct skl_pipe_wm *pipe_wm = &new_crtc_state->wm.skl.optimal; 3052 + 3053 + /* 3054 + * We store use_sagv_wm in the crtc state rather than relying on 3055 + * that bw state since we have no convenient way to get at the 3056 + * latter from the plane commit hooks (especially in the legacy 3057 + * cursor case). 3058 + * 3059 + * drm_atomic_check_only() gets upset if we pull more crtcs 3060 + * into the state, so we have to calculate this based on the 3061 + * individual intel_crtc_can_enable_sagv() rather than 3062 + * the overall intel_can_enable_sagv(). Otherwise the 3063 + * crtcs not included in the commit would not switch to the 3064 + * SAGV watermarks when we are about to enable SAGV, and that 3065 + * would lead to underruns. This does mean extra power draw 3066 + * when only a subset of the crtcs are blocking SAGV as the 3067 + * other crtcs can't be allowed to use the more optimal 3068 + * normal (ie. non-SAGV) watermarks. 3069 + */ 3070 + pipe_wm->use_sagv_wm = !HAS_HW_SAGV_WM(display) && 3071 + DISPLAY_VER(display) >= 12 && 3072 + intel_crtc_can_enable_sagv(new_crtc_state); 3073 + 3020 3074 ret = skl_wm_add_affected_planes(state, crtc); 3021 3075 if (ret) 3022 3076 return ret;