radv/winsys: cleanup the chained submission path
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 30 Oct 2018 10:41:18 +0000 (11:41 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 31 Oct 2018 08:21:28 +0000 (09:21 +0100)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c

index 149c25621874336c42f2e4fa8d667c0f4a276698..5f621ec3fb881b0ae736ad715de604bed6da4df1 100644 (file)
@@ -777,6 +777,7 @@ static int radv_amdgpu_winsys_cs_submit_chained(struct radeon_winsys_ctx *_ctx,
        amdgpu_bo_list_handle bo_list;
        struct amdgpu_cs_request request = {0};
        struct amdgpu_cs_ib_info ibs[2];
+       unsigned number_of_ibs = 1;
 
        for (unsigned i = cs_count; i--;) {
                struct radv_amdgpu_cs *cs = radv_amdgpu_cs(cs_array[i]);
@@ -800,28 +801,33 @@ static int radv_amdgpu_winsys_cs_submit_chained(struct radeon_winsys_ctx *_ctx,
                }
        }
 
-       r = radv_amdgpu_create_bo_list(cs0->ws, cs_array, cs_count, NULL, 0, initial_preamble_cs,
-                                      radv_bo_list, &bo_list);
+       /* Create a buffer object list. */
+       r = radv_amdgpu_create_bo_list(cs0->ws, cs_array, cs_count, NULL, 0,
+                                      initial_preamble_cs, radv_bo_list,
+                                      &bo_list);
        if (r) {
                fprintf(stderr, "amdgpu: buffer list creation failed for the "
                                "chained submission(%d)\n", r);
                return r;
        }
 
+       /* Configure the CS request. */
+       if (initial_preamble_cs) {
+               ibs[0] = radv_amdgpu_cs(initial_preamble_cs)->ib;
+               ibs[1] = cs0->ib;
+               number_of_ibs++;
+       } else {
+               ibs[0] = cs0->ib;
+       }
+
        request.ip_type = cs0->hw_ip;
        request.ring = queue_idx;
-       request.number_of_ibs = 1;
-       request.ibs = &cs0->ib;
+       request.number_of_ibs = number_of_ibs;
+       request.ibs = ibs;
        request.resources = bo_list;
        request.fence_info = radv_set_cs_fence(ctx, cs0->hw_ip, queue_idx);
 
-       if (initial_preamble_cs) {
-               request.ibs = ibs;
-               request.number_of_ibs = 2;
-               ibs[1] = cs0->ib;
-               ibs[0] = ((struct radv_amdgpu_cs*)initial_preamble_cs)->ib;
-       }
-
+       /* Submit the CS. */
        r = radv_amdgpu_cs_submit(ctx, &request, sem_info);
        if (r) {
                if (r == -ENOMEM)