From 6659b299e6b0969984be928b2387417a9031f55c Mon Sep 17 00:00:00 2001 From: Erico Nunes Date: Wed, 2 Oct 2024 16:00:02 +0200 Subject: [PATCH] v3dv: match render and display device for wsi present Since the last changes for EGL_EXT_device_drm_render_node, the can_present_on_device callback now may receive the render device. With that, the v3dv implementation may return that this device cannot be used for presentation. In particular, this callback is used for x11 wsi, and when through XWayland it does now get the render device. On x11 wsi, this makes the swapchain operate on blit mode. The blit mode introduces additional unneeded overhead on wsi and runs through a different path which currently causes rendering issues (in particular also with Zink). Allowing both devices to match in the callback returns all wsi to operate on the native mode and fixes the issues above. Signed-off-by: Erico Nunes Reviewed-by: Iago Toral Quiroga Part-of: --- src/broadcom/vulkan/v3dv_wsi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/broadcom/vulkan/v3dv_wsi.c b/src/broadcom/vulkan/v3dv_wsi.c index 78af39448ce..5e09eebd189 100644 --- a/src/broadcom/vulkan/v3dv_wsi.c +++ b/src/broadcom/vulkan/v3dv_wsi.c @@ -41,7 +41,15 @@ v3dv_wsi_can_present_on_device(VkPhysicalDevice _pdevice, int fd) { V3DV_FROM_HANDLE(v3dv_physical_device, pdevice, _pdevice); assert(pdevice->display_fd != -1); - return wsi_common_drm_devices_equal(fd, pdevice->display_fd); + assert(pdevice->render_fd != -1); + + /* v3dv handles presentation by allocating wsi buffers in the display + * device, so both render and display devices can match here. + * In particular, this callback receives the render device when + * running in an XWayland environment. + */ + return wsi_common_drm_devices_equal(fd, pdevice->display_fd) || + wsi_common_drm_devices_equal(fd, pdevice->render_fd); }