1 /*===================== begin_copyright_notice ================================== 2 3 # Copyright (c) 2022, Intel Corporation 4 5 # Permission is hereby granted, free of charge, to any person obtaining a 6 # copy of this software and associated documentation files (the "Software"), 7 # to deal in the Software without restriction, including without limitation 8 # the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 # and/or sell copies of the Software, and to permit persons to whom the 10 # Software is furnished to do so, subject to the following conditions: 11 12 # The above copyright notice and this permission notice shall be included 13 # in all copies or substantial portions of the Software. 14 15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 16 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 # OTHER DEALINGS IN THE SOFTWARE. 22 23 ======================= end_copyright_notice ==================================*/ 24 //! 25 //! \file vphal_renderer_xe_hpm.h 26 //! \brief The header file of VPHAL top level rendering component 27 //! \details The top renderer is responsible for coordinating the sequence of calls to low level renderers, e.g. DNDI or Comp 28 //! 29 #ifndef __VPHAL_RENDERER_XE_HPM_H__ 30 #define __VPHAL_RENDERER_XE_HPM_H__ 31 32 #include "vphal_renderer_g12.h" 33 #include "vphal_debug_xe_xpm.h" 34 35 void KernelDll_ModifyFunctionPointers_g12hp(Kdll_State *pState); 36 37 //! 38 //! \brief VPHAL renderer Gen12 class 39 //! 40 class VphalRendererXe_Hpm : public VphalRendererG12 41 { 42 public: 43 //! 44 //! \brief VphalRendererXe_Hpm constructor 45 //! \details Based on the HW and OS info, initialize the renderer interfaces 46 //! \param [in] pRenderHal 47 //! Pointer to RenderHal Interface Structure 48 //! \param [in,out] pStatus 49 //! Pointer to the MOS_STATUS flag. 50 //! Will assign this flag to MOS_STATUS_SUCCESS if successful, otherwise failed 51 //! VphalRendererXe_Hpm(PRENDERHAL_INTERFACE pRenderHal,MOS_STATUS * pStatus)52 VphalRendererXe_Hpm( 53 PRENDERHAL_INTERFACE pRenderHal, 54 MOS_STATUS *pStatus) : 55 VphalRendererG12(pRenderHal, pStatus) 56 { 57 bEnableCMFC = true; 58 59 m_modifyKdllFunctionPointers = KernelDll_ModifyFunctionPointers_g12hp; 60 for (uint32_t nIndex = 0; nIndex < VPHAL_MAX_NUM_DS_SURFACES; nIndex++) 61 { 62 m_pDSSurface[nIndex] = nullptr; 63 } 64 } 65 66 //! 67 //! \brief VPHAL renderer destructor 68 //! \details Destory the resources allocated for the renderers 69 //! including VEBOX and Composite. 70 //! \param [in,out] VphalRenderer* pRenderer 71 //! VPHAL renderer pointer 72 //! \return VOID 73 //! ~VphalRendererXe_Hpm()74 ~VphalRendererXe_Hpm() 75 { 76 for (uint32_t nIndex = 0; nIndex < VPHAL_MAX_NUM_DS_SURFACES; nIndex++) 77 { 78 if (m_pDSSurface[nIndex]) 79 { 80 m_pOsInterface->pfnFreeResource(m_pOsInterface, &m_pDSSurface[nIndex]->OsResource); 81 //release 3dlut params 82 if (m_pDSSurface[nIndex]->p3DLutParams) 83 { 84 MOS_FreeMemory(m_pDSSurface[nIndex]->p3DLutParams); 85 m_pDSSurface[nIndex]->p3DLutParams = nullptr; 86 } 87 } 88 MOS_FreeMemAndSetNull(m_pDSSurface[nIndex]); 89 } 90 } 91 92 //! 93 //! \brief Get Renderer Cache Settings 94 //! \details Get cache settings for various VP features 95 //! \param [in] pOsInterface 96 //! OS Interface 97 //! \param [in] pPlatform 98 //! Platform Pointer 99 //! \param [in] pSkuTable 100 //! SKU feature table 101 //! \param [in,out] pSettings 102 //! Pointer to Render Cache Control Settings 103 //! \return void 104 //! 105 virtual void GetCacheCntl( 106 PMOS_INTERFACE pOsInterface, 107 PLATFORM *pPlatform, 108 MEDIA_FEATURE_TABLE *pSkuTable, 109 PVPHAL_RENDER_CACHE_CNTL pSettings); 110 111 //! 112 //! \brief Allocate render components 113 //! \details Allocate render components 114 //! \param [in] pVeboxInterface 115 //! Pointer to Vebox Interface Structure 116 //! \param [in] pSfcInterface 117 //! Pointer to SFC interface Structure 118 //! \return MOS_STATUS 119 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed 120 //! 121 virtual MOS_STATUS AllocateRenderComponents( 122 PMHW_VEBOX_INTERFACE pVeboxInterface, 123 PMHW_SFC_INTERFACE pSfcInterface); 124 125 //! 126 //! \brief Main render function 127 //! \details The top level renderer function, which may contain multiple 128 //! passes of rendering 129 //! \param [in] pcRenderParams 130 //! Const pointer to VPHAL render parameter 131 //! \return MOS_STATUS 132 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed 133 //! 134 virtual MOS_STATUS Render( 135 PCVPHAL_RENDER_PARAMS pcRenderParams); 136 137 //! 138 //! \brief Initialize the KDLL parameters 139 //! \details Initialize the KDLL parameters 140 //! \return MOS_STATUS 141 //! 142 MOS_STATUS InitKdllParam(); 143 144 //! 145 //! \brief Allocate surface dumper 146 //! \return MOS_STATUS 147 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed 148 //! 149 MOS_STATUS CreateSurfaceDumper(); 150 151 private: 152 //! 153 //! \brief Scaling function 154 //! \details The scaling function is only for scaling without other VP features. 155 //! Down scaling needs 2 pass if scaling ratio is >2 for better quality. 156 //! Pass#1 DS to 1/2 target resolution; Pass #2: DS from 1/2 target resolution to target resolution 157 //! \param [in,out] pRenderParams 158 //! Pointer to VPHAL render parameter 159 //! \return MOS_STATUS 160 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed 161 //! 162 MOS_STATUS RenderScaling( 163 PVPHAL_RENDER_PARAMS pRenderParams); 164 165 // Surfaces for down scaling if down scaling firstly in the use case scaling + 3dlut 166 PVPHAL_SURFACE m_pDSSurface[VPHAL_MAX_NUM_DS_SURFACES]; 167 }; 168 169 #endif // __VPHAL_RENDER_XE_HPM_H__ 170