summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2015-11-10 14:24:18 -0700
committerBrian Paul <[email protected]>2015-11-12 11:21:25 -0700
commitfce68832c5e06a046b69fbad1e1424aaec6fc0b2 (patch)
tree0ecc4bd51ed79f01c023152354a52b31d84b6518 /src/gallium
parentfa30de7643ca6c70ac2661684b22f7b220a40b0b (diff)
st/wgl: reimplement stw_device::fb_mutex with CRITICAL_SECTION
Reviewed-by: Sinclair Yeh <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/wgl/stw_device.c4
-rw-r--r--src/gallium/state_trackers/wgl/stw_device.h16
-rw-r--r--src/gallium/state_trackers/wgl/stw_framebuffer.c24
3 files changed, 29 insertions, 15 deletions
diff --git a/src/gallium/state_trackers/wgl/stw_device.c b/src/gallium/state_trackers/wgl/stw_device.c
index 2f51fdb1cbf..287b937afe5 100644
--- a/src/gallium/state_trackers/wgl/stw_device.c
+++ b/src/gallium/state_trackers/wgl/stw_device.c
@@ -107,7 +107,7 @@ stw_init(const struct stw_winsys *stw_winsys)
stw_dev->max_2d_length = 1 << (stw_dev->max_2d_levels - 1);
InitializeCriticalSection(&stw_dev->ctx_mutex);
- pipe_mutex_init( stw_dev->fb_mutex );
+ InitializeCriticalSection(&stw_dev->fb_mutex);
stw_dev->ctx_table = handle_table_create();
if (!stw_dev->ctx_table) {
@@ -169,7 +169,7 @@ stw_cleanup(void)
stw_framebuffer_cleanup();
- pipe_mutex_destroy( stw_dev->fb_mutex );
+ DeleteCriticalSection(&stw_dev->fb_mutex);
DeleteCriticalSection(&stw_dev->ctx_mutex);
FREE(stw_dev->smapi);
diff --git a/src/gallium/state_trackers/wgl/stw_device.h b/src/gallium/state_trackers/wgl/stw_device.h
index f271762f6b1..d695e8f4e12 100644
--- a/src/gallium/state_trackers/wgl/stw_device.h
+++ b/src/gallium/state_trackers/wgl/stw_device.h
@@ -68,7 +68,7 @@ struct stw_device
CRITICAL_SECTION ctx_mutex;
struct handle_table *ctx_table;
- pipe_mutex fb_mutex;
+ CRITICAL_SECTION fb_mutex;
struct stw_framebuffer *fb_head;
#ifdef DEBUG
@@ -103,4 +103,18 @@ stw_unlock_contexts(struct stw_device *stw_dev)
}
+static inline void
+stw_lock_framebuffers(struct stw_device *stw_dev)
+{
+ EnterCriticalSection(&stw_dev->fb_mutex);
+}
+
+
+static inline void
+stw_unlock_framebuffers(struct stw_device *stw_dev)
+{
+ LeaveCriticalSection(&stw_dev->fb_mutex);
+}
+
+
#endif /* STW_DEVICE_H_ */
diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.c b/src/gallium/state_trackers/wgl/stw_framebuffer.c
index 09dede8d2a1..ce5b2c3e0b8 100644
--- a/src/gallium/state_trackers/wgl/stw_framebuffer.c
+++ b/src/gallium/state_trackers/wgl/stw_framebuffer.c
@@ -230,11 +230,11 @@ stw_call_window_proc(int nCode, WPARAM wParam, LPARAM lParam)
}
}
else if (pParams->message == WM_DESTROY) {
- pipe_mutex_lock( stw_dev->fb_mutex );
+ stw_lock_framebuffers(stw_dev);
fb = stw_framebuffer_from_hwnd_locked( pParams->hwnd );
if (fb)
stw_framebuffer_destroy_locked(fb);
- pipe_mutex_unlock( stw_dev->fb_mutex );
+ stw_unlock_framebuffers(stw_dev);
}
return CallNextHookEx(tls_data->hCallWndProcHook, nCode, wParam, lParam);
@@ -304,10 +304,10 @@ stw_framebuffer_create(HDC hdc, int iPixelFormat)
*/
pipe_mutex_lock( fb->mutex );
- pipe_mutex_lock( stw_dev->fb_mutex );
+ stw_lock_framebuffers(stw_dev);
fb->next = stw_dev->fb_head;
stw_dev->fb_head = fb;
- pipe_mutex_unlock( stw_dev->fb_mutex );
+ stw_unlock_framebuffers(stw_dev);
return fb;
}
@@ -328,12 +328,12 @@ stw_framebuffer_reference(struct stw_framebuffer **ptr,
if (fb)
fb->refcnt++;
if (old_fb) {
- pipe_mutex_lock(stw_dev->fb_mutex);
+ stw_lock_framebuffers(stw_dev);
pipe_mutex_lock(old_fb->mutex);
stw_framebuffer_destroy_locked(old_fb);
- pipe_mutex_unlock(stw_dev->fb_mutex);
+ stw_unlock_framebuffers(stw_dev);
}
*ptr = fb;
@@ -372,7 +372,7 @@ stw_framebuffer_cleanup(void)
if (!stw_dev)
return;
- pipe_mutex_lock( stw_dev->fb_mutex );
+ stw_lock_framebuffers(stw_dev);
fb = stw_dev->fb_head;
while (fb) {
@@ -385,7 +385,7 @@ stw_framebuffer_cleanup(void)
}
stw_dev->fb_head = NULL;
- pipe_mutex_unlock( stw_dev->fb_mutex );
+ stw_unlock_framebuffers(stw_dev);
}
@@ -419,9 +419,9 @@ stw_framebuffer_from_hdc(HDC hdc)
if (!stw_dev)
return NULL;
- pipe_mutex_lock( stw_dev->fb_mutex );
+ stw_lock_framebuffers(stw_dev);
fb = stw_framebuffer_from_hdc_locked(hdc);
- pipe_mutex_unlock( stw_dev->fb_mutex );
+ stw_unlock_framebuffers(stw_dev);
return fb;
}
@@ -436,9 +436,9 @@ stw_framebuffer_from_hwnd(HWND hwnd)
{
struct stw_framebuffer *fb;
- pipe_mutex_lock( stw_dev->fb_mutex );
+ stw_lock_framebuffers(stw_dev);
fb = stw_framebuffer_from_hwnd_locked(hwnd);
- pipe_mutex_unlock( stw_dev->fb_mutex );
+ stw_unlock_framebuffers(stw_dev);
return fb;
}