1 /*===================== begin_copyright_notice ================================== 2 3 # Copyright (c) 2021-2023, 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 renderhal_xe_hpg_base.h 26 //! \brief header file of xe_hpg hardware functions 27 //! \details Xe_HPM hardware functions declare 28 //! 29 #ifndef __RENDERHAL_XE_HPG_BASE_H__ 30 #define __RENDERHAL_XE_HPG_BASE_H__ 31 32 #include "renderhal_platform_interface_next.h" 33 #include "mhw_render_hwcmd_xe_hpg.h" 34 #include "mhw_state_heap_xe_hpg.h" 35 36 extern const uint32_t g_cLookup_RotationMode_hpg_base[8]; 37 38 struct MHW_VFE_PARAMS_XE_HPG : MHW_VFE_PARAMS 39 { 40 bool bFusedEuDispatch = 0; 41 uint32_t numOfWalkers = 0; 42 bool enableSingleSliceDispatchCcsMode = 0; 43 44 // Surface state offset of scratch space buffer. 45 uint32_t scratchStateOffset = 0; 46 }; 47 48 //! \brief for Xe_HPM VP and MDF 49 //! SLM URB DC RO Rest/L3 Client Pool 50 //! 0 96(fixed) 0 0 320 (KB chunks based on GT2) 51 #define RENDERHAL_L3_CACHE_CONFIG_CNTLREG_VALUE_XE_HPG_BASE_RENDERHAL (0x00000200) 52 53 class XRenderHal_Interface_Xe_Hpg_Base : public XRenderHal_Platform_Interface_Next 54 { 55 public: 56 //! 57 //! \brief Setup Surface State 58 //! \details Setup Surface States for Xe_HPM 59 //! \param PRENDERHAL_INTERFACE pRenderHal 60 //! [in] Pointer to Hardware Interface Structure 61 //! \param PRENDERHAL_SURFACE pRenderHalSurface 62 //! [in] Pointer to Render Hal Surface 63 //! \param PRENDERHAL_SURFACE_STATE_PARAMS pParams 64 //! [in] Pointer to Surface State Params 65 //! \param int32_t *piNumEntries 66 //! [out] Pointer to Number of Surface State Entries (Num Planes) 67 //! \param PRENDERHAL_SURFACE_STATE_ENTRY * ppSurfaceEntries 68 //! [out] Array of Surface State Entries 69 //! \param PRENDERHAL_OFFSET_OVERRIDE pOffsetOverride 70 //! [in] If not nullptr, provides adjustments to Y, UV plane offsets, 71 //! used for kernel WA in a few cases. nullptr is the most common usage. 72 //! \return MOS_STATUS 73 //! 74 MOS_STATUS SetupSurfaceState( 75 PRENDERHAL_INTERFACE pRenderHal, 76 PRENDERHAL_SURFACE pRenderHalSurface, 77 PRENDERHAL_SURFACE_STATE_PARAMS pParams, 78 int32_t * piNumEntries, 79 PRENDERHAL_SURFACE_STATE_ENTRY *ppSurfaceEntries, 80 PRENDERHAL_OFFSET_OVERRIDE pOffsetOverride) override; 81 82 //! 83 //! \brief Convert To Nano Seconds 84 //! \details Convert to Nano Seconds 85 //! \param PRENDERHAL_INTERFACE pRenderHal 86 //! [in] Pointer to Hardware Interface Structure 87 //! \param uint64_t iTicks 88 //! [in] Ticks 89 //! \param uint64_t *piNs 90 //! [in] Nano Seconds 91 //! \return void 92 //! 93 void ConvertToNanoSeconds( 94 PRENDERHAL_INTERFACE pRenderHal, 95 uint64_t iTicks, 96 uint64_t * piNs) override; 97 98 //! 99 //! \brief Initialize the State Heap Settings per platform 100 //! \param PRENDERHAL_INTERFACE pRenderHal 101 //! [out] Pointer to PRENDERHAL_INTERFACE 102 //! \return void 103 //! 104 void InitStateHeapSettings( 105 PRENDERHAL_INTERFACE pRenderHal) override; 106 107 //! 108 //! \brief Enables L3 cacheing flag and sets related registers/values 109 //! \param PRENDERHAL_INTERFACE pRenderHal 110 //! [in] Pointer to Hardware Interface 111 //! \param pCacheSettings 112 //! [in] L3 Cache Configurations 113 //! \return MOS_STATUS 114 //! MOS_STATUS_SUCCESS if success, else fail reason 115 //! 116 virtual MOS_STATUS EnableL3Caching( 117 PRENDERHAL_INTERFACE pRenderHal, 118 PRENDERHAL_L3_CACHE_SETTINGS pCacheSettings) override; 119 120 //! 121 //! \brief Get the pointer to the MHW_VFE_PARAMS 122 //! \return MHW_VFE_PARAMS* 123 //! pointer to the MHW_VFE_PARAMS 124 //! GetVfeStateParameters()125 virtual MHW_VFE_PARAMS *GetVfeStateParameters() override { return &m_vfeStateParams; } 126 127 //! 128 //! \brief enable/disable the fusedEUDispatch flag in the VFE_PARAMS 129 //! \return no return value 130 //! 131 virtual void SetFusedEUDispatch(bool enable) override; 132 133 //! 134 //! \brief set the number of walkers in the VFE_PARAMS 135 //! \return MOS_STATUS_SUCCESS 136 //! 137 MOS_STATUS SetNumOfWalkers(uint32_t numOfWalkers); 138 139 //! 140 //! \brief enable/disable the single slice dispatch flag in the VFE_PARAMS 141 //! \return no return value 142 //! SetSingleSliceDispatchCcsMode(bool enable)143 void SetSingleSliceDispatchCcsMode(bool enable) 144 { 145 m_vfeStateParams.enableSingleSliceDispatchCcsMode = enable; 146 }; 147 148 //! \brief Set L3 cache override config parameters 149 //! \param [in] pRenderHal 150 //! Pointer to RenderHal Interface Structure 151 //! \param [in,out] pCacheSettings 152 //! Pointer to pCacheSettings 153 //! \param [in] bEnableSLM 154 //! Flag to enable SLM 155 //! \return MOS_STATUS 156 //! MOS_STATUS_SUCCESS if success. Error code otherwise 157 //! 158 virtual MOS_STATUS SetCacheOverrideParams( 159 PRENDERHAL_INTERFACE pRenderHal, 160 PRENDERHAL_L3_CACHE_SETTINGS pCacheSettings, 161 bool bEnableSLM) override; 162 163 //! \brief Get the size of Render Surface State Command 164 //! \return size_t 165 //! the size of render surface state command 166 virtual size_t GetSurfaceStateCmdSize() override; 167 168 //! \brief Get the address of the ith Palette Data 169 //! \param [in] i 170 //! Index of the palette data 171 //! \return void * 172 //! address of the ith palette data table GetPaletteDataAddress(int i)173 virtual void *GetPaletteDataAddress(int i) override { return &m_paletteData[i]; } 174 175 //! \brief Get the size of Binding Table State Command 176 //! \return size_t 177 //! the size of binding table state command GetBTStateCmdSize()178 virtual size_t GetBTStateCmdSize() override { return mhw_state_heap_xe_hpg::BINDING_TABLE_STATE_CMD::byteSize; } 179 180 //! \brief Sets states of scratch space buffer. 181 //! \param Pointer to RENDERHAL_INTERFACE renderHal 182 //! [in] Pointer to render HAL Interface. 183 //! \param indexOfBindingTable 184 //! [in] Index of the binding table in use. 185 //! \return MOS_STATUS 186 MOS_STATUS SetScratchSpaceBufferState( 187 RENDERHAL_INTERFACE *renderHal, 188 uint32_t indexOfBindingTable); 189 190 MHW_SETPAR_DECL_HDR(CFE_STATE); 191 192 protected: 193 XRenderHal_Interface_Xe_Hpg_Base(); ~XRenderHal_Interface_Xe_Hpg_Base()194 virtual ~XRenderHal_Interface_Xe_Hpg_Base() {} 195 196 MHW_VFE_PARAMS_XE_HPG m_vfeStateParams; 197 198 mhw::render::xe_hpg::Cmd::PALETTE_ENTRY_CMD 199 m_paletteData[RENDERHAL_PALETTE_MAX][RENDERHAL_PALETTE_ENTRIES_MAX]; 200 201 MEDIA_CLASS_DEFINE_END(XRenderHal_Interface_Xe_Hpg_Base) 202 }; 203 204 #endif // __RENDERHAL_XE_HPG_BASE_H__ 205