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

@ -102,7 +102,6 @@ spec@glsl-1.20@execution@tex-miplevel-selection gl2:textureproj 3d,Fail
spec@glsl-1.20@execution@tex-miplevel-selection gl2:textureproj(bias) 3d,Fail spec@glsl-1.20@execution@tex-miplevel-selection gl2:textureproj(bias) 3d,Fail
spec@khr_texture_compression_astc@basic-gl,Fail spec@khr_texture_compression_astc@basic-gl,Fail
glx@glx-make-current,Crash
glx@glx-multithread-buffer,Fail glx@glx-multithread-buffer,Fail
glx@glx-swap-pixmap-bad,Fail glx@glx-swap-pixmap-bad,Fail
glx@glx-visuals-depth -pixmap,Fail glx@glx-visuals-depth -pixmap,Fail

View File

@ -5,7 +5,6 @@ dEQP-GLES2.functional.clipping.triangle_vertex.clip_three.clip_pos_x_and_neg_x_n
dEQP-GLES2.functional.draw.random.51 dEQP-GLES2.functional.draw.random.51
dEQP-GLES2.functional.texture.size.cube.256x256_rgb888 dEQP-GLES2.functional.texture.size.cube.256x256_rgb888
glx@glx-multi-window-single-context
shaders@glsl-vs-loop shaders@glsl-vs-loop
shaders@glsl-vs-loop-nested shaders@glsl-vs-loop-nested
spec@arb_framebuffer_srgb@blit renderbuffer srgb single_sampled enabled clear spec@arb_framebuffer_srgb@blit renderbuffer srgb single_sampled enabled clear

View File

@ -1,5 +1,3 @@
glx@glx-make-current,Crash
glx@glx-multi-window-single-context,Fail
glx@glx-multithread-buffer,Fail glx@glx-multithread-buffer,Fail
glx@glx-swap-pixmap-bad,Fail glx@glx-swap-pixmap-bad,Fail
glx@glx-visuals-depth -pixmap,Crash glx@glx-visuals-depth -pixmap,Crash

View File

@ -156,8 +156,6 @@ spec@glsl-1.30@execution@interpolation@interpolation-noperspective-gl_frontsecon
spec@glsl-1.30@execution@interpolation@interpolation-noperspective-other-flat-fixed,Fail spec@glsl-1.30@execution@interpolation@interpolation-noperspective-other-flat-fixed,Fail
spec@glsl-1.30@execution@interpolation@interpolation-noperspective-other-smooth-fixed,Fail spec@glsl-1.30@execution@interpolation@interpolation-noperspective-other-smooth-fixed,Fail
glx@glx-make-current,Crash
glx@glx-multi-window-single-context,Fail
glx@glx-swap-pixmap-bad,Fail glx@glx-swap-pixmap-bad,Fail
glx@glx-visuals-depth -pixmap,Crash glx@glx-visuals-depth -pixmap,Crash
glx@glx-visuals-stencil -pixmap,Crash glx@glx-visuals-stencil -pixmap,Crash

View File

@ -291,8 +291,6 @@ spec@!opengl 2.1@polygon-stipple-fs,Fail
spec@ext_packed_float@query-rgba-signed-components,Fail spec@ext_packed_float@query-rgba-signed-components,Fail
# Uncategorized piglit failures # Uncategorized piglit failures
glx@glx-make-current,Crash
glx@glx-multi-window-single-context,Fail
glx@glx-query-drawable-glx_fbconfig_id-window,Fail glx@glx-query-drawable-glx_fbconfig_id-window,Fail
glx@glx-swap-pixmap-bad,Fail glx@glx-swap-pixmap-bad,Fail
glx@glx-visuals-depth -pixmap,Crash glx@glx-visuals-depth -pixmap,Crash

View File

@ -596,8 +596,6 @@ KHR-GLES3.texture_repeat_mode.rgba32ui_49x23_2_mirrored_repeat,Fail
KHR-GLES3.texture_repeat_mode.rgba32ui_49x23_2_repeat,Fail KHR-GLES3.texture_repeat_mode.rgba32ui_49x23_2_repeat,Fail
glx@glx-multithread-buffer,Fail glx@glx-multithread-buffer,Fail
glx@glx-make-current,Crash
glx@glx-multi-window-single-context,Fail
glx@glx-swap-pixmap-bad,Fail glx@glx-swap-pixmap-bad,Fail
glx@glx-tfp,Fail glx@glx-tfp,Fail
glx@glx-visuals-depth -pixmap,Crash glx@glx-visuals-depth -pixmap,Crash

