From 72877865d949444df92ba48eb0b6f80c896b9bff Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 30 Oct 2018 11:41:18 +0100 Subject: [PATCH] radv/winsys: cleanup the chained submission path Signed-off-by: Samuel Pitoiset Reviewed-by: Dave Airlie --- src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c index 149c2562187..5f621ec3fb8 100644 --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c @@ -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) -- 2.30.2