summaryrefslogtreecommitdiff
path: root/src/amd/vulkan/radv_wsi.c
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>2020-03-24 17:59:26 +0100
committerMarge Bot <eric+marge@anholt.net>2020-04-27 18:01:24 +0000
commitcbeda7f78e36caa7e4ca775bd848e1c8d38ee5d7 (patch)
treefc1b6b28ae0b5cfd119e7ad5ca01442a71834ac4 /src/amd/vulkan/radv_wsi.c
parent9a61f2a8a9ca17e2d53dded9c1c490c890aa4a74 (diff)
radv: Add WSI buffers to BO list only if they can be used.
Also reverse the BO list removal loop. This way typical WSI usage should find the entry in O(active swapchains) iterations, which should not be a performance issues. Tested with Doom(2106) which found the entry in 1 iteration every time. Acked-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4306>
Diffstat (limited to 'src/amd/vulkan/radv_wsi.c')
-rw-r--r--src/amd/vulkan/radv_wsi.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
index 960b09700bb..d93b263e859 100644
--- a/src/amd/vulkan/radv_wsi.c
+++ b/src/amd/vulkan/radv_wsi.c
@@ -35,15 +35,34 @@ radv_wsi_proc_addr(VkPhysicalDevice physicalDevice, const char *pName)
return radv_lookup_entrypoint(pName);
}
+static void
+radv_wsi_set_memory_ownership(VkDevice _device,
+ VkDeviceMemory _mem,
+ VkBool32 ownership)
+{
+ RADV_FROM_HANDLE(radv_device, device, _device);
+ RADV_FROM_HANDLE(radv_device_memory, mem, _mem);
+
+ if (ownership)
+ radv_bo_list_add(device, mem->bo);
+ else
+ radv_bo_list_remove(device, mem->bo);
+}
+
VkResult
radv_init_wsi(struct radv_physical_device *physical_device)
{
- return wsi_device_init(&physical_device->wsi_device,
- radv_physical_device_to_handle(physical_device),
- radv_wsi_proc_addr,
- &physical_device->instance->alloc,
- physical_device->master_fd,
- &physical_device->instance->dri_options);
+ VkResult result = wsi_device_init(&physical_device->wsi_device,
+ radv_physical_device_to_handle(physical_device),
+ radv_wsi_proc_addr,
+ &physical_device->instance->alloc,
+ physical_device->master_fd,
+ &physical_device->instance->dri_options);
+ if (result != VK_SUCCESS)
+ return result;
+
+ physical_device->wsi_device.set_memory_ownership = radv_wsi_set_memory_ownership;
+ return VK_SUCCESS;
}
void