Commit 616b549b authored by Daniel Vetter's avatar Daniel Vetter

drm/vc4: Use dma_resv locking wrappers

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.
Reviewed-by: default avatarEric Anholt <eric@anholt.net>
Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191125094356.161941-5-daniel.vetter@ffwll.ch
parent 80f30930
...@@ -568,7 +568,7 @@ vc4_unlock_bo_reservations(struct drm_device *dev, ...@@ -568,7 +568,7 @@ vc4_unlock_bo_reservations(struct drm_device *dev,
for (i = 0; i < exec->bo_count; i++) { for (i = 0; i < exec->bo_count; i++) {
struct drm_gem_object *bo = &exec->bo[i]->base; struct drm_gem_object *bo = &exec->bo[i]->base;
ww_mutex_unlock(&bo->resv->lock); dma_resv_unlock(bo->resv);
} }
ww_acquire_fini(acquire_ctx); ww_acquire_fini(acquire_ctx);
...@@ -595,8 +595,7 @@ vc4_lock_bo_reservations(struct drm_device *dev, ...@@ -595,8 +595,7 @@ vc4_lock_bo_reservations(struct drm_device *dev,
retry: retry:
if (contended_lock != -1) { if (contended_lock != -1) {
bo = &exec->bo[contended_lock]->base; bo = &exec->bo[contended_lock]->base;
ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock, ret = dma_resv_lock_slow_interruptible(bo->resv, acquire_ctx);
acquire_ctx);
if (ret) { if (ret) {
ww_acquire_done(acquire_ctx); ww_acquire_done(acquire_ctx);
return ret; return ret;
...@@ -609,19 +608,19 @@ vc4_lock_bo_reservations(struct drm_device *dev, ...@@ -609,19 +608,19 @@ vc4_lock_bo_reservations(struct drm_device *dev,
bo = &exec->bo[i]->base; bo = &exec->bo[i]->base;
ret = ww_mutex_lock_interruptible(&bo->resv->lock, acquire_ctx); ret = dma_resv_lock_interruptible(bo->resv, acquire_ctx);
if (ret) { if (ret) {
int j; int j;
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
bo = &exec->bo[j]->base; bo = &exec->bo[j]->base;
ww_mutex_unlock(&bo->resv->lock); dma_resv_unlock(bo->resv);
} }
if (contended_lock != -1 && contended_lock >= i) { if (contended_lock != -1 && contended_lock >= i) {
bo = &exec->bo[contended_lock]->base; bo = &exec->bo[contended_lock]->base;
ww_mutex_unlock(&bo->resv->lock); dma_resv_unlock(bo->resv);
} }
if (ret == -EDEADLK) { if (ret == -EDEADLK) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment