Mesa (main): venus: add env perf options and introduce no_async_set_alloc

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


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

Author: Yiwei Zhang <zzyiwei at chromium.org>
Date:   Fri Apr 22 21:37:27 2022 +0000

venus: add env perf options and introduce no_async_set_alloc

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

---

 src/virtio/vulkan/vn_common.c         | 7 +++++++
 src/virtio/vulkan/vn_common.h         | 6 ++++++
 src/virtio/vulkan/vn_descriptor_set.c | 6 ++++--
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/virtio/vulkan/vn_common.c b/src/virtio/vulkan/vn_common.c
index 1c23cbb87f3..59792f42950 100644
--- a/src/virtio/vulkan/vn_common.c
+++ b/src/virtio/vulkan/vn_common.c
@@ -27,6 +27,11 @@ static const struct debug_control vn_debug_options[] = {
    { NULL, 0 },
 };
 
+static const struct debug_control vn_perf_options[] = {
+   { "no_async_set_alloc", VN_PERF_NO_ASYNC_SET_ALLOC },
+   { NULL, 0 },
+};
+
 struct vn_env vn_env;
 
 static void
@@ -34,6 +39,8 @@ vn_env_init_once(void)
 {
    vn_env.debug =
       parse_debug_string(os_get_option("VN_DEBUG"), vn_debug_options);
+   vn_env.perf =
+      parse_debug_string(os_get_option("VN_PERF"), vn_perf_options);
 }
 
 void
diff --git a/src/virtio/vulkan/vn_common.h b/src/virtio/vulkan/vn_common.h
index 00c5d215f1e..39e64880aa3 100644
--- a/src/virtio/vulkan/vn_common.h
+++ b/src/virtio/vulkan/vn_common.h
@@ -45,6 +45,7 @@
 #define VN_DEFAULT_ALIGN 8
 
 #define VN_DEBUG(category) (unlikely(vn_env.debug & VN_DEBUG_##category))
+#define VN_PERF(category) (unlikely(vn_env.perf & VN_PERF_##category))
 
 #define vn_error(instance, error)                                            \
    (VN_DEBUG(RESULT) ? vn_log_result((instance), (error), __func__) : (error))
@@ -141,6 +142,10 @@ enum vn_debug {
    VN_DEBUG_NO_ABORT = 1ull << 4,
 };
 
+enum vn_perf {
+   VN_PERF_NO_ASYNC_SET_ALLOC = 1ull << 0,
+};
+
 typedef uint64_t vn_object_id;
 
 /* base class of vn_instance */
@@ -173,6 +178,7 @@ struct vn_refcount {
 
 struct vn_env {
    uint64_t debug;
+   uint64_t perf;
 };
 extern struct vn_env vn_env;
 
diff --git a/src/virtio/vulkan/vn_descriptor_set.c b/src/virtio/vulkan/vn_descriptor_set.c
index a2a692ae1a7..0c428b57ce6 100644
--- a/src/virtio/vulkan/vn_descriptor_set.c
+++ b/src/virtio/vulkan/vn_descriptor_set.c
@@ -259,8 +259,10 @@ vn_CreateDescriptorPool(VkDevice device,
     * allocation must not fail due to a fragmented pool per spec. In this
     * case, set allocation can be asynchronous with pool resource tracking.
     */
-   pool->async_set_allocation = !(
-      pCreateInfo->flags & VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT);
+   pool->async_set_allocation =
+      !VN_PERF(NO_ASYNC_SET_ALLOC) &&
+      !(pCreateInfo->flags &
+        VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT);
 
    pool->max.set_count = pCreateInfo->maxSets;
 



More information about the mesa-commit mailing list