Mesa (master): v3dv: implement wsi hook to decide if we can present directly on device
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Apr 27 06:50:29 UTC 2021
Module: Mesa
Branch: master
Commit: d636c5660cd6b9a7c11a795070797be9463d8202
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d636c5660cd6b9a7c11a795070797be9463d8202
Author: Iago Toral Quiroga <itoral at igalia.com>
Date: Mon Apr 26 08:13:53 2021 +0200
v3dv: implement wsi hook to decide if we can present directly on device
This will prevent the driver to take the prime blit path for presentation
in scenarios where it can avoid it, which can substantially improve
performance, particularly at high resolutions.
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5917>
---
src/broadcom/vulkan/v3dv_wsi.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/src/broadcom/vulkan/v3dv_wsi.c b/src/broadcom/vulkan/v3dv_wsi.c
index 25bb4636aa1..97616985214 100644
--- a/src/broadcom/vulkan/v3dv_wsi.c
+++ b/src/broadcom/vulkan/v3dv_wsi.c
@@ -46,6 +46,31 @@ v3dv_wsi_proc_addr(VkPhysicalDevice physicalDevice, const char *pName)
return vk_device_dispatch_table_get(&vk_device_trampolines, pName);
}
+static bool
+v3dv_wsi_can_present_on_device(VkPhysicalDevice _pdevice, int fd)
+{
+ V3DV_FROM_HANDLE(v3dv_physical_device, pdevice, _pdevice);
+
+ drmDevicePtr fd_devinfo, display_devinfo;
+ int ret;
+
+ ret = drmGetDevice2(fd, 0, &fd_devinfo);
+ if (ret)
+ return false;
+
+ ret = drmGetDevice2(pdevice->display_fd, 0, &display_devinfo);
+ if (ret) {
+ drmFreeDevice(&fd_devinfo);
+ return false;
+ }
+
+ bool result = drmDevicesEqual(fd_devinfo, display_devinfo);
+
+ drmFreeDevice(&fd_devinfo);
+ drmFreeDevice(&display_devinfo);
+ return result;
+}
+
VkResult
v3dv_wsi_init(struct v3dv_physical_device *physical_device)
{
@@ -61,6 +86,8 @@ v3dv_wsi_init(struct v3dv_physical_device *physical_device)
return result;
physical_device->wsi_device.supports_modifiers = true;
+ physical_device->wsi_device.can_present_on_device =
+ v3dv_wsi_can_present_on_device;
return VK_SUCCESS;
}
More information about the mesa-commit
mailing list