mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 14:38:06 +02:00
egl: ensure a render node is passed to _eglFindDevice()
_eglFindDevice() will fail if it's not provided a render node: the EGLDevice list only contains one entry per render node, plus the special software device. Passing a primary node for a display-only device will not work. Signed-off-by: Simon Ser <contact@emersion.fr> Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10142 Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Reviewed-by: Leandro Ribeiro <leandro.ribeiro@collabora.com> Tested-by: Iago Toral Quiroga <itoral@igalia.com> Tested-by: Alejandro Piñeiro <apinheiro@igalia.com> Fixes:2be404f557("egl: error out if we can't find an EGLDevice in _eglFindDevice()") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26205> (cherry picked from commit0f978c3441)
This commit is contained in:
parent
62455a9a25
commit
3db740ff6c
2 changed files with 25 additions and 2 deletions
|
|
@ -84,7 +84,7 @@
|
|||
"description": "egl: ensure a render node is passed to _eglFindDevice()",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "2be404f5571ada32d3b2e9cfe9b769846f27d68f",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -1080,8 +1080,31 @@ dri2_setup_device(_EGLDisplay *disp, EGLBoolean software)
|
|||
{
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
_EGLDevice *dev;
|
||||
int render_fd;
|
||||
|
||||
/* Extensions must be loaded before calling this function */
|
||||
assert(dri2_dpy->mesa);
|
||||
/* If we're not software, we need a DRM node FD */
|
||||
assert(software || dri2_dpy->fd_render_gpu >= 0);
|
||||
|
||||
/* fd_render_gpu is what we got from WSI, so might actually be a lie and
|
||||
* not a render node... */
|
||||
if (software) {
|
||||
render_fd = -1;
|
||||
} else if (loader_is_device_render_capable(dri2_dpy->fd_render_gpu)) {
|
||||
render_fd = dri2_dpy->fd_render_gpu;
|
||||
} else {
|
||||
render_fd = dri2_dpy->mesa->queryCompatibleRenderOnlyDeviceFd(
|
||||
dri2_dpy->fd_render_gpu);
|
||||
if (render_fd < 0)
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
dev = _eglFindDevice(render_fd, software);
|
||||
|
||||
if (render_fd >= 0 && render_fd != dri2_dpy->fd_render_gpu)
|
||||
close(render_fd);
|
||||
|
||||
dev = _eglFindDevice(dri2_dpy->fd_render_gpu, software);
|
||||
if (!dev)
|
||||
return EGL_FALSE;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue