[RFC PATCH 22/22] drm/i915/drrs: DRRS doesn't really need frontbuffer bits

Jouni Högander jouni.hogander at intel.com
Fri Mar 24 08:07:42 UTC 2023


We are following new strategy to rely purely on dirtyfb callback. DRRS
was using frontbuffer bits to keep track of update between invalidates
and flush. Now as we have only flush we can remove frontbuffer bits
track keeping from DRRS as well.

Signed-off-by: Jouni Högander <jouni.hogander at intel.com>
---
 .../drm/i915/display/intel_display_types.h    |  2 -
 drivers/gpu/drm/i915/display/intel_drrs.c     | 54 ++-----------------
 drivers/gpu/drm/i915/display/intel_drrs.h     |  3 +-
 .../gpu/drm/i915/display/intel_frontbuffer.c  |  2 +-
 4 files changed, 7 insertions(+), 54 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 05e362d7cd24..bcfac589a60a 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1407,8 +1407,6 @@ struct intel_crtc {
 		struct mutex mutex;
 		struct delayed_work work;
 		enum drrs_refresh_rate refresh_rate;
-		unsigned int frontbuffer_bits;
-		unsigned int busy_frontbuffer_bits;
 		enum transcoder cpu_transcoder;
 		struct intel_link_m_n m_n, m2_n2;
 	} drrs;
diff --git a/drivers/gpu/drm/i915/display/intel_drrs.c b/drivers/gpu/drm/i915/display/intel_drrs.c
index 024994efdd83..17e39a317a39 100644
--- a/drivers/gpu/drm/i915/display/intel_drrs.c
+++ b/drivers/gpu/drm/i915/display/intel_drrs.c
@@ -9,7 +9,6 @@
 #include "intel_de.h"
 #include "intel_display_types.h"
 #include "intel_drrs.h"
-#include "intel_frontbuffer.h"
 #include "intel_panel.h"
 
 /**
@@ -115,21 +114,6 @@ static void intel_drrs_schedule_work(struct intel_crtc *crtc)
 	mod_delayed_work(system_wq, &crtc->drrs.work, msecs_to_jiffies(1000));
 }
 
-static unsigned int intel_drrs_frontbuffer_bits(const struct intel_crtc_state *crtc_state)
-{
-	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
-	struct drm_i915_private *i915 = to_i915(crtc->base.dev);
-	unsigned int frontbuffer_bits;
-
-	frontbuffer_bits = INTEL_FRONTBUFFER_ALL_MASK(crtc->pipe);
-
-	for_each_intel_crtc_in_pipe_mask(&i915->drm, crtc,
-					 crtc_state->bigjoiner_pipes)
-		frontbuffer_bits |= INTEL_FRONTBUFFER_ALL_MASK(crtc->pipe);
-
-	return frontbuffer_bits;
-}
-
 /**
  * intel_drrs_activate - activate DRRS
  * @crtc_state: the crtc state
@@ -154,8 +138,6 @@ void intel_drrs_activate(const struct intel_crtc_state *crtc_state)
 	crtc->drrs.cpu_transcoder = crtc_state->cpu_transcoder;
 	crtc->drrs.m_n = crtc_state->dp_m_n;
 	crtc->drrs.m2_n2 = crtc_state->dp_m2_n2;
-	crtc->drrs.frontbuffer_bits = intel_drrs_frontbuffer_bits(crtc_state);
-	crtc->drrs.busy_frontbuffer_bits = 0;
 
 	intel_drrs_schedule_work(crtc);
 
@@ -187,8 +169,6 @@ void intel_drrs_deactivate(const struct intel_crtc_state *old_crtc_state)
 		intel_drrs_set_state(crtc, DRRS_REFRESH_RATE_HIGH);
 
 	crtc->drrs.cpu_transcoder = INVALID_TRANSCODER;
-	crtc->drrs.frontbuffer_bits = 0;
-	crtc->drrs.busy_frontbuffer_bits = 0;
 
 	mutex_unlock(&crtc->drrs.mutex);
 
@@ -201,34 +181,19 @@ static void intel_drrs_downclock_work(struct work_struct *work)
 
 	mutex_lock(&crtc->drrs.mutex);
 
-	if (intel_drrs_is_active(crtc) && !crtc->drrs.busy_frontbuffer_bits)
+	if (intel_drrs_is_active(crtc))
 		intel_drrs_set_state(crtc, DRRS_REFRESH_RATE_LOW);
 
 	mutex_unlock(&crtc->drrs.mutex);
 }
 
-static void intel_drrs_frontbuffer_update(struct drm_i915_private *dev_priv,
-					  unsigned int all_frontbuffer_bits,
-					  bool invalidate)
+static void intel_drrs_frontbuffer_update(struct drm_i915_private *dev_priv)
 {
 	struct intel_crtc *crtc;
 
 	for_each_intel_crtc(&dev_priv->drm, crtc) {
-		unsigned int frontbuffer_bits;
-
 		mutex_lock(&crtc->drrs.mutex);
 
-		frontbuffer_bits = all_frontbuffer_bits & crtc->drrs.frontbuffer_bits;
-		if (!frontbuffer_bits) {
-			mutex_unlock(&crtc->drrs.mutex);
-			continue;
-		}
-
-		if (invalidate)
-			crtc->drrs.busy_frontbuffer_bits |= frontbuffer_bits;
-		else
-			crtc->drrs.busy_frontbuffer_bits &= ~frontbuffer_bits;
-
 		/* flush/invalidate means busy screen hence upclock */
 		intel_drrs_set_state(crtc, DRRS_REFRESH_RATE_HIGH);
 
@@ -236,10 +201,7 @@ static void intel_drrs_frontbuffer_update(struct drm_i915_private *dev_priv,
 		 * flush also means no more activity hence schedule downclock, if all
 		 * other fbs are quiescent too
 		 */
-		if (!crtc->drrs.busy_frontbuffer_bits)
-			intel_drrs_schedule_work(crtc);
-		else
-			cancel_delayed_work(&crtc->drrs.work);
+		intel_drrs_schedule_work(crtc);
 
 		mutex_unlock(&crtc->drrs.mutex);
 	}
@@ -248,19 +210,16 @@ static void intel_drrs_frontbuffer_update(struct drm_i915_private *dev_priv,
 /**
  * intel_drrs_flush - Restart Idleness DRRS
  * @dev_priv: i915 device
- * @frontbuffer_bits: frontbuffer plane tracking bits
  *
  * This function gets called every time rendering on the given planes has
  * completed or flip on a crtc is completed. So DRRS should be upclocked
  * (LOW_RR -> HIGH_RR). And also Idleness detection should be started again,
  * if no other planes are dirty.
  *
- * Dirty frontbuffers relevant to DRRS are tracked in busy_frontbuffer_bits.
  */
-void intel_drrs_flush(struct drm_i915_private *dev_priv,
-		      unsigned int frontbuffer_bits)
+void intel_drrs_flush(struct drm_i915_private *dev_priv)
 {
-	intel_drrs_frontbuffer_update(dev_priv, frontbuffer_bits, false);
+	intel_drrs_frontbuffer_update(dev_priv);
 }
 
 /**
@@ -302,9 +261,6 @@ static int intel_drrs_debugfs_status_show(struct seq_file *m, void *unused)
 		   crtc->drrs.refresh_rate == DRRS_REFRESH_RATE_LOW ?
 		   "low" : "high");
 
-	seq_printf(m, "DRRS busy frontbuffer bits: 0x%x\n",
-		   crtc->drrs.busy_frontbuffer_bits);
-
 	mutex_unlock(&crtc->drrs.mutex);
 
 	drm_modeset_unlock(&crtc->base.mutex);
diff --git a/drivers/gpu/drm/i915/display/intel_drrs.h b/drivers/gpu/drm/i915/display/intel_drrs.h
index 5b494bc5540b..dcc1bf1a0150 100644
--- a/drivers/gpu/drm/i915/display/intel_drrs.h
+++ b/drivers/gpu/drm/i915/display/intel_drrs.h
@@ -19,8 +19,7 @@ const char *intel_drrs_type_str(enum drrs_type drrs_type);
 bool intel_drrs_is_active(struct intel_crtc *crtc);
 void intel_drrs_activate(const struct intel_crtc_state *crtc_state);
 void intel_drrs_deactivate(const struct intel_crtc_state *crtc_state);
-void intel_drrs_flush(struct drm_i915_private *dev_priv,
-		      unsigned int frontbuffer_bits);
+void intel_drrs_flush(struct drm_i915_private *dev_priv);
 void intel_drrs_crtc_init(struct intel_crtc *crtc);
 void intel_drrs_crtc_debugfs_add(struct intel_crtc *crtc);
 void intel_drrs_connector_debugfs_add(struct intel_connector *connector);
diff --git a/drivers/gpu/drm/i915/display/intel_frontbuffer.c b/drivers/gpu/drm/i915/display/intel_frontbuffer.c
index 08c92a63e66d..cedf0eead2dc 100644
--- a/drivers/gpu/drm/i915/display/intel_frontbuffer.c
+++ b/drivers/gpu/drm/i915/display/intel_frontbuffer.c
@@ -84,7 +84,7 @@ void frontbuffer_flush(struct drm_i915_private *i915,
 		return;
 
 	might_sleep();
-	intel_drrs_flush(i915, frontbuffer_bits);
+	intel_drrs_flush(i915);
 	intel_psr_flush(i915);
 	intel_fbc_flush(i915);
 }
-- 
2.34.1



More information about the Intel-gfx-trybot mailing list