From 42882897c67f6c74e67e120e946a95929e6c2065 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 17 Jun 2009 21:28:18 +0100 Subject: wgl: Fix window resizing in multithread applications. In multithreading stw_call_window_proc can be called by a thread other than the thread where the context is bound. --- src/gallium/state_trackers/wgl/shared/stw_device.c | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/gallium/state_trackers/wgl/shared/stw_device.c') diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.c b/src/gallium/state_trackers/wgl/shared/stw_device.c index 070ffcb3ca..1b4a2d5cdb 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_device.c +++ b/src/gallium/state_trackers/wgl/shared/stw_device.c @@ -30,6 +30,7 @@ #include "glapi/glthread.h" #include "util/u_debug.h" #include "pipe/p_screen.h" +#include "state_tracker/st_public.h" #ifdef DEBUG #include "trace/tr_screen.h" @@ -63,7 +64,26 @@ stw_flush_frontbuffer(struct pipe_screen *screen, { const struct stw_winsys *stw_winsys = stw_dev->stw_winsys; HDC hdc = (HDC)context_private; + struct stw_framebuffer *fb; + fb = stw_framebuffer_from_hdc( hdc ); + assert(fb); + if (fb == NULL) + return; + + pipe_mutex_lock( fb->mutex ); + +#if DEBUG + { + struct pipe_surface *surface2; + + if(!st_get_framebuffer_surface( fb->stfb, ST_SURFACE_FRONT_LEFT, &surface2 )) + assert(0); + else + assert(surface2 == surface); + } +#endif + #ifdef DEBUG if(stw_dev->trace_running) { screen = trace_screen(screen)->screen; @@ -72,6 +92,10 @@ stw_flush_frontbuffer(struct pipe_screen *screen, #endif stw_winsys->flush_frontbuffer(screen, surface, hdc); + + stw_framebuffer_update(fb); + + pipe_mutex_unlock( fb->mutex ); } -- cgit v1.2.3