View File

@ -47,8 +47,6 @@ glx@glx_ext_import_context@imported context has same context id,Fail
glx@glx_ext_import_context@make current- multi process,Fail glx@glx_ext_import_context@make current- multi process,Fail
glx@glx_ext_import_context@make current- single process,Fail glx@glx_ext_import_context@make current- single process,Fail
glx@glx_ext_import_context@query context info,Fail glx@glx_ext_import_context@query context info,Fail
glx@glx-make-current,Crash
glx@glx-multi-window-single-context,Fail
glx@glx-swap-pixmap-bad,Fail glx@glx-swap-pixmap-bad,Fail
glx@glx-visuals-depth -pixmap,Crash glx@glx-visuals-depth -pixmap,Crash
glx@glx-visuals-stencil -pixmap,Crash glx@glx-visuals-stencil -pixmap,Crash

View File

@ -29,13 +29,6 @@ spec@oes_shader_io_blocks@compiler@layout-location-aliasing.vert,Fail
glx@glx-copy-sub-buffer,Fail glx@glx-copy-sub-buffer,Fail
glx@glx-copy-sub-buffer samples=2,Fail glx@glx-copy-sub-buffer samples=2,Fail
glx@glx-copy-sub-buffer samples=4,Fail glx@glx-copy-sub-buffer samples=4,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-window-single-context,Fail
glx@glx-swap-copy,Fail glx@glx-swap-copy,Fail
glx@glx-swap-pixmap-bad,Fail glx@glx-swap-pixmap-bad,Fail

View File

@ -1,6 +1,4 @@
# piglit failures # piglit failures
glx@glx-make-current,Crash
glx@glx-multi-window-single-context,Fail
glx@glx-visuals-depth -pixmap,Crash glx@glx-visuals-depth -pixmap,Crash
glx@glx-visuals-stencil -pixmap,Crash glx@glx-visuals-stencil -pixmap,Crash
glx@glx_arb_create_context_es2_profile@invalid opengl es version,Fail glx@glx_arb_create_context_es2_profile@invalid opengl es version,Fail

1 # piglit failures
glx@glx-make-current,Crash
glx@glx-multi-window-single-context,Fail
2 glx@glx-visuals-depth -pixmap,Crash
3 glx@glx-visuals-stencil -pixmap,Crash
4 glx@glx_arb_create_context_es2_profile@invalid opengl es version,Fail

View File

@ -1,6 +1,4 @@
# piglit failures # piglit failures
glx@glx-make-current,Crash
glx@glx-multi-window-single-context,Fail
glx@glx-swap-event_interval,Fail glx@glx-swap-event_interval,Fail
glx@glx-visuals-depth -pixmap,Crash glx@glx-visuals-depth -pixmap,Crash
glx@glx-visuals-stencil -pixmap,Crash glx@glx-visuals-stencil -pixmap,Crash

1 # piglit failures
glx@glx-make-current,Crash
glx@glx-multi-window-single-context,Fail
2 glx@glx-swap-event_interval,Fail
3 glx@glx-visuals-depth -pixmap,Crash
4 glx@glx-visuals-stencil -pixmap,Crash

View File

@ -1,6 +1,4 @@
# piglit failures # piglit failures
glx@glx-make-current,Crash
glx@glx-multi-window-single-context,Fail
glx@glx-swap-event_interval,Fail glx@glx-swap-event_interval,Fail
glx@glx-visuals-depth -pixmap,Crash glx@glx-visuals-depth -pixmap,Crash
glx@glx-visuals-stencil -pixmap,Crash glx@glx-visuals-stencil -pixmap,Crash

1 # piglit failures
glx@glx-make-current,Crash
glx@glx-multi-window-single-context,Fail
2 glx@glx-swap-event_interval,Fail
3 glx@glx-visuals-depth -pixmap,Crash
4 glx@glx-visuals-stencil -pixmap,Crash

View File

@ -1,6 +1,4 @@
# piglit failures # piglit failures
glx@glx-make-current,Crash
glx@glx-multi-window-single-context,Fail
glx@glx-visuals-depth -pixmap,Crash glx@glx-visuals-depth -pixmap,Crash
glx@glx-visuals-stencil -pixmap,Crash glx@glx-visuals-stencil -pixmap,Crash
glx@glx_arb_create_context_es2_profile@invalid opengl es version,Fail glx@glx_arb_create_context_es2_profile@invalid opengl es version,Fail

