mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-06 02:24:14 +08:00
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: Eric Anholt <eric@anholt.net> Cc: Eric Anholt <eric@anholt.net> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20191125094356.161941-5-daniel.vetter@ffwll.ch
This commit is contained in:
parent
80f30930b6
commit
616b549b15
@ -568,7 +568,7 @@ vc4_unlock_bo_reservations(struct drm_device *dev,
|
||||
for (i = 0; i < exec->bo_count; i++) {
|
||||
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);
|
||||
@ -595,8 +595,7 @@ vc4_lock_bo_reservations(struct drm_device *dev,
|
||||
retry:
|
||||
if (contended_lock != -1) {
|
||||
bo = &exec->bo[contended_lock]->base;
|
||||
ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock,
|
||||
acquire_ctx);
|
||||
ret = dma_resv_lock_slow_interruptible(bo->resv, acquire_ctx);
|
||||
if (ret) {
|
||||
ww_acquire_done(acquire_ctx);
|
||||
return ret;
|
||||
@ -609,19 +608,19 @@ retry:
|
||||
|
||||
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) {
|
||||
int j;
|
||||
|
||||
for (j = 0; j < i; j++) {
|
||||
bo = &exec->bo[j]->base;
|
||||
ww_mutex_unlock(&bo->resv->lock);
|
||||
dma_resv_unlock(bo->resv);
|
||||
}
|
||||
|
||||
if (contended_lock != -1 && contended_lock >= i) {
|
||||
bo = &exec->bo[contended_lock]->base;
|
||||
|
||||
ww_mutex_unlock(&bo->resv->lock);
|
||||
dma_resv_unlock(bo->resv);
|
||||
}
|
||||
|
||||
if (ret == -EDEADLK) {
|
||||
|
Loading…
Reference in New Issue
Block a user