Debian Codegraph @

media_softlet/agnostic/common/os/mos_os_mock_adaptor.h

raw
1 /*
2 * Copyright (c) 2020-2026, 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_os_mock_adaptor.h
24 //! \brief Common interface and structure used in mock adaptor.
25 //!
26
27 #ifndef __MOS_OS_MOCK_ADAPTOR_H__
28 #define __MOS_OS_MOCK_ADAPTOR_H__
29
30 #include "mos_os.h"
31 #include "mos_os_specific.h"
32
33 #define MOS_MOCKADAPTOR_DEFAULT_PLATFORM "tgllp"
34 #define MOS_MOCKADAPTOR_DEFAULT_STEPPING "a0"
35
36 class MosMockAdaptor
37 {
38 public:
39 MosMockAdaptor();
40
41 virtual ~MosMockAdaptor();
42
43 //!
44 //! \brief Interface for initializing Mock Adaptor.
45 //! \details Interface for initializing Mock Adaptor.
46 //! \param [in/out] osContext
47 //! Pointer to OS context.
48 //! \return MOS_STATUS
49 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
50 //!
51 MOS_STATUS Init(
52 MOS_CONTEXT_HANDLE osDriverContext,
53 OsContextNext *osDeviceContext);
54
55 //!
56 //! \brief Destroy MockAdaptor.
57 //! \details Destroy MockAdaptor.
58 //! \return void
59 //!
60 MOS_STATUS Destroy();
61
62 protected:
63 //!
64 //! \brief Initialize MockAdaptor and replace platform information for device context.
65 //! \details Initialize according to regkey and replace platform infomation for device context.
66 //! \param [in] osContext
67 //! Pointer to Os Context.
68 //! \return MOS_STATUS
69 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
70 //!
71 MOS_STATUS Initialize(
72 PMOS_CONTEXT osContext);
73
74 //!
75 //! \brief Read corresponding regkey for mockadaptor
76 //! \details Read corresponding regkey for mockadaptor.
77 //! \param [in] osContext
78 //! Pointer to Os Context.
79 //! \return MOS_STATUS
80 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
81 //!
82 MOS_STATUS RegkeyRead(PMOS_CONTEXT osContext);
83
84 //!
85 //! \brief Initialize PlatForm.
86 //! \details Initialize PlatForm according to the regkey.
87 //! \return MOS_STATUS
88 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
89 //!
90 MOS_STATUS InitializePlatForm();
91
92 //!
93 //! \brief Initialize SKU/WA table for device context.
94 //! \details Initialize the SKU/WA table for device context by mocking.
95 //! \return MOS_STATUS
96 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
97 //!
98 virtual MOS_STATUS InitializeSkuWaTable(PMOS_CONTEXT context)
99 {
100 return MOS_STATUS_SUCCESS;
101 }
102
103 //!
104 //! \brief Replace platform infomation for device context.
105 //! \details Replace platform infomation for device context.
106 //! \return MOS_STATUS
107 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
108 //!
109 virtual MOS_STATUS ReplacePlatformInfo(PMOS_CONTEXT context)
110 {
111 return MOS_STATUS_SUCCESS;
112 }
113
114 //!
115 //! \brief Initialize device context.
116 //! \details Initialize the device context according the regkey.
117 //! \return MOS_STATUS
118 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
119 //!
120 virtual MOS_STATUS InitContext(
121 PMOS_CONTEXT osContext);
122
123 //!
124 //! \brief Update User FeatureKey
125 //! \details Update User FeatureKey to report platform info.
126 //! \return MOS_STATUS
127 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
128 //!
129 virtual MOS_STATUS UpdateUserFeatureKey(
130 PMOS_CONTEXT osContext)
131 {
132 return MOS_STATUS_SUCCESS;
133 }
134
135 protected:
136 PLATFORM *m_pPlatform;
137 MEDIA_WA_TABLE *m_pWaTable;
138 MEDIA_FEATURE_TABLE *m_pSkuTable;
139 MEDIA_SYSTEM_INFO *m_pGtSystemInfo;
140
141 PRODUCT_FAMILY m_productFamily;
142 std::string m_stepping;
143 uint16_t m_deviceId;
144 uint16_t m_numOfVdbox;
145 bool m_enabled;
146
147 MEDIA_CLASS_DEFINE_END(MosMockAdaptor)
148 };
149
150 #endif // __MOS_OS_MOCK_ADAPTOR_H__