mesa/src/egl/main
José Expósito d913927fe9 egl/glx: fallback to software when Zink is forced and fails
When `MESA_LOADER_DRIVER_OVERRIDE` is set to `zink` and the display
initialization fails, fallback to software rendering.

The error was reported in #10123 and it can be reproduced with:

    $ MESA_LOADER_DRIVER_OVERRIDE=zink eglinfo

`eglinfo` would crash in `dri2_display_release()` because of
`assert(dri2_dpy->ref_count > 0)`.

After bisecting the error to commit 8cd44b8843 ("egl/glx: add
autoloading for zink"), I found out that, before this change, the
display was set to initialized even when `_eglDriver.Initialize(disp)`
failed:

    disp->Options.Zink = env && !strcmp(env, "zink");
    // disp->Options.Zink is true

    if (!_eglDriver.Initialize(disp)) {
       [...]
       // Zink initialization has failed at this point
       // However, success is set to true:
       bool success = disp->Options.Zink;
       if (!disp->Options.Zink && !getenv("GALLIUM_DRIVER")) {
          [...]
       }
       // Software initialization is ignored because success is true
       if (!success) {
          [...]
       }
    }

    // The display is set as initialized even though it shouldn't
    disp->Initialized = EGL_TRUE;

Resolves: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10123
Fixes: 8cd44b8843 ("egl/glx: add autoloading for zink")
Signed-off-by: José Expósito <jexposit@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26184>
2023-12-19 11:59:49 +00:00
..
50_mesa.json meson: Make the glvnd vendor name configurable 2020-12-03 22:36:27 +00:00
egl.def.in egl/dri2: Implement the new flush method 2022-11-02 18:11:41 +00:00
eglapi.c egl/glx: fallback to software when Zink is forced and fails 2023-12-19 11:59:49 +00:00
eglarray.c egl: re-format using clang-format 2023-07-07 23:00:06 +00:00
eglarray.h egl: re-format using clang-format 2023-07-07 23:00:06 +00:00
eglconfig.c egl: fixup _eglFilterConfigArray() params and drop _eglFallbackMatch() wrapper 2023-08-07 19:58:30 +00:00
eglconfig.h egl: make _eglFilterConfigArray static 2023-08-07 19:58:30 +00:00
eglconfigdebug.c egl: re-format using clang-format 2023-07-07 23:00:06 +00:00
eglconfigdebug.h egl: re-format using clang-format 2023-07-07 23:00:06 +00:00
eglcontext.c egl: re-format using clang-format 2023-07-07 23:00:06 +00:00
eglcontext.h egl: re-format using clang-format 2023-07-07 23:00:06 +00:00
eglcurrent.c egl: re-format using clang-format 2023-07-07 23:00:06 +00:00
eglcurrent.h egl: re-format using clang-format 2023-07-07 23:00:06 +00:00
egldefines.h egl: bump extension string length 2023-08-18 23:37:36 +00:00
egldevice.c egl: fix leaking drmDevicePtr in _eglFindDevice 2023-10-25 12:37:30 +00:00
egldevice.h egl: Rename _eglAddDevice() to _eglFindDevice() 2023-07-17 22:27:01 +00:00
egldispatchstubs.c egl: re-format using clang-format 2023-07-07 23:00:06 +00:00
egldispatchstubs.h egl: re-format using clang-format 2023-07-07 23:00:06 +00:00
egldisplay.c egl/surfaceless: Fix EGL_DEVICE_EXT implementation 2023-12-13 23:15:17 +00:00
egldisplay.h egl: Add _eglHasAttrib() function 2023-12-13 23:15:17 +00:00
egldriver.h mesa/st, dri2, wgl, glx: Restore flush_objects interop backward compat 2023-11-21 23:15:32 +00:00
eglentrypoint.h egl: Export the MESA GL Interop functions through eglGetProcAddress 2023-08-19 01:08:30 +00:00
eglglobals.c egl: Implement EGL_EXT_explicit_device 2023-07-28 18:00:34 +00:00
eglglobals.h egl: re-format using clang-format 2023-07-07 23:00:06 +00:00
eglglvnd.c egl: re-format using clang-format 2023-07-07 23:00:06 +00:00
eglimage.c egl: re-format using clang-format 2023-07-07 23:00:06 +00:00
eglimage.h egl: re-format using clang-format 2023-07-07 23:00:06 +00:00
egllog.c egl: re-format using clang-format 2023-07-07 23:00:06 +00:00
egllog.h egl: re-format using clang-format 2023-07-07 23:00:06 +00:00
eglsurface.c egl: reenable partial redraw with a warning when using gallium hud 2023-08-15 08:18:52 +00:00
eglsurface.h egl: re-format using clang-format 2023-07-07 23:00:06 +00:00
eglsync.c egl: re-format using clang-format 2023-07-07 23:00:06 +00:00
eglsync.h egl: re-format using clang-format 2023-07-07 23:00:06 +00:00
egltypedefs.h egl: re-format using clang-format 2023-07-07 23:00:06 +00:00