From 9c875b040c8571e8bc762fc68cefe9e384e62a1f Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Sat, 4 Sep 2021 07:58:51 -0700 Subject: [PATCH] wgl: Un-inline helpers which use stw_own_mutex Reviewed-by: Charmaine Lee Reviewed By: Bill Kristiansen Acked-by: Roland Scheidegger Part-of: --- src/gallium/frontends/wgl/stw_framebuffer.c | 27 +++++++++++++++++++++ src/gallium/frontends/wgl/stw_framebuffer.h | 19 +++------------ 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/src/gallium/frontends/wgl/stw_framebuffer.c b/src/gallium/frontends/wgl/stw_framebuffer.c index 29434081390..4a487462466 100644 --- a/src/gallium/frontends/wgl/stw_framebuffer.c +++ b/src/gallium/frontends/wgl/stw_framebuffer.c @@ -333,6 +333,33 @@ stw_framebuffer_create(HDC hdc, int iPixelFormat, enum stw_framebuffer_owner own return fb; } +/** + * Increase fb reference count. The referenced framebuffer should be locked. + * + * It's not necessary to hold stw_dev::fb_mutex global lock. + */ +void +stw_framebuffer_reference_locked(struct stw_framebuffer *fb) +{ + if (fb) { + assert(stw_own_mutex(&fb->mutex)); + fb->refcnt++; + } +} + +/** + * Release stw_framebuffer::mutex lock. This framebuffer must not be accessed + * after calling this function, as it may have been deleted by another thread + * in the meanwhile. + */ +void +stw_framebuffer_unlock(struct stw_framebuffer *fb) +{ + assert(fb); + assert(stw_own_mutex(&fb->mutex)); + LeaveCriticalSection(&fb->mutex); +} + /** * Update the framebuffer's size if necessary. diff --git a/src/gallium/frontends/wgl/stw_framebuffer.h b/src/gallium/frontends/wgl/stw_framebuffer.h index 7b7809513e0..be1b3371e9e 100644 --- a/src/gallium/frontends/wgl/stw_framebuffer.h +++ b/src/gallium/frontends/wgl/stw_framebuffer.h @@ -160,14 +160,8 @@ stw_framebuffer_create(HDC hdc, int iPixelFormat, enum stw_framebuffer_owner own * * It's not necessary to hold stw_dev::fb_mutex global lock. */ -static inline void -stw_framebuffer_reference_locked(struct stw_framebuffer *fb) -{ - if (fb) { - assert(stw_own_mutex(&fb->mutex)); - fb->refcnt++; - } -} +void +stw_framebuffer_reference_locked(struct stw_framebuffer *fb); void @@ -214,13 +208,8 @@ stw_framebuffer_lock(struct stw_framebuffer *fb) * after calling this function, as it may have been deleted by another thread * in the meanwhile. */ -static inline void -stw_framebuffer_unlock(struct stw_framebuffer *fb) -{ - assert(fb); - assert(stw_own_mutex(&fb->mutex)); - LeaveCriticalSection(&fb->mutex); -} +void +stw_framebuffer_unlock(struct stw_framebuffer *fb); /**