Skip to content

render-device: Unmake the EGLContext after checking whether hw accelerated

When creating a render device, we create a temporary EGLContext where we then query the GL_RENDERER string to check whether the renderer is any of the known software renderers. After we're done, we destroy the context and move on.

This should be fine as according to specification eglDestroyContext(), with the context being actually destroyed a bit later when it's no longer current, but mesa, when running RK3399 (Pinebook Pro), this results in a crash in a future eglMakeCurrent():

#0 in dri_unbind_context () at ../src/gallium/frontends/dri/dri_context.c:266 #1 (closed) in driUnbindContext () at ../src/gallium/frontends/dri/dri_util.c:763 #2 (closed) in dri2_make_current () at ../src/egl/drivers/dri2/egl_dri2.c:1814 #3 (closed) in eglMakeCurrent () at ../src/egl/main/eglapi.c:907 ...

We can avoid this, however, by calling eglMakeCurrent() with EGL_NO_CONTEXT on the EGLDisplay, prior to destroying, effectively avoiding the crash, so lets do that.

Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7194 Closes: #2414 (closed)

Merge request reports