1 /* 2 * Copyright (c) 2012-2017, 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_decode_hevc_g11.h 24 //! \brief Defines the decode interface extension for HEVC. 25 //! \details Defines all types, macros, and functions required by CodecHal for GEN11 HEVC decoding. Definitions are not externally facing. 26 //! This file should not be included except in codechal_decode_hevc_*.c/h. 27 //! 28 29 #ifndef __CODECHAL_DECODER_HEVC__G11_H__ 30 #define __CODECHAL_DECODER_HEVC__G11_H__ 31 32 #include "codechal_decode_hevc.h" 33 #include "codechal_decode_scalability.h" 34 #include "codechal_decode_singlepipe_virtualengine.h" 35 36 class CodechalDecodeHevcG11 : public CodechalDecodeHevc 37 { 38 public: 39 40 //! 41 //! \brief Allocate and initialize HEVC decoder standard 42 //! \param [in] settings 43 //! Pointer to CodechalSetting 44 //! \return MOS_STATUS 45 //! MOS_STATUS_SUCCESS if success, else fail reason 46 //! 47 MOS_STATUS AllocateStandard ( 48 CodechalSetting * settings) override; 49 50 //! 51 //! \brief Constructor 52 //! \param [in] hwInterface 53 //! Hardware interface 54 //! \param [in] debugInterface 55 //! Debug interface 56 //! \param [in] standardInfo 57 //! The information of decode standard for this instance 58 //! 59 CodechalDecodeHevcG11( 60 CodechalHwInterface *hwInterface, 61 CodechalDebugInterface* debugInterface, 62 PCODECHAL_STANDARD_INFO standardInfo); 63 64 //! 65 //! \brief Copy constructor 66 //! 67 CodechalDecodeHevcG11(const CodechalDecodeHevcG11&) = delete; 68 69 //! 70 //! \brief Copy assignment operator 71 //! 72 CodechalDecodeHevcG11& operator=(const CodechalDecodeHevcG11&) = delete; 73 74 //! 75 //! \brief Destructor 76 //! 77 ~CodechalDecodeHevcG11 (); 78 79 //! 80 //! \brief Set states for each frame to prepare for GEN11 HEVC decode 81 //! \return MOS_STATUS 82 //! MOS_STATUS_SUCCESS if success, else fail reason 83 //! 84 MOS_STATUS SetFrameStates () override; 85 86 //! 87 //! \brief HEVC decoder state level function 88 //! \details State level function for GEN11 HEVC decoder 89 //! 90 //! \return MOS_STATUS 91 //! MOS_STATUS_SUCCESS if success, else fail reason 92 //! 93 MOS_STATUS DecodeStateLevel () override; 94 95 //! 96 //! \brief HEVC decoder primitive level function 97 //! \details Primitive level function for GEN specific HEVC decoder 98 //! 99 //! \return MOS_STATUS 100 //! MOS_STATUS_SUCCESS if success, else fail reason 101 //! 102 MOS_STATUS DecodePrimitiveLevel () override; 103 104 //! 105 //! \brief Allocate variable sized resources 106 //! \details Allocate variable sized resources in HEVC decode driver 107 //! \return MOS_STATUS 108 //! MOS_STATUS_SUCCESS if success, else fail reason 109 //! 110 MOS_STATUS AllocateResourcesVariableSizes (); 111 112 //! 113 //! \brief Set S2L picture level Dmem parameters 114 //! \details Set S2L HuC Dmem picture level paramters 115 //! 116 //! \param [out] hucHevcS2LPicBss 117 //! Pointer to S2L Dmem picture Bss paramters 118 //! 119 //! \return MOS_STATUS 120 //! MOS_STATUS_SUCCESS if success, else fail reason 121 //! 122 MOS_STATUS SetHucDmemS2LPictureBss( 123 PHUC_HEVC_S2L_PIC_BSS hucHevcS2LPicBss) override; 124 125 //! 126 //! \brief Determine Decode Phase 127 //! \details Determine decode phase in hevc decode 128 //! 129 //! \return MOS_STATUS 130 //! MOS_STATUS_SUCCESS if success, else fail reason 131 //! 132 MOS_STATUS DetermineDecodePhase (); 133 134 //! 135 //! \brief Send S2L picture level commands 136 //! \details Send S2L picture level commands in HEVC decode driver 137 //! 138 //! \return MOS_STATUS 139 //! MOS_STATUS_SUCCESS if success, else fail reason 140 //! 141 MOS_STATUS SendPictureS2L () override; 142 143 //! 144 //! \brief Initialize the picture level MHW parameters for long format 145 //! \details Initialize the picture level MHW parameters for long format in HEVC decode driver 146 //! 147 //! \return MOS_STATUS 148 //! MOS_STATUS_SUCCESS if success, else fail reason 149 //! 150 MOS_STATUS InitPicLongFormatMhwParams() override; 151 152 //! 153 //! \brief Send long format picture level commands 154 //! \details Send long format picture level commands in HEVC decode driver 155 //! 156 //! \return MOS_STATUS 157 //! MOS_STATUS_SUCCESS if success, else fail reason 158 //! 159 MOS_STATUS SendPictureLongFormat () override; 160 161 //! 162 //! \brief Send long format Slice level commands 163 //! \details Send long format Slice level commands in HEVC decode driver 164 //! 165 //! \param [out] cmdBuffer 166 //! Pointer to Command buffer 167 //! \param [in] hevcSliceState 168 //! Pointer to HEVC Slice State 169 //! 170 //! \return MOS_STATUS 171 //! MOS_STATUS_SUCCESS if success, else fail reason 172 //! 173 MOS_STATUS SendSliceLongFormat ( 174 PMOS_COMMAND_BUFFER cmdBuffer, 175 PMHW_VDBOX_HEVC_SLICE_STATE hevcSliceState); 176 177 PCODEC_HEVC_EXT_PIC_PARAMS m_hevcExtPicParams; //!< Extended pic params for Rext 178 PCODEC_HEVC_EXT_SLICE_PARAMS m_hevcExtSliceParams; //!< Extended slice params for Rext 179 180 #if USE_CODECHAL_DEBUG_TOOL 181 MOS_STATUS DumpPicParams( 182 PCODEC_HEVC_PIC_PARAMS picParams, 183 PCODEC_HEVC_EXT_PIC_PARAMS extPicParams); 184 185 MOS_STATUS DumpSliceParams( 186 PCODEC_HEVC_SLICE_PARAMS sliceParams, 187 PCODEC_HEVC_EXT_SLICE_PARAMS extSliceParams, 188 uint32_t numSlices, 189 bool shortFormatInUse); 190 #endif 191 192 protected: 193 194 //! 195 //! \brief End status report for GEN specific decoder 196 //! \param [in] decodeStatusReport 197 //! Decode status 198 //! \param [out] cmdBuffer 199 //! Pointer to command buffer 200 //! \return MOS_STATUS 201 //! MOS_STATUS_SUCCESS if success, else fail reason 202 //! 203 MOS_STATUS EndStatusReport( 204 CodechalDecodeStatusReport &decodeStatusReport, 205 PMOS_COMMAND_BUFFER cmdBuffer) override; 206 207 //! 208 //! \brief End status report for GEN specific decoder 209 // \details End status report for GEN specific decoder to read HCP status report at end of FE 210 //! \param [out] cmdBuffer 211 //! Pointer to command buffer 212 //! \return MOS_STATUS 213 //! MOS_STATUS_SUCCESS if success, else fail reason 214 //! 215 MOS_STATUS EndStatusReportForFE( 216 PMOS_COMMAND_BUFFER cmdBuffer); 217 218 //! 219 //! \brief Set And Populate VE Hint parameters 220 //! \details Set Virtual Engine hint parameter and populate it to primary cmd buffer attributes 221 //! \param [in] primCmdBuf 222 //! Pointer to primary cmd buffer 223 //! \return MOS_STATUS 224 //! MOS_STATUS_SUCCESS if success, else fail reason 225 //! 226 MOS_STATUS SetAndPopulateVEHintParams( 227 PMOS_COMMAND_BUFFER primCmdBuf); 228 229 //! 230 //! \brief Determine if need to send prolog with frame tracking 231 //! \param [in] sendPrologWithFrameTracking 232 //! Pointer to bool type flag 233 //! \return MOS_STATUS 234 //! MOS_STATUS_SUCCESS if success, else fail reason 235 //! 236 MOS_STATUS DetermineSendProlgwithFrmTracking( 237 bool *sendPrologWithFrameTracking); 238 239 //! 240 //! \brief Set up params for gpu context creation 241 //! \return MOS_STATUS 242 //! MOS_STATUS_SUCCESS if success, else fail reason 243 //! 244 MOS_STATUS SetGpuCtxCreatOption(CodechalSetting * settings) override; 245 246 //! 247 //! \brief Check LCU Size 248 //! \details Check LCU Size for HEVC decode driver 249 //! \return MOS_STATUS 250 //! MOS_STATUS_SUCCESS if success, else fail reason 251 //! 252 MOS_STATUS CheckLCUSize(); 253 254 private: 255 //! 256 //! \brief The virtual function for decode standard to override the requested space size 257 //! \param [in] requestedSize 258 //! The intial request size computed by picture level and slice level 259 //! \return The final requested space size 260 //! 261 uint32_t RequestedSpaceSize(uint32_t requestedSize) override; 262 263 //! 264 //! \brief The virtual function for decode standard to override the extra requested space size 265 //! \param [in] requestedSize 266 //! The intial request size computed by picture level and slice level 267 //! \param [in] additionalSizeNeeded 268 //! The additional request size for command buffer 269 //! \return The extra requested space size 270 //! 271 virtual MOS_STATUS VerifyExtraSpace( 272 uint32_t requestedSize, 273 uint32_t additionalSizeNeeded) override; 274 275 protected: 276 uint32_t m_frameSizeMaxAlloced; //!< Max Frame size used for buffer allocation in past frames 277 278 PCODECHAL_DECODE_SINGLEPIPE_VIRTUALENGINE_STATE m_sinlgePipeVeState; //!< single pipe virtual engine state 279 PCODECHAL_DECODE_SCALABILITY_STATE m_scalabilityState; //!< Scalability state 280 }; 281 282 #endif // __CODECHAL_DECODER_HEVC__G11_H__ 283