Module: Mesa
Branch: main
Commit: 08512aea09fcf28601c7997e73f8efc787b6f13a
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=08512aea09fcf28601c7997e73f8efc787b6f13a

Author: Jason Ekstrand <[email protected]>
Date:   Thu Mar 24 17:49:19 2022 -0500

vulkan: Replace various uses of device->timeline_mode

What we really care about is if we're DEFERRED so we need to do a flush
and if there can be any other threads we might race against.  We don't
really care about the timeline mode itself.

Reviewed-by: Lionel Landwerlin <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15566>

---

 src/vulkan/runtime/vk_device.c    | 2 +-
 src/vulkan/runtime/vk_fence.c     | 2 +-
 src/vulkan/runtime/vk_queue.c     | 2 +-
 src/vulkan/runtime/vk_semaphore.c | 6 +++---
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/vulkan/runtime/vk_device.c b/src/vulkan/runtime/vk_device.c
index 517820fdc48..e317a7bf132 100644
--- a/src/vulkan/runtime/vk_device.c
+++ b/src/vulkan/runtime/vk_device.c
@@ -189,7 +189,7 @@ vk_device_finish(UNUSED struct vk_device *device)
 VkResult
 vk_device_flush(struct vk_device *device)
 {
-   if (device->timeline_mode != VK_DEVICE_TIMELINE_MODE_EMULATED)
+   if (device->submit_mode != VK_QUEUE_SUBMIT_MODE_DEFERRED)
       return VK_SUCCESS;
 
    bool progress;
diff --git a/src/vulkan/runtime/vk_fence.c b/src/vulkan/runtime/vk_fence.c
index cf5e8914498..89402bf0fe4 100644
--- a/src/vulkan/runtime/vk_fence.c
+++ b/src/vulkan/runtime/vk_fence.c
@@ -438,7 +438,7 @@ vk_common_GetFenceFdKHR(VkDevice _device,
        * semaphore export apply.  We can't export a sync file from a fence
        * if the fence event hasn't been submitted to the kernel yet.
        */
-      if (device->timeline_mode == VK_DEVICE_TIMELINE_MODE_ASSISTED) {
+      if (vk_device_supports_threaded_submit(device)) {
          result = vk_sync_wait(device, sync, 0,
                                VK_SYNC_WAIT_PENDING,
                                UINT64_MAX);
diff --git a/src/vulkan/runtime/vk_queue.c b/src/vulkan/runtime/vk_queue.c
index 35ad8487d61..5eae8a1c7cd 100644
--- a/src/vulkan/runtime/vk_queue.c
+++ b/src/vulkan/runtime/vk_queue.c
@@ -997,7 +997,7 @@ vk_queue_wait_before_present(struct vk_queue *queue,
     * semaphores, however, we need to do a wait.  Thanks to the above bit of
     * spec text, that wait should never block for long.
     */
-   if (queue->base.device->timeline_mode != VK_DEVICE_TIMELINE_MODE_ASSISTED)
+   if (!vk_device_supports_threaded_submit(queue->base.device))
       return VK_SUCCESS;
 
    const uint32_t wait_count = pPresentInfo->waitSemaphoreCount;
diff --git a/src/vulkan/runtime/vk_semaphore.c 
b/src/vulkan/runtime/vk_semaphore.c
index ee0588b4616..b5295fb12cc 100644
--- a/src/vulkan/runtime/vk_semaphore.c
+++ b/src/vulkan/runtime/vk_semaphore.c
@@ -156,7 +156,7 @@ vk_common_CreateSemaphore(VkDevice _device,
     * operation which is much trickier to assert early.
     */
    if (semaphore_type == VK_SEMAPHORE_TYPE_BINARY &&
-       device->timeline_mode == VK_DEVICE_TIMELINE_MODE_ASSISTED)
+       vk_device_supports_threaded_submit(device))
       assert(sync_type->move);
 
    /* Allocate a vk_semaphore + vk_sync implementation. Because the permanent
@@ -371,7 +371,7 @@ vk_common_SignalSemaphore(VkDevice _device,
    if (unlikely(result != VK_SUCCESS))
       return result;
 
-   if (device->timeline_mode == VK_DEVICE_TIMELINE_MODE_EMULATED) {
+   if (device->submit_mode == VK_QUEUE_SUBMIT_MODE_DEFERRED) {
       result = vk_device_flush(device);
       if (unlikely(result != VK_SUCCESS))
          return result;
@@ -521,7 +521,7 @@ vk_common_GetSemaphoreFdKHR(VkDevice _device,
        * However, thanks to the above bit of spec text, that wait should never
        * block for long.
        */
-      if (device->timeline_mode == VK_DEVICE_TIMELINE_MODE_ASSISTED) {
+      if (vk_device_supports_threaded_submit(device)) {
          result = vk_sync_wait(device, sync, 0,
                                VK_SYNC_WAIT_PENDING,
                                UINT64_MAX);

Reply via email to