1 # piglit failures
glx@glx-make-current,Crash
glx@glx-multi-window-single-context,Fail
2 glx@glx-visuals-depth -pixmap,Crash
3 glx@glx-visuals-stencil -pixmap,Crash
4 glx@glx_arb_create_context_es2_profile@invalid opengl es version,Fail

View File

@ -5,8 +5,6 @@ spec@!opengl 1.1@windowoverlap,Fail
spec@arb_shader_clock@execution@clock,Fail spec@arb_shader_clock@execution@clock,Fail
spec@egl_chromium_sync_control@conformance,Fail spec@egl_chromium_sync_control@conformance,Fail
spec@egl_chromium_sync_control@conformance@eglGetSyncValuesCHROMIUM_msc_and_sbc_test,Fail spec@egl_chromium_sync_control@conformance@eglGetSyncValuesCHROMIUM_msc_and_sbc_test,Fail
glx@glx-make-current,Crash
glx@glx-multi-window-single-context,Fail
glx@glx-visuals-depth -pixmap,Fail glx@glx-visuals-depth -pixmap,Fail
glx@glx-visuals-stencil -pixmap,Fail glx@glx-visuals-stencil -pixmap,Fail
glx@glx_arb_create_context_es2_profile@invalid opengl es version,Fail glx@glx_arb_create_context_es2_profile@invalid opengl es version,Fail

1 # piglit failures
5 spec@egl_chromium_sync_control@conformance,Fail
6 spec@egl_chromium_sync_control@conformance@eglGetSyncValuesCHROMIUM_msc_and_sbc_test,Fail
7 glx@glx-make-current,Crash glx@glx-visuals-depth -pixmap,Fail
glx@glx-multi-window-single-context,Fail
glx@glx-visuals-depth -pixmap,Fail
8 glx@glx-visuals-stencil -pixmap,Fail
9 glx@glx_arb_create_context_es2_profile@invalid opengl es version,Fail
10 glx@glx_arb_create_context_no_error@no error,Fail

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 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-context-front,Fail
glx@glx-multi-window-single-context,Fail
glx@glx-swap-copy,Fail glx@glx-swap-copy,Fail
glx@glx-swap-pixmap-bad,Fail glx@glx-swap-pixmap-bad,Fail

View File

@ -72,8 +72,6 @@ KHR-GL43.transform_feedback_overflow_query_ARB.basic-single-stream-separate-attr
KHR-GL43.transform_feedback_overflow_query_ARB.multiple-streams-multiple-buffers-per-stream,Fail KHR-GL43.transform_feedback_overflow_query_ARB.multiple-streams-multiple-buffers-per-stream,Fail
KHR-GL43.transform_feedback_overflow_query_ARB.multiple-streams-one-buffer-per-stream,Fail KHR-GL43.transform_feedback_overflow_query_ARB.multiple-streams-one-buffer-per-stream,Fail
glx@glx-make-current,Crash
glx@glx-multi-window-single-context,Fail
glx@glx-multithread-clearbuffer,Crash glx@glx-multithread-clearbuffer,Crash
glx@glx-multithread-texture,Crash glx@glx-multithread-texture,Crash
glx@glx-swap-copy,Fail glx@glx-swap-copy,Fail

View File

@ -1,6 +1,5 @@
dEQP-GLES2.functional.texture.filtering.cube.nearest_linear_mirror_l8_pot dEQP-GLES2.functional.texture.filtering.cube.nearest_linear_mirror_l8_pot
spec@khr_debug@push-pop-group_gl.* spec@khr_debug@push-pop-group_gl.*
glx@glx-multi-window-single-context
# "Pending expose event- rerunning." # "Pending expose event- rerunning."
# exit status: signal: 11" # exit status: signal: 11"

View File

@ -6,7 +6,6 @@ KHR-GL32.texture_size_promotion.functional
# ignores copied from the old runner script # ignores copied from the old runner script
spec@arb_map_buffer_alignment@arb_map_buffer_alignment-map-invalidate-range spec@arb_map_buffer_alignment@arb_map_buffer_alignment-map-invalidate-range
glx@glx-make-current
spec@arb_timer_query.* spec@arb_timer_query.*
spec@arb_sample_shading@builtin-gl-sample-mask spec@arb_sample_shading@builtin-gl-sample-mask
spec@glsl-1.30@execution@tex-miplevel-selection.* spec@glsl-1.30@execution@tex-miplevel-selection.*

