-
Notifications
You must be signed in to change notification settings - Fork 351
/
Copy pathmhw_cp_interface.h
366 lines (307 loc) · 9.28 KB
/
mhw_cp_interface.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
/*
* Copyright (c) 2014-2017, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
//!
//! \file mhw_cp_interface.h
//! \brief MHW interface for content protection
//! \details Impelements the functionalities across all platforms for content protection
//!
#ifndef __MHW_CP_INTERFACE_H__
#define __MHW_CP_INTERFACE_H__
#include "mhw_mi.h"
#include "mos_os.h"
#include "mos_util_debug.h"
class MhwMiInterface;
namespace mhw
{
namespace mi
{
class Itf;
}
} // namespace mhw
typedef int32_t CP_MODE;
#define CP_TYPE_NONE 0
enum _CP_SECURITY_TYPE: int32_t;
typedef enum _CP_SECURITY_TYPE CP_SECURITY_TYPE;
typedef struct _MHW_CP_SLICE_INFO_PARAMS
{
PMOS_RESOURCE presDataBuffer = nullptr;
uint32_t dwDataLength[2] = {0}; // 1 is for DECE mode, 0 is for others
uint32_t dwDataStartOffset[2] = {0}; // 1 is for DECE mode, 0 is for others
uint32_t dwSliceIndex = 0;
bool bLastPass = false;
uint32_t dwTotalBytesConsumed = 0;
} MHW_CP_SLICE_INFO_PARAMS, *PMHW_CP_SLICE_INFO_PARAMS;
typedef struct _MHW_CP_COPY_PARAMS
{
PMOS_RESOURCE presSrc;
PMOS_RESOURCE presDst;
uint32_t size;
uint16_t lengthOfTable;
bool isEncodeInUse;
} MHW_CP_COPY_PARAMS, *PMHW_CP_COPY_PARAMS;
typedef struct _MHW_ADD_CP_COPY_PARAMS
{
PMOS_RESOURCE presSrc;
PMOS_RESOURCE presDst;
uint64_t offset;
uint32_t size;
bool bypass;
} MHW_ADD_CP_COPY_PARAMS, *PMHW_ADD_CP_COPY_PARAMS;
static void MhwStubMessage()
{
MOS_NORMALMESSAGE(MOS_COMPONENT_CP, MOS_CP_SUBCOMP_MHW, "This function is stubbed as it is not implemented.");
}
class MhwCpInterface
{
public:
virtual ~MhwCpInterface() {}
virtual MOS_STATUS AddProlog(
PMOS_INTERFACE osInterface,
PMOS_COMMAND_BUFFER cmdBuffer)
{
MOS_UNUSED(osInterface);
MOS_UNUSED(cmdBuffer);
MhwStubMessage();
return MOS_STATUS_SUCCESS;
}
virtual MOS_STATUS RefreshCounter(
PMOS_INTERFACE osInterface,
PMOS_COMMAND_BUFFER cmdBuffer)
{
MOS_UNUSED(osInterface);
MOS_UNUSED(cmdBuffer);
return MOS_STATUS_SUCCESS;
}
virtual bool IsHwCounterIncrement(
PMOS_INTERFACE osInterface)
{
MOS_UNUSED(osInterface);
MhwStubMessage();
return false;
}
virtual MOS_STATUS AddEpilog(
PMOS_INTERFACE osInterface,
PMOS_COMMAND_BUFFER cmdBuffer)
{
MOS_UNUSED(osInterface);
MOS_UNUSED(cmdBuffer);
MhwStubMessage();
return MOS_STATUS_SUCCESS;
}
virtual MOS_STATUS AddCheckForEarlyExit(
PMOS_INTERFACE osInterface,
PMOS_COMMAND_BUFFER cmdBuffer)
{
MOS_UNUSED(osInterface);
MOS_UNUSED(cmdBuffer);
MhwStubMessage();
return MOS_STATUS_SUCCESS;
}
virtual MOS_STATUS CheckStatusReportNum(
void * mfxRegisters,
uint32_t cencBufIndex,
PMOS_RESOURCE resource,
PMOS_COMMAND_BUFFER cmdBuffer)
{
MOS_UNUSED(mfxRegisters);
MOS_UNUSED(cencBufIndex);
MOS_UNUSED(resource);
MOS_UNUSED(cmdBuffer);
MhwStubMessage();
return MOS_STATUS_SUCCESS;
}
virtual MOS_STATUS SetCpCopy(
PMOS_INTERFACE osInterface,
PMOS_COMMAND_BUFFER cmdBuffer,
PMHW_CP_COPY_PARAMS params)
{
MOS_UNUSED(osInterface);
MOS_UNUSED(cmdBuffer);
MOS_UNUSED(params);
MhwStubMessage();
return MOS_STATUS_SUCCESS;
}
virtual MOS_STATUS AddCpCopy(
PMOS_INTERFACE osInterface,
PMOS_COMMAND_BUFFER cmdBuffer,
PMHW_ADD_CP_COPY_PARAMS params)
{
MOS_UNUSED(osInterface);
MOS_UNUSED(cmdBuffer);
MOS_UNUSED(params);
MhwStubMessage();
return MOS_STATUS_SUCCESS;
}
virtual MOS_STATUS ReadEncodeCounterFromHW(
PMOS_INTERFACE osInterface,
PMOS_COMMAND_BUFFER cmdBuffer,
PMOS_RESOURCE resource,
uint16_t currentIndex)
{
MOS_UNUSED(osInterface);
MOS_UNUSED(cmdBuffer);
MOS_UNUSED(resource);
MOS_UNUSED(currentIndex);
MhwStubMessage();
return MOS_STATUS_SUCCESS;
}
virtual MOS_STATUS SetProtectionSettingsForMiFlushDw(
PMOS_INTERFACE osInterface,
void * cmd)
{
MOS_UNUSED(osInterface);
MOS_UNUSED(cmd);
MhwStubMessage();
return MOS_STATUS_SUCCESS;
}
virtual MOS_STATUS SetProtectionSettingsForMfxWait(
PMOS_INTERFACE osInterface,
void * cmd)
{
MOS_UNUSED(osInterface);
MOS_UNUSED(cmd);
MhwStubMessage();
return MOS_STATUS_SUCCESS;
}
virtual MOS_STATUS SetProtectionSettingsForMfxPipeModeSelect(uint32_t *data)
{
MOS_UNUSED(data);
MhwStubMessage();
return MOS_STATUS_SUCCESS;
}
virtual MOS_STATUS SetProtectionSettingsForHcpPipeModeSelect(
uint32_t *data,
bool scalableEncode = false)
{
MOS_UNUSED(data);
MhwStubMessage();
return MOS_STATUS_SUCCESS;
}
virtual MOS_STATUS SetProtectionSettingsForHucPipeModeSelect(uint32_t *data)
{
MOS_UNUSED(data);
MhwStubMessage();
return MOS_STATUS_SUCCESS;
}
virtual MOS_STATUS SetProtectionSettingsForReservedPipeModeSelect(uint32_t *data)
{
MOS_UNUSED(data);
MhwStubMessage();
return MOS_STATUS_SUCCESS;
}
virtual MOS_STATUS SetMfxProtectionState(
bool isDecodeInUse,
PMOS_COMMAND_BUFFER cmdBuffer,
PMHW_BATCH_BUFFER batchBuffer,
PMHW_CP_SLICE_INFO_PARAMS sliceInfoParam)
{
MOS_UNUSED(isDecodeInUse);
MOS_UNUSED(cmdBuffer);
MOS_UNUSED(batchBuffer);
MOS_UNUSED(sliceInfoParam);
MhwStubMessage();
return MOS_STATUS_SUCCESS;
}
virtual MOS_STATUS SetHcpProtectionState(
bool isDecodeInUse,
PMOS_COMMAND_BUFFER cmdBuffer,
PMHW_BATCH_BUFFER batchBuffer,
PMHW_CP_SLICE_INFO_PARAMS sliceInfoParam)
{
MOS_UNUSED(isDecodeInUse);
MOS_UNUSED(cmdBuffer);
MOS_UNUSED(batchBuffer);
MOS_UNUSED(sliceInfoParam);
MhwStubMessage();
return MOS_STATUS_SUCCESS;
}
virtual MOS_STATUS RegisterMiInterface(
MhwMiInterface *miInterface)
{
MOS_UNUSED(miInterface);
MhwStubMessage();
return MOS_STATUS_SUCCESS;
}
virtual MOS_STATUS RegisterMiInterfaceNext(
std::shared_ptr<mhw::mi::Itf> m_miItf)
{
MOS_UNUSED(m_miItf);
MhwStubMessage();
return MOS_STATUS_SUCCESS;
}
virtual void GetCpStateLevelCmdSize(
uint32_t &cmdSize,
uint32_t &patchListSize)
{
cmdSize = 0;
patchListSize = 0;
MhwStubMessage();
return;
}
virtual void GetCpSliceLevelCmdSize(
uint32_t &cmdSize,
uint32_t &patchListSize)
{
cmdSize = 0;
patchListSize = 0;
MhwStubMessage();
return;
}
virtual void RegisterParams(void *params)
{
MOS_UNUSED(params);
MhwStubMessage();
}
virtual MOS_STATUS UpdateParams(bool isInput)
{
MOS_UNUSED(isInput);
MhwStubMessage();
return MOS_STATUS_SUCCESS;
}
virtual void SetCpSecurityType(
CP_SECURITY_TYPE type = static_cast<CP_SECURITY_TYPE>(1))
{
MOS_UNUSED(type);
MhwStubMessage();
}
virtual MOS_STATUS GetCounterValue(uint32_t *ctr)
{
MhwStubMessage();
return MOS_STATUS_SUCCESS;
}
MEDIA_CLASS_DEFINE_END(MhwCpInterface)
};
//!
//! \brief Create MhwCpInterface Object
//! Must use Delete_MhwCpInterface to delete created Object to avoid ULT Memory Leak errors
//!
//! \return Return CP Wrapper Object if CPLIB not loaded
//!
MhwCpInterface* Create_MhwCpInterface(PMOS_INTERFACE osInterface);
//!
//! \brief Delete the MhwCpInterface Object
//!
//! \param [in] *pMhwCpInterface
//! MhwCpInterface
//!
void Delete_MhwCpInterface(MhwCpInterface* pMhwCpInterface);
#endif