[2/4] drm/i915: Use dma_resv locking wrappers
diff mbox series

Message ID 20191125094356.161941-3-daniel.vetter@ffwll.ch
State New
Headers show
Series
  • consistently use dma_resv locking wrappers
Related show

Commit Message

Daniel Vetter Nov. 25, 2019, 9:43 a.m. UTC
I'll add more fancy logic to them soon, so everyone really has to use
them. Plus they already provide some nice additional debug
infrastructure on top of direct ww_mutex usage for the fences tracked
by dma_resv.

Aside: We might want to create wrappers for i915_vma locking of the
->resv like we have for the i915_gem_bo itself already.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Daniel Vetter Dec. 14, 2019, 12:10 a.m. UTC | #1
On Mon, Nov 25, 2019 at 10:43:54AM +0100, Daniel Vetter wrote:
> I'll add more fancy logic to them soon, so everyone really has to use
> them. Plus they already provide some nice additional debug
> infrastructure on top of direct ww_mutex usage for the fences tracked
> by dma_resv.
> 
> Aside: We might want to create wrappers for i915_vma locking of the
> ->resv like we have for the i915_gem_bo itself already.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Matthew Auld <matthew.auld@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Jani Nikula <jani.nikula@intel.com>
> ---

Maarten/Chris, should I drop this one or keep? I guess this will all
change anyway rsn ...
-Daniel

>  drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> index 7a87e8270460..7b8f4ebd9986 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> @@ -1848,7 +1848,7 @@ static int eb_move_to_gpu(struct i915_execbuffer *eb)
>  	for (i = 0; i < count; i++) {
>  		struct i915_vma *vma = eb->vma[i];
>  
> -		err = ww_mutex_lock_interruptible(&vma->resv->lock, &acquire);
> +		err = dma_resv_lock_interruptible(vma->resv, &acquire);
>  		if (!err)
>  			continue;
>  
> @@ -1859,7 +1859,7 @@ static int eb_move_to_gpu(struct i915_execbuffer *eb)
>  			do {
>  				int j = i - 1;
>  
> -				ww_mutex_unlock(&eb->vma[j]->resv->lock);
> +				dma_resv_unlock(eb->vma[j]->resv);
>  
>  				swap(eb->flags[i], eb->flags[j]);
>  				swap(eb->vma[i],  eb->vma[j]);
> @@ -1868,7 +1868,7 @@ static int eb_move_to_gpu(struct i915_execbuffer *eb)
>  			GEM_BUG_ON(vma != eb->vma[0]);
>  			vma->exec_flags = &eb->flags[0];
>  
> -			err = ww_mutex_lock_slow_interruptible(&vma->resv->lock,
> +			err = dma_resv_lock_slow_interruptible(vma->resv,
>  							       &acquire);
>  		}
>  		if (err)
> -- 
> 2.24.0
>

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
index 7a87e8270460..7b8f4ebd9986 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -1848,7 +1848,7 @@  static int eb_move_to_gpu(struct i915_execbuffer *eb)
 	for (i = 0; i < count; i++) {
 		struct i915_vma *vma = eb->vma[i];
 
-		err = ww_mutex_lock_interruptible(&vma->resv->lock, &acquire);
+		err = dma_resv_lock_interruptible(vma->resv, &acquire);
 		if (!err)
 			continue;
 
@@ -1859,7 +1859,7 @@  static int eb_move_to_gpu(struct i915_execbuffer *eb)
 			do {
 				int j = i - 1;
 
-				ww_mutex_unlock(&eb->vma[j]->resv->lock);
+				dma_resv_unlock(eb->vma[j]->resv);
 
 				swap(eb->flags[i], eb->flags[j]);
 				swap(eb->vma[i],  eb->vma[j]);
@@ -1868,7 +1868,7 @@  static int eb_move_to_gpu(struct i915_execbuffer *eb)
 			GEM_BUG_ON(vma != eb->vma[0]);
 			vma->exec_flags = &eb->flags[0];
 
-			err = ww_mutex_lock_slow_interruptible(&vma->resv->lock,
+			err = dma_resv_lock_slow_interruptible(vma->resv,
 							       &acquire);
 		}
 		if (err)