drm/i915: Use intel_gt directly when closing VMAs
diff mbox series

Message ID 20190725082600.31811-1-tvrtko.ursulin@linux.intel.com
State New
Headers show
Series
  • drm/i915: Use intel_gt directly when closing VMAs
Related show

Commit Message

Tvrtko Ursulin July 25, 2019, 8:26 a.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Save one level of derefernce by not going via global i915.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/i915_vma.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Chris Wilson July 25, 2019, 8:33 a.m. UTC | #1
Quoting Tvrtko Ursulin (2019-07-25 09:26:00)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Save one level of derefernce by not going via global i915.

This shouldn't actually be on intel_gt. It's used as a keepalive
mechanism for GEM clients (the display servers that take a dri3 buffer
from a client, show it and then forget it, rinse and repeat). :(
-Chris

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
index ee73baf29415..83068e0be08d 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -757,7 +757,7 @@  int __i915_vma_do_pin(struct i915_vma *vma,
 
 void i915_vma_close(struct i915_vma *vma)
 {
-	struct drm_i915_private *i915 = vma->vm->i915;
+	struct intel_gt *gt = vma->vm->gt;
 	unsigned long flags;
 
 	GEM_BUG_ON(i915_vma_is_closed(vma));
@@ -774,21 +774,21 @@  void i915_vma_close(struct i915_vma *vma)
 	 * causing us to rebind the VMA once more. This ends up being a lot
 	 * of wasted work for the steady state.
 	 */
-	spin_lock_irqsave(&i915->gt.closed_lock, flags);
-	list_add(&vma->closed_link, &i915->gt.closed_vma);
-	spin_unlock_irqrestore(&i915->gt.closed_lock, flags);
+	spin_lock_irqsave(&gt->closed_lock, flags);
+	list_add(&vma->closed_link, &gt->closed_vma);
+	spin_unlock_irqrestore(&gt->closed_lock, flags);
 }
 
 static void __i915_vma_remove_closed(struct i915_vma *vma)
 {
-	struct drm_i915_private *i915 = vma->vm->i915;
+	struct intel_gt *gt = vma->vm->gt;
 
 	if (!i915_vma_is_closed(vma))
 		return;
 
-	spin_lock_irq(&i915->gt.closed_lock);
+	spin_lock_irq(&gt->closed_lock);
 	list_del_init(&vma->closed_link);
-	spin_unlock_irq(&i915->gt.closed_lock);
+	spin_unlock_irq(&gt->closed_lock);
 }
 
 void i915_vma_reopen(struct i915_vma *vma)