mesa/src/egl
José Expósito ab4a2e97a9 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>
(cherry picked from commit d913927fe9)
2023-12-20 00:05:03 +00:00
..
drivers egl/wayland: set the correct modifier for the linear_copy image 2023-12-04 21:36:35 +00:00
generate egl: Export the MESA GL Interop functions through eglGetProcAddress 2023-08-19 01:08:30 +00:00
main egl/glx: fallback to software when Zink is forced and fails 2023-12-20 00:05:03 +00:00
wayland meson: work around meson 0.62 issue 2023-12-04 21:36:35 +00:00
.clang-format clang-format: Disable formatting by default 2023-08-13 16:48:49 +02:00
egl-entrypoint-check.py egl: Export the MESA GL Interop functions through eglGetProcAddress 2023-08-19 01:08:30 +00:00
egl-glvnd-symbols.txt egl: add glvnd symbols check 2019-07-10 11:27:51 +00:00
egl-symbols.txt egl/dri2: Implement the new flush method 2022-11-02 18:11:41 +00:00
meson.build meson: support installation tags 2023-09-11 13:00:45 +00:00