1 /* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
3 * Copyright 2000 Gareth Hughes
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * GARETH HUGHES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 * Gareth Hughes <gareth@valinux.com>
31 #ifndef __MACH64_LOCK_H__
32 #define __MACH64_LOCK_H__
34 extern void mach64GetLock( mach64ContextPtr mmesa
, GLuint flags
);
37 /* Turn DEBUG_LOCKING on to find locking conflicts.
39 #define DEBUG_LOCKING 1
42 extern char *prevLockFile
;
43 extern int prevLockLine
;
45 #define DEBUG_LOCK() \
47 prevLockFile = (__FILE__); \
48 prevLockLine = (__LINE__); \
51 #define DEBUG_RESET() \
57 #define DEBUG_CHECK_LOCK() \
59 if ( prevLockFile ) { \
61 "LOCK SET!\n\tPrevious %s:%d\n\tCurrent: %s:%d\n", \
62 prevLockFile, prevLockLine, __FILE__, __LINE__ ); \
71 #define DEBUG_CHECK_LOCK()
76 * !!! We may want to separate locks from locks with validation. This
77 * could be used to improve performance for those things commands that
78 * do not do any drawing !!!
81 /* Lock the hardware and validate our state.
83 #define LOCK_HARDWARE( mmesa ) \
87 DRM_CAS( mmesa->driHwLock, mmesa->hHWContext, \
88 (DRM_LOCK_HELD | mmesa->hHWContext), __ret ); \
90 mach64GetLock( mmesa, 0 ); \
94 /* Unlock the hardware.
96 #define UNLOCK_HARDWARE( mmesa ) \
98 DRM_UNLOCK( mmesa->driFd, \
100 mmesa->hHWContext ); \
104 #endif /* __MACH64_LOCK_H__ */