mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-03 13:00:37 +01:00
st/wgl: reimplement stw_device::fb_mutex with CRITICAL_SECTION
Reviewed-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com>
This commit is contained in:
parent
fa30de7643
commit
fce68832c5
3 changed files with 29 additions and 15 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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_ */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue