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