[Mesa-dev] [PATCH 2/4] radv/winsys: cleanup the chained submission path

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Oct 30 10:41:18 UTC 2018


Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 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 149c256218..5f621ec3fb 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.19.1



More information about the mesa-dev mailing list