1 #ifndef __GAMMA_LOCK_H__
2 #define __GAMMA_LOCK_H__
4 #ifdef GLX_DIRECT_RENDERING
6 extern void gammaGetLock( gammaContextPtr gmesa
, GLuint flags
);
8 /* Turn DEBUG_LOCKING on to find locking conflicts.
10 #define DEBUG_LOCKING 0
13 extern char *prevLockFile
;
14 extern int prevLockLine
;
16 #define DEBUG_LOCK() \
18 prevLockFile = (__FILE__); \
19 prevLockLine = (__LINE__); \
22 #define DEBUG_RESET() \
28 #define DEBUG_CHECK_LOCK() \
30 if ( prevLockFile ) { \
32 "LOCK SET!\n\tPrevious %s:%d\n\tCurrent: %s:%d\n", \
33 prevLockFile, prevLockLine, __FILE__, __LINE__ ); \
42 #define DEBUG_CHECK_LOCK()
47 * !!! We may want to separate locks from locks with validation. This
48 * could be used to improve performance for those things commands that
49 * do not do any drawing !!!
52 /* Lock the hardware and validate our state.
54 #define LOCK_HARDWARE( gmesa ) \
58 DRM_CAS( gmesa->driHwLock, gmesa->hHWContext, \
59 (DRM_LOCK_HELD | gmesa->hHWContext), __ret ); \
61 gammaGetLock( gmesa, 0 ); \
65 /* Unlock the hardware.
67 #define UNLOCK_HARDWARE( gmesa ) \
69 DRM_UNLOCK( gmesa->driFd, \
71 gmesa->hHWContext ); \
77 #define GAMMAHW_LOCK( gmesa ) \
78 DRM_UNLOCK(gmesa->driFd, gmesa->driHwLock, gmesa->hHWContext); \
79 DRM_SPINLOCK(&gmesa->driScreen->pSAREA->drawable_lock, \
80 gmesa->driScreen->drawLockID); \
81 VALIDATE_DRAWABLE_INFO_NO_LOCK(gmesa);
83 #define GAMMAHW_UNLOCK( gmesa ) \
84 DRM_SPINUNLOCK(&gmesa->driScreen->pSAREA->drawable_lock, \
85 gmesa->driScreen->drawLockID); \
86 VALIDATE_DRAWABLE_INFO_NO_LOCK_POST(gmesa);
88 #endif /* __GAMMA_LOCK_H__ */