[Intel-gfx] [PATCH 3/3] drm/i915: Don't waste fences for scanout when not needed

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Tue Jan 28 13:51:56 CET 2014


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Gen2 and gen3 require fences for tiled scanout, but gen4+ only require a
fence for FBC GTT modification tracking. Install a fence for scanout
only when it might actually be required.

This could potentially be optimized even further, but this seems like
a fair comporomise for now.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index fd48c2e..71dd041 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1972,6 +1972,13 @@ int intel_pin_fenced_fb_obj(struct drm_device *dev,
 	u32 alignment;
 	int ret;
 
+	/*
+	 * Pre-i965 always needs a fence for tiled scanout, whereas
+	 * 965+ only requires a fence if using framebuffer compression.
+	 */
+	if (INTEL_INFO(dev)->gen >= 4 && !HAS_FBC(dev))
+		return intel_pin_fb_obj(dev, obj, pipelined);
+
 	ret = intel_fb_obj_alignment(dev, obj, &alignment);
 	if (ret)
 		return ret;
@@ -1981,11 +1988,6 @@ int intel_pin_fenced_fb_obj(struct drm_device *dev,
 	if (ret)
 		goto err_interruptible;
 
-	/* Install a fence for tiled scan-out. Pre-i965 always needs a
-	 * fence, whereas 965+ only requires a fence if using
-	 * framebuffer compression.  For simplicity, we always install
-	 * a fence as the cost is not that onerous.
-	 */
 	ret = i915_gem_object_get_fence(obj);
 	if (ret)
 		goto err_unpin;
@@ -2004,6 +2006,13 @@ err_interruptible:
 
 void intel_unpin_fenced_fb_obj(struct drm_i915_gem_object *obj)
 {
+	struct drm_device *dev = obj->base.dev;
+
+	if (INTEL_INFO(dev)->gen >= 4 && !HAS_FBC(dev)) {
+		intel_unpin_fb_obj(obj);
+		return;
+	}
+
 	i915_gem_object_unpin_fence(obj);
 	i915_gem_object_unpin_from_display_plane(obj);
 }
-- 
1.8.3.2




More information about the Intel-gfx mailing list