Merge branch 'mesa_7_7_branch'
[mesa.git] / src / mesa / drivers / dri / ffb / ffb_lock.h
1
2 #ifndef _FFB_LOCK_H
3 #define _FFB_LOCK_H
4
5 #include "ffb_context.h"
6
7 extern void ffbXMesaUpdateState(ffbContextPtr fmesa);
8 #define FFB_UPDATE_STATE(fmesa) ffbXMesaUpdateState(fmesa)
9
10 /* Lock the hardware and validate our state. This hardware can only ever
11 * exist on SPARC platforms. Don't bother building the real LOCK_HARDWARE and
12 * UNLOCK_HARDWARE code on non-SPARC platforms. The only reason the driver
13 * gets built on non-SPARC is to catch build breakages earlier.
14 */
15 #if !defined(__sparc__)
16 #define LOCK_HARDWARE(fmesa)
17 #define UNLOCK_HARDWARE(fmesa)
18 #else
19 #define LOCK_HARDWARE(fmesa) \
20 do { \
21 DRM_CAS_RESULT(__ret); \
22 DRM_CAS(fmesa->driHwLock, fmesa->hHWContext, \
23 (DRM_LOCK_HELD | fmesa->hHWContext), __ret);\
24 if (__ret) { \
25 drmGetLock(fmesa->driFd, fmesa->hHWContext, 0); \
26 FFB_UPDATE_STATE(fmesa); \
27 } \
28 } while (0)
29
30
31 /* Unlock the hardware. */
32 #define UNLOCK_HARDWARE(fmesa) \
33 DRM_UNLOCK(fmesa->driFd, fmesa->driHwLock, fmesa->hHWContext);
34 #endif
35
36 #endif /* !(_FFB_LOCK_H) */