Introduce platform dependent SAGV checking in
combination with bandwidth state pipe SAGV mask.

v2, v3, v4, v5: Fix rebase conflict

Signed-off-by: Stanislav Lisovskiy <stanislav.lisovs...@intel.com>
---
 drivers/gpu/drm/i915/intel_pm.c | 38 ++++++++++++++++++++++++---------
 1 file changed, 28 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index f7249bca3f6f..059bc312c9de 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3806,7 +3806,6 @@ void intel_sagv_post_plane_update(struct 
intel_atomic_state *state)
 
 static bool intel_crtc_can_enable_sagv(const struct intel_crtc_state 
*crtc_state)
 {
-       struct intel_atomic_state *state = 
to_intel_atomic_state(crtc_state->uapi.state);
        struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
        struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
        struct intel_plane *plane;
@@ -3819,13 +3818,6 @@ static bool intel_crtc_can_enable_sagv(const struct 
intel_crtc_state *crtc_state
        if (!crtc_state->hw.active)
                return true;
 
-       /*
-        * SKL+ workaround: bspec recommends we disable SAGV when we have
-        * more then one pipe enabled
-        */
-       if (hweight8(state->active_pipes) > 1)
-               return false;
-
        if (crtc_state->hw.adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE)
                return false;
 
@@ -3861,6 +3853,24 @@ static bool intel_crtc_can_enable_sagv(const struct 
intel_crtc_state *crtc_state
        return true;
 }
 
+static bool skl_crtc_can_enable_sagv(const struct intel_crtc_state *crtc_state)
+{
+       struct intel_atomic_state *state = 
to_intel_atomic_state(crtc_state->uapi.state);
+       /*
+        * SKL+ workaround: bspec recommends we disable SAGV when we have
+        * more then one pipe enabled
+        */
+       if (hweight8(state->active_pipes) > 1)
+               return false;
+
+       return intel_crtc_can_enable_sagv(crtc_state);
+}
+
+static bool icl_crtc_can_enable_sagv(const struct intel_crtc_state *crtc_state)
+{
+       return intel_crtc_can_enable_sagv(crtc_state);
+}
+
 bool intel_can_enable_sagv(const struct intel_bw_state *bw_state)
 {
        return bw_state->pipe_sagv_reject == 0;
@@ -3868,9 +3878,10 @@ bool intel_can_enable_sagv(const struct intel_bw_state 
*bw_state)
 
 static int intel_compute_sagv_mask(struct intel_atomic_state *state)
 {
+       struct drm_i915_private *dev_priv = to_i915(state->base.dev);
        int ret;
        struct intel_crtc *crtc;
-       struct intel_crtc_state *new_crtc_state;
+       const struct intel_crtc_state *new_crtc_state;
        struct intel_bw_state *new_bw_state = NULL;
        const struct intel_bw_state *old_bw_state = NULL;
        int i;
@@ -3878,6 +3889,8 @@ static int intel_compute_sagv_mask(struct 
intel_atomic_state *state)
 
        for_each_new_intel_crtc_in_state(state, crtc,
                                         new_crtc_state, i) {
+               bool can_sagv;
+
                new_bw_state = intel_atomic_get_bw_state(state);
                if (IS_ERR(new_bw_state))
                        return PTR_ERR(new_bw_state);
@@ -3890,7 +3903,12 @@ static int intel_compute_sagv_mask(struct 
intel_atomic_state *state)
                        active_pipes_calculated = true;
                }
 
-               if (intel_crtc_can_enable_sagv(new_crtc_state))
+               if (INTEL_GEN(dev_priv) >= 11)
+                       can_sagv = icl_crtc_can_enable_sagv(new_crtc_state);
+               else
+                       can_sagv = skl_crtc_can_enable_sagv(new_crtc_state);
+
+               if (can_sagv)
                        new_bw_state->pipe_sagv_reject &= ~BIT(crtc->pipe);
                else
                        new_bw_state->pipe_sagv_reject |= BIT(crtc->pipe);
-- 
2.24.1.485.gad05a3d8e5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to