Mesa (master): radv: Signal fence correctly after sparse binding.
Bas Nieuwenhuizen
bnieuwenhuizen at kemper.freedesktop.org
Mon Jan 29 16:24:06 UTC 2018
Module: Mesa
Branch: master
Commit: 0347a83bbfd8d993742e125335c6ae46a6aa5a15
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0347a83bbfd8d993742e125335c6ae46a6aa5a15
Author: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Date: Sat Jan 27 14:51:12 2018 +0100
radv: Signal fence correctly after sparse binding.
It did not signal syncobjs in the fence, and also signalled too early
if there was work on the queue already, as we have to wait till that
work is done.
Fixes: d27aaae4d2 "radv: Add external fence support."
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
src/amd/vulkan/radv_device.c | 46 ++++++++++++++++++++++++++++++--------------
1 file changed, 32 insertions(+), 14 deletions(-)
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 4463e6945e..2ce667fd21 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -1996,6 +1996,32 @@ VkResult radv_alloc_sem_info(struct radv_winsys_sem_info *sem_info,
return ret;
}
+/* Signals fence as soon as all the work currently put on queue is done. */
+static VkResult radv_signal_fence(struct radv_queue *queue,
+ struct radv_fence *fence)
+{
+ int ret;
+ VkResult result;
+ struct radv_winsys_sem_info sem_info;
+
+ result = radv_alloc_sem_info(&sem_info, 0, NULL, 0, NULL,
+ radv_fence_to_handle(fence));
+ if (result != VK_SUCCESS)
+ return result;
+
+ ret = queue->device->ws->cs_submit(queue->hw_ctx, queue->queue_idx,
+ &queue->device->empty_cs[queue->queue_family_index],
+ 1, NULL, NULL, &sem_info,
+ false, fence->fence);
+ radv_free_sem_info(&sem_info);
+
+ /* TODO: find a better error */
+ if (ret)
+ return vk_error(VK_ERROR_OUT_OF_DEVICE_MEMORY);
+
+ return VK_SUCCESS;
+}
+
VkResult radv_QueueSubmit(
VkQueue _queue,
uint32_t submitCount,
@@ -2124,18 +2150,7 @@ VkResult radv_QueueSubmit(
if (fence) {
if (!fence_emitted) {
- struct radv_winsys_sem_info sem_info;
-
- result = radv_alloc_sem_info(&sem_info, 0, NULL, 0, NULL,
- _fence);
- if (result != VK_SUCCESS)
- return result;
-
- ret = queue->device->ws->cs_submit(ctx, queue->queue_idx,
- &queue->device->empty_cs[queue->queue_family_index],
- 1, NULL, NULL, &sem_info,
- false, base_fence);
- radv_free_sem_info(&sem_info);
+ radv_signal_fence(queue, fence);
}
fence->submitted = true;
}
@@ -2656,8 +2671,11 @@ radv_sparse_image_opaque_bind_memory(struct radv_device *device,
}
- if (fence && !fence_emitted) {
- fence->signalled = true;
+ if (fence) {
+ if (!fence_emitted) {
+ radv_signal_fence(queue, fence);
+ }
+ fence->submitted = true;
}
return VK_SUCCESS;
More information about the mesa-commit
mailing list