Hi,

We have experienced a problem with the win32 wgl pbuffer implementation using 
gallium together with threading.

This attached change releases the stw_framebuffer::mutex past creation of
the pbuffer stw_framebuffer. Without this change the pbuffers
lock is never released. Since on win32 mutexes are recursive, this
does not hurt as long as all actions on a context are done from
the same thread. But if, for example, context creation happens in
a different thread than usage, every access to the context will
block for ever.

This actually fixes the observed problems in an application that really creates 
the context in a different thread than it makes use of the pbuffer.

Please review and may be apply if its ok.
Thanks!

Mathias
From ff67a41a17288cef14e91d6c4095d3862eca96b1 Mon Sep 17 00:00:00 2001
From: Mathias Froehlich <mathias.froehl...@web.de>
Date: Thu, 13 Oct 2011 11:32:35 +0200
Subject: [PATCH] st/wgl: Release stw_framebuffer::mutex after pbuffer
 creation.

This change releases the stw_framebuffer::mutex past creation of
the pbuffer stw_framebuffer. Without this change the pbuffers
lock is never released. Since on win32 mutexes are recursive, this
does not hurt as long as all actions on a context are done from
the same thread. But if, for example, context creation happens in
a different thread than usage, every access to the context will
block for ever.
---
 src/gallium/state_trackers/wgl/stw_ext_pbuffer.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c b/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
index c7273f2..252d07a 100644
--- a/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
+++ b/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
@@ -209,6 +209,8 @@ wglCreatePbufferARB(HDC _hDC,
    fb = stw_framebuffer_create(hDC, iPixelFormat);
    if (!fb) {
       SetLastError(ERROR_NO_SYSTEM_RESOURCES);
+   } else {
+      stw_framebuffer_release(fb);
    }
 
    return (HPBUFFERARB)fb;
-- 
1.7.6

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to