intel/dri: finish proper glthread
KWin was able to get NULL-context in the call intelUnbindContext. But a call _mesa_glthread_finish is not resistent to such case. Case can be catched with steps: 1. Create both glx and egl contexts 2. Make glx as current 3. Make egl as current 4. Reset glx context 5. Make egl as current
Solution adds proper finishing of glthread-context (context will be taken from the requested dri-context for unbinding, but not from the saved current context).
Piglit-test: piglit!87 (merged)
CI: https://mesa-ci.01.org/global_logic/builds/163/group/63a9f0ea7bb98050796b649e85481845
Related stack-trace:
#5 0x00007f312e10d124 in _mesa_glthread_finish (ctx=0x0) at ../mesa-19.1.0-rc4/src/mesa/main/glthread.c:184
#6 0x00007f312e00a8a4 in intelUnbindContext (driContextPriv=<optimized out>) at ../mesa-19.1.0-rc4/src/mesa/drivers/dri/i965/brw_context.c:1232
#7 0x00007f312e0987ea in driUnbindContext (pcp=0x55acf0ede080) at ../mesa-19.1.0-rc4/src/mesa/drivers/dri/common/dri_util.c:615
#8 0x00007f314ab53425 in dri2_make_current (drv=0x55acee384c30, disp=0x55acf1aecd90, dsurf=0x55acf1c030d0, rsurf=0x55acf1c030d0, ctx=<optimized out>) at ../mesa-19.1.0-rc4/src/egl/drivers/dri2/egl_dri2.c:1479
#9 0x00007f314ab491d7 in eglMakeCurrent (dpy=0x55acf1aecd90, draw=0x55acf1c030d0, read=0x55acf1c030d0, ctx=<optimized out>) at ../mesa-19.1.0-rc4/src/egl/main/eglapi.c:869
#10 0x00007f313e58020e in non-virtual thunk to KWin::AbstractEglBackend::makeCurrent() () from /usr/lib64/qt5/plugins/org.kde.kwin.platforms/KWinX11Platform.so
#11 0x00007f308d61388e in KWin::SceneOpenGLShadow::~SceneOpenGLShadow() () from /usr/lib64/qt5/plugins/org.kde.kwin.scenes/KWinSceneOpenGL.so
CC: Kenneth Graunke kenneth@whitecape.org Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110814 Fixes: dca36d55 (i965: Implement threaded GL support) Signed-off-by: 's avatarSergii Romantsov sergii.romantsov@globallogic.com