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@emersion.fr>
Fixes: 5743a36b2b ("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>
This commit is contained in:
Simon Ser 2021-03-18 21:48:44 +01:00 committed by Marge Bot
parent 6298347ec7
commit 08a51770bd
3 changed files with 7 additions and 3 deletions

View File

@ -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;

View File

@ -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[] = {

View File

@ -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;