xref: /aosp_15_r20/external/intel-media-driver/cmrtlib/linux/share/cm_include.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 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 // cm_include.h : include file for standard system include files,
23 // or project specific include files that are used frequently, but
24 // are changed infrequently
25 //
26 
27 #ifndef CMRTLIB_LINUX_SHARE_CM_INCLUDE_H_
28 #define CMRTLIB_LINUX_SHARE_CM_INCLUDE_H_
29 
30 #include <dlfcn.h>
31 
32 #ifndef ANDROID
33 #include "va/va.h"
34 #else
35 #include <va/va_android.h>
36 #define Display unsigned int
37 #define ANDROID_DISPLAY 0x18c34078
38 #endif
39 
40 #define sprintf_s snprintf
41 
42 #ifdef CM_RT_EXPORTS
43 #define CM_RT_API __attribute__((visibility("default")))
44 #else
45 #define CM_RT_API
46 #endif
47 
48 #ifndef CM_NOINLINE
49   #define CM_NOINLINE __attribute__((noinline))
50 #endif
51 
52 #define __cdecl
53 #define __stdcall  __attribute__((__stdcall__))
54 
55 #ifdef __try
56 #undef __try
57 #endif
58 #define __try try
59 
60 #ifdef __except
61 #undef __except
62 #endif
63 #define __except(e)  catch(e)
64 
65 #define  EXCEPTION_EXECUTE_HANDLER std::exception const& e
66 
67 #if NO_EXCEPTION_HANDLING || ANDROID
68     #define try         if (true)
69     #define catch(x)    if (false)
70     #define throw(...)
71 #endif
72 
73 typedef union _LARGE_INTEGER
74 {
75     struct
76     {
77         unsigned int LowPart;
78         int HighPart;
79     } u;
80     long long int QuadPart;
81 } LARGE_INTEGER;
82 
83 typedef int HANDLE;
84 
85 extern "C" int32_t QueryPerformanceFrequency(LARGE_INTEGER *frequency);
86 extern "C" int32_t QueryPerformanceCounter(LARGE_INTEGER *performanceCount);
87 
88 #endif  // #ifndef CMRTLIB_LINUX_SHARE_CM_INCLUDE_H_
89