diff options
author | Marek Olšák <[email protected]> | 2018-07-12 00:47:11 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2018-07-16 13:32:33 -0400 |
commit | f8aa116c3c6d33c4f9076d04355d6226debbb88b (patch) | |
tree | 00a6fa06938b4b2bf1bba955825eedbb591b39d2 /src/gallium/winsys/amdgpu | |
parent | 6b1e0e51e6dbb896ec0dccc6e5dd1bb3e0f35c2b (diff) |
winsys/amdgpu: clean up error handling in amdgpu_cs_submit_ib
Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/gallium/winsys/amdgpu')
-rw-r--r-- | src/gallium/winsys/amdgpu/drm/amdgpu_cs.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c index 872e67a790a..ac7160a5e51 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c @@ -1312,8 +1312,6 @@ void amdgpu_cs_submit_ib(void *job, int thread_index) simple_mtx_unlock(&ws->global_bo_list_lock); if (r) { fprintf(stderr, "amdgpu: buffer list creation failed (%d)\n", r); - amdgpu_fence_signalled(cs->fence); - cs->error_code = r; goto cleanup; } } else { @@ -1321,8 +1319,7 @@ void amdgpu_cs_submit_ib(void *job, int thread_index) if (!amdgpu_add_sparse_backing_buffers(cs)) { fprintf(stderr, "amdgpu: amdgpu_add_sparse_backing_buffers failed\n"); - amdgpu_fence_signalled(cs->fence); - cs->error_code = -ENOMEM; + r = -ENOMEM; goto cleanup; } @@ -1348,8 +1345,6 @@ void amdgpu_cs_submit_ib(void *job, int thread_index) handles, flags, &bo_list); if (r) { fprintf(stderr, "amdgpu: buffer list creation failed (%d)\n", r); - amdgpu_fence_signalled(cs->fence); - cs->error_code = r; goto cleanup; } } @@ -1458,7 +1453,6 @@ void amdgpu_cs_submit_ib(void *job, int thread_index) num_chunks, chunks, &seq_no); } - cs->error_code = r; if (r) { if (r == -ENOMEM) fprintf(stderr, "amdgpu: Not enough memory for command submission.\n"); @@ -1468,8 +1462,6 @@ void amdgpu_cs_submit_ib(void *job, int thread_index) fprintf(stderr, "amdgpu: The CS has been rejected, " "see dmesg for more information (%i).\n", r); - amdgpu_fence_signalled(cs->fence); - acs->ctx->num_rejected_cs++; ws->num_total_rejected_cs++; } else { @@ -1486,6 +1478,13 @@ void amdgpu_cs_submit_ib(void *job, int thread_index) amdgpu_bo_list_destroy(bo_list); cleanup: + /* If there was an error, signal the fence, because it won't be signalled + * by the hardware. */ + if (r) + amdgpu_fence_signalled(cs->fence); + + cs->error_code = r; + for (i = 0; i < cs->num_real_buffers; i++) p_atomic_dec(&cs->real_buffers[i].bo->num_active_ioctls); for (i = 0; i < cs->num_slab_buffers; i++) |