summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/wgl/stw_framebuffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/wgl/stw_framebuffer.c')
-rw-r--r--src/gallium/state_trackers/wgl/stw_framebuffer.c43
1 files changed, 10 insertions, 33 deletions
diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.c b/src/gallium/state_trackers/wgl/stw_framebuffer.c
index b49bc22..1263615 100644
--- a/src/gallium/state_trackers/wgl/stw_framebuffer.c
+++ b/src/gallium/state_trackers/wgl/stw_framebuffer.c
@@ -67,14 +67,18 @@ stw_framebuffer_from_hwnd_locked(HWND hwnd)
* Decrement the reference count on the given stw_framebuffer object.
* If the reference count hits zero, destroy the object.
*
- * Note: Both stw_dev::fb_mutex and stw_framebuffer::mutex must already
- * be locked.
+ * Note: Both stw_dev::fb_mutex and stw_framebuffer::mutex must already be
+ * locked. After this function completes, the fb's mutex will be unlocked.
*/
-static void
-stw_framebuffer_destroy_locked(struct stw_framebuffer *fb)
+void
+stw_framebuffer_release_locked(struct stw_framebuffer *fb)
{
struct stw_framebuffer **link;
+ assert(fb);
+ assert(stw_own_mutex(&fb->mutex));
+ assert(stw_own_mutex(&stw_dev->fb_mutex));
+
/* check the reference count */
fb->refcnt--;
if (fb->refcnt) {
@@ -223,7 +227,7 @@ stw_call_window_proc(int nCode, WPARAM wParam, LPARAM lParam)
stw_lock_framebuffers(stw_dev);
fb = stw_framebuffer_from_hwnd_locked( pParams->hwnd );
if (fb)
- stw_framebuffer_destroy_locked(fb);
+ stw_framebuffer_release_locked(fb);
stw_unlock_framebuffers(stw_dev);
}
@@ -304,33 +308,6 @@ stw_framebuffer_create(HDC hdc, int iPixelFormat)
/**
- * Have ptr reference fb. The referenced framebuffer should be locked.
- */
-void
-stw_framebuffer_reference(struct stw_framebuffer **ptr,
- struct stw_framebuffer *fb)
-{
- struct stw_framebuffer *old_fb = *ptr;
-
- if (old_fb == fb)
- return;
-
- if (fb)
- fb->refcnt++;
- if (old_fb) {
- stw_lock_framebuffers(stw_dev);
-
- stw_framebuffer_lock(old_fb);
- stw_framebuffer_destroy_locked(old_fb);
-
- stw_unlock_framebuffers(stw_dev);
- }
-
- *ptr = fb;
-}
-
-
-/**
* Update the framebuffer's size if necessary.
*/
void
@@ -369,7 +346,7 @@ stw_framebuffer_cleanup(void)
next = fb->next;
stw_framebuffer_lock(fb);
- stw_framebuffer_destroy_locked(fb);
+ stw_framebuffer_release_locked(fb);
fb = next;
}