diff options
author | Pauli Nieminen <suokkos@gmail.com> | 2009-07-30 20:17:29 +0300 |
---|---|---|
committer | Alex Deucher <alexdeucher@gmail.com> | 2009-08-12 14:14:29 -0400 |
commit | 29173d3d5cf02d58e720b5c7fe48a0630c7d5d5f (patch) | |
tree | afaf64a351d5f451de6e9cd12191c25079888f38 /src/mesa/drivers/dri/radeon/radeon_lock.h | |
parent | 5eeb44f3983dfda2f2707783be12806da795cbcd (diff) |
radeon: Add protection against recursive DRM locking.
Reference counting protects DRM lock call from recursive locking that would
cause hang. Code also adds optional debugging output for recursive call that
is compiled only if NDEBUG is not defined.
This code is not 100% thread safe because mesa doesn't include increment and
test atomic operation. There is built-in gcc functions but they are only
available from gcc 4.2.
Diffstat (limited to 'src/mesa/drivers/dri/radeon/radeon_lock.h')
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_lock.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_lock.h b/src/mesa/drivers/dri/radeon/radeon_lock.h index 2817709eed..da5a5b4371 100644 --- a/src/mesa/drivers/dri/radeon/radeon_lock.h +++ b/src/mesa/drivers/dri/radeon/radeon_lock.h @@ -48,12 +48,22 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. extern void radeonGetLock(radeonContextPtr rmesa, GLuint flags); -void radeon_lock_hardware(radeonContextPtr rmesa); +void radeon_lock_hardware(radeonContextPtr rmesa +#ifndef NDEBUG + ,const char* function + ,const char* file + ,const int line +#endif + ); void radeon_unlock_hardware(radeonContextPtr rmesa); /* Lock the hardware and validate our state. */ +#ifdef NDEBUG #define LOCK_HARDWARE( rmesa ) radeon_lock_hardware(rmesa) +#else +#define LOCK_HARDWARE( rmesa ) radeon_lock_hardware(rmesa, __FUNCTION__, __FILE__, __LINE__) +#endif #define UNLOCK_HARDWARE( rmesa ) radeon_unlock_hardware(rmesa) #endif |