diff options
author | Mike Blumenkrantz <michael.blumenkrantz@gmail.com> | 2024-07-30 12:38:24 -0400 |
---|---|---|
committer | Eric Engestrom <eric@engestrom.ch> | 2024-08-07 12:04:51 +0200 |
commit | 06020b2ad8c9f1a07cee3e0cd453db09bad19277 (patch) | |
tree | 627e8e237d5df5f0a55e67119be102673535c75f /src/gallium | |
parent | 6cd9d0a0d6b266005f5c512231f0866f03dbc862 (diff) |
dril: always take the egl init path
using EGL_DEFAULT_DISPLAY will cover the swrast case, which
fixes generating all the correct configs
Fixes: ec7afd2c24c ("dril: rework config creation")
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30426>
(cherry picked from commit ef88af846761ca9e642f7ed46011db7d3d6b61fd)
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/targets/dril/dril_target.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/src/gallium/targets/dril/dril_target.c b/src/gallium/targets/dril/dril_target.c index 98306c7665d..593a07ef92b 100644 --- a/src/gallium/targets/dril/dril_target.c +++ b/src/gallium/targets/dril/dril_target.c @@ -343,12 +343,15 @@ init_dri2_configs(int fd) EGLBoolean (*peglGetConfigAttrib)(EGLDisplay, EGLConfig, EGLint, EGLint *) = peglGetProcAddress("eglGetConfigAttrib"); const char *(*peglQueryString)(EGLDisplay, EGLint) = peglGetProcAddress("eglQueryString"); - /* try opening GBM for hardware driver info */ - struct gbm_device *gbm = gbm_create_device(fd); - if (!gbm) - goto out; + struct gbm_device *gbm = NULL; + if (fd != -1) { + /* try opening GBM for hardware driver info */ + gbm = gbm_create_device(fd); + if (!gbm) + goto out; + } - EGLDisplay dpy = peglGetPlatformDisplayEXT(EGL_PLATFORM_GBM_MESA, gbm, NULL); + EGLDisplay dpy = peglGetPlatformDisplayEXT(EGL_PLATFORM_GBM_MESA, gbm ? gbm : EGL_DEFAULT_DISPLAY, NULL); if (!dpy) goto out_gbm; int maj, min; @@ -415,7 +418,8 @@ out_egl: peglTerminate(dpy); out_gbm: - gbm_device_destroy(gbm); + if (gbm) + gbm_device_destroy(gbm); out: dlclose(egl); if (c) @@ -430,19 +434,9 @@ drilCreateNewScreen(int scrn, int fd, const __DRIextension **driver_extensions, const __DRIconfig ***driver_configs, void *data) { - /* multiply for possible 1/2/4/8/16/32 MSAA configs */ - // allocate an array of pointers - const __DRIconfig **configs = NULL; - /* try dri2 if fd is valid */ - if (fd >= 0) - configs = init_dri2_configs(fd); - if (!configs) { - configs = calloc(ARRAY_SIZE(drilConfigs) + 1, sizeof(void *)); - // otherwise set configs to point to our config list - for (int i = 0; i < ARRAY_SIZE(drilConfigs); i++) { - configs[i] = mem_dup(&drilConfigs[i], sizeof(drilConfigs[i])); - } - } + const __DRIconfig **configs = init_dri2_configs(fd); + if (!configs) + return NULL; // outpointer it *driver_configs = configs; |