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 <ba...@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

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to