egl: use render node for wl_drm if available
This causes clients to use the render node and skip DRM authentication if a DRM render node is available. Signed-off-by: Simon Ser <contact@emersion.fr> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9334>
This commit is contained in:
parent
fb1100d718
commit
71e8141503
|
@ -3242,11 +3242,18 @@ dri2_bind_wayland_display_wl(_EGLDisplay *disp, struct wl_display *wl_dpy)
|
|||
.is_format_supported = dri2_wl_is_format_supported
|
||||
};
|
||||
int flags = 0;
|
||||
char *device_name;
|
||||
uint64_t cap;
|
||||
|
||||
if (dri2_dpy->wl_server_drm)
|
||||
return EGL_FALSE;
|
||||
|
||||
device_name = drmGetRenderDeviceNameFromFd(dri2_dpy->fd);
|
||||
if (!device_name)
|
||||
device_name = strdup(dri2_dpy->device_name);
|
||||
if (!device_name)
|
||||
return EGL_FALSE;
|
||||
|
||||
if (drmGetCap(dri2_dpy->fd, DRM_CAP_PRIME, &cap) == 0 &&
|
||||
cap == (DRM_PRIME_CAP_IMPORT | DRM_PRIME_CAP_EXPORT) &&
|
||||
dri2_dpy->image->base.version >= 7 &&
|
||||
|
@ -3254,9 +3261,11 @@ dri2_bind_wayland_display_wl(_EGLDisplay *disp, struct wl_display *wl_dpy)
|
|||
flags |= WAYLAND_DRM_PRIME;
|
||||
|
||||
dri2_dpy->wl_server_drm =
|
||||
wayland_drm_init(wl_dpy, dri2_dpy->device_name,
|
||||
wayland_drm_init(wl_dpy, device_name,
|
||||
&wl_drm_callbacks, disp, flags);
|
||||
|
||||
free(device_name);
|
||||
|
||||
if (!dri2_dpy->wl_server_drm)
|
||||
return EGL_FALSE;
|
||||
|
||||
|
|
Loading…
Reference in New Issue