Debian Codegraph @

media_driver/agnostic/common/vp/hal/vphal.h

raw
1 /*
2 * Copyright (c) 2009-2025, 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 vphal.h
24 //! \brief vphal interface clarification
25 //! \details vphal interface clarification inlcuding:
26 //! some marcro, enum, structure, function
27 //!
28 #ifndef __VPHAL_H__
29 #define __VPHAL_H__
30
31 #include "mos_utilities.h"
32 #include "mos_util_debug.h"
33 #include "mhw_vebox.h"
34 #include "mhw_sfc.h"
35 #include "vp_pipeline_adapter_base.h"
36 #include "vphal_common_hdr.h"
37 #include "vp_common.h"
38 #include "vp_base.h"
39 #include "renderhal_legacy.h"
40
41 // YUV input ranges
42 #define YUV_RANGE_FROM_DDI 3
43
44 // RGB input ranges
45 #define RGB_RANGE_16_235 1
46 #define RGB_RANGE_0_255 0
47
48 //------------------------------------------------------------------------------
49 // Simplified macros for debug message, Assert, Null check and MOS eStatus check
50 // within VPhal without the need to explicitly pass comp and sub-comp name
51 //------------------------------------------------------------------------------
52
53 //------------------------------------------------------------------------------
54 // Macros specific to MOS_VP_SUBCOMP_HW sub-comp
55 //------------------------------------------------------------------------------
56 #define VPHAL_HW_ASSERT(_expr) \
57 MOS_ASSERT(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_HW, _expr)
58
59 #define VPHAL_HW_ASSERTMESSAGE(_message, ...) \
60 MOS_ASSERTMESSAGE(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_HW, _message, ##__VA_ARGS__)
61
62 #define VPHAL_HW_WARNINGMESSAGE(_message, ...) \
63 MOS_WARNINGMESSAGE(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_HW, _message, ##__VA_ARGS__)
64
65 #define VPHAL_HW_NORMALMESSAGE(_message, ...) \
66 MOS_NORMALMESSAGE(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_HW, _message, ##__VA_ARGS__)
67
68 #define VPHAL_HW_VERBOSEMESSAGE(_message, ...) \
69 MOS_VERBOSEMESSAGE(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_HW, _message, ##__VA_ARGS__)
70
71 #define VPHAL_HW_FUNCTION_ENTER \
72 MOS_FUNCTION_ENTER(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_HW)
73
74 #define VPHAL_HW_CHK_STATUS(_stmt) \
75 MOS_CHK_STATUS(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_HW, _stmt)
76
77 #define VPHAL_HW_CHK_NULL(_ptr) \
78 MOS_CHK_NULL(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_HW, _ptr)
79
80 #define VPHAL_HW_CHK_NULL_NO_STATUS(_ptr) \
81 MOS_CHK_NULL_NO_STATUS(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_HW, _ptr)
82
83 //------------------------------------------------------------------------------
84 // Macros specific to MOS_VP_SUBCOMP_PUBLIC sub-comp
85 //------------------------------------------------------------------------------
86 #define VPHAL_PUBLIC_ASSERT(_expr) \
87 MOS_ASSERT(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_PUBLIC, _expr)
88
89 #define VPHAL_PUBLIC_ASSERTMESSAGE(_message, ...) \
90 MOS_ASSERTMESSAGE(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_PUBLIC, _message, ##__VA_ARGS__)
91
92 #define VPHAL_PUBLIC_WARNINGMESSAGE(_message, ...) \
93 MOS_WARNINGMESSAGE(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_PUBLIC, _message, ##__VA_ARGS__)
94
95 #define VPHAL_PUBLIC_NORMALMESSAGE(_message, ...) \
96 MOS_NORMALMESSAGE(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_PUBLIC, _message, ##__VA_ARGS__)
97
98 #define VPHAL_PUBLIC_VERBOSEMESSAGE(_message, ...) \
99 MOS_VERBOSEMESSAGE(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_PUBLIC, _message, ##__VA_ARGS__)
100
101 #define VPHAL_PUBLIC_FUNCTION_ENTER \
102 MOS_FUNCTION_ENTER(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_PUBLIC)
103
104 #define VPHAL_PUBLIC_CHK_STATUS(_stmt) \
105 MOS_CHK_STATUS(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_PUBLIC, _stmt)
106
107 #define VPHAL_PUBLIC_CHK_STATUS_RETURN(_stmt) \
108 MOS_CHK_STATUS_RETURN(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_PUBLIC, _stmt)
109
110 #define VPHAL_PUBLIC_CHK_NULL(_ptr) \
111 MOS_CHK_NULL(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_PUBLIC, _ptr)
112
113 #define VPHAL_PUBLIC_CHK_NULL_NO_STATUS(_ptr) \
114 MOS_CHK_NULL_NO_STATUS(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_PUBLIC, _ptr)
115
116 #define VPHAL_PUBLIC_CHK_NULL_NO_STATUS_RETURN(_ptr) \
117 MOS_CHK_NULL_NO_STATUS_RETURN(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_PUBLIC, _ptr)
118
119 //------------------------------------------------------------------------------
120 // Macros specific to MOS_VP_SUBCOMP_DEBUG sub-comp
121 //------------------------------------------------------------------------------
122 #define VPHAL_DEBUG_ASSERT(_expr) \
123 MOS_ASSERT(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_DEBUG, _expr)
124
125 #define VPHAL_DEBUG_ASSERTMESSAGE(_message, ...) \
126 MOS_ASSERTMESSAGE(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_DEBUG, _message, ##__VA_ARGS__)
127
128 #define VPHAL_DEBUG_WARNINGMESSAGE(_message, ...) \
129 MOS_WARNINGMESSAGE(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_DEBUG, _message, ##__VA_ARGS__)
130
131 #define VPHAL_DEBUG_NORMALMESSAGE(_message, ...) \
132 MOS_NORMALMESSAGE(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_DEBUG, _message, ##__VA_ARGS__)
133
134 #define VPHAL_DEBUG_VERBOSEMESSAGE(_message, ...) \
135 MOS_VERBOSEMESSAGE(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_DEBUG, _message, ##__VA_ARGS__)
136
137 #define VPHAL_DEBUG_FUNCTION_ENTER \
138 MOS_FUNCTION_ENTER(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_DEBUG)
139
140 #define VPHAL_DEBUG_FUNCTION_EXIT \
141 MOS_FUNCTION_EXIT(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_DEBUG)
142
143 #define VPHAL_DEBUG_CHK_STATUS(_stmt) \
144 MOS_CHK_STATUS(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_DEBUG, _stmt)
145
146 #define VPHAL_DEBUG_CHK_NULL(_ptr) \
147 MOS_CHK_NULL(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_DEBUG, _ptr)
148
149 #define VPHAL_DEBUG_CHK_NULL_NO_STATUS(_ptr) \
150 MOS_CHK_NULL_NO_STATUS(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_DEBUG, _ptr)
151
152 //------------------------------------------------------------------------------
153 // Macros specific to MOS_VP_SUBCOMP_RENDER sub-comp
154 //------------------------------------------------------------------------------
155 #define VPHAL_RENDER_ASSERT(_expr) \
156 MOS_ASSERT(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_RENDER, _expr)
157
158 #define VPHAL_RENDER_ASSERTMESSAGE(_message, ...) \
159 MOS_ASSERTMESSAGE(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_RENDER, _message, ##__VA_ARGS__)
160
161 #define VPHAL_RENDER_WARNINGMESSAGE(_message, ...) \
162 MOS_WARNINGMESSAGE(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_RENDER, _message, ##__VA_ARGS__)
163
164 #define VPHAL_RENDER_NORMALMESSAGE(_message, ...) \
165 MOS_NORMALMESSAGE(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_RENDER, _message, ##__VA_ARGS__)
166
167 #define VPHAL_RENDER_VERBOSEMESSAGE(_message, ...) \
168 MOS_VERBOSEMESSAGE(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_RENDER, _message, ##__VA_ARGS__)
169
170 #define VPHAL_RENDER_FUNCTION_ENTER \
171 MOS_FUNCTION_ENTER(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_RENDER)
172
173 #define VPHAL_RENDER_EXITMESSAGE(_message, ...) \
174 MOS_DEBUGMESSAGE(MOS_MESSAGE_LVL_FUNCTION_EXIT, MOS_COMPONENT_VP, MOS_VP_SUBCOMP_RENDER, _message, ##__VA_ARGS__)
175
176 #define VPHAL_RENDER_CHK_STATUS(_stmt) \
177 MOS_CHK_STATUS(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_RENDER, _stmt)
178
179 #define VPHAL_RENDER_CHK_STATUS_RETURN(_stmt) \
180 MOS_CHK_STATUS_RETURN(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_RENDER, _stmt)
181
182 #define VPHAL_RENDER_CHK_STATUS_MESSAGE(_stmt, _message, ...) \
183 MOS_CHK_STATUS_MESSAGE(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_RENDER, _stmt, _message, ##__VA_ARGS__)
184
185 #define VPHAL_RENDER_CHK_NULL(_ptr) \
186 MOS_CHK_NULL(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_RENDER, _ptr)
187
188 #define VPHAL_RENDER_CHK_NULL_RETURN(_ptr) \
189 MOS_CHK_NULL_RETURN(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_RENDER, _ptr)
190
191 #define VPHAL_RENDER_CHK_NULL_NO_STATUS(_ptr) \
192 MOS_CHK_NULL_NO_STATUS(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_RENDER, _ptr)
193 //!
194 //! \def VPHAL_RENDER_CHK_NULL_NO_STATUS_RETURN(_ptr)
195 //! MOS_ASSERTMESSAGE \a _ptr with MOS utility comp/subcomp info without returning a status
196 //!
197 #define VPHAL_RENDER_CHK_NULL_NO_STATUS_RETURN(_ptr) \
198 MOS_CHK_NULL_NO_STATUS_RETURN(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_RENDER, _ptr)
199
200 //------------------------------------------------------------------------------
201 // Macros specific to MOS_VP_SUBCOMP_DDI sub-comp
202 //------------------------------------------------------------------------------
203 #define VP_DDI_ASSERT(_expr) \
204 MOS_ASSERT(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_DDI, _expr)
205
206 #define VP_DDI_ASSERTMESSAGE(_message, ...) \
207 MOS_ASSERTMESSAGE(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_DDI, _message, ##__VA_ARGS__)
208
209 #define VP_DDI_NORMALMESSAGE(_message, ...) \
210 MOS_NORMALMESSAGE(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_DDI, _message, ##__VA_ARGS__)
211
212 #define VP_DDI_WARNINGMESSAGE(_message, ...) \
213 MOS_WARNINGMESSAGE(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_DDI, _message, ##__VA_ARGS__)
214
215 #define VP_DDI_VERBOSEMESSAGE(_message, ...) \
216 MOS_VERBOSEMESSAGE(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_DDI, _message, ##__VA_ARGS__)
217
218 #define VP_DDI_FUNCTION_ENTER \
219 MOS_FUNCTION_ENTER(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_DDI)
220
221 #define VP_DDI_CHK_STATUS(_stmt) \
222 MOS_CHK_STATUS(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_DDI, _stmt)
223
224 #define VP_DDI_CHK_STATUS_MESSAGE(_stmt, _message, ...) \
225 MOS_CHK_STATUS_MESSAGE(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_DDI, _stmt, _message, ##__VA_ARGS__)
226
227 #define VP_DDI_CHK_NULL(_ptr) \
228 MOS_CHK_NULL(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_DDI, _ptr)
229
230 #define VP_DDI_CHK_NULL_NO_STATUS(_ptr) \
231 MOS_CHK_NULL_NO_STATUS(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_DDI, _ptr)
232
233 #define VPHAL_DDI_CHK_HR(_ptr) \
234 MOS_CHK_HR(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_DDI, _ptr)
235
236 #define VPHAL_DDI_CHK_NULL_WITH_HR(_ptr) \
237 MOS_CHK_NULL_WITH_HR(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_DDI, _ptr)
238
239 //!
240 //! \brief VPHAL SS/EU setting
241 //!
242 struct VphalSseuSetting
243 {
244 uint8_t numSlices;
245 uint8_t numSubSlices;
246 uint8_t numEUs;
247 uint8_t reserved; // Place holder for frequency setting
248 };
249
250 //!
251 //! \brief Gpu context entry
252 //!
253 struct VPHAL_GPU_CONTEXT_ENTRY
254 {
255 MOS_GPU_CONTEXT gpuCtxForMos = MOS_GPU_CONTEXT_MAX;
256 GPU_CONTEXT_HANDLE gpuContextHandle = MOS_GPU_CONTEXT_INVALID_HANDLE;
257 void* pGpuContext = nullptr;
258 };
259
260 //-----------------------------------------------------------------------------
261 // VPHAL-DDI RENDERING INTERFACE
262 //
263 // Params that may apply to more than one layer are part of VPHAL_SURFACE
264 // DDI layers must set this interface before calling pfnRender
265 //-----------------------------------------------------------------------------
266 //!
267 //! Structure VphalSettings
268 //! \brief VPHAL Settings - controls allocation of internal resources in VPHAL
269 //!
270 using VphalSettings = VpSettings;
271 #pragma pack(push)
272 #pragma pack(1)
273
274 #pragma pack(pop)
275
276
277 //!
278 //! Class VphalState
279 //! \brief VPHAL class definition
280 //!
281 class VphalState : public VpBase
282 {
283 public:
284 // Perf Optimize for ClearVideoView DDI
285 bool m_clearVideoViewMode = false;
286
287 // factory function
288 static VphalState* VphalStateFactory(
289 PMOS_INTERFACE pOsInterface,
290 PMOS_CONTEXT pOsDriverContext,
291 MOS_STATUS *peStatus);
292
293 //!
294 //! \brief VphalState Constructor
295 //! \details Creates instance of VphalState
296 //! - Caller must call Allocate to allocate all VPHAL states and objects.
297 //! \param [in] pOsInterface
298 //! OS interface, if provided externally - may be nullptr
299 //! \param [in] pOsDriverContext
300 //! OS driver context (UMD context, pShared, ...)
301 //! \param [in,out] peStatus
302 //! Pointer to the MOS_STATUS flag.
303 //! Will assign this flag to MOS_STATUS_SUCCESS if successful, otherwise failed
304 //!
305 VphalState(
306 PMOS_INTERFACE pOsInterface,
307 MOS_STATUS *peStatus);
308
309 //!
310 //! \brief Copy constructor
311 //!
312 VphalState(const VphalState&) = delete;
313
314 //!
315 //! \brief Copy assignment operator
316 //!
317 VphalState& operator=(const VphalState&) = delete;
318
319 //!
320 //! \brief VphalState Destuctor
321 //! \details Destroys VPHAL and all internal states and objects
322 //!
323 virtual ~VphalState();
324
325 //!
326 //! \brief Allocate VPHAL Resources
327 //! \details Allocate VPHAL Resources
328 //! - Allocate and initialize HW states
329 //! - Allocate and initialize renderer states
330 //! \param [in] pVpHalSettings
331 //! Pointer to VPHAL Settings
332 //! \return MOS_STATUS
333 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
334 //!
335 virtual MOS_STATUS Allocate(
336 const VphalSettings *pVpHalSettings) override;
337
338 //!
339 //! \brief Performs VP Rendering
340 //! \details Performs VP Rendering
341 //! - call default render of video
342 //! \param [in] pcRenderParams
343 //! Pointer to Render Params
344 //! \return MOS_STATUS
345 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
346 //!
347 virtual MOS_STATUS Render(
348 PCVPHAL_RENDER_PARAMS pcRenderParams) override;
349
350 //!
351 //! \brief Get feature reporting from renderer
352 //! \details Get feature reporting from renderer
353 //! \return VphalFeatureReport*
354 //! Pointer to VPHAL_FEATURE_REPOR: rendering features reported
355 //!
356 virtual VphalFeatureReport* GetRenderFeatureReport() override;
357
358 //!
359 //! \brief Get Status Report
360 //! \details Get Status Report, will return back to app indicating if related frame id is done by gpu
361 //! \param [out] pQueryReport
362 //! Pointer to pQueryReport, the status query report array.
363 //! \param [in] wStatusNum
364 //! The size of array pQueryReport.
365 //! \return MOS_STATUS
366 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
367 virtual MOS_STATUS GetStatusReport(
368 PQUERY_STATUS_REPORT_APP pQueryReport,
369 uint16_t numStatus) override;
370
371 //!
372 //! \brief Get Status Report's entry length from head to tail
373 //! \details Get Status Report's entry length from head to tail
374 //! \param [out] puiLength
375 //! Pointer to the entry length
376 //! \return MOS_STATUS
377 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
378 //!
379 virtual MOS_STATUS GetStatusReportEntryLength(
380 uint32_t *puiLength) override;
381
382 virtual PLATFORM &GetPlatform() override
383 {
384 return m_platform;
385 }
386
387 virtual MEDIA_FEATURE_TABLE *GetSkuTable() override
388 {
389 return m_skuTable;
390 }
391
392 MEDIA_WA_TABLE* GetWaTable()
393 {
394 return m_waTable;
395 }
396
397 virtual PMOS_INTERFACE GetOsInterface() override
398 {
399 return m_osInterface;
400 }
401
402 virtual PRENDERHAL_INTERFACE GetRenderHal() override
403 {
404 return m_renderHal;
405 }
406
407 PMHW_VEBOX_INTERFACE GetVeboxInterface()
408 {
409 return m_veboxInterface;
410 }
411
412 MhwCpInterface* GetCpInterface()
413 {
414 return m_cpInterface;
415 }
416
417 PMHW_SFC_INTERFACE GetSfcInterface()
418 {
419 return m_sfcInterface;
420 }
421
422 VphalRenderer* GetRenderer()
423 {
424 return m_renderer;
425 }
426
427 VPHAL_STATUS_TABLE& GetStatusTable()
428 {
429 return m_statusTable;
430 }
431
432 void SetMhwVeboxInterface(MhwVeboxInterface* veboxInterface)
433 {
434 if (veboxInterface == nullptr)
435 {
436 return;
437 }
438
439 if (m_veboxInterface != nullptr)
440 {
441 m_veboxItf = std::static_pointer_cast<mhw::vebox::Itf>(m_veboxInterface->GetNewVeboxInterface());
442 MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
443
444 if (m_veboxItf)
445 {
446 eStatus = m_veboxItf->DestroyHeap();
447 if (eStatus != MOS_STATUS_SUCCESS)
448 {
449 VPHAL_PUBLIC_ASSERTMESSAGE("Failed to destroy Vebox Interface, eStatus:%d.\n", eStatus);
450 }
451 }
452
453 eStatus = m_veboxInterface->DestroyHeap();
454 MOS_Delete(m_veboxInterface);
455 m_veboxInterface = nullptr;
456 if (eStatus != MOS_STATUS_SUCCESS)
457 {
458 VPHAL_PUBLIC_ASSERTMESSAGE("Failed to destroy Vebox Interface, eStatus:%d.\n", eStatus);
459 }
460 }
461
462 m_veboxInterface = veboxInterface;
463 m_veboxItf = std::static_pointer_cast<mhw::vebox::Itf>(veboxInterface->GetNewVeboxInterface());
464 }
465
466 void SetMhwSfcInterface(MhwSfcInterface* sfcInterface)
467 {
468 if (sfcInterface == nullptr)
469 {
470 return;
471 }
472
473 if (m_sfcInterface != nullptr)
474 {
475 MOS_Delete(m_sfcInterface);
476 m_sfcInterface = nullptr;
477 }
478
479 m_sfcInterface = sfcInterface;
480 }
481
482 virtual MOS_STATUS GetVpMhwInterface(
483 VP_MHWINTERFACE &vpMhwinterface);
484
485 protected:
486 // Internals
487 PLATFORM m_platform;
488 MEDIA_FEATURE_TABLE *m_skuTable;
489 MEDIA_WA_TABLE *m_waTable;
490
491 // States
492 PMOS_INTERFACE m_osInterface;
493 PRENDERHAL_INTERFACE_LEGACY m_renderHal;
494 PMHW_VEBOX_INTERFACE m_veboxInterface;
495 MhwCpInterface *m_cpInterface;
496 PMHW_SFC_INTERFACE m_sfcInterface;
497 VphalRenderer *m_renderer;
498 std::shared_ptr<mhw::vebox::Itf> m_veboxItf = nullptr;
499
500 // Render GPU context/node
501 MOS_GPU_NODE m_renderGpuNode;
502 MOS_GPU_CONTEXT m_renderGpuContext;
503
504 // StatusTable indicating if command is done by gpu or not
505 VPHAL_STATUS_TABLE m_statusTable = {};
506
507 MediaUserSettingSharedPtr m_userSettingPtr = nullptr; //!< usersettingInstance
508
509 // Same MOS_GPU_CONTEXT may be created in MediaContext with a different handle,
510 // which will cause the gpuContext created in VphalState missed to be destroyed during
511 // m_osInterface being destroyed. m_gpuContextCheckList is used to store gpu contexts
512 // which may encounter such case.
513 std::vector<VPHAL_GPU_CONTEXT_ENTRY> m_gpuContextCheckList;
514
515 //!
516 //! \brief Create instance of VphalRenderer
517 //! \details Create instance of VphalRenderer
518 //! \return MOS_STATUS
519 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
520 //!
521 virtual MOS_STATUS CreateRenderer() = 0;
522
523 virtual bool IsApoEnabled() override
524 {
525 return false;
526 }
527
528 virtual bool IsRenderContextBasedSchedulingNeeded()
529 {
530 return false;
531 }
532
533 private:
534 //!
535 //! \brief Put GPU context entry
536 //! \details Put GPU context entry in the m_gpuContextCheckList
537 //! \param MOS_GPU_CONTEXT mosGpuConext
538 //! [in] Mos GPU context
539 //! \return MOS_STATUS
540 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
541 //!
542 MOS_STATUS AddGpuContextToCheckList(
543 MOS_GPU_CONTEXT mosGpuConext);
544
545 //!
546 //! \brief Destroy GPU context entry with invalid handle
547 //! \details Release these GPU context overwritten by MediaContext
548 //! \return MOS_STATUS
549 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
550 //!
551 MOS_STATUS DestroyGpuContextWithInvalidHandle();
552
553 //!
554 //! \brief Check whether GPU context is reused or not
555 //! \details Check whether GPU context is reused or not
556 //! \param MOS_GPU_CONTEXT mosGpuConext
557 //! [in] Mos GPU context
558 //! \return bool
559 //! Return true if is reused, otherwise false
560 //!
561 bool IsGpuContextReused(
562 MOS_GPU_CONTEXT mosGpuContext);
563 };
564
565 #endif // __VPHAL_H__