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 #include "media_sfc_interface_legacy.h" 34 35 #include "media_interfaces_mhw_next.h" 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 //! 70 //! \brief Copy constructor 71 //! 72 CodechalHwInterfaceG12(const CodechalHwInterfaceG12&) = delete; 73 74 //! 75 //! \brief Copy assignment operator 76 //! 77 CodechalHwInterfaceG12& operator=(const CodechalHwInterfaceG12&) = delete; 78 79 //! 80 //! \brief Destructor 81 //! 82 virtual ~CodechalHwInterfaceG12(); 83 84 MOS_STATUS InitL3CacheSettings() override; 85 86 MOS_STATUS GetStreamoutCommandSize( 87 uint32_t *commandsSize, 88 uint32_t *patchListSize) override; 89 //! 90 //! \brief Set Cacheability Settings 91 //! \details Set Cacheability Settings in sub interfaces in codechal hw interface 92 //! 93 //! \param [in] cacheabilitySettings 94 //! cacheability Settings to set into sub mhw intefaces in hw interface 95 //! 96 //! \return MOS_STATUS 97 //! MOS_STATUS_SUCCESS if success, else fail reason 98 //! 99 virtual MOS_STATUS SetCacheabilitySettings( 100 MHW_MEMORY_OBJECT_CONTROL_PARAMS cacheabilitySettings[MOS_CODEC_RESOURCE_USAGE_END_CODEC]) override; 101 102 //! 103 //! \brief Calculates the maximum size for AVP picture level commands 104 //! \details Client facing function to calculate the maximum size for AVP picture level commands 105 //! \param [in] mode 106 //! Indicate the codec mode 107 //! \param [out] commandsSize 108 //! The maximum command buffer size 109 //! \param [out] patchListSize 110 //! The maximum command patch list size 111 //! \param [in] params 112 //! Indicate the command size parameters 113 //! \return MOS_STATUS 114 //! MOS_STATUS_SUCCESS if success, else fail reason 115 //! 116 virtual MOS_STATUS GetAvpStateCommandSize( 117 uint32_t mode, 118 uint32_t *commandsSize, 119 uint32_t *patchListSize, 120 PMHW_VDBOX_STATE_CMDSIZE_PARAMS params) override; 121 122 //! 123 //! \brief Calculates maximum size for AVP tile level commands 124 //! \details Client facing function to calculate maximum size for AVP tile level commands 125 //! \param [in] mode 126 //! Indicate the codec mode 127 //! \param [out] commandsSize 128 //! The maximum command buffer size 129 //! \param [out] patchListSize 130 //! The maximum command patch list size 131 //! \return MOS_STATUS 132 //! MOS_STATUS_SUCCESS if success, else fail reason 133 //! 134 virtual MOS_STATUS GetAvpPrimitiveCommandSize( 135 uint32_t mode, 136 uint32_t *commandsSize, 137 uint32_t *patchListSize) override; 138 139 //! 140 //! \brief Set Rowstore Cache offsets for Gen12 specific interfaces 141 //! \details Set Rowstore Cache offsets in sub interfaces in codechal hw G12 interface 142 //! 143 //! \param [in] rowstoreParams 144 //! parameters to set rowstore cache offsets 145 //! 146 //! \return MOS_STATUS 147 //! MOS_STATUS_SUCCESS if success, else fail reason 148 //! 149 virtual MOS_STATUS SetRowstoreCachingOffsets( 150 PMHW_VDBOX_ROWSTORE_PARAMS rowstoreParams) override; 151 152 //! 153 //! \brief Send conditional batch buffer end cmd 154 //! \details Send conditional batch buffer end cmd 155 //! 156 //! \param [in] resource 157 //! Reource used in conditional batch buffer end cmd 158 //! \param [in] offset 159 //! Reource offset used in mi atomic dword cmd 160 //! \param [in] compData 161 //! Compare data 162 //! \param [in] disableCompMask 163 //! Indicate disabling compare mask 164 //! \param [in] enableEndCurrentBatchBuffLevel 165 //! End Current Batch Buffer Level 166 //! \param [in] compareOperation 167 //! Compare operation 168 //! \param [in,out] cmdBuffer 169 //! command buffer 170 //! 171 //! \return MOS_STATUS 172 //! MOS_STATUS_SUCCESS if success, else fail reason 173 //! 174 MOS_STATUS SendCondBbEndCmd( 175 PMOS_RESOURCE resource, 176 uint32_t offset, 177 uint32_t compData, 178 bool disableCompMask, 179 bool enableEndCurrentBatchBuffLevel, 180 uint32_t compareOperation, 181 PMOS_COMMAND_BUFFER cmdBuffer); 182 183 //! 184 //! \brief Initialize the codechal hw interface 185 //! \details Initialize the interface before using 186 //! 187 //! \param [in] settings 188 //! Settings for initialization 189 //! 190 //! \return MOS_STATUS 191 //! MOS_STATUS_SUCCESS if success, else fail reason 192 //! 193 MOS_STATUS Initialize( 194 CodechalSetting *settings) override; 195 196 //! 197 //! \brief Read AVP status for status report 198 //! \param vdboxIndex 199 //! [in] the vdbox index 200 //! \param params 201 //! [in] the parameters for AVP status read 202 //! \param cmdBuffer 203 //! [in, out] the command buffer 204 //! \return MOS_STATUS 205 //! MOS_STATUS_SUCCESS if success, else fail reason 206 //! 207 MOS_STATUS ReadAvpStatus( 208 MHW_VDBOX_NODE_IND vdboxIndex, 209 const EncodeStatusReadParams ¶ms, 210 PMOS_COMMAND_BUFFER cmdBuffer); 211 212 //! 213 //! \brief Read AVP specific image status for status report 214 //! \param vdboxIndex 215 //! [in] the vdbox index 216 //! \param params 217 //! [in] the parameters for AVP IMG status read 218 //! \param cmdBuffer 219 //! [in, out] the command buffer 220 //! \return MOS_STATUS 221 //! MOS_STATUS_SUCCESS if success, else fail reason 222 //! 223 MOS_STATUS ReadImageStatusForAvp( 224 MHW_VDBOX_NODE_IND vdboxIndex, 225 const EncodeStatusReadParams ¶ms, 226 PMOS_COMMAND_BUFFER cmdBuffer); 227 228 229 //! 230 //! \brief Get film grain kernel info 231 //! \details Get kernel base and size 232 //! 233 //! \param [out] kernelBase 234 //! base addr of film grain kernels 235 //! 236 //! \param [out] kernelSize 237 //! size of film grain kernels 238 //! 239 //! \return MOS_STATUS 240 //! MOS_STATUS_SUCCESS if success, else fail reason 241 //! 242 virtual MOS_STATUS GetFilmGrainKernelInfo( 243 uint8_t* &kernelBase, 244 uint32_t &kernelSize) override; 245 246 private: 247 //! 248 //! \brief Called by constructor 249 //! 250 void PrepareCmdSize(CODECHAL_FUNCTION codecFunction); 251 252 //! 253 //! \brief Called by constructor 254 //! 255 void InternalInit(CODECHAL_FUNCTION codecFunction); 256 }; 257 #endif // __CODECHAL_HW_G12_X_H__ 258