From bbc29393d3beaf6344c7188547b4ff61b63946ae Mon Sep 17 00:00:00 2001 From: Charmaine Lee Date: Fri, 21 Jul 2017 21:41:06 -0700 Subject: st/mesa: create framebuffer iface hash table per st manager With commit 5124bf98239, a framebuffer interface hash table is created in st_gl_api_create(), which is called in dri_init_screen_helper() for each screen. When the hash table is overwritten with multiple calls to st_gl_api_create(), it can cause race condition. This patch fixes the problem by creating a framebuffer interface hash table per state tracker manager. Fixes crash with steam. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101876 Fixes: 5124bf98239 ("st/mesa: add destroy_drawable interface") Tested-by: Christoph Haag Reviewed-by: Brian Paul --- src/gallium/state_trackers/glx/xlib/xm_api.c | 3 +++ src/gallium/state_trackers/glx/xlib/xm_st.c | 1 + 2 files changed, 4 insertions(+) (limited to 'src/gallium/state_trackers/glx/xlib') diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index e4b1e9dd4de..828253bdb19 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -181,6 +181,9 @@ xmesa_close_display(Display *display) * xmdpy->screen->destroy(xmdpy->screen); * } */ + + if (xmdpy->smapi->destroy) + xmdpy->smapi->destroy(xmdpy->smapi); free(xmdpy->smapi); XFree((char *) info); diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c b/src/gallium/state_trackers/glx/xlib/xm_st.c index 6a0f4aad7d8..0c42e653c76 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_st.c +++ b/src/gallium/state_trackers/glx/xlib/xm_st.c @@ -304,6 +304,7 @@ xmesa_create_st_framebuffer(XMesaDisplay xmdpy, XMesaBuffer b) stfbi->flush_front = xmesa_st_framebuffer_flush_front; stfbi->validate = xmesa_st_framebuffer_validate; stfbi->ID = p_atomic_inc_return(&xmesa_stfbi_ID); + stfbi->state_manager = xmdpy->smapi; p_atomic_set(&stfbi->stamp, 1); stfbi->st_manager_private = (void *) xstfb; -- cgit v1.2.3