glx: Fix drawable refcounting for naked Windows

driFetchDrawable is only ever called from the MakeCurrent path, which
means it has to handle the case of pre-GLX-1.3 Windows being named as
the drawable. When it finds the drawable in the hash, it increments its
refcount before returning it, so for a GLXWindow it would be 2 on first
return, one from glXCreateWindow and one from glXMakeCurrent. But when
it does not find the drawable and creates one for the naked Window, the
reference count on first return would only be 1. As a result, if this
context was then ever bound to a different drawable, the old Window's
DRI drawable state (like the back buffer) would be destroyed.

Fixes piglit's glx-multi-window-single-context and glx-make-current for
a variety of drivers.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6713
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17479>
This commit is contained in:
Adam Jackson
2022-07-11 19:30:05 -04:00
parent 585d81e3ec
commit 768238fdc0
21 changed files with 8 additions and 53 deletions

View File

@@ -908,14 +908,8 @@ KHR-GLES31.core.texture_storage_multisample.GLCoverage.gl_tex_parameter_handlers
fast_color_clear@fcc-front-buffer-distraction,Fail
# X Error of failed request: BadMatch (invalid parameter attributes)
# Major opcode of failed request: 150 (GLX)
# Minor opcode of failed request: 11 (X_GLXSwapBuffers)
glx@glx-make-current,Crash
glx@glx-multi-context-front,Fail
glx@glx-multi-window-single-context,Fail
glx@glx-swap-copy,Fail
glx@glx-swap-pixmap-bad,Fail