[Mesa-dev] [PATCH 2/8] radv: Better handle submitting 0 command buffers.

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Sun Feb 5 11:43:53 UTC 2017


If we had submitCount >0, but each submit had zero command buffers,
then we still wouldn't signal the fence.

Signed-off-by: Bas Nieuwenhuizen <basni at google.com>
---
 src/amd/vulkan/radv_device.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 64083e4ce0c..3f9a452ddf3 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -1392,6 +1392,7 @@ VkResult radv_QueueSubmit(
 	RADV_FROM_HANDLE(radv_queue, queue, _queue);
 	RADV_FROM_HANDLE(radv_fence, fence, _fence);
 	struct radeon_winsys_fence *base_fence = fence ? fence->fence : NULL;
+	bool signalled_fence = false;
 	struct radeon_winsys_ctx *ctx = queue->hw_ctx;
 	int ret;
 	uint32_t max_cs_submission = queue->device->trace_bo ? 1 : UINT32_MAX;
@@ -1477,10 +1478,25 @@ VkResult radv_QueueSubmit(
 			}
 		}
 		free(cs_array);
+		if (!pSubmits[i].commandBufferCount) {
+			ret = queue->device->ws->cs_submit(ctx, radv_queue_family_to_ring(queue->queue_family_index),
+							queue->queue_idx, NULL, 0, NULL,
+							(struct radeon_winsys_sem **)pSubmits[i].pWaitSemaphores,
+							pSubmits[i].waitSemaphoreCount,
+							(struct radeon_winsys_sem **)pSubmits[i].pSignalSemaphores,
+							pSubmits[i].signalSemaphoreCount,
+							false, base_fence);
+
+			if (ret) {
+				radv_loge("failed to submit CS %d\n", i);
+				abort();
+			}
+		} else
+			signalled_fence = true;
 	}
 
 	if (fence) {
-		if (!submitCount)
+		if (!signalled_fence)
 			ret = queue->device->ws->cs_submit(ctx,
 							   radv_queue_family_to_ring(queue->queue_family_index),
 							   queue->queue_idx,
-- 
2.11.0



More information about the mesa-dev mailing list