xref: /aosp_15_r20/external/intel-media-driver/media_driver/linux/common/cm/hal/cm_innerdef_os.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 2009-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      cm_innerdef_os.h
24 //! \brief     Contains CM definitions (cm_innerdef_os.h)
25 //!
26 
27 #pragma once
28 
29 #pragma GCC diagnostic ignored "-Wdelete-non-virtual-dtor"
30 #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
31 
32 // Use this Macro to distinguish open-source and close-source.
33 // Note that this will be moved to CMake Files in future
34 #define USE_EXTENSION_CODE 0
35 
36 #include "mos_os.h"
37 #include "media_libva_common.h"
38 #include <sys/types.h>
39 #include <sys/syscall.h>
40 #include <unistd.h>
41 
42 
43 typedef void* UMD_RESOURCE;
44 
45 #define CM_LINUX  1
46 
47 typedef int  (__cdecl *pCallBackReleaseVaSurface)( void *VaDpy, void *pVaSurfID);
48 
49 #define CM_INVALID_TAG              (LONG_LONG_MAX)
50 
51 #define CM_TRACKER_ID_QWORD_PER_TASK     0
52 
53 #define CM_ERROR_NULL_POINTER CM_NULL_POINTER
54 
55 #ifndef _SYSTEMTIME_DEFINE_PROTECTOR_
56 #define _SYSTEMTIME_DEFINE_PROTECTOR_
57 
58 typedef struct _SYSTEMTIME
59 {
60     uint16_t wYear;
61     uint16_t wMonth;
62     uint16_t wDayOfWeek;
63     uint16_t wDay;
64     uint16_t wHour;
65     uint16_t wMinute;
66     uint16_t wSecond;
67     uint16_t wMilliseconds;
68 } SYSTEMTIME, *PSYSTEMTIME;
69 
GetLocalTime(PSYSTEMTIME psystime)70 inline void GetLocalTime(PSYSTEMTIME psystime)
71 {
72     time_t temp;
73     struct tm *ltime;
74     time(&temp);
75     ltime=localtime(&temp);
76     psystime->wYear = ltime->tm_year;
77     psystime->wMonth = ltime->tm_mon;
78     psystime->wDayOfWeek = ltime->tm_wday;
79     psystime->wDay = ltime->tm_mday;
80     psystime->wHour = ltime->tm_hour;
81     psystime->wMinute = ltime->tm_min;
82     psystime->wSecond = ltime->tm_sec;
83     psystime->wMilliseconds = 0;
84 }
85 
86 #endif
87 
88 #define CmGetCurProcessId() getpid()
89 #define CmGetCurThreadId()  syscall(SYS_gettid)
90 
91