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); /**