drm/i915: Compute use_sagv_wm differently
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 19 Dec 2023 13:07:54 +0000 (15:07 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 2 Feb 2024 21:02:23 +0000 (23:02 +0200)
commit1e41fa9452039beea297105fb6f7f68cb2774e1a
tree9c6de9528a72d0c07f064786ec3072b3448c3e27
parent7fd4548d4b645c037d7b0508acfd0955598ded4e
drm/i915: Compute use_sagv_wm differently

drm_atomic_check_only() gets upset if we try to add extra crtcs
to any commit that isn't flagged with DRM_MODE_ATOMIC_ALLOW_MODESET.
This conflicts with how SAGV watermarks work on pre-ADL as we
need to manually switch over the SAGV watermarks before we can
safely enable SAGV.

So in order to make SAGV usage possible we need to compute each
pipe's use of SAGV watermarks as if there aren't any other
active pipes. Ie. if the current pipe isn't the one blocking
SAGV then we make it use the SAGV watermarks, even if some
other pipe prevents SAGV from actually being used. Otherwise
we could end up with a pipes using the normal watermarks (but
not blocking SAGV), and some other pipe in parallel enabling
SAGV, which would likely cause underruns.

The alternative approach of preventing SAGV usage until all
pipes simultanously end up using SAGV watermarks would only
really work if userspace always adds all pipes to every
commits, which isn't the case typically.

The downside of this is that we will end up using the less
optimal SAGV watermarks even if some other pipe prevents
SAGV from actually being enabled. In which case the system
won't achieve the minimum possible power consumption.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231219130756.25986-2-ville.syrjala@linux.intel.com
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
drivers/gpu/drm/i915/display/skl_watermark.c