Debian Codegraph @

media_common/linux/common/os/mos_defs_specific.h

raw
1 /*
2 * Copyright (c) 2013-2017, Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22 //!
23 //! \file mos_defs_specific.h
24 //! \brief Defines common types and macros across different platform on Linux
25 //! \details Defines common types and macros across different platform on Linux
26 //!
27 #ifndef __MOS_DEFS_SPECIFIC_H__
28 #define __MOS_DEFS_SPECIFIC_H__
29
30 #include <pthread.h>
31 #include <semaphore.h>
32 #include <cstdint>
33 #include <string>
34
35 typedef pthread_mutex_t MOS_MUTEX, *PMOS_MUTEX; //!< mutex pointer
36 typedef sem_t MOS_SEMAPHORE, *PMOS_SEMAPHORE; //!< semaphore pointer
37 typedef pthread_t MOS_THREADHANDLE; //!< thread handle
38 typedef uint32_t UFKEY, *PUFKEY; //!< Handle of user feature key
39 typedef std::string UFKEY_NEXT, *PUFKEY_NEXT;
40
41 #define _T(x) x
42 #define MAX_PATH 128
43
44 #include <va/va.h> // For VAStatus
45 typedef VAStatus MOS_OSRESULT;
46 #include <stdarg.h>
47 #define MOS_FUNC_EXPORT __attribute__((visibility("default")))
48 #define MOS_DATA_EXPORT __attribute__((visibility("default")))
49 #define MOS_FUNC_PRIVATE __attribute__((visibility("hidden")))
50 #define MOS_DATA_PRIVATE __attribute__((visibility("hidden")))
51 #define MOS_EXPORT_DECL
52
53 #ifndef __UFO_PORTABLE_DATATYPE_DEFINED__
54 typedef struct tagRECT
55 {
56 int32_t left;
57 int32_t top;
58 int32_t right;
59 int32_t bottom;
60 } RECT, *PRECT, *LPRECT;
61
62 typedef union _LARGE_INTEGER {
63 struct {
64 uint32_t LowPart;
65 int32_t HighPart;
66 } DUMMYSTRUCTNAME;
67 struct {
68 uint32_t LowPart;
69 int32_t HighPart;
70 } u;
71 int64_t QuadPart;
72 } LARGE_INTEGER, *PLARGE_INTEGER;
73
74 typedef void* HANDLE; //!< Opaque handle comprehended only by the OS
75 typedef void** PHANDLE; //!< Opaque handle comprehended only by the OS
76 typedef void* HMODULE; //!< Opaque handle comprehended only by the OS
77
78 typedef uint32_t TP_WAIT_RESULT;
79 typedef struct _TP_WAIT TP_WAIT, *PTP_WAIT;
80 typedef struct _TP_CALLBACK_INSTANCE TP_CALLBACK_INSTANCE, *PTP_CALLBACK_INSTANCE;
81
82 #define INFINITE 0xFFFFFFFF
83
84 #endif
85
86 /* compile-time ASSERT */
87
88 #ifndef C_ASSERT
89 #define __CONCATING( a1, a2 ) a1 ## a2
90 #define __UNIQUENAME( a1, a2 ) __CONCATING( a1, a2 )
91 #define UNIQUENAME( __text ) __UNIQUENAME( __text, __COUNTER__ )
92 #define C_ASSERT(e) typedef char UNIQUENAME(STATIC_ASSERT_)[(e)?1:-1]
93 #endif
94
95 #if __GNUC__ < 4
96 #error "Unsupported GCC version. Please use 4.0+"
97 #endif
98
99 #define __noop
100 #if defined __x86_64__
101 #define __stdcall // deprecated for x86-64
102 #define __cdecl // deprecated for x86-64
103 #else
104 #define __cdecl __attribute__((__cdecl__))
105 #define __stdcall __attribute__((__stdcall__))
106 #endif
107
108 #define __declspec(x) __declspec_##x
109
110 #define __MEDIA_PORTABLE_DATAYPE_DEFINED__
111
112 #define _stprintf sprintf
113 #define _sntprintf snprintf
114
115 #define vsprintf_s(pBuffer, size, format, arg) vsnprintf(pBuffer, size, format, arg)
116 #define sprintf_s(pBuffer, size, format, ...) snprintf(pBuffer, size, format, ##__VA_ARGS__)
117
118 enum SYNC_HAZARD
119 {
120 SYNC_RAW_HAZARD,
121 SYNC_WAR_HAZARD,
122 SYNC_WAW_HAZARD
123 };
124
125 #endif // __MOS_DEFS_SPECIFIC_H__