1 /* 2 * Copyright (c) 2019-2021, 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_render_vebox_xe_xpm.h 24 //! \brief Interface and structure specific for Xe_XPM Vebox 25 //! \details Interface and structure specific for Xe_XPM Vebox 26 //! 27 #ifndef __VPHAL_RENDER_VEBOX_XE_XPM_H__ 28 #define __VPHAL_RENDER_VEBOX_XE_XPM_H__ 29 30 #include "vphal_render_vebox_base.h" 31 #include "vphal_render_vebox_g12_base.h" 32 #include "vphal_render_vebox_xe_xpm_denoise.h" 33 #include "mhw_vebox_xe_xpm.h" 34 35 //! 36 //! \brief Macro for Vebox Scalable 37 //! 38 #define VPHAL_VEBOX_STATISTICS_SURFACE_TGNE_OFFSET_G12 0x5C 39 40 typedef class VPHAL_VEBOX_STATE_XE_XPM *PVPHAL_VEBOX_STATE_XE_XPM; 41 class VPHAL_VEBOX_STATE_XE_XPM:virtual public VPHAL_VEBOX_STATE_G12_BASE 42 { 43 public: 44 VPHAL_VEBOX_STATE_XE_XPM( 45 PMOS_INTERFACE pOsInterface, 46 PMHW_VEBOX_INTERFACE pVeboxInterface, 47 PMHW_SFC_INTERFACE pSfcInterface, 48 PRENDERHAL_INTERFACE pRenderHal, 49 PVPHAL_VEBOX_EXEC_STATE pVeboxExecState, 50 PVPHAL_RNDR_PERF_DATA pPerfData, 51 const VPHAL_DNDI_CACHE_CNTL &dndiCacheCntl, 52 MOS_STATUS *peStatus); 53 54 virtual ~VPHAL_VEBOX_STATE_XE_XPM(); 55 56 //! 57 //! \brief Vebox is needed on Xe_XPM 58 //! \details Check if Vebox Render operation can be applied 59 //! \param [in] pcRenderParams 60 //! Pointer to VpHal render parameters 61 //! \param [in,out] pRenderPassData 62 //! Pointer to Render data 63 //! \return bool 64 //! return true if Vebox is needed, otherwise false 65 //! 66 virtual bool IsNeeded( 67 PCVPHAL_RENDER_PARAMS pcRenderParams, 68 RenderpassData *pRenderPassData) override; 69 virtual MOS_STATUS AllocateResources() override; 70 virtual void FreeResources() override; 71 72 // Vebox Scalability 73 bool bVeboxScalableMode = false; //!< Vebox Scalable Mode 74 std::vector<PMOS_COMMAND_BUFFER> m_veCmdBuffers = {}; //!< Command Buffer for Vebox Scalable 75 uint32_t dwVECmdBufSize = 0; //!< Command Buffer Size 76 MOS_RESOURCE VESemaMemS[MHW_VEBOX_MAX_SEMAPHORE_NUM_G12] = {}; //!< Semphore for Vebox Scalable 77 MOS_RESOURCE VESemaMemSAdd[MHW_VEBOX_MAX_SEMAPHORE_NUM_G12] = {}; //!< Semphore for Vebox Scalable addition 78 uint32_t dwNumofVebox = 0; //!< Number of Vebox 79 bool bScalingHQPefMode = false; //!< set scalingHQ as perf mode 80 81 // Vebox HVS 82 VphalHVSDenoiserHpm *m_hvsDenoiser = nullptr; //!< Human Vision System Based Denoiser - Media Kernel to generate DN parameter 83 84 protected: 85 86 virtual VphalSfcState* CreateSfcState() override; 87 88 VPHAL_OUTPUT_PIPE_MODE GetOutputPipe( 89 PCVPHAL_RENDER_PARAMS pcRenderParams, 90 PVPHAL_SURFACE pSrcSurface, 91 RenderpassData* pRenderData) override; 92 93 virtual MOS_STATUS VeboxRenderVeboxCmd( 94 MOS_COMMAND_BUFFER &CmdBuffer, 95 MHW_VEBOX_DI_IECP_CMD_PARAMS &VeboxDiIecpCmdParams, 96 VPHAL_VEBOX_SURFACE_STATE_CMD_PARAMS &VeboxSurfaceStateCmdParams, 97 MHW_VEBOX_SURFACE_STATE_CMD_PARAMS &MhwVeboxSurfaceStateCmdParams, 98 MHW_VEBOX_STATE_CMD_PARAMS &VeboxStateCmdParams, 99 MHW_MI_FLUSH_DW_PARAMS &FlushDwParams, 100 PRENDERHAL_GENERIC_PROLOG_PARAMS pGenericPrologParams) override; 101 102 virtual MOS_STATUS SetupDiIecpState( 103 bool bDiScdEnable, 104 PMHW_VEBOX_DI_IECP_CMD_PARAMS pVeboxDiIecpCmdParams) override; 105 106 //! 107 //! \brief Initialize the Cmd buffer and insert prolog with VE params 108 //! \details Initialize the Cmd buffer and insert prolog with VE params 109 //! \param [in] pRenderHal 110 //! pointer to Renderhal interface 111 //! \param [in,out] CmdBuffer 112 //! reference to Cmd buffer control struct 113 //! \param [in] pGenericPrologParams 114 //! pointer to Generic prolog params struct to send to cmd buffer header 115 //! \return MOS_STATUS 116 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed 117 //! 118 virtual MOS_STATUS InitCmdBufferWithVeParams( 119 PRENDERHAL_INTERFACE pRenderHal, 120 MOS_COMMAND_BUFFER &CmdBuffer, 121 PRENDERHAL_GENERIC_PROLOG_PARAMS pGenericPrologParams); 122 123 //! 124 //! \brief Alloc Batch Buffers with VE interface 125 //! \details Allocate Batch Buffers with VE interface 126 //! \return MOS_STATUS 127 //! MOS_STATUS_SUCCESS if success, else fail reason 128 //! 129 virtual MOS_STATUS AllocVESecondaryCmdBuffers(); 130 131 //! 132 //! \brief Alloc Semaphore Resources with VE interface 133 //! \details Allocate Semaphore Resources with VE interface 134 //! \return MOS_STATUS 135 //! MOS_STATUS_SUCCESS if success, else fail reason 136 //! 137 virtual MOS_STATUS AllocVESemaphoreResources(); 138 139 //! 140 //! \brief Init Batch Buffers with VE interface 141 //! \details Init Batch Buffers with VE interface 142 //! \return MOS_STATUS 143 //! MOS_STATUS_SUCCESS if success, else fail reason 144 //! 145 virtual MOS_STATUS InitVESecondaryCmdBuffers(); 146 147 //! 148 //! \brief Unlock Batch Buffers with VE interface 149 //! \details Unlock Batch Buffers with VE interface 150 //! \return MOS_STATUS 151 //! MOS_STATUS_SUCCESS if success, else fail reason 152 //! 153 virtual MOS_STATUS UnLockVESecondaryCmdBuffers(); 154 155 //! 156 //! \brief Free Resources with VE interface 157 //! \details Free Resources with VE interface 158 //! \return MOS_STATUS 159 //! MOS_STATUS_SUCCESS if success, else fail reason 160 //! 161 virtual MOS_STATUS FreeVEResources(); 162 163 virtual MOS_STATUS AddMiBatchBufferEnd( 164 PMOS_INTERFACE pOsInterface, 165 PMHW_MI_INTERFACE pMhwMiInterface, 166 PMOS_COMMAND_BUFFER pCmdBufferInUse); 167 168 virtual MOS_STATUS VeboxSetHVSDNParams( 169 PVPHAL_DENOISE_PARAMS pDNParams); 170 171 //! 172 //! \brief Get output surface of Vebox 173 //! \details Get output surface of Vebox in current operation 174 //! \param bDiVarianceEnable 175 //! [in] Is DI/Variances report enabled 176 //! \return PVPHAL_SURFACE 177 //! Corresponding output surface pointer 178 //! 179 virtual PVPHAL_SURFACE GetSurfOutput( 180 bool bDiVarianceEnable) override; 181 182 // TGNE 183 184 uint32_t dwGlobalNoiseLevel_Temporal = 0; //!< Global Temporal Noise Level for Y 185 uint32_t dwGlobalNoiseLevelU_Temporal = 0; //!< Global Temporal Noise Level for U 186 uint32_t dwGlobalNoiseLevelV_Temporal = 0; //!< Global Temporal Noise Level for V 187 uint32_t curNoiseLevel_Temporal = 0; //!< Temporal Noise Level for Y 188 uint32_t curNoiseLevelU_Temporal = 0; //!< Temporal Noise Level for U 189 uint32_t curNoiseLevelV_Temporal = 0; //!< Temporal Noise Level for V 190 bool bTGNE_Valid = false; //!< TGNE Flag of Valid 191 bool bTGNE_FirstFrame = true; //!< TGNE Flag of First Frame 192 bool m_bTgneEnable = true; //!< Enable TGNE for Denoise 193 194 }; 195 196 #endif // __VPHAL_RENDER_VEBOX_XE_XPM_H__ 197 198