Mesa (main): venus: add NO_FENCE_FEEDBACK perf option and disable sparse resource
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jun 16 19:06:12 UTC 2022
Module: Mesa
Branch: main
Commit: 1a7632e54b428d4f443909e5574d58f6cc8c8e53
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1a7632e54b428d4f443909e5574d58f6cc8c8e53
Author: Yiwei Zhang <zzyiwei at chromium.org>
Date: Tue May 24 05:25:03 2022 +0000
venus: add NO_FENCE_FEEDBACK perf option and disable sparse resource
Signed-off-by: Yiwei Zhang <zzyiwei at chromium.org>
Reviewed-by: Ryan Neph <ryanneph at google.com>
Reviewed-by: Chad Versace <chadversary at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16731>
---
src/virtio/vulkan/vn_common.c | 1 +
src/virtio/vulkan/vn_common.h | 1 +
src/virtio/vulkan/vn_physical_device.c | 31 +++++++++++++++++++++++++++++++
src/virtio/vulkan/vn_queue.c | 3 +++
4 files changed, 36 insertions(+)
diff --git a/src/virtio/vulkan/vn_common.c b/src/virtio/vulkan/vn_common.c
index ec48f72a2a0..9977160101d 100644
--- a/src/virtio/vulkan/vn_common.c
+++ b/src/virtio/vulkan/vn_common.c
@@ -35,6 +35,7 @@ static const struct debug_control vn_perf_options[] = {
{ "no_async_buffer_create", VN_PERF_NO_ASYNC_BUFFER_CREATE },
{ "no_async_queue_submit", VN_PERF_NO_ASYNC_QUEUE_SUBMIT },
{ "no_event_feedback", VN_PERF_NO_EVENT_FEEDBACK },
+ { "no_fence_feedback", VN_PERF_NO_FENCE_FEEDBACK },
{ NULL, 0 },
};
diff --git a/src/virtio/vulkan/vn_common.h b/src/virtio/vulkan/vn_common.h
index 47505e7e805..d8a68721697 100644
--- a/src/virtio/vulkan/vn_common.h
+++ b/src/virtio/vulkan/vn_common.h
@@ -147,6 +147,7 @@ enum vn_perf {
VN_PERF_NO_ASYNC_BUFFER_CREATE = 1ull << 1,
VN_PERF_NO_ASYNC_QUEUE_SUBMIT = 1ull << 2,
VN_PERF_NO_EVENT_FEEDBACK = 1ull << 3,
+ VN_PERF_NO_FENCE_FEEDBACK = 1ull << 4,
};
typedef uint64_t vn_object_id;
diff --git a/src/virtio/vulkan/vn_physical_device.c b/src/virtio/vulkan/vn_physical_device.c
index 1ba46ad9664..5fa1a3ee47e 100644
--- a/src/virtio/vulkan/vn_physical_device.c
+++ b/src/virtio/vulkan/vn_physical_device.c
@@ -164,6 +164,30 @@ vn_physical_device_init_features(struct vn_physical_device *physical_dev)
feats->vulkan_1_0 = features2.features;
+ /* TODO allow sparse resource along with sync feedback
+ *
+ * vkQueueBindSparse relies on explicit sync primitives. To intercept the
+ * timeline semaphores within each bind info to write the feedback buffer,
+ * we have to split the call into bindInfoCount number of calls while
+ * inserting vkQueueSubmit to wait on the signal timeline semaphores before
+ * filling the feedback buffer. To intercept the fence to be signaled, we
+ * have to relocate the fence to another vkQueueSubmit call and potentially
+ * have to use an internal timeline semaphore to synchronize between them.
+ * Those would make the code overly complex, so we disable sparse binding
+ * for simplicity.
+ */
+ if (!VN_PERF(NO_FENCE_FEEDBACK)) {
+ feats->vulkan_1_0.sparseBinding = false;
+ feats->vulkan_1_0.sparseResidencyBuffer = false;
+ feats->vulkan_1_0.sparseResidencyImage2D = false;
+ feats->vulkan_1_0.sparseResidencyImage3D = false;
+ feats->vulkan_1_0.sparseResidency2Samples = false;
+ feats->vulkan_1_0.sparseResidency4Samples = false;
+ feats->vulkan_1_0.sparseResidency8Samples = false;
+ feats->vulkan_1_0.sparseResidency16Samples = false;
+ feats->vulkan_1_0.sparseResidencyAliased = false;
+ }
+
struct VkPhysicalDeviceVulkan11Features *vk11_feats = &feats->vulkan_1_1;
struct VkPhysicalDeviceVulkan12Features *vk12_feats = &feats->vulkan_1_2;
@@ -466,6 +490,13 @@ vn_physical_device_init_properties(struct vn_physical_device *physical_dev)
props->vulkan_1_0 = properties2.properties;
+ /* TODO allow sparse resource along with sync feedback */
+ if (!VN_PERF(NO_FENCE_FEEDBACK)) {
+ props->vulkan_1_0.limits.sparseAddressSpaceSize = 0;
+ props->vulkan_1_0.sparseProperties =
+ (VkPhysicalDeviceSparseProperties){ 0 };
+ }
+
struct VkPhysicalDeviceProperties *vk10_props = &props->vulkan_1_0;
struct VkPhysicalDeviceVulkan11Properties *vk11_props = &props->vulkan_1_1;
struct VkPhysicalDeviceVulkan12Properties *vk12_props = &props->vulkan_1_2;
diff --git a/src/virtio/vulkan/vn_queue.c b/src/virtio/vulkan/vn_queue.c
index 37f8ebe1f71..e50d28b2eaf 100644
--- a/src/virtio/vulkan/vn_queue.c
+++ b/src/virtio/vulkan/vn_queue.c
@@ -392,6 +392,9 @@ vn_QueueBindSparse(VkQueue _queue,
struct vn_queue *queue = vn_queue_from_handle(_queue);
struct vn_device *dev = queue->device;
+ /* TODO allow sparse resource along with sync feedback */
+ assert(VN_PERF(NO_FENCE_FEEDBACK));
+
struct vn_queue_submission submit;
VkResult result = vn_queue_submission_prepare_bind_sparse(
&submit, _queue, bindInfoCount, pBindInfo, fence);
More information about the mesa-commit
mailing list