From 7daedd2a305469eacecea892998d5ec88d1e6496 Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Tue, 11 Oct 2022 19:00:46 -0700 Subject: [PATCH] venus: Add vn_queue_wait_idle_before_present() Trivial refactor. Signed-off-by: Chad Versace Reviewed-by: Yiwei Zhang Reviewed-by: Ryan Neph Part-of: --- src/virtio/vulkan/vn_queue.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/virtio/vulkan/vn_queue.c b/src/virtio/vulkan/vn_queue.c index 1f102c78323..2844863fba7 100644 --- a/src/virtio/vulkan/vn_queue.c +++ b/src/virtio/vulkan/vn_queue.c @@ -441,6 +441,21 @@ vn_queue_submit(struct vn_instance *instance, return VK_SUCCESS; } +static void +vn_queue_wait_idle_before_present(struct vn_queue *queue) +{ + struct vn_instance *instance = queue->device->instance; + VkQueue queue_h = vn_queue_to_handle(queue); + + if (VN_DEBUG(WSI)) { + static uint32_t ratelimit = 0; + if (ratelimit++ < 10) + vn_log(instance, "forcing vkQueueWaitIdle before presenting"); + } + + vn_QueueWaitIdle(queue_h); +} + VkResult vn_QueueSubmit(VkQueue queue_h, uint32_t submitCount, @@ -501,16 +516,7 @@ vn_QueueSubmit(VkQueue queue_h, .bo_count = 1, }); } else { - if (VN_DEBUG(WSI)) { - static uint32_t ratelimit; - if (ratelimit < 10) { - vn_log(dev->instance, - "forcing vkQueueWaitIdle before presenting"); - ratelimit++; - } - } - - vn_QueueWaitIdle(submit.queue); + vn_queue_wait_idle_before_present(queue); } }