1 /* 2 * Copyright (c) 2017-2019, 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_encode_mpeg2_g12.h 24 //! \brief MPEG2 dual-pipe encoder for GEN12 platform. 25 //! 26 27 #ifndef __CODECHAL_ENCODE_MPEG2_G12_H__ 28 #define __CODECHAL_ENCODE_MPEG2_G12_H__ 29 30 #include "codechal_encode_mpeg2.h" 31 #include "codechal_encode_sw_scoreboard_g12.h" 32 #include "codechal_encode_singlepipe_virtualengine.h" 33 34 //! 35 //! \class CodechalEncodeMpeg2G12 36 //! \brief MPEG2 dual-pipe encoder base class for GEN12 37 //! \details This class defines the member fields, functions for GEN12 platform 38 //! 39 class CodechalEncodeMpeg2G12 : public CodechalEncodeMpeg2 40 { 41 public: 42 PCODECHAL_ENCODE_SINGLEPIPE_VIRTUALENGINE_STATE m_sinlgePipeVeState; //!< single pipe virtual engine state 43 //! 44 //! \brief Constructor 45 //! 46 CodechalEncodeMpeg2G12( 47 CodechalHwInterface* hwInterface, 48 CodechalDebugInterface* debugInterface, 49 PCODECHAL_STANDARD_INFO standardInfo); 50 51 //! 52 //! \brief Copy constructor 53 //! 54 CodechalEncodeMpeg2G12(const CodechalEncodeMpeg2G12&) = delete; 55 56 //! 57 //! \brief Copy assignment operator 58 //! 59 CodechalEncodeMpeg2G12& operator=(const CodechalEncodeMpeg2G12&) = delete; 60 61 //! 62 //! \brief Destructor 63 //! 64 ~CodechalEncodeMpeg2G12(); 65 66 //! 67 //! \brief Resize buffers due to resoluton change. 68 //! \details Resize buffers due to resoluton change. 69 //! 70 //! \return void 71 //! 72 virtual void ResizeOnResChange() override; 73 74 //! 75 //! \brief Set And Populate VE Hint parameters 76 //! \details Set Virtual Engine hint parameter and populate it to primary cmd buffer attributes 77 //! \param [in] cmdBuffer 78 //! Pointer to primary cmd buffer 79 //! \return MOS_STATUS 80 //! MOS_STATUS_SUCCESS if success, else fail reason 81 //! 82 MOS_STATUS SetAndPopulateVEHintParams( 83 PMOS_COMMAND_BUFFER cmdBuffer); 84 85 MOS_STATUS AddMediaVfeCmd( 86 PMOS_COMMAND_BUFFER cmdBuffer, 87 SendKernelCmdsParams *params) override; 88 89 //! 90 //! \brief Set up params for gpu context creation 91 //! \return MOS_STATUS 92 //! MOS_STATUS_SUCCESS if success, else fail reason 93 //! 94 MOS_STATUS SetGpuCtxCreatOption() override; 95 96 //! 97 //! \brief Encode User Feature Key Report. 98 //! \details Report user feature values set by encode. 99 //! 100 //! \return MOS_STATUS 101 //! MOS_STATUS_SUCCESS if success 102 //! 103 virtual MOS_STATUS UserFeatureKeyReport() override; 104 105 MOS_STATUS SubmitCommandBuffer( 106 PMOS_COMMAND_BUFFER cmdBuffer, 107 bool bNullRendering) override; 108 109 protected: 110 MOS_STATUS EncodeMeKernel() override; 111 112 MOS_STATUS Initialize(CodechalSetting * codecHalSettings) override; 113 114 MOS_STATUS InitKernelState() override; 115 116 MOS_STATUS InitKernelStateMbEnc(); 117 118 //! 119 //! \brief Get maximum BT count 120 //! 121 //! \return uint32_t 122 //! Maximum BT count 123 //! 124 virtual uint32_t GetMaxBtCount() override; 125 126 //! 127 //! \brief Encode kernel functions 128 //! 129 //! \return MOS_STATUS 130 //! MOS_STATUS_SUCCESS if success, else fail reason 131 //! 132 virtual MOS_STATUS ExecuteKernelFunctions() override; 133 134 MOS_STATUS SetCurbeMbEnc( 135 bool mbEncIFrameDistEnabled, 136 bool mbQpDataEnabled) override; 137 138 MOS_STATUS SendMbEncSurfaces( 139 PMOS_COMMAND_BUFFER cmdBuffer, 140 bool mbEncIFrameDistEnabled) override; 141 142 MOS_STATUS SendPrologWithFrameTracking( 143 PMOS_COMMAND_BUFFER cmdBuffer, 144 bool frameTracking, 145 MHW_MI_MMIOREGISTERS *mmioRegister = nullptr) override; 146 147 //! 148 //! \brief Get encoder kernel header and kernel size 149 //! 150 //! \param [in] binary 151 //! Pointer to kernel binary 152 //! \param [in] operation 153 //! Enc kernel operation 154 //! \param [in] krnStateIdx 155 //! Kernel state index 156 //! \param [out] krnHeader 157 //! Pointer to kernel header 158 //! \param [out] krnSize 159 //! Pointer to kernel size 160 //! 161 //! \return MOS_STATUS 162 //! MOS_STATUS_SUCCESS if success, else fail reason 163 //! 164 static MOS_STATUS GetKernelHeaderAndSize( 165 void *binary, 166 EncOperation operation, 167 uint32_t krnStateIdx, 168 void *krnHeader, 169 uint32_t *krnSize); 170 171 MOS_STATUS InitMmcState() override; 172 173 CodechalEncodeSwScoreboardG12 *m_swScoreboardState = nullptr; //!< pointer to SW scoreboard ini state. 174 175 MOS_STATUS UpdateCmdBufAttribute( 176 PMOS_COMMAND_BUFFER cmdBuffer, 177 bool renderEngineInUse) override; 178 }; 179 180 #endif // __CODECHAL_ENCODE_MPEG2_G12_H__ 181