VEBOX/bdw: set downsample method
[platform/upstream/libva-intel-driver.git] / src / i965_mutext.h
1 #ifndef _I965_MUTEX_H_
2 #define _I965_MUTEX_H_
3
4 #include "intel_compiler.h"
5
6 #if defined PTHREADS
7 #include <pthread.h>
8
9 typedef pthread_mutex_t _I965Mutex;
10
11 static INLINE void _i965InitMutex(_I965Mutex *m)
12 {
13     pthread_mutex_init(m, NULL);
14 }
15
16 static INLINE void
17 _i965DestroyMutex(_I965Mutex *m)
18 {
19     pthread_mutex_destroy(m);
20 }
21
22 static INLINE void
23 _i965LockMutex(_I965Mutex *m)
24 {
25     pthread_mutex_lock(m);
26 }
27
28 static INLINE void
29 _i965UnlockMutex(_I965Mutex *m)
30 {
31     pthread_mutex_unlock(m);
32 }
33
34 #define _I965_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
35 #define _I965_DECLARE_MUTEX(m)                    \
36     _I965Mutex m = _I965_MUTEX_INITIALIZER
37
38 #else
39
40 typedef int _I965Mutex;
41 static INLINE void _i965InitMutex(_I965Mutex *m) { (void) m; }
42 static INLINE void _i965DestroyMutex(_I965Mutex *m) { (void) m; }
43 static INLINE void _i965LockMutex(_I965Mutex *m) { (void) m; }
44 static INLINE void _i965UnlockMutex(_I965Mutex *m) { (void) m; }
45
46 #define _I965_MUTEX_INITIALIZER 0
47 #define _I965_DECLARE_MUTEX(m)                    \
48     _I965Mutex m = _I965_MUTEX_INITIALIZER
49
50 #endif
51
52 #endif /* _I965_MUTEX_H_ */