wayland/dma-buf: Don't warn if there was no render node

When running in KVM, the EGL driver supports querying the render node
path, but it returns NULL. Handle that better by falling back to
querying the device main device file, instead of falling back on v3 of
the protocol and logging a warning.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2151>
This commit is contained in:
Jonas Ådahl 2022-01-12 12:11:01 +01:00 committed by Marge Bot
parent 719a6c0006
commit a2382f3251

View File

@ -1424,29 +1424,34 @@ meta_wayland_dma_buf_manager_new (MetaWaylandCompositor *compositor,
device_path = meta_egl_query_device_string (egl, egl_device, device_path = meta_egl_query_device_string (egl, egl_device,
EGL_DRM_RENDER_NODE_FILE_EXT, EGL_DRM_RENDER_NODE_FILE_EXT,
&local_error); &local_error);
if (local_error)
{
g_warning ("Failed to query EGL render node path: %s",
local_error->message);
g_clear_error (&local_error);
}
} }
else if (meta_egl_egl_device_has_extensions (egl, egl_device, NULL,
"EGL_EXT_device_drm", if (!device_path &&
NULL)) meta_egl_egl_device_has_extensions (egl, egl_device, NULL,
"EGL_EXT_device_drm",
NULL))
{ {
device_path = meta_egl_query_device_string (egl, egl_device, device_path = meta_egl_query_device_string (egl, egl_device,
EGL_DRM_DEVICE_FILE_EXT, EGL_DRM_DEVICE_FILE_EXT,
&local_error); &local_error);
} if (local_error)
else {
{ g_warning ("Failed to query EGL render node path: %s",
meta_topic (META_DEBUG_WAYLAND, local_error->message);
"Only advertising zwp_linux_dmabuf_v1 interface version 3 " }
"support, missing 'EGL_EXT_device_drm' and "
"'EGL_EXT_device_drm_render_node'");
protocol_version = 3;
goto initialize;
} }
if (!device_path) if (!device_path)
{ {
g_warning ("Failed to query EGL device path: %s", meta_topic (META_DEBUG_WAYLAND,
local_error->message); "Only advertising zwp_linux_dmabuf_v1 interface version 3 "
"support, no suitable device path could be found");
protocol_version = 3; protocol_version = 3;
goto initialize; goto initialize;
} }