[Mesa-dev] [PATCH 3/9] winsys/amdgpu: remove label bo_list_error

Marek Olšák maraeo at gmail.com
Thu Jul 12 05:26:34 UTC 2018


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/winsys/amdgpu/drm/amdgpu_cs.c | 28 +++++++++++++----------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
index 77b372d2cea..1aaa0667310 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
@@ -1311,26 +1311,34 @@ void amdgpu_cs_submit_ib(void *job, int thread_index)
 
       LIST_FOR_EACH_ENTRY(bo, &ws->global_bo_list, u.real.global_list_item) {
          assert(num < ws->num_buffers);
          handles[num++] = bo->bo;
       }
 
       r = amdgpu_bo_list_create(ws->dev, ws->num_buffers,
                                 handles, NULL, &bo_list);
       free(handles);
       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 {
       unsigned num_handles;
 
       if (!amdgpu_add_sparse_backing_buffers(cs)) {
-         r = -ENOMEM;
-         goto bo_list_error;
+         fprintf(stderr, "amdgpu: amdgpu_add_sparse_backing_buffers failed\n");
+         amdgpu_fence_signalled(cs->fence);
+         cs->error_code = -ENOMEM;
+         goto cleanup;
       }
 
       amdgpu_bo_handle *handles = alloca(sizeof(*handles) * cs->num_real_buffers);
       uint8_t *flags = alloca(sizeof(*flags) * cs->num_real_buffers);
 
       num_handles = 0;
       for (i = 0; i < cs->num_real_buffers; ++i) {
          struct amdgpu_cs_buffer *buffer = &cs->real_buffers[i];
 
 	 if (buffer->bo->is_local)
@@ -1339,32 +1347,28 @@ void amdgpu_cs_submit_ib(void *job, int thread_index)
          assert(buffer->u.real.priority_usage != 0);
 
          handles[num_handles] = buffer->bo->bo;
          flags[num_handles] = (util_last_bit64(buffer->u.real.priority_usage) - 1) / 4;
 	 ++num_handles;
       }
 
       if (num_handles) {
          r = amdgpu_bo_list_create(ws->dev, num_handles,
                                    handles, flags, &bo_list);
-      } else {
-         r = 0;
+         if (r) {
+            fprintf(stderr, "amdgpu: buffer list creation failed (%d)\n", r);
+            amdgpu_fence_signalled(cs->fence);
+            cs->error_code = r;
+            goto cleanup;
+         }
       }
    }
-bo_list_error:
-
-   if (r) {
-      fprintf(stderr, "amdgpu: buffer list creation failed (%d)\n", r);
-      amdgpu_fence_signalled(cs->fence);
-      cs->error_code = r;
-      goto cleanup;
-   }
 
    if (acs->ring_type == RING_GFX)
       ws->gfx_bo_list_counter += cs->num_real_buffers;
 
    if (acs->ctx->num_rejected_cs) {
       r = -ECANCELED;
    } else {
       struct drm_amdgpu_cs_chunk chunks[5];
       unsigned num_chunks = 0;
 
-- 
2.17.1



More information about the mesa-dev mailing list