Mesa (main): venus: add VN_PERF option no_async_queue_submit

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 26 23:56:20 UTC 2022


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

Author: Yiwei Zhang <zzyiwei at chromium.org>
Date:   Fri Apr 22 22:06:23 2022 +0000

venus: add VN_PERF option no_async_queue_submit

Signed-off-by: Yiwei Zhang <zzyiwei at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16110>

---

 src/virtio/vulkan/vn_android.c | 6 ++++--
 src/virtio/vulkan/vn_common.c  | 1 +
 src/virtio/vulkan/vn_common.h  | 1 +
 src/virtio/vulkan/vn_queue.c   | 2 +-
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/virtio/vulkan/vn_android.c b/src/virtio/vulkan/vn_android.c
index 493600917bc..45dc7c8c501 100644
--- a/src/virtio/vulkan/vn_android.c
+++ b/src/virtio/vulkan/vn_android.c
@@ -787,11 +787,13 @@ vn_QueueSignalReleaseImageANDROID(VkQueue queue,
       return vn_error(dev->instance, result);
 
    if (dev->instance->experimental.globalFencing == VK_TRUE) {
-      /* XXX With globalFencing, the external queue fence was not passed in the
+      /* With globalFencing, the external queue fence was not passed in the
        * above vn_QueueSubmit to hint it to be synchronous. So we need to wait
        * for the ring here before vn_GetFenceFdKHR which is pure kernel ops.
+       * Skip ring wait if async queue submit is disabled.
        */
-      vn_instance_ring_wait(dev->instance);
+      if (!VN_PERF(NO_ASYNC_QUEUE_SUBMIT))
+         vn_instance_ring_wait(dev->instance);
 
       const VkFenceGetFdInfoKHR fd_info = {
          .sType = VK_STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR,
diff --git a/src/virtio/vulkan/vn_common.c b/src/virtio/vulkan/vn_common.c
index 24365c0032c..e39c5fa9fba 100644
--- a/src/virtio/vulkan/vn_common.c
+++ b/src/virtio/vulkan/vn_common.c
@@ -30,6 +30,7 @@ static const struct debug_control vn_debug_options[] = {
 static const struct debug_control vn_perf_options[] = {
    { "no_async_set_alloc", VN_PERF_NO_ASYNC_SET_ALLOC },
    { "no_async_buffer_create", VN_PERF_NO_ASYNC_BUFFER_CREATE },
+   { "no_async_queue_submit", VN_PERF_NO_ASYNC_QUEUE_SUBMIT },
    { NULL, 0 },
 };
 
diff --git a/src/virtio/vulkan/vn_common.h b/src/virtio/vulkan/vn_common.h
index 7fbfafb9600..19831c6d2a9 100644
--- a/src/virtio/vulkan/vn_common.h
+++ b/src/virtio/vulkan/vn_common.h
@@ -145,6 +145,7 @@ enum vn_debug {
 enum vn_perf {
    VN_PERF_NO_ASYNC_SET_ALLOC = 1ull << 0,
    VN_PERF_NO_ASYNC_BUFFER_CREATE = 1ull << 1,
+   VN_PERF_NO_ASYNC_QUEUE_SUBMIT = 1ull << 2,
 };
 
 typedef uint64_t vn_object_id;
diff --git a/src/virtio/vulkan/vn_queue.c b/src/virtio/vulkan/vn_queue.c
index 490955eebac..006ccc3e6a0 100644
--- a/src/virtio/vulkan/vn_queue.c
+++ b/src/virtio/vulkan/vn_queue.c
@@ -341,7 +341,7 @@ vn_QueueSubmit(VkQueue _queue,
    }
 
    /* TODO defer roundtrip for external fence until the next sync operation */
-   if (!wsi_mem && !is_fence_external) {
+   if (!wsi_mem && !is_fence_external && !VN_PERF(NO_ASYNC_QUEUE_SUBMIT)) {
       vn_async_vkQueueSubmit(dev->instance, submit.queue, submit.batch_count,
                              submit.submit_batches, submit.fence);
       vn_queue_submission_cleanup(&submit);



More information about the mesa-commit mailing list