1 /* 2 * Copyright (c) 2022-2024, 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 vp_base.h 24 //! \brief vp base clarification 25 //! \details vp base clarification inlcuding: 26 //! some marcro, enum, structure, function 27 //! 28 #ifndef __VP_BASE_H__ 29 #define __VP_BASE_H__ 30 31 #include <stdint.h> 32 #include "mos_defs.h" 33 #include "vp_common.h" 34 #include "vp_common_tools.h" 35 #include "mhw_vebox.h" 36 #include "mhw_sfc.h" 37 #include "igfxfmid.h" 38 #include "media_class_trace.h" 39 #include "media_skuwa_specific.h" 40 #include "mos_os.h" 41 #include "mos_os_specific.h" 42 #include "vp_feature_report.h" 43 #include "mos_os_cp_interface_specific.h" 44 45 class MediaScalability; 46 class MediaContext; 47 48 using VphalFeatureReport = VpFeatureReport; 49 50 namespace vp 51 { 52 class VpPlatformInterface; 53 class VpUserFeatureControl; 54 }; // namespace vp 55 56 class VpExtIntfBase; 57 58 //----------------------------------------------------------------------------- 59 // VPHAL-DDI RENDERING INTERFACE 60 // 61 // Params that may apply to more than one layer are part of VPHAL_SURFACE 62 // DDI layers must set this interface before calling pfnRender 63 //----------------------------------------------------------------------------- 64 //! 65 //! Structure VpSettings 66 //! \brief VPHAL Settings - controls allocation of internal resources in VPHAL 67 //! 68 struct VpSettings 69 { 70 //! 71 //! \brief VpSettings Constructor 72 //! \details Creates instance of VpSettings 73 //! VpSettingsVpSettings74 VpSettings() : maxPhases(0), 75 mediaStates(0), 76 sameSampleThreshold(0), 77 disableDnDi(0), 78 kernelUpdate(0), 79 disableHdr(0), 80 veboxParallelExecution(0), 81 clearVideoViewMode(false){}; 82 83 int32_t maxPhases; 84 int32_t mediaStates; 85 int32_t sameSampleThreshold; 86 uint32_t disableDnDi; //!< For validation purpose 87 uint32_t kernelUpdate; //!< For VEBox Copy and Update kernels 88 uint32_t disableHdr; //!< Disable Hdr 89 uint32_t veboxParallelExecution; //!< Control VEBox parallel execution with render engine 90 bool clearVideoViewMode; //!< Perf Optimize for ClearVideoView DDI 91 }; 92 93 struct _VP_MHWINTERFACE 94 { 95 // Internals 96 PLATFORM m_platform; 97 MEDIA_FEATURE_TABLE *m_skuTable; 98 MEDIA_WA_TABLE * m_waTable; 99 100 // States 101 PMOS_INTERFACE m_osInterface; 102 PRENDERHAL_INTERFACE m_renderHal; 103 PMHW_VEBOX_INTERFACE m_veboxInterface; 104 MhwCpInterface * m_cpInterface; 105 PMHW_SFC_INTERFACE m_sfcInterface; 106 PMHW_MI_INTERFACE m_mhwMiInterface; 107 vp::VpPlatformInterface *m_vpPlatformInterface; 108 void * m_settings; 109 VpFeatureReport * m_reporting; 110 111 // Render GPU context/node 112 MOS_GPU_NODE m_renderGpuNode; 113 MOS_GPU_CONTEXT m_renderGpuContext; 114 115 // vp Pipeline workload status report 116 PVPHAL_STATUS_TABLE m_statusTable; 117 118 void *m_debugInterface; 119 vp::VpUserFeatureControl *m_userFeatureControl; 120 121 MediaScalability *m_singlePipeScalability; 122 MediaScalability *m_multiPipeScalability; 123 124 MOS_STATUS (*pfnCreateSinglePipe)( 125 void *hwInterface, MediaContext *mediaContext, uint8_t componentType); 126 127 MOS_STATUS (*pfnCreateMultiPipe)( 128 void *hwInterface, MediaContext *mediaContext, uint8_t componentType); 129 130 bool m_bIsMediaSfcInterfaceInUse = false; 131 }; 132 133 using VP_MHWINTERFACE = _VP_MHWINTERFACE; 134 using PVP_MHWINTERFACE = VP_MHWINTERFACE *; 135 136 class VpBase 137 { 138 public: 139 VpBase(); 140 141 virtual ~VpBase(); 142 143 // factory function 144 static VpBase* VphalStateFactory( 145 PMOS_INTERFACE osInterface, 146 MOS_CONTEXT_HANDLE osDriverContext, 147 MOS_STATUS *eStatus, 148 bool clearViewMode = false); 149 150 //! 151 //! \brief Allocate VpPipelineAdapterBase Resources 152 //! \details Allocate VpPipelineAdapterBase Resources 153 //! - Allocate and initialize HW states 154 //! - Allocate and initialize renderer states 155 //! \param [in] pVpHalSettings 156 //! Pointer to VPHAL Settings 157 //! \return MOS_STATUS 158 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed 159 //! 160 virtual MOS_STATUS Allocate( 161 const VpSettings *pVpSettings) = 0; 162 163 virtual VphalFeatureReport *GetRenderFeatureReport() = 0; 164 165 virtual PLATFORM& GetPlatform() = 0; 166 167 virtual MEDIA_FEATURE_TABLE* GetSkuTable() = 0; 168 169 virtual PMOS_INTERFACE GetOsInterface() = 0; 170 171 virtual PRENDERHAL_INTERFACE GetRenderHal() = 0; 172 173 virtual MOS_STATUS Render( 174 PCVPHAL_RENDER_PARAMS pcRenderParams) = 0; 175 176 virtual MOS_STATUS GetStatusReport( 177 PQUERY_STATUS_REPORT_APP pQueryReport, 178 uint16_t numStatus) = 0; 179 180 virtual MOS_STATUS GetStatusReportEntryLength( 181 uint32_t *puiLength) = 0; 182 183 HANDLE m_gpuAppTaskEvent = nullptr; 184 185 VpExtIntfBase *extIntf = nullptr; 186 187 protected: IsApoEnabled()188 virtual bool IsApoEnabled() 189 { 190 return false; 191 } 192 193 MEDIA_CLASS_DEFINE_END(VpBase) 194 }; 195 196 class VpExtIntfBase 197 { 198 public: VpExtIntfBase(VpBase * hal)199 VpExtIntfBase(VpBase *hal) : m_hal(hal) 200 { 201 } 202 ~VpExtIntfBase()203 virtual ~VpExtIntfBase() 204 { 205 } 206 207 protected: 208 VpBase *m_hal = nullptr; 209 210 MEDIA_CLASS_DEFINE_END(VpExtIntfBase) 211 }; 212 213 #endif // __VPBASE_H__ 214