1 /* 2 * Copyright (c) 2021-2022, 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 codec_hw_xe2_lpm.h 24 //! \brief This modules implements HW interface layer to be used on Xe2_LPM platforms on all operating systems/DDIs, across CODECHAL components. 25 //! 26 #ifndef __CODEC_HW_XE2_LPM_H__ 27 #define __CODEC_HW_XE2_LPM_H__ 28 29 #include "codec_hw_next.h" 30 #include "mhw_vdbox_vvcp_itf.h" 31 32 #define CODECHAL_NUM_MEDIA_STATES_XE2_LPM (CODECHAL_NUM_MEDIA_STATES + 4) 33 34 //! Codechal hw interface Xe2_LPM 35 /*! 36 This class defines the interfaces for hardware dependent settings and functions used in Codechal for M15 platforms 37 */ 38 class CodechalHwInterfaceXe2_Lpm_Base : public CodechalHwInterfaceNext 39 { 40 protected: 41 static const CODECHAL_SSEU_SETTING m_defaultSsEuLutM15[CODECHAL_NUM_MEDIA_STATES_XE2_LPM]; 42 43 public: 44 //! 45 //! \brief Constructor 46 //! 47 CodechalHwInterfaceXe2_Lpm_Base( 48 PMOS_INTERFACE osInterface, 49 CODECHAL_FUNCTION codecFunction, 50 MhwInterfacesNext *mhwInterfacesNext, 51 bool disableScalability = false); 52 53 //! 54 //! \brief Copy constructor 55 //! 56 CodechalHwInterfaceXe2_Lpm_Base(const CodechalHwInterfaceXe2_Lpm_Base&) = delete; 57 58 //! 59 //! \brief Copy assignment operator 60 //! 61 CodechalHwInterfaceXe2_Lpm_Base& operator=(const CodechalHwInterfaceXe2_Lpm_Base&) = delete; 62 63 //! 64 //! \brief Destructor 65 //! 66 virtual ~CodechalHwInterfaceXe2_Lpm_Base(); 67 68 //! 69 //! \brief Set Cacheability Settings 70 //! \details Set Cacheability Settings in sub interfaces in codechal hw interface 71 //! 72 //! \param [in] cacheabilitySettings 73 //! cacheability Settings to set into sub mhw intefaces in hw interface 74 //! 75 //! \return MOS_STATUS 76 //! MOS_STATUS_SUCCESS if success, else fail reason 77 //! 78 MOS_STATUS SetCacheabilitySettings( 79 MHW_MEMORY_OBJECT_CONTROL_PARAMS cacheabilitySettings[MOS_CODEC_RESOURCE_USAGE_END_CODEC]) override; 80 81 //! 82 //! \brief Calculates the maximum size for AVP picture level commands 83 //! \details Client facing function to calculate the maximum size for AVP picture level commands 84 //! \param [in] mode 85 //! Indicate the codec mode 86 //! \param [out] commandsSize 87 //! The maximum command buffer size 88 //! \param [out] patchListSize 89 //! The maximum command patch list size 90 //! \param [in] params 91 //! Indicate the command size parameters 92 //! \return MOS_STATUS 93 //! MOS_STATUS_SUCCESS if success, else fail reason 94 //! 95 MOS_STATUS GetAvpStateCommandSize( 96 uint32_t mode, 97 uint32_t *commandsSize, 98 uint32_t *patchListSize, 99 PMHW_VDBOX_STATE_CMDSIZE_PARAMS params); 100 101 //! 102 //! \brief Calculates maximum size for AVP tile level commands 103 //! \details Client facing function to calculate maximum size for AVP tile level commands 104 //! \param [in] mode 105 //! Indicate the codec mode 106 //! \param [out] commandsSize 107 //! The maximum command buffer size 108 //! \param [out] patchListSize 109 //! The maximum command patch list size 110 //! \return MOS_STATUS 111 //! MOS_STATUS_SUCCESS if success, else fail reason 112 //! 113 MOS_STATUS GetAvpPrimitiveCommandSize( 114 uint32_t mode, 115 uint32_t *commandsSize, 116 uint32_t *patchListSize); 117 118 //! 119 //! \brief Set Rowstore Cache offsets for Gen12 specific interfaces 120 //! \details Set Rowstore Cache offsets in sub interfaces in codechal hw G12 interface 121 //! 122 //! \param [in] rowstoreParams 123 //! parameters to set rowstore cache offsets 124 //! 125 //! \return MOS_STATUS 126 //! MOS_STATUS_SUCCESS if success, else fail reason 127 //! 128 MOS_STATUS SetRowstoreCachingOffsets( 129 PMHW_VDBOX_ROWSTORE_PARAMS rowstoreParams) override; 130 131 //! 132 //! \brief Send conditional batch buffer end cmd 133 //! \details Send conditional batch buffer end cmd 134 //! 135 //! \param [in] resource 136 //! Reource used in conditional batch buffer end cmd 137 //! \param [in] offset 138 //! Reource offset used in mi atomic dword cmd 139 //! \param [in] compData 140 //! Compare data 141 //! \param [in] disableCompMask 142 //! Indicate disabling compare mask 143 //! \param [in] enableEndCurrentBatchBuffLevel 144 //! End Current Batch Buffer Level 145 //! \param [in] compareOperation 146 //! Compare operation 147 //! \param [in,out] cmdBuffer 148 //! command buffer 149 //! 150 //! \return MOS_STATUS 151 //! MOS_STATUS_SUCCESS if success, else fail reason 152 //! 153 MOS_STATUS SendCondBbEndCmd( 154 PMOS_RESOURCE resource, 155 uint32_t offset, 156 uint32_t compData, 157 bool disableCompMask, 158 bool enableEndCurrentBatchBuffLevel, 159 uint32_t compareOperation, 160 PMOS_COMMAND_BUFFER cmdBuffer); 161 162 //! 163 //! \brief Initialize the codechal hw interface 164 //! \details Initialize the interface before using 165 //! 166 //! \param [in] settings 167 //! Settings for initialization 168 //! 169 //! \return MOS_STATUS 170 //! MOS_STATUS_SUCCESS if success, else fail reason 171 //! 172 MOS_STATUS Initialize( 173 CodechalSetting *settings) override; 174 175 //! 176 //! \brief Calculates the maximum size for VVCP picture level commands 177 //! \details Client facing function to calculate the maximum size for VVCP picture level commands 178 //! \param [in] mode 179 //! Indicate the codec mode 180 //! \param [out] commandsSize 181 //! The maximum command buffer size 182 //! \param [out] patchListSize 183 //! The maximum command patch list size 184 //! \param [in] params 185 //! Indicate the command size parameters 186 //! \return MOS_STATUS 187 //! MOS_STATUS_SUCCESS if success, else fail reason 188 //! 189 MOS_STATUS GetVvcpStateCommandSize( 190 uint32_t mode, 191 uint32_t *commandsSize, 192 uint32_t *patchListSize, 193 PMHW_VDBOX_STATE_CMDSIZE_PARAMS params); 194 195 //! 196 //! \brief Calculates the size for VVCP slice level commands 197 //! \details Client facing function to calculate the maximum size for VVCP picture level commands 198 //! \param [in] mode 199 //! Indicate the codec mode 200 //! \param [out] sliceCommandsSize 201 //! The maximum command buffer size for slice 202 //! \param [out] slicePatchListSize 203 //! The maximum command patch list size for slice 204 //! \param [out] tileCommandsSize 205 //! The maximum command buffer size for tile 206 //! \param [out] tilePatchListSize 207 //! The maximum command patch list size for tile 208 //! \return MOS_STATUS 209 //! MOS_STATUS_SUCCESS if success, else fail reason 210 //! 211 MOS_STATUS GetVvcpPrimitiveCommandSize( 212 uint32_t mode, 213 uint32_t *sliceCommandsSize, 214 uint32_t *slicePatchListSize, 215 uint32_t *tileCommandsSize, 216 uint32_t *tilePatchListSize); 217 218 //! 219 //! \brief Calculates the maximum size for HCP picture level commands 220 //! \details Client facing function to calculate the maximum size for HCP picture level commands 221 //! \param [in] mode 222 //! Indicate the codec mode 223 //! \param [out] commandsSize 224 //! The maximum command buffer size 225 //! \param [out] patchListSize 226 //! The maximum command patch list size 227 //! \param [in] params 228 //! Indicate the command size parameters 229 //! \return MOS_STATUS 230 //! MOS_STATUS_SUCCESS if success, else fail reason 231 //! 232 MOS_STATUS GetHcpStateCommandSize( 233 uint32_t mode, 234 uint32_t * commandsSize, 235 uint32_t * patchListSize, 236 PMHW_VDBOX_STATE_CMDSIZE_PARAMS params); 237 238 MEDIA_CLASS_DEFINE_END(CodechalHwInterfaceXe2_Lpm_Base) 239 }; 240 #endif // __CODEC_HW_XE2_LPM_H__ 241