| 1 |
/* |
| 2 |
* Copyright (c) 2017-2020, 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_vp9_g12.h |
| 24 |
//! \brief Defines the decode interface extension for Gen12 VP9. |
| 25 |
//! \details Defines all types, macros, and functions required by CodecHal for Gen12 VP9 decoding. |
| 26 |
//! Definitions are not externally facing. |
| 27 |
//! |
| 28 |
|
| 29 |
#ifndef __CODECHAL_DECODE_VP9_G12_H__ |
| 30 |
#define __CODECHAL_DECODE_VP9_G12_H__ |
| 31 |
|
| 32 |
#include "codechal_decode_vp9.h" |
| 33 |
#include "codechal_decode_scalability_g12.h" |
| 34 |
#include "codechal_decode_singlepipe_virtualengine.h" |
| 35 |
#include "codechal_decode_sfc_vp9_g12.h" |
| 36 |
#include "mhw_vdbox_g12_X.h" |
| 37 |
|
| 38 |
//! |
| 39 |
//! \class CodechalDecodeVp9G12 |
| 40 |
//! \brief This class defines the member fields, functions etc used by gen12 VP9 decoder. |
| 41 |
//! |
| 42 |
class CodechalDecodeVp9G12 : public CodechalDecodeVp9 |
| 43 |
{ |
| 44 |
public: |
| 45 |
//! |
| 46 |
//! \brief Constructor |
| 47 |
//! \param [in] hwInterface |
| 48 |
//! Hardware interface |
| 49 |
//! \param [in] debugInterface |
| 50 |
//! Debug interface |
| 51 |
//! \param [in] standardInfo |
| 52 |
//! The information of decode standard for this instance |
| 53 |
//! |
| 54 |
CodechalDecodeVp9G12( |
| 55 |
CodechalHwInterface *hwInterface, |
| 56 |
CodechalDebugInterface* debugInterface, |
| 57 |
PCODECHAL_STANDARD_INFO standardInfo); |
| 58 |
|
| 59 |
//! |
| 60 |
//! \brief Copy constructor |
| 61 |
//! |
| 62 |
CodechalDecodeVp9G12(const CodechalDecodeVp9G12&) = delete; |
| 63 |
|
| 64 |
//! |
| 65 |
//! \brief Copy assignment operator |
| 66 |
//! |
| 67 |
CodechalDecodeVp9G12& operator=(const CodechalDecodeVp9G12&) = delete; |
| 68 |
|
| 69 |
~CodechalDecodeVp9G12(); |
| 70 |
|
| 71 |
MOS_STATUS AllocateStandard ( |
| 72 |
CodechalSetting * settings) override; |
| 73 |
|
| 74 |
//! |
| 75 |
//! \brief Set states for each frame to prepare for VP9 G12 decode |
| 76 |
//! \return MOS_STATUS |
| 77 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 78 |
//! |
| 79 |
MOS_STATUS SetFrameStates() override; |
| 80 |
|
| 81 |
MOS_STATUS DecodeStateLevel () override; |
| 82 |
|
| 83 |
MOS_STATUS DecodePrimitiveLevel () override; |
| 84 |
|
| 85 |
MOS_STATUS InitializeDecodeMode () override; |
| 86 |
|
| 87 |
MOS_STATUS AllocateResourcesVariableSizes() override; |
| 88 |
|
| 89 |
MOS_STATUS DetermineDecodePhase() override; |
| 90 |
|
| 91 |
MOS_STATUS InitSfcState() override; |
| 92 |
|
| 93 |
MOS_STATUS CalcDownsamplingParams( |
| 94 |
void *picParams, |
| 95 |
uint32_t *refSurfWidth, |
| 96 |
uint32_t *refSurfHeight, |
| 97 |
MOS_FORMAT *format, |
| 98 |
uint8_t *frameIdx) override; |
| 99 |
|
| 100 |
MOS_STATUS InitMmcState() override; |
| 101 |
|
| 102 |
protected: |
| 103 |
|
| 104 |
//! |
| 105 |
//! \brief Set And Populate VE Hint parameters |
| 106 |
//! \details Set Virtual Engine hint parameter and populate it to primary cmd buffer attributes |
| 107 |
//! \param [in] primCmdBuf |
| 108 |
//! Pointer to primary cmd buffer |
| 109 |
//! \return MOS_STATUS |
| 110 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 111 |
//! |
| 112 |
MOS_STATUS SetAndPopulateVEHintParams( |
| 113 |
PMOS_COMMAND_BUFFER primCmdBuf); |
| 114 |
|
| 115 |
//! |
| 116 |
//! \brief Determin if need to send prolog with frame tracking |
| 117 |
//! \param [in] sendPrologWithFrameTracking |
| 118 |
//! Pointer to bool type flag |
| 119 |
//! \return MOS_STATUS |
| 120 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 121 |
//! |
| 122 |
MOS_STATUS DetermineSendProlgwithFrmTracking( |
| 123 |
bool *sendPrologWithFrameTracking); |
| 124 |
|
| 125 |
//! |
| 126 |
//! \brief Add picture state mhw parameters |
| 127 |
//! \details Add picture state mhw parameters to command buffer for VP9 decoder |
| 128 |
//! \param [in] cmdBuffer |
| 129 |
//! Command buffer to hold HW commands |
| 130 |
//! |
| 131 |
//! \return MOS_STATUS |
| 132 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 133 |
//! |
| 134 |
MOS_STATUS AddPicStateMhwCmds( |
| 135 |
PMOS_COMMAND_BUFFER cmdBuffer) override; |
| 136 |
|
| 137 |
MOS_STATUS SetGpuCtxCreatOption(CodechalSetting *settings) override; |
| 138 |
|
| 139 |
private: |
| 140 |
//! |
| 141 |
//! \brief The virtual function for decode standard to override the requested space size |
| 142 |
//! \param [in] requestedSize |
| 143 |
//! The intial request size computed by picture level and slice level |
| 144 |
//! \return The final requested space size |
| 145 |
//! |
| 146 |
uint32_t RequestedSpaceSize(uint32_t requestedSize) override; |
| 147 |
|
| 148 |
//! |
| 149 |
//! \brief The virtual function for decode standard to override the extra requested space size |
| 150 |
//! \param [in] requestedSize |
| 151 |
//! The intial request size computed by picture level and slice level |
| 152 |
//! \param [in] additionalSizeNeeded |
| 153 |
//! The additional request size for command buffer |
| 154 |
//! \return The extra requested space size |
| 155 |
//! |
| 156 |
virtual MOS_STATUS VerifyExtraSpace( |
| 157 |
uint32_t requestedSize, |
| 158 |
uint32_t additionalSizeNeeded) override; |
| 159 |
|
| 160 |
//! |
| 161 |
//! \brief Utility function to allocate internal histogram surface |
| 162 |
//! |
| 163 |
//! \return MOS_STATUS |
| 164 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 165 |
//! |
| 166 |
MOS_STATUS AllocateHistogramSurface(); |
| 167 |
|
| 168 |
protected: |
| 169 |
uint32_t m_frameSizeMaxAlloced; //!< Max Frame size used for buffer allocation in past frames |
| 170 |
|
| 171 |
PCODECHAL_DECODE_SINGLEPIPE_VIRTUALENGINE_STATE m_sinlgePipeVeState; //!< single pipe virtual engine state |
| 172 |
PCODECHAL_DECODE_SCALABILITY_STATE_G12 m_scalabilityState; //!< Scalability state |
| 173 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 174 |
bool m_histogramDebug = true; //!< Internal histogram buffer debug |
| 175 |
#endif |
| 176 |
|
| 177 |
#ifdef _DECODE_PROCESSING_SUPPORTED |
| 178 |
CodechalVp9SfcStateG12 *m_sfcState = nullptr; //!< VP9 SFC state |
| 179 |
#endif |
| 180 |
PMOS_SURFACE m_histogramSurface = nullptr; //!< Internal histogram buffer |
| 181 |
}; |
| 182 |
#endif // __CODECHAL_DECODE_VP9_G12_H__ |
| 183 |
|