egl/wayland: keep display fd open for prime

Keep the display fd open for creating DRI screen on display gpu in
case of prime.

Signed-off-by: Yogesh Mohanmarimuthu <yogesh.mohanmarimuthu@amd.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13422>
This commit is contained in:
Yogesh Mohanmarimuthu 2021-11-22 18:45:18 +05:30 committed by Marge Bot
parent 94946251d0
commit 57b22f99a9

View file

@ -2165,8 +2165,14 @@ dri2_initialize_wayland_drm(_EGLDisplay *disp)
goto cleanup;
}
dri2_dpy->fd_display_gpu = fcntl(dri2_dpy->fd, F_DUPFD_CLOEXEC, 3);
dri2_dpy->fd = loader_get_user_preferred_fd(dri2_dpy->fd,
&dri2_dpy->is_different_gpu);
if (!dri2_dpy->is_different_gpu) {
close(dri2_dpy->fd_display_gpu);
dri2_dpy->fd_display_gpu = -1;
}
dev = _eglAddDevice(dri2_dpy->fd, false);
if (!dev) {
_eglError(EGL_NOT_INITIALIZED, "DRI2: failed to find EGLDevice");