aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index f539a2a92774..7398b4850649 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -534,21 +534,24 @@ int amdgpu_ctx_wait_prev_fence(struct amdgpu_ctx *ctx,
534 struct drm_sched_entity *entity) 534 struct drm_sched_entity *entity)
535{ 535{
536 struct amdgpu_ctx_entity *centity = to_amdgpu_ctx_entity(entity); 536 struct amdgpu_ctx_entity *centity = to_amdgpu_ctx_entity(entity);
537 unsigned idx = centity->sequence & (amdgpu_sched_jobs - 1); 537 struct dma_fence *other;
538 struct dma_fence *other = centity->fences[idx]; 538 unsigned idx;
539 long r;
539 540
540 if (other) { 541 spin_lock(&ctx->ring_lock);
541 signed long r; 542 idx = centity->sequence & (amdgpu_sched_jobs - 1);
542 r = dma_fence_wait(other, true); 543 other = dma_fence_get(centity->fences[idx]);
543 if (r < 0) { 544 spin_unlock(&ctx->ring_lock);
544 if (r != -ERESTARTSYS)
545 DRM_ERROR("Error (%ld) waiting for fence!\n", r);
546 545
547 return r; 546 if (!other)
548 } 547 return 0;
549 }
550 548
551 return 0; 549 r = dma_fence_wait(other, true);
550 if (r < 0 && r != -ERESTARTSYS)
551 DRM_ERROR("Error (%ld) waiting for fence!\n", r);
552
553 dma_fence_put(other);
554 return r;
552} 555}
553 556
554void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr) 557void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr)