Mesa (master): egl: fix software flag in _eglAddDevice call on DRM
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Mar 26 11:15:43 UTC 2021
Module: Mesa
Branch: master
Commit: 08a51770bd1b39262003a14850d416df04d13ac7
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=08a51770bd1b39262003a14850d416df04d13ac7
Author: Simon Ser <contact at emersion.fr>
Date: Thu Mar 18 21:48:44 2021 +0100
egl: fix software flag in _eglAddDevice call on DRM
On the EGL DRM platform, call _eglAddDevice with the software flag
set if GBM has loaded a software driver. This allows _eglAddDevice
to make the difference between llvmpipe and kmsro.
This is important on split render/display SoCs: we don't want to
advertise EGL_MESA_device_software on these systems.
Completely drop disp->Options.ForceSoftware, because GBM is
responsible for choosing software rendering and doesn't take this
hint into account.
Signed-off-by: Simon Ser <contact at emersion.fr>
Fixes: 5743a36b2b32 ("egl: Don't add hardware device if there is no render node v2.")
References: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4178
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9697>
---
src/egl/drivers/dri2/platform_drm.c | 2 +-
src/gbm/backends/dri/gbm_dri.c | 7 +++++--
src/gbm/backends/dri/gbm_driint.h | 1 +
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index 2944a5d7ad4..8b392f3e788 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -718,7 +718,7 @@ dri2_initialize_drm(_EGLDisplay *disp)
goto cleanup;
}
- dev = _eglAddDevice(dri2_dpy->fd, disp->Options.ForceSoftware);
+ dev = _eglAddDevice(dri2_dpy->fd, dri2_dpy->gbm_dri->software);
if (!dev) {
err = "DRI2: failed to find EGLDevice";
goto cleanup;
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index ac579ef7804..751b2e56497 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -486,10 +486,13 @@ dri_screen_create_sw(struct gbm_dri_device *dri)
return -errno;
ret = dri_screen_create_dri2(dri, driver_name);
- if (ret == 0)
+ if (ret != 0)
+ ret = dri_screen_create_swrast(dri);
+ if (ret != 0)
return ret;
- return dri_screen_create_swrast(dri);
+ dri->software = true;
+ return 0;
}
static const struct gbm_dri_visual gbm_dri_visuals_table[] = {
diff --git a/src/gbm/backends/dri/gbm_driint.h b/src/gbm/backends/dri/gbm_driint.h
index a8bfa39e522..d321fe2be07 100644
--- a/src/gbm/backends/dri/gbm_driint.h
+++ b/src/gbm/backends/dri/gbm_driint.h
@@ -63,6 +63,7 @@ struct gbm_dri_device {
void *driver;
char *driver_name; /* Name of the DRI module, without the _dri suffix */
+ bool software; /* A software driver was loaded */
__DRIscreen *screen;
__DRIcontext *context;
More information about the mesa-commit
mailing list