[Intel-gfx] [PATCH 1/2] drm/i915: fb_obj invalidate is divided into two functions

Ramalingam C ramalingam.c at intel.com
Thu Jun 11 02:38:34 PDT 2015


fb_obj invalidate is divided into two functions. So that
we can invoke the frontbuffer invalidation from the flip
preparation also.

Signed-off-by: Ramalingam C <ramalingam.c at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
References: https://bugs.freedesktop.org/show_bug.cgi?id=90418
---
 drivers/gpu/drm/i915/intel_frontbuffer.c |   42 +++++++++++++++++++++++-------
 1 file changed, 33 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_frontbuffer.c b/drivers/gpu/drm/i915/intel_frontbuffer.c
index 57095f5..4cea589 100644
--- a/drivers/gpu/drm/i915/intel_frontbuffer.c
+++ b/drivers/gpu/drm/i915/intel_frontbuffer.c
@@ -119,6 +119,33 @@ static void intel_mark_fb_busy(struct drm_device *dev,
 }
 
 /**
+ * intel_frontbuffer_invalidate - Invalidate frontbuffer
+ * @dev: DRM device
+ * @ring: set for asynchronous rendering
+ * @origin: which operation caused the invalidation
+ * @frontbuffer_bits: frontbuffer plane tracking bits
+ *
+ * This function gets called every time rendering on the given planes has
+ * started and frontbuffer caching must be invalidated.
+ *
+ * Can be called without any locks held.
+ */
+void intel_frontbuffer_invalidate(struct drm_device *dev,
+				struct intel_engine_cs *ring,
+				enum fb_op_origin origin,
+				unsigned frontbuffer_bits)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	intel_mark_fb_busy(dev, frontbuffer_bits, ring);
+
+	intel_psr_invalidate(dev, frontbuffer_bits);
+	intel_edp_drrs_invalidate(dev, frontbuffer_bits);
+	intel_fbc_invalidate(dev_priv, frontbuffer_bits, origin);
+}
+
+
+/**
  * intel_fb_obj_invalidate - invalidate frontbuffer object
  * @obj: GEM object to invalidate
  * @ring: set for asynchronous rendering
@@ -136,26 +163,23 @@ void intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
 {
 	struct drm_device *dev = obj->base.dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
+	unsigned frontbuffer_bits;
 
 	WARN_ON(!mutex_is_locked(&dev->struct_mutex));
 
 	if (!obj->frontbuffer_bits)
 		return;
 
+	frontbuffer_bits = obj->frontbuffer_bits;
+
 	if (ring) {
 		mutex_lock(&dev_priv->fb_tracking.lock);
-		dev_priv->fb_tracking.busy_bits
-			|= obj->frontbuffer_bits;
-		dev_priv->fb_tracking.flip_bits
-			&= ~obj->frontbuffer_bits;
+		dev_priv->fb_tracking.busy_bits |= frontbuffer_bits;
+		dev_priv->fb_tracking.flip_bits &= ~frontbuffer_bits;
 		mutex_unlock(&dev_priv->fb_tracking.lock);
 	}
 
-	intel_mark_fb_busy(dev, obj->frontbuffer_bits, ring);
-
-	intel_psr_invalidate(dev, obj->frontbuffer_bits);
-	intel_edp_drrs_invalidate(dev, obj->frontbuffer_bits);
-	intel_fbc_invalidate(dev_priv, obj->frontbuffer_bits, origin);
+	intel_frontbuffer_invalidate(dev, ring, origin, frontbuffer_bits);
 }
 
 /**
-- 
1.7.9.5



More information about the Intel-gfx mailing list