1 /* 2 * Copyright (c) 2017-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 codechal_hw_g12_X.h 24 //! \brief This modules implements HW interface layer to be used on Gen12 platforms on all operating systems/DDIs, across CODECHAL components. 25 //! 26 #ifndef __CODECHAL_HW_G12_X_H__ 27 #define __CODECHAL_HW_G12_X_H__ 28 29 #include "codechal_hw.h" 30 #include "mhw_mi_hwcmd_g12_X.h" 31 #include "mhw_render_hwcmd_g12_X.h" 32 #include "mhw_vdbox_avp_interface.h" 33 #ifdef IGFX_MHW_INTERFACES_NEXT_SUPPORT 34 #include "media_interfaces_mhw_next.h" 35 #endif 36 37 //! 38 //! \enum MediaStatesAv1FilmGrain 39 //! 40 enum 41 { 42 CODECHAl_MEDIA_STATE_AV1_FILM_GRAIN_GRV = CODECHAL_MEDIA_STATE_SW_SCOREBOARD_INIT + 1, 43 CODECHAl_MEDIA_STATE_AV1_FILM_GRAIN_RP1, 44 CODECHAl_MEDIA_STATE_AV1_FILM_GRAIN_RP2, 45 CODECHAl_MEDIA_STATE_AV1_FILM_GRAIN_AN, 46 }; //Please merge to CODECHAL_MEDIA_STATE_TYPE 47 48 #define CODECHAL_NUM_MEDIA_STATES_G12 (CODECHAL_NUM_MEDIA_STATES + 4) 49 50 //! Codechal hw interface Gen12 51 /*! 52 This class defines the interfaces for hardware dependent settings and functions used in Codechal for Gen12 platforms 53 */ 54 class CodechalHwInterfaceG12 : public CodechalHwInterface 55 { 56 protected: 57 static const CODECHAL_SSEU_SETTING m_defaultSsEuLutG12[CODECHAL_NUM_MEDIA_STATES_G12]; 58 59 public: 60 //! 61 //! \brief Constructor 62 //! 63 CodechalHwInterfaceG12( 64 PMOS_INTERFACE osInterface, 65 CODECHAL_FUNCTION codecFunction, 66 MhwInterfaces *mhwInterfaces, 67 bool disableScalability = false); 68 69 #ifdef IGFX_MHW_INTERFACES_NEXT_SUPPORT 70 //! 71 //! \brief Constructor 72 //! 73 CodechalHwInterfaceG12( 74 PMOS_INTERFACE osInterface, 75 CODECHAL_FUNCTION codecFunction, 76 MhwInterfacesNext *mhwInterfacesNext, 77 bool disableScalability = false); 78 #endif 79 80 //! 81 //! \brief Copy constructor 82 //! 83 CodechalHwInterfaceG12(const CodechalHwInterfaceG12&) = delete; 84 85 //! 86 //! \brief Copy assignment operator 87 //! 88 CodechalHwInterfaceG12& operator=(const CodechalHwInterfaceG12&) = delete; 89 90 //! 91 //! \brief Destructor 92 //! 93 virtual ~CodechalHwInterfaceG12(); 94 95 MOS_STATUS InitL3CacheSettings() override; 96 97 MOS_STATUS GetStreamoutCommandSize( 98 uint32_t *commandsSize, 99 uint32_t *patchListSize) override; 100 //! 101 //! \brief Set Cacheability Settings 102 //! \details Set Cacheability Settings in sub interfaces in codechal hw interface 103 //! 104 //! \param [in] cacheabilitySettings 105 //! cacheability Settings to set into sub mhw intefaces in hw interface 106 //! 107 //! \return MOS_STATUS 108 //! MOS_STATUS_SUCCESS if success, else fail reason 109 //! 110 virtual MOS_STATUS SetCacheabilitySettings( 111 MHW_MEMORY_OBJECT_CONTROL_PARAMS cacheabilitySettings[MOS_CODEC_RESOURCE_USAGE_END_CODEC]) override; 112 113 //! 114 //! \brief Calculates the maximum size for AVP picture level commands 115 //! \details Client facing function to calculate the maximum size for AVP picture level commands 116 //! \param [in] mode 117 //! Indicate the codec mode 118 //! \param [out] commandsSize 119 //! The maximum command buffer size 120 //! \param [out] patchListSize 121 //! The maximum command patch list size 122 //! \param [in] params 123 //! Indicate the command size parameters 124 //! \return MOS_STATUS 125 //! MOS_STATUS_SUCCESS if success, else fail reason 126 //! 127 virtual MOS_STATUS GetAvpStateCommandSize( 128 uint32_t mode, 129 uint32_t *commandsSize, 130 uint32_t *patchListSize, 131 PMHW_VDBOX_STATE_CMDSIZE_PARAMS params) override; 132 133 //! 134 //! \brief Calculates maximum size for AVP tile level commands 135 //! \details Client facing function to calculate maximum size for AVP tile level commands 136 //! \param [in] mode 137 //! Indicate the codec mode 138 //! \param [out] commandsSize 139 //! The maximum command buffer size 140 //! \param [out] patchListSize 141 //! The maximum command patch list size 142 //! \return MOS_STATUS 143 //! MOS_STATUS_SUCCESS if success, else fail reason 144 //! 145 virtual MOS_STATUS GetAvpPrimitiveCommandSize( 146 uint32_t mode, 147 uint32_t *commandsSize, 148 uint32_t *patchListSize) override; 149 150 //! 151 //! \brief Set Rowstore Cache offsets for Gen12 specific interfaces 152 //! \details Set Rowstore Cache offsets in sub interfaces in codechal hw G12 interface 153 //! 154 //! \param [in] rowstoreParams 155 //! parameters to set rowstore cache offsets 156 //! 157 //! \return MOS_STATUS 158 //! MOS_STATUS_SUCCESS if success, else fail reason 159 //! 160 virtual MOS_STATUS SetRowstoreCachingOffsets( 161 PMHW_VDBOX_ROWSTORE_PARAMS rowstoreParams) override; 162 163 //! 164 //! \brief Send conditional batch buffer end cmd 165 //! \details Send conditional batch buffer end cmd 166 //! 167 //! \param [in] resource 168 //! Reource used in conditional batch buffer end cmd 169 //! \param [in] offset 170 //! Reource offset used in mi atomic dword cmd 171 //! \param [in] compData 172 //! Compare data 173 //! \param [in] disableCompMask 174 //! Indicate disabling compare mask 175 //! \param [in] enableEndCurrentBatchBuffLevel 176 //! End Current Batch Buffer Level 177 //! \param [in] compareOperation 178 //! Compare operation 179 //! \param [in,out] cmdBuffer 180 //! command buffer 181 //! 182 //! \return MOS_STATUS 183 //! MOS_STATUS_SUCCESS if success, else fail reason 184 //! 185 MOS_STATUS SendCondBbEndCmd( 186 PMOS_RESOURCE resource, 187 uint32_t offset, 188 uint32_t compData, 189 bool disableCompMask, 190 bool enableEndCurrentBatchBuffLevel, 191 uint32_t compareOperation, 192 PMOS_COMMAND_BUFFER cmdBuffer); 193 194 //! 195 //! \brief Initialize the codechal hw interface 196 //! \details Initialize the interface before using 197 //! 198 //! \param [in] settings 199 //! Settings for initialization 200 //! 201 //! \return MOS_STATUS 202 //! MOS_STATUS_SUCCESS if success, else fail reason 203 //! 204 MOS_STATUS Initialize( 205 CodechalSetting *settings) override; 206 207 #ifdef IGFX_MHW_INTERFACES_NEXT_SUPPORT 208 //! 209 //! \brief Read AVP status for status report 210 //! \param vdboxIndex 211 //! [in] the vdbox index 212 //! \param params 213 //! [in] the parameters for AVP status read 214 //! \param cmdBuffer 215 //! [in, out] the command buffer 216 //! \return MOS_STATUS 217 //! MOS_STATUS_SUCCESS if success, else fail reason 218 //! 219 MOS_STATUS ReadAvpStatus( 220 MHW_VDBOX_NODE_IND vdboxIndex, 221 const EncodeStatusReadParams ¶ms, 222 PMOS_COMMAND_BUFFER cmdBuffer); 223 224 //! 225 //! \brief Read AVP specific image status for status report 226 //! \param vdboxIndex 227 //! [in] the vdbox index 228 //! \param params 229 //! [in] the parameters for AVP IMG status read 230 //! \param cmdBuffer 231 //! [in, out] the command buffer 232 //! \return MOS_STATUS 233 //! MOS_STATUS_SUCCESS if success, else fail reason 234 //! 235 MOS_STATUS ReadImageStatusForAvp( 236 MHW_VDBOX_NODE_IND vdboxIndex, 237 const EncodeStatusReadParams ¶ms, 238 PMOS_COMMAND_BUFFER cmdBuffer); 239 #endif 240 241 //! 242 //! \brief Get film grain kernel info 243 //! \details Get kernel base and size 244 //! 245 //! \param [out] kernelBase 246 //! base addr of film grain kernels 247 //! 248 //! \param [out] kernelSize 249 //! size of film grain kernels 250 //! 251 //! \return MOS_STATUS 252 //! MOS_STATUS_SUCCESS if success, else fail reason 253 //! 254 virtual MOS_STATUS GetFilmGrainKernelInfo( 255 uint8_t* &kernelBase, 256 uint32_t &kernelSize) override; 257 258 private: 259 //! 260 //! \brief Called by constructor 261 //! 262 void PrepareCmdSize(CODECHAL_FUNCTION codecFunction); 263 264 //! 265 //! \brief Called by constructor 266 //! 267 void InternalInit(CODECHAL_FUNCTION codecFunction); 268 }; 269 #endif // __CODECHAL_HW_G12_X_H__ 270