egl,egl/x11: keep display fd open for prime
Keep the display fd open for creating DRI screen on display gpu in case of prime. Also close the fd opened in dri2_display_destroy() 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:

committed by
Marge Bot

parent
4e6e30215d
commit
b8da022da4
@@ -1127,6 +1127,8 @@ dri2_display_destroy(_EGLDisplay *disp)
|
||||
}
|
||||
if (dri2_dpy->fd >= 0)
|
||||
close(dri2_dpy->fd);
|
||||
if (dri2_dpy->fd_display_gpu >= 0)
|
||||
close(dri2_dpy->fd_display_gpu);
|
||||
|
||||
/* Don't dlclose the driver when building with the address sanitizer, so you
|
||||
* get good symbols from the leak reports.
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <xcb/xcb.h>
|
||||
#include <xcb/dri3.h>
|
||||
@@ -633,7 +634,12 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy)
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
dri2_dpy->driver_name = loader_get_driver_for_fd(dri2_dpy->fd);
|
||||
if (!dri2_dpy->driver_name) {
|
||||
|
Reference in New Issue
Block a user