[Intel-gfx] [PATCH 3/3] drm/i915: Pin the pages before acquiring struct_mutex for display

Chris Wilson chris at chris-wilson.co.uk
Wed Jul 26 16:00:38 UTC 2017


Since we don't need the struct_mutex to acquire the object's pages, call
i915_gem_object_pin_pages() before we bind the object into the GGTT.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 5018e04f7224..f93d9a13b13a 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12434,10 +12434,16 @@ intel_prepare_plane_fb(struct drm_plane *plane,
 	if (!obj)
 		return 0;
 
-	ret = mutex_lock_interruptible(&dev_priv->drm.struct_mutex);
+	ret = i915_gem_object_pin_pages(obj);
 	if (ret)
 		return ret;
 
+	ret = mutex_lock_interruptible(&dev_priv->drm.struct_mutex);
+	if (ret) {
+		i915_gem_object_unpin_pages(obj);
+		return ret;
+	}
+
 	if (plane->type == DRM_PLANE_TYPE_CURSOR &&
 	    INTEL_INFO(dev_priv)->cursor_needs_physical) {
 		const int align = intel_cursor_alignment(dev_priv);
@@ -12456,6 +12462,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,
 	i915_gem_object_wait_priority(obj, 0, I915_PRIORITY_DISPLAY);
 
 	mutex_unlock(&dev_priv->drm.struct_mutex);
+	i915_gem_object_unpin_pages(obj);
 	if (ret)
 		return ret;
 
-- 
2.13.3



More information about the Intel-gfx mailing list