[Intel-gfx] [PATCH 2/4] drm/i915: Use dma_resv locking wrappers
Daniel Vetter
daniel at ffwll.ch
Sat Dec 14 00:10:18 UTC 2019
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 at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> Cc: Matthew Auld <matthew.auld at intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> Cc: Jani Nikula <jani.nikula at 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
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
More information about the Intel-gfx
mailing list