summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/wgl/shared/stw_device.c
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2009-06-17 21:28:18 +0100
committerJosé Fonseca <jfonseca@vmware.com>2009-06-18 14:54:07 +0100
commit42882897c67f6c74e67e120e946a95929e6c2065 (patch)
treecb6a5196c4d8cf7744d81f6292fc0016010b641a /src/gallium/state_trackers/wgl/shared/stw_device.c
parent4b4855c717e839a9ee6353604558543473c020c9 (diff)
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.
Diffstat (limited to 'src/gallium/state_trackers/wgl/shared/stw_device.c')
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_device.c24
1 files changed, 24 insertions, 0 deletions
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 );
}