vulkan/wsi/wayland: improve same gpu detection

Some compositor like KWin do not return the render node.

v2: Make sure we test if only drm_info.hasPrimary is true (Jason)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: db42ed1e04 ("vulkan/wsi/wl: correctly find whether the compositor uses the same GPU")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8139
Reviewed-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20914>
This commit is contained in:
Lionel Landwerlin 2023-01-25 20:16:23 +02:00 committed by Marge Bot
parent 56e758d9e9
commit e27d217fb1

View file

@ -843,10 +843,18 @@ wsi_wl_display_init(struct wsi_wayland *wsi_wl,
/* Round-trip again to fetch dma-buf feedback */
wl_display_roundtrip_queue(display->wl_display, display->queue);
if (wsi_wl->wsi->drm_info.hasRender) {
if (wsi_wl->wsi->drm_info.hasRender ||
wsi_wl->wsi->drm_info.hasPrimary) {
/* Apparently some wayland compositor do not send the render
* device node but the primary, so test against both.
*/
display->same_gpu =
major(display->main_device) == wsi_wl->wsi->drm_info.renderMajor &&
minor(display->main_device) == wsi_wl->wsi->drm_info.renderMinor;
(wsi_wl->wsi->drm_info.hasRender &&
major(display->main_device) == wsi_wl->wsi->drm_info.renderMajor &&
minor(display->main_device) == wsi_wl->wsi->drm_info.renderMinor) ||
(wsi_wl->wsi->drm_info.hasPrimary &&
major(display->main_device) == wsi_wl->wsi->drm_info.primaryMajor &&
minor(display->main_device) == wsi_wl->wsi->drm_info.primaryMinor);
}
}