1 /* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_lock.h,v 1.4 2001/01/08 01:07:21 martin Exp $ */
2 /**************************************************************************
4 Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
8 Permission is hereby granted, free of charge, to any person obtaining a
9 copy of this software and associated documentation files (the "Software"),
10 to deal in the Software without restriction, including without limitation
11 on the rights to use, copy, modify, merge, publish, distribute, sub
12 license, and/or sell copies of the Software, and to permit persons to whom
13 the Software is furnished to do so, subject to the following conditions:
15 The above copyright notice and this permission notice (including the next
16 paragraph) shall be included in all copies or substantial portions of the
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
22 ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
23 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
25 USE OR OTHER DEALINGS IN THE SOFTWARE.
27 **************************************************************************/
31 * Kevin E. Martin <martin@valinux.com>
32 * Gareth Hughes <gareth@valinux.com>
36 #ifndef __R128_LOCK_H__
37 #define __R128_LOCK_H__
39 #ifdef GLX_DIRECT_RENDERING
41 extern void r128GetLock( r128ContextPtr rmesa
, GLuint flags
);
43 /* Turn DEBUG_LOCKING on to find locking conflicts.
45 #define DEBUG_LOCKING 0
48 extern char *prevLockFile
;
49 extern int prevLockLine
;
51 #define DEBUG_LOCK() \
53 prevLockFile = (__FILE__); \
54 prevLockLine = (__LINE__); \
57 #define DEBUG_RESET() \
63 #define DEBUG_CHECK_LOCK() \
65 if ( prevLockFile ) { \
67 "LOCK SET!\n\tPrevious %s:%d\n\tCurrent: %s:%d\n", \
68 prevLockFile, prevLockLine, __FILE__, __LINE__ ); \
77 #define DEBUG_CHECK_LOCK()
82 * !!! We may want to separate locks from locks with validation. This
83 * could be used to improve performance for those things commands that
84 * do not do any drawing !!!
87 /* Lock the hardware and validate our state.
89 #define LOCK_HARDWARE( rmesa ) \
93 DRM_CAS( rmesa->driHwLock, rmesa->hHWContext, \
94 (DRM_LOCK_HELD | rmesa->hHWContext), __ret ); \
96 r128GetLock( rmesa, 0 ); \
100 /* Unlock the hardware.
102 #define UNLOCK_HARDWARE( rmesa ) \
104 DRM_UNLOCK( rmesa->driFd, \
106 rmesa->hHWContext ); \
111 #endif /* __R128_LOCK_H__ */