View File

@ -7,7 +7,6 @@ dEQP-GLES3.functional.shaders.texture_functions.textureprojlodoffset.sampler2dsh
dEQP-GLES3.functional.shaders.texture_functions.textureprojoffset.sampler2dshadow_vertex,Fail dEQP-GLES3.functional.shaders.texture_functions.textureprojoffset.sampler2dshadow_vertex,Fail
# kopper # kopper
glx@glx-multi-window-single-context,Crash
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-export-tex,Crash spec@ext_image_dma_buf_import@ext_image_dma_buf_import-export-tex,Crash
spec@egl_chromium_sync_control@conformance@eglGetSyncValuesCHROMIUM_ust_test,Fail spec@egl_chromium_sync_control@conformance@eglGetSyncValuesCHROMIUM_ust_test,Fail
@ -36,7 +35,6 @@ glx@glx_ext_import_context@imported context has same context id,Fail
glx@glx_ext_import_context@make current- multi process,Fail glx@glx_ext_import_context@make current- multi process,Fail
glx@glx_ext_import_context@make current- single process,Fail glx@glx_ext_import_context@make current- single process,Fail
glx@glx_ext_import_context@query context info,Fail glx@glx_ext_import_context@query context info,Fail
glx@glx-make-current,Crash
glx@glx-swap-copy,Fail glx@glx-swap-copy,Fail
glx@glx-swap-pixmap-bad,Fail glx@glx-swap-pixmap-bad,Fail
glx@glx-visuals-depth,Crash glx@glx-visuals-depth,Crash

View File

@ -417,7 +417,14 @@ driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable)
(*pdraw->destroyDrawable) (pdraw); (*pdraw->destroyDrawable) (pdraw);
return NULL; return NULL;
} }
pdraw->refcount = 1; /* This sure does look suspicious, doesn't it? We're on this path because
* this is a naked Window. GLX 1.3 drawables have an explicit creation
* step (setting refcount to 1), and those we would have found in the
* hash lookup above, bumped their refcount for the bind_context we're
* being called for, and then returned. But since we just created the
* internal naked-Window state, we need to account for both here.
*/
pdraw->refcount = 2;
return pdraw; return pdraw;
} }

View File

@ -13,15 +13,6 @@ dEQP-GLES3.functional.texture.compressed.astc.void_extent_ldr.8x5,Fail
dEQP-GLES3.functional.texture.compressed.astc.void_extent_ldr.8x6,Fail dEQP-GLES3.functional.texture.compressed.astc.void_extent_ldr.8x6,Fail
dEQP-GLES3.functional.texture.compressed.astc.void_extent_ldr.8x8,Fail dEQP-GLES3.functional.texture.compressed.astc.void_extent_ldr.8x8,Fail
# X Error of failed request: BadMatch (invalid parameter attributes)
# Major opcode of failed request: 151 (GLX)
# Minor opcode of failed request: 11 (X_GLXSwapBuffers)
# Serial number of failed request: 79
# Current serial number in output stream: 80
glx@glx-make-current,Crash
glx@glx-multi-window-single-context,Fail
glx@glx-swap-pixmap-bad,Fail glx@glx-swap-pixmap-bad,Fail
# failed to create drawable # failed to create drawable

View File

@ -10,9 +10,7 @@ glx@glx_ext_import_context@imported context has same context id,Fail
glx@glx_ext_import_context@make current- multi process,Fail glx@glx_ext_import_context@make current- multi process,Fail
glx@glx_ext_import_context@make current- single process,Fail glx@glx_ext_import_context@make current- single process,Fail
glx@glx_ext_import_context@query context info,Fail glx@glx_ext_import_context@query context info,Fail
glx@glx-make-current,Crash
glx@glx-multithread-clearbuffer,Crash glx@glx-multithread-clearbuffer,Crash
glx@glx-multi-window-single-context,Fail
glx@glx-swap-pixmap-bad,Fail glx@glx-swap-pixmap-bad,Fail
glx@glx-visuals-depth -pixmap,Crash glx@glx-visuals-depth -pixmap,Crash
glx@glx-visuals-stencil -pixmap,Crash glx@glx-visuals-stencil -pixmap,Crash