mesa/src/egl
Luigi Santivetti 2907faee7a egl/dri2: try to bind old context if bindContext failed
This change mostly touches error handling code paths, where a
bug was found when the DRI driver failed to bind a new DRI
context. Specifically, the reason for it to fail was the window
system unable (for whatever reason) to provide the DRI drawable
with a buffer. In this instance, Mesa un-does the EGL bindings,
but doesn't restore the old DRI context, hence remaining in a
funny state. It's worth mentioning that despite trying, there
is no guarantee that the old DRI context can be restored,
depending on the runtime.

Before this change, if bindContext() failed then
dri2_make_current() would rebind the old EGL context and
surfaces and return EGL_BAD_MATCH. However, it wouldn't rebind
the DRI context and surfaces, thus leaving it in an
inconsistent and unrecoverable state.

After this change, dri2_make_current() tries to bind the old
DRI context and surfaces when bindContext() failed. If unable
to do so, it leaves EGL and the DRI driver in a consistent
state, it reports an error and returns EGL_BAD_MATCH.

Fixes: 4e8f95f64d ("egl_dri2: Always unbind old contexts")

Signed-off-by: Luigi Santivetti <luigi.santivetti@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5707>
2020-07-21 18:42:03 +00:00
..
drivers egl/dri2: try to bind old context if bindContext failed 2020-07-21 18:42:03 +00:00
generate EGL: sync headers with Khronos 2020-05-25 14:06:38 +00:00
main egl: inline _EGLAPI into _EGLDriver 2020-07-21 00:59:43 +00:00
wayland meson: use gnu_symbol_visibility argument 2020-06-01 18:59:18 +00:00
Android.mk egl: Build surfaceless platform on Android 2020-07-13 08:46:55 +00:00
Makefile.sources egl: inline _EGLAPI into _EGLDriver 2020-07-21 00:59:43 +00:00
egl-entrypoint-check.py
egl-glvnd-symbols.txt egl: add glvnd symbols check 2019-07-10 11:27:51 +00:00
egl-symbols.txt
meson.build egl: inline _EGLAPI into _EGLDriver 2020-07-21 00:59:43 +00:00