venus: add NO_FENCE_FEEDBACK perf option and disable sparse resource

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16731>
This commit is contained in:
Yiwei Zhang 2022-05-24 05:25:03 +00:00 committed by Marge Bot
parent 942ec179f3
commit 1a7632e54b
4 changed files with 36 additions and 0 deletions

View File

@ -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 },
};

View File

@ -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;

View File

@ -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;

View File

@ -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);