| 1 |
/* |
| 2 |
* Copyright (c) 2011-2025, 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_decoder.h |
| 24 |
//! \brief Defines the decode interface for CodecHal. |
| 25 |
//! \details The decode interface is further sub-divided by standard, this file is for the base interface which is shared by all decode standards. |
| 26 |
//! |
| 27 |
|
| 28 |
#ifndef __CODECHAL_DECODER_H__ |
| 29 |
#define __CODECHAL_DECODER_H__ |
| 30 |
|
| 31 |
#include "codechal.h" |
| 32 |
#include "codechal_setting.h" |
| 33 |
#include "codechal_hw.h" |
| 34 |
#include "codechal_debug.h" |
| 35 |
#include "codechal_oca_debug.h" |
| 36 |
#include "codechal_decode_downsampling.h" |
| 37 |
#include "codechal_decode_sfc.h" |
| 38 |
#include "codechal_mmc.h" |
| 39 |
#include "codechal_utilities.h" |
| 40 |
#include "codec_def_decode.h" |
| 41 |
#include "cm_wrapper.h" |
| 42 |
#include "media_perf_profiler.h" |
| 43 |
#include "codec_def_cenc_decode.h" |
| 44 |
|
| 45 |
class CodechalSecureDecodeInterface; |
| 46 |
class CodechalDecodeHistogram; |
| 47 |
|
| 48 |
//------------------------------------------------------------------------------ |
| 49 |
// Macros specific to MOS_CODEC_SUBCOMP_DECODE sub-comp |
| 50 |
//------------------------------------------------------------------------------ |
| 51 |
#define CODECHAL_DECODE_ASSERT(_expr) \ |
| 52 |
MOS_ASSERT(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_DECODE, _expr) |
| 53 |
|
| 54 |
#define CODECHAL_DECODE_COND_ASSERTMESSAGE(_expr, _message, ...) \ |
| 55 |
if (_expr) \ |
| 56 |
{ \ |
| 57 |
CODECHAL_DECODE_ASSERTMESSAGE(_message, ##__VA_ARGS__) \ |
| 58 |
} |
| 59 |
|
| 60 |
#define CODECHAL_DECODE_ASSERTMESSAGE(_message, ...) \ |
| 61 |
MOS_ASSERTMESSAGE(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_DECODE, _message, ##__VA_ARGS__) |
| 62 |
|
| 63 |
#define CODECHAL_DECODE_WARNINGMESSAGE(_message, ...) \ |
| 64 |
MOS_WARNINGMESSAGE(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_DECODE, _message, ##__VA_ARGS__) |
| 65 |
|
| 66 |
#define CODECHAL_DECODE_NORMALMESSAGE(_message, ...) \ |
| 67 |
MOS_NORMALMESSAGE(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_DECODE, _message, ##__VA_ARGS__) |
| 68 |
|
| 69 |
#define CODECHAL_DECODE_VERBOSEMESSAGE(_message, ...) \ |
| 70 |
MOS_VERBOSEMESSAGE(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_DECODE, _message, ##__VA_ARGS__) |
| 71 |
|
| 72 |
#define CODECHAL_DECODE_FUNCTION_ENTER \ |
| 73 |
MOS_FUNCTION_ENTER(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_DECODE) |
| 74 |
|
| 75 |
#define CODECHAL_DECODE_CHK_STATUS(_stmt) \ |
| 76 |
MOS_CHK_STATUS(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_DECODE, _stmt) |
| 77 |
|
| 78 |
#define CODECHAL_DECODE_CHK_STATUS_RETURN(_stmt) \ |
| 79 |
MOS_CHK_STATUS_RETURN(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_DECODE, _stmt) |
| 80 |
|
| 81 |
#define CODECHAL_DECODE_CHK_STATUS_BREAK(_stmt) \ |
| 82 |
MOS_CHK_STATUS_BREAK(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_DECODE, _stmt) |
| 83 |
|
| 84 |
#define CODECHAL_DECODE_CHK_STATUS_MESSAGE(_stmt, _message, ...) \ |
| 85 |
MOS_CHK_STATUS_MESSAGE(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_DECODE, _stmt, _message, ##__VA_ARGS__) |
| 86 |
|
| 87 |
#define CODECHAL_DECODE_CHK_STATUS_MESSAGE_RETURN(_stmt, _message, ...) \ |
| 88 |
MOS_CHK_STATUS_MESSAGE_RETURN(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_DECODE, _stmt, _message, ##__VA_ARGS__) |
| 89 |
|
| 90 |
#define CODECHAL_DECODE_CHK_NULL(_ptr) \ |
| 91 |
MOS_CHK_NULL(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_DECODE, _ptr) |
| 92 |
|
| 93 |
#define CODECHAL_DECODE_CHK_NULL_RETURN(_ptr) \ |
| 94 |
MOS_CHK_NULL_RETURN(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_DECODE, _ptr) |
| 95 |
|
| 96 |
#define CODECHAL_DECODE_CHK_NULL_NO_STATUS(_ptr) \ |
| 97 |
MOS_CHK_NULL_NO_STATUS(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_DECODE, _ptr) |
| 98 |
|
| 99 |
#define CODECHAL_DECODE_CHK_NULL_NO_STATUS_RETURN(_ptr) \ |
| 100 |
MOS_CHK_NULL_NO_STATUS_RETURN(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_DECODE, _ptr) |
| 101 |
|
| 102 |
#define CODECHAL_DECODE_CHK_COND(_expr, _message, ...) \ |
| 103 |
MOS_CHK_COND(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_DECODE,_expr,_message, ##__VA_ARGS__) |
| 104 |
|
| 105 |
#define CODECHAL_DECODE_CHK_COND_RETURN(_expr, _message, ...) \ |
| 106 |
MOS_CHK_COND_RETURN(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_DECODE,_expr,_message, ##__VA_ARGS__) |
| 107 |
|
| 108 |
#define CODECHAL_DECODE_NUM_STREAM_OUT_BUFFERS 5 |
| 109 |
|
| 110 |
#define CODECHAL_DECODE_STATUS_NUM 512 |
| 111 |
|
| 112 |
typedef enum _CODECHAL_CS_ENGINE_ID_DEF |
| 113 |
{ |
| 114 |
// Instance ID |
| 115 |
CODECHAL_CS_INSTANCE_ID_VDBOX0 = 0, |
| 116 |
CODECHAL_CS_INSTANCE_ID_VDBOX1 = 1, |
| 117 |
CODECHAL_CS_INSTANCE_ID_VDBOX2 = 2, |
| 118 |
CODECHAL_CS_INSTANCE_ID_VDBOX3 = 3, |
| 119 |
CODECHAL_CS_INSTANCE_ID_VDBOX4 = 4, |
| 120 |
CODECHAL_CS_INSTANCE_ID_VDBOX5 = 5, |
| 121 |
CODECHAL_CS_INSTANCE_ID_VDBOX6 = 6, |
| 122 |
CODECHAL_CS_INSTANCE_ID_VDBOX7 = 7, |
| 123 |
CODECHAL_CS_INSTANCE_ID_MAX, |
| 124 |
// Class ID |
| 125 |
CODECHAL_CLASS_ID_VIDEO_ENGINE = 1, |
| 126 |
} CODECHAL_CS_ENGINE_ID_DEF; |
| 127 |
|
| 128 |
typedef union _CODECHAL_CS_ENGINE_ID |
| 129 |
{ |
| 130 |
struct |
| 131 |
{ |
| 132 |
uint32_t ClassId : 3; //[0...4] |
| 133 |
uint32_t ReservedFiled1 : 1; //[0] |
| 134 |
uint32_t InstanceId : 6; //[0...7] |
| 135 |
uint32_t ReservedField2 : 22; //[0] |
| 136 |
} fields; |
| 137 |
uint32_t value; |
| 138 |
} CODECHAL_CS_ENGINE_ID, *PCODECHAL_CS_ENGINE_ID; |
| 139 |
|
| 140 |
typedef struct _CODECHAL_VLD_SLICE_RECORD |
| 141 |
{ |
| 142 |
uint32_t dwSkip; |
| 143 |
uint32_t dwOffset; |
| 144 |
uint32_t dwLength; |
| 145 |
uint32_t dwSliceStartMbOffset; |
| 146 |
bool bIsLastSlice; |
| 147 |
} CODECHAL_VLD_SLICE_RECORD, *PCODECHAL_VLD_SLICE_RECORD; |
| 148 |
|
| 149 |
//! |
| 150 |
//! \struct CodechalDecodeStatusReport |
| 151 |
//! \brief Information pertaining to a particular picture's decode operation |
| 152 |
//! |
| 153 |
struct CodechalDecodeStatusReport |
| 154 |
{ |
| 155 |
//! \brief Status for the picture associated with this status report |
| 156 |
CODECHAL_STATUS m_codecStatus = CODECHAL_STATUS_SUCCESSFUL; |
| 157 |
//! \brief Status report number associated with the picture in this status report provided in Execute() |
| 158 |
uint32_t m_statusReportNumber = 0; |
| 159 |
//! \brief Uncompressed frame information for the picture associated with this status report |
| 160 |
CODEC_PICTURE m_currDecodedPic = {0}; |
| 161 |
//! \brief Applies for VC1 and MPEG2 only, uncompressed frame information for the out of loop deblock destination |
| 162 |
CODEC_PICTURE m_currDeblockedPic = {0}; |
| 163 |
//! \brief Pointer to the resource for the decode render target for the picture associated with this status report |
| 164 |
MOS_RESOURCE m_currDecodedPicRes = {0}; |
| 165 |
//! \brief Applies when debug dumps are enabled for VC1 only, resource of deblocked picture |
| 166 |
MOS_RESOURCE m_deblockedPicResOlp = {0}; |
| 167 |
//! \brief number of MBs decoded or if unused set to 0xFFFF |
| 168 |
uint16_t m_numMbsAffected = 0; |
| 169 |
//! \brief Crc of frame from MMIO |
| 170 |
uint32_t m_frameCrc = 0; |
| 171 |
|
| 172 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 173 |
//! \brief Applies when debug dumps are enabled, pointer to SFC output resource for the picture associated with this status report |
| 174 |
PMOS_RESOURCE m_currSfcOutputPicRes = nullptr; |
| 175 |
//! \brief Applies when debug dumps are enabled, pointer to histogram output resource for the picture associated with this status report |
| 176 |
PMOS_RESOURCE m_currHistogramOutBuf = nullptr; |
| 177 |
//! \brief Applies when debug dumps are enabled, pointer to AV1 film grain output resource for the picture associated with this status report |
| 178 |
PMOS_RESOURCE m_currFgOutputPicRes = nullptr; |
| 179 |
//! \brief Applies when debug dumps are enabled, stream out buffer (legacy) |
| 180 |
PMOS_RESOURCE m_streamOutBuf = nullptr; |
| 181 |
//! \brief Applies when debug dumps are enabled, index of the streamout buffer (legacy) |
| 182 |
uint32_t m_streamoutIdx = 0; |
| 183 |
//! \brief Applies when debug dumps are enabled, stream in buffer |
| 184 |
MOS_RESOURCE m_streamInBufRes = {0}; |
| 185 |
//! \brief Applies when debug dumps are enabled, stream out buffer |
| 186 |
MOS_RESOURCE m_streamOutBufRes = {0}; |
| 187 |
//! \brief Applies when debug dumps are enabled, stream size |
| 188 |
uint32_t m_streamSize = 0; |
| 189 |
//! \brief Applies when debug dumps are enabled, indicates whether or not this is the final field in the frame. |
| 190 |
bool m_secondField = false; |
| 191 |
//! \brief Applies to VC1 only, indicates whether or not the frame required OLP. |
| 192 |
bool m_olpNeeded = false; |
| 193 |
//! \brief Applies when debug dumps are enabled, frame type (I/P/B) |
| 194 |
uint16_t m_frameType = 0; |
| 195 |
#endif // (_DEBUG || _RELEASE_INTERNAL) |
| 196 |
}; |
| 197 |
|
| 198 |
//! |
| 199 |
//! \struct CodechalDecodeStatus |
| 200 |
//! \brief Codechal decode status for the frame |
| 201 |
//! |
| 202 |
struct CodechalDecodeStatus |
| 203 |
{ |
| 204 |
//! \brief Value stored by MFX engine |
| 205 |
uint32_t m_hwStoredData = 0; |
| 206 |
//! \brief SW(driver) stored value |
| 207 |
uint32_t m_swStoredData = 0; |
| 208 |
//! \brief Value of MMIO decoding effor eStatus register |
| 209 |
uint32_t m_mmioErrorStatusReg = 0; |
| 210 |
//! \brief Value of MMIO decoding MB error register |
| 211 |
uint32_t m_mmioMBCountReg = 0; |
| 212 |
//! \brief Frame CRC related to current frames |
| 213 |
uint32_t m_mmioFrameCrcReg = 0; |
| 214 |
//! \brief Value of MMIO CS Engine ID register for each BB |
| 215 |
uint32_t m_mmioCsEngineIdReg[CODECHAL_CS_INSTANCE_ID_MAX] = {0}; |
| 216 |
//! \brief Huc error for HEVC Fix Function, DWORD0: mask value, DWORD1: reg value |
| 217 |
uint64_t m_hucErrorStatus2 = 0; |
| 218 |
//! \brief Huc error for HEVC Fix Function, DWORD0: mask value, DWORD1: reg value |
| 219 |
uint64_t m_hucErrorStatus = 0; |
| 220 |
|
| 221 |
CodechalDecodeStatusReport m_decodeStatusReport; |
| 222 |
}; |
| 223 |
|
| 224 |
//! |
| 225 |
//! \struct CodechalDecodeStatusBuffer |
| 226 |
//! \brief Codechal decode status buffer |
| 227 |
//! |
| 228 |
struct CodechalDecodeStatusBuffer |
| 229 |
{ |
| 230 |
//! \brief Codechal decode status |
| 231 |
CodechalDecodeStatus *m_decodeStatus = nullptr; |
| 232 |
//! \brief Handle of status buffer |
| 233 |
MOS_RESOURCE m_statusBuffer = {0}; |
| 234 |
//! \brief Locked data point of status buffer |
| 235 |
uint32_t *m_data = nullptr; |
| 236 |
//! \brief Software store data |
| 237 |
uint32_t m_swStoreData = 0; |
| 238 |
//! \brief First index for status buffer |
| 239 |
uint16_t m_firstIndex = 0; |
| 240 |
//! \brief Current index for status buffer |
| 241 |
uint16_t m_currIndex = 0; |
| 242 |
//! \brief Offset to store data |
| 243 |
uint8_t m_storeDataOffset = 0; |
| 244 |
//! \brief Offset to decode error status |
| 245 |
uint8_t m_decErrorStatusOffset = 0; |
| 246 |
//! \brief Offset to decode frame CRC |
| 247 |
uint8_t m_decFrameCrcOffset = 0; |
| 248 |
//! \brief Offset to decode MB count |
| 249 |
uint8_t m_decMBCountOffset = 0; |
| 250 |
//! \brief Offset to CS engine ID |
| 251 |
uint8_t m_csEngineIdOffset = 0; |
| 252 |
|
| 253 |
//! \brief Offset to mask of MMIO HuCErrorStatus2 |
| 254 |
uint8_t m_hucErrorStatus2MaskOffset = 0; |
| 255 |
//! \brief Offset to MMIO HuCErrorStatus2 |
| 256 |
uint8_t m_hucErrorStatus2RegOffset = 0; |
| 257 |
//! \brief Offset to mask of MMIO HuCErrorStatus |
| 258 |
uint8_t m_hucErrorStatusMaskOffset = 0; |
| 259 |
//! \brief Offset to MMIO HuCErrorStatus |
| 260 |
uint8_t m_hucErrorStatusRegOffset = 0; |
| 261 |
}; |
| 262 |
|
| 263 |
//! |
| 264 |
//! \class CodechalDecode |
| 265 |
//! \brief This class defines the common member fields, functions etc as decode base class. |
| 266 |
//! |
| 267 |
class CodechalDecode : public Codechal |
| 268 |
{ |
| 269 |
public: |
| 270 |
//! |
| 271 |
//! \enum CodechalHcpDecodePhase |
| 272 |
//! \brief enum constant for HEVC/VP9 decode pass control |
| 273 |
//! |
| 274 |
enum CodechalHcpDecodePhase |
| 275 |
{ |
| 276 |
CodechalHcpDecodePhaseInitialized = 0x00, //!< Initial phase |
| 277 |
CodechalHcpDecodePhaseLegacyLong, //!< Legacy long format phase |
| 278 |
CodechalHcpDecodePhaseLegacyS2L, //!< Legacy short to long phase |
| 279 |
CodechalHcpDecodePhaseMax //!< Maximal phases |
| 280 |
}; |
| 281 |
|
| 282 |
//! |
| 283 |
//! \enum CodechalDecodeMotionType |
| 284 |
//! \brief Codechal decode motion type |
| 285 |
//! |
| 286 |
enum CodechalDecodeMotionType |
| 287 |
{ |
| 288 |
CodechalDecodeMcField = 1, //!< Field motion type |
| 289 |
CodechalDecodeMcFrame = 2, //!< Frame motion type |
| 290 |
CodechalDecodeMc16x8 = 2, //!< 16x8 motion type |
| 291 |
CodechalDecodeMcDmv = 3 //!< DMV motion type |
| 292 |
}; |
| 293 |
|
| 294 |
//! |
| 295 |
//! \enum CodechalDecodeMvPacking |
| 296 |
//! \brief For motion vector packing: the equivilant derefences of a [2][2][2] array mapped as a [8] array |
| 297 |
//! |
| 298 |
enum CodechalDecodeMvPacking |
| 299 |
{ |
| 300 |
CodechalDecodeRstFirstForwHorz = 0, //!< first forward horizontal |
| 301 |
CodechalDecodeRstFirstForwVert = 1, //!< first forward vertical |
| 302 |
CodechalDecodeRstFirstBackHorz = 2, //!< first backward horizontal |
| 303 |
CodechalDecodeRstFirstBackVert = 3, //!< first backward vertical |
| 304 |
CodechalDecodeRstSecndForwHorz = 4, //!< second forward horizontal |
| 305 |
CodechalDecodeRstSecndForwVert = 5, //!< second forward vertical |
| 306 |
CodechalDecodeRstSecndBackHorz = 6, //!< second backward horizontal |
| 307 |
CodechalDecodeRstSecndBackVert = 7 //!< second backward vertical |
| 308 |
}; |
| 309 |
|
| 310 |
//! |
| 311 |
//! \enum CodechalDecodeRefAddrIndex |
| 312 |
//! \brief Reference address indexes |
| 313 |
//! |
| 314 |
enum CodechalDecodeRefAddrIndex |
| 315 |
{ |
| 316 |
// MPEG2/VC1 reference address indexes |
| 317 |
CodechalDecodeFwdRefTop = 0, //!< forward reference top field |
| 318 |
CodechalDecodeBwdRefTop = 1, //!< backward reference top field |
| 319 |
CodechalDecodeFwdRefBottom = 2, //!< forward reference bottom field |
| 320 |
CodechalDecodeBwdRefBottom = 3, //!< backward reference bottom field |
| 321 |
// VP8/VP9 reference address indexes |
| 322 |
CodechalDecodeLastRef = 0, //!< last reference |
| 323 |
CodechalDecodeGoldenRef = 1, //!< golden reference |
| 324 |
CodechalDecodeAlternateRef = 2 //!< alternate reference |
| 325 |
}; |
| 326 |
|
| 327 |
//! |
| 328 |
//! \brief Constructor |
| 329 |
//! \param [in] hwInterface |
| 330 |
//! Hardware interface |
| 331 |
//! \param [in] debugInterface |
| 332 |
//! Debug interface |
| 333 |
//! \param [in] standardInfo |
| 334 |
//! The information of decode standard for this instance |
| 335 |
//! |
| 336 |
CodechalDecode( |
| 337 |
CodechalHwInterface *hwInterface, |
| 338 |
CodechalDebugInterface *debugInterface, |
| 339 |
PCODECHAL_STANDARD_INFO standardInfo); |
| 340 |
|
| 341 |
//! |
| 342 |
//! \brief Copy constructor |
| 343 |
//! |
| 344 |
CodechalDecode(const CodechalDecode &) = delete; |
| 345 |
|
| 346 |
//! |
| 347 |
//! \brief Copy assignment operator |
| 348 |
//! |
| 349 |
CodechalDecode &operator=(const CodechalDecode &) = delete; |
| 350 |
|
| 351 |
//! |
| 352 |
//! \brief Destructor |
| 353 |
//! |
| 354 |
virtual ~CodechalDecode(); |
| 355 |
|
| 356 |
//! |
| 357 |
//! \brief Get picture width for decode |
| 358 |
//! \return Width value |
| 359 |
//! |
| 360 |
virtual uint32_t GetWidth() { return m_width; } |
| 361 |
|
| 362 |
//! |
| 363 |
//! \brief Get picture height for decode |
| 364 |
//! \return Height value |
| 365 |
//! |
| 366 |
virtual uint32_t GetHeight() { return m_height; } |
| 367 |
|
| 368 |
CodechalHwInterface *GetHwInterface() |
| 369 |
{ |
| 370 |
return m_hwInterface; |
| 371 |
} |
| 372 |
|
| 373 |
//! |
| 374 |
//! \brief Help function to allocate a 1D linear buffer for each decode standard |
| 375 |
//! \param [in,out] resource |
| 376 |
//! Pointer to allocated buffer |
| 377 |
//! \param [in] size |
| 378 |
//! Buffer size |
| 379 |
//! \param [in] name |
| 380 |
//! Buffer name |
| 381 |
//! \param [in] initialize |
| 382 |
//! Initialization flag, by default is false |
| 383 |
//! \param [in] value |
| 384 |
//! Initialization value when intialize flag is true, by default is 0 |
| 385 |
//! \return MOS_STATUS |
| 386 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 387 |
//! |
| 388 |
MOS_STATUS AllocateBuffer( |
| 389 |
PMOS_RESOURCE resource, |
| 390 |
uint32_t size, |
| 391 |
const char* name, |
| 392 |
bool initialize = false, |
| 393 |
uint8_t value = 0, |
| 394 |
bool bPersistent = false); |
| 395 |
|
| 396 |
//! |
| 397 |
//! \brief Help function to allocate a NV12 TILE_Y surface |
| 398 |
//! \details Help function to allocate a NV12 TILE_Y surface for each decode standard |
| 399 |
//! |
| 400 |
//! \param [in,out] surface |
| 401 |
//! Pointer to allocated surface |
| 402 |
//! \param [in] width |
| 403 |
//! Surface width |
| 404 |
//! \param [in] height |
| 405 |
//! Surface height |
| 406 |
//! \param [in] name |
| 407 |
//! Surface name |
| 408 |
//! \param [in] format |
| 409 |
//! Surface format, by default is NV12 |
| 410 |
//! \param [in] isCompressible |
| 411 |
//! Compressible flag, by default is false |
| 412 |
MOS_STATUS AllocateSurface( |
| 413 |
PMOS_SURFACE surface, |
| 414 |
uint32_t width, |
| 415 |
uint32_t height, |
| 416 |
const char* name, |
| 417 |
MOS_FORMAT format = Format_NV12, |
| 418 |
bool isCompressible = false); |
| 419 |
|
| 420 |
MOS_STATUS DestroySurface(PMOS_SURFACE surface); |
| 421 |
|
| 422 |
//! |
| 423 |
//! \brief Entry to allocate and intialize the decode instance |
| 424 |
//! \param [in] codecHalSettings |
| 425 |
//! The settings to inialize the decode instance |
| 426 |
//! \return MOS_STATUS |
| 427 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 428 |
//! |
| 429 |
MOS_STATUS Allocate(CodechalSetting * codecHalSettings) override; |
| 430 |
|
| 431 |
//! |
| 432 |
//! \brief The handle at the end of each frame. |
| 433 |
//! \return MOS_STATUS |
| 434 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 435 |
//! |
| 436 |
MOS_STATUS EndFrame() override; |
| 437 |
|
| 438 |
//! |
| 439 |
//! \brief The entry to decode each frame. |
| 440 |
//! \param [in] params |
| 441 |
//! Pointer to decode parameters of this frame |
| 442 |
//! \return MOS_STATUS |
| 443 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 444 |
//! |
| 445 |
MOS_STATUS Execute(void *params) override; |
| 446 |
|
| 447 |
//! |
| 448 |
//! \brief Inserts the generic prologue command for a command buffer |
| 449 |
//! \param [in] cmdBuffer |
| 450 |
//! Command buffer |
| 451 |
//! \param [in] frameTrackingRequested |
| 452 |
//! frame Tracking Requested |
| 453 |
//! \return MOS_STATUS |
| 454 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 455 |
//! |
| 456 |
MOS_STATUS SendPrologWithFrameTracking( |
| 457 |
PMOS_COMMAND_BUFFER cmdBuffer, |
| 458 |
bool frameTrackingRequested); |
| 459 |
|
| 460 |
//! |
| 461 |
//! \brief Inserts predication command for a command buffer |
| 462 |
//! \param [in] cmdBuffer |
| 463 |
//! Command buffer |
| 464 |
//! \return MOS_STATUS |
| 465 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 466 |
//! |
| 467 |
MOS_STATUS SendPredicationCommand( |
| 468 |
PMOS_COMMAND_BUFFER cmdBuffer); |
| 469 |
|
| 470 |
//! |
| 471 |
//! \brief Inserts marker commands for a command buffer |
| 472 |
//! \param [in] cmdBuffer |
| 473 |
//! Command buffer |
| 474 |
//! \param [in] isRender |
| 475 |
//! Whether render engine workload or not |
| 476 |
//! \return MOS_STATUS |
| 477 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 478 |
//! |
| 479 |
MOS_STATUS SendMarkerCommand( |
| 480 |
PMOS_COMMAND_BUFFER cmdBuffer, |
| 481 |
bool isRender); |
| 482 |
|
| 483 |
//! |
| 484 |
//! \brief The entry to get status report. |
| 485 |
//! \param [out] status |
| 486 |
//! The point to decode status |
| 487 |
//! \param [in] numStatus |
| 488 |
//! The requested number of status reports |
| 489 |
//! \return MOS_STATUS |
| 490 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 491 |
//! |
| 492 |
MOS_STATUS GetStatusReport( |
| 493 |
void *status, |
| 494 |
uint16_t numStatus) override; |
| 495 |
|
| 496 |
//! |
| 497 |
//! \brief Reset status report for GEN specific decoder |
| 498 |
//! \param [in] nullHwInUse |
| 499 |
//! Indicates whether or not null hardware is inuse |
| 500 |
//! \return MOS_STATUS |
| 501 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 502 |
//! |
| 503 |
MOS_STATUS ResetStatusReport( |
| 504 |
bool nullHwInUse); |
| 505 |
|
| 506 |
//! |
| 507 |
//! \brief Help function to copy resource |
| 508 |
//! \details Help function to copy resource via Huc stream out function. |
| 509 |
//! \param [out] cmdBuffer |
| 510 |
//! Pointer to command buffer |
| 511 |
//! \param [in] src |
| 512 |
//! Pointer to source resource |
| 513 |
//! \param [out] dst |
| 514 |
//! Pointer to destination resource |
| 515 |
//! \param [in] copyLength |
| 516 |
//! The copy length starts from source offset |
| 517 |
//! \param [in] copyInputOffset |
| 518 |
//! The copy offset relative to source offset, by default is 0. |
| 519 |
//! \param [in] copyOutputOffset |
| 520 |
//! The output offset relative to destination offset, by default is 0. |
| 521 |
//! \return MOS_STATUS |
| 522 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 523 |
//! |
| 524 |
virtual MOS_STATUS HucCopy( |
| 525 |
PMOS_COMMAND_BUFFER cmdBuffer, |
| 526 |
PMOS_RESOURCE src, |
| 527 |
PMOS_RESOURCE dst, |
| 528 |
uint32_t copyLength, |
| 529 |
uint32_t copyInputOffset = 0, |
| 530 |
uint32_t copyOutputOffset = 0); |
| 531 |
|
| 532 |
//! |
| 533 |
//! \brief Gets the decode mode |
| 534 |
//! \return The decode mode \see m_mode |
| 535 |
//! |
| 536 |
uint32_t GetMode() { return m_mode; } |
| 537 |
|
| 538 |
//! |
| 539 |
//! \brief Get the perf profiler pointer |
| 540 |
//! \return The perf profiler \see m_perfProfiler |
| 541 |
//! |
| 542 |
MediaPerfProfiler *GetPerfProfiler() |
| 543 |
{ |
| 544 |
return m_perfProfiler; |
| 545 |
} |
| 546 |
|
| 547 |
//! |
| 548 |
//! \brief Gets the decode standard |
| 549 |
//! \return The decode standard \see m_standard |
| 550 |
//! |
| 551 |
uint32_t GetStandard() { return m_standard; } |
| 552 |
|
| 553 |
//! |
| 554 |
//! \brief Gets video context |
| 555 |
//! \return The video context \see m_videoContext |
| 556 |
//! |
| 557 |
MOS_GPU_CONTEXT GetVideoContext() { return m_videoContext; } |
| 558 |
|
| 559 |
//! |
| 560 |
//! \brief Sets video context |
| 561 |
//! \return The video context \see m_videoContext |
| 562 |
//! |
| 563 |
void SetVideoContext(MOS_GPU_CONTEXT context) { m_videoContext = context; } |
| 564 |
|
| 565 |
//! |
| 566 |
//! \brief Gets video WA context |
| 567 |
//! \return The video WA context \see m_videoContextForWa |
| 568 |
//! |
| 569 |
MOS_GPU_CONTEXT GetVideoWAContext() { return m_videoContextForWa; } |
| 570 |
|
| 571 |
//! |
| 572 |
//! \brief Sets cenc decoder batch buffer |
| 573 |
//! \param [in] cmdBuffer |
| 574 |
//! Pointer of command buffer. |
| 575 |
//! \return MOS_STATUS |
| 576 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 577 |
//! |
| 578 |
virtual MOS_STATUS SetCencBatchBuffer( PMOS_COMMAND_BUFFER cmdBuffer); |
| 579 |
|
| 580 |
//! |
| 581 |
//! \brief Indicates whether or not the status query reporting is enabled |
| 582 |
//! \return If status query reporting is enabled \see m_statusQueryReportingEnabled |
| 583 |
//! |
| 584 |
bool IsStatusQueryReportingEnabled() { return m_statusQueryReportingEnabled; } |
| 585 |
|
| 586 |
//! |
| 587 |
//! \brief Gets decode status buffer |
| 588 |
//! \return The decode status buffer \see m_decodeStatusBuf |
| 589 |
//! |
| 590 |
CodechalDecodeStatusBuffer *GetDecodeStatusBuf() { return &m_decodeStatusBuf; } |
| 591 |
|
| 592 |
//! |
| 593 |
//! \brief Gets vdbox index |
| 594 |
//! \return The vdbox index \see m_vdboxIndex |
| 595 |
//! |
| 596 |
MHW_VDBOX_NODE_IND GetVdboxIndex() { return m_vdboxIndex; } |
| 597 |
|
| 598 |
//! |
| 599 |
//! \brief Indicates whether or not the first execute call |
| 600 |
//! \return If first execute call \see m_executeCallIndex |
| 601 |
//! |
| 602 |
inline bool IsFirstExecuteCall() { return (m_executeCallIndex == 0); } |
| 603 |
|
| 604 |
//! |
| 605 |
//! \brief Indicates whether or not the decoder is inuse |
| 606 |
//! \return If decoder is inuse \see m_isHybridDecoder |
| 607 |
//! |
| 608 |
bool IsHybridDecoder() { return m_isHybridDecoder; } |
| 609 |
|
| 610 |
//! |
| 611 |
//! \brief Indicates whether or not the picture is incomplete |
| 612 |
//! \return If picture is incomplete \see m_incompletePicture |
| 613 |
//! |
| 614 |
bool IsIncompletePicture() { return m_incompletePicture; } |
| 615 |
|
| 616 |
//! |
| 617 |
//! \brief Indicates whether or not the jpeg scan is incomplete |
| 618 |
//! \return If jpeg scan is incomplete \see m_incompleteJpegScan |
| 619 |
//! |
| 620 |
virtual bool IsIncompleteJpegScan() { return false; } |
| 621 |
|
| 622 |
//! |
| 623 |
//! \brief Gets flags which indicates whether video context uses null hardware |
| 624 |
//! \return Flags which indicates whether video context uses null hardware \see m_videoContextUsesNullHw |
| 625 |
//! |
| 626 |
bool GetVideoContextUsesNullHw() { return m_videoContextUsesNullHw; } |
| 627 |
|
| 628 |
//! |
| 629 |
//! \brief Gets flags which indicates whether video context for using null hardware |
| 630 |
//! \return Flags which indicates whether video context for using null hardware \see m_videoContextForWaUsesNullHw |
| 631 |
//! |
| 632 |
bool GetVideoContextForWaUsesNullHw() { return m_videoContextForWaUsesNullHw; } |
| 633 |
|
| 634 |
//! |
| 635 |
//! \brief Gets flags which indicates whether render context uses null hardware |
| 636 |
//! \return Flags which indicates whether render context uses null hardware \see m_renderContextUsesNullHw |
| 637 |
//! |
| 638 |
bool GetRenderContextUsesNullHw() { return m_renderContextUsesNullHw; } |
| 639 |
|
| 640 |
//! |
| 641 |
//! \brief Set decode histogram |
| 642 |
//! \return No return |
| 643 |
//! |
| 644 |
void SetDecodeHistogram(CodechalDecodeHistogram *decodeHistogram) { m_decodeHistogram = decodeHistogram; } |
| 645 |
|
| 646 |
//! |
| 647 |
//! \brief Get decode histogram |
| 648 |
//! \return Pointer of codechal decode histogram |
| 649 |
//! |
| 650 |
CodechalDecodeHistogram* GetDecodeHistogram() { return m_decodeHistogram; } |
| 651 |
|
| 652 |
#ifdef _DECODE_PROCESSING_SUPPORTED |
| 653 |
//! |
| 654 |
//! \brief Indicates whether or not the vd sfc is supported |
| 655 |
//! \return If vd sfc is supported \see m_vdSfcSupported |
| 656 |
//! |
| 657 |
bool IsVdSfcSupported() { return m_vdSfcSupported; } |
| 658 |
|
| 659 |
//! |
| 660 |
//! \brief Set if vd sfc supported |
| 661 |
//! \return No return |
| 662 |
//! |
| 663 |
void SetVdSfcSupportedFlag(bool isVdSfcSpported) { m_vdSfcSupported = isVdSfcSpported; } |
| 664 |
|
| 665 |
//! \brief Field scaling interface |
| 666 |
FieldScalingInterface *m_fieldScalingInterface = nullptr; |
| 667 |
#endif |
| 668 |
|
| 669 |
//! |
| 670 |
//! \brief Get dummy reference surface |
| 671 |
//! \return Pointer of reference surface |
| 672 |
//! |
| 673 |
MOS_SURFACE* GetDummyReference() { return &m_dummyReference; } |
| 674 |
|
| 675 |
//! |
| 676 |
//! \brief Get dummy reference status |
| 677 |
//! \return CODECHAL_DUMMY_REFERENCE_STATUS |
| 678 |
//! |
| 679 |
CODECHAL_DUMMY_REFERENCE_STATUS GetDummyReferenceStatus() { return m_dummyReferenceStatus; } |
| 680 |
|
| 681 |
//! |
| 682 |
//! \brief Set dummy reference status |
| 683 |
//! \return void |
| 684 |
//! |
| 685 |
void SetDummyReferenceStatus(CODECHAL_DUMMY_REFERENCE_STATUS status) |
| 686 |
{ |
| 687 |
m_dummyReferenceStatus = status; |
| 688 |
} |
| 689 |
|
| 690 |
//! |
| 691 |
//! \brief Get mmc enable flag |
| 692 |
//! \return bool |
| 693 |
//! |
| 694 |
bool IsDecoderMmcEnabled(){return m_mmc ? m_mmc->IsMmcEnabled() : false;} |
| 695 |
|
| 696 |
MOS_STATUS CheckDecodeOutputBufSize(MOS_SURFACE &dstSurface); |
| 697 |
|
| 698 |
protected: |
| 699 |
|
| 700 |
//! |
| 701 |
//! \brief Set up params for gpu context creation |
| 702 |
//! \return MOS_STATUS |
| 703 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 704 |
//! |
| 705 |
virtual MOS_STATUS SetGpuCtxCreatOption(CodechalSetting * settings); |
| 706 |
|
| 707 |
//! |
| 708 |
//! \brief Allocate and initialize GEN specific decoder standard |
| 709 |
//! \param [in] settings |
| 710 |
//! Pointer to CodechalSetting |
| 711 |
//! \return MOS_STATUS |
| 712 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 713 |
//! |
| 714 |
virtual MOS_STATUS AllocateStandard(CodechalSetting * settings) = 0; |
| 715 |
|
| 716 |
//! |
| 717 |
//! \brief Set states for each frame to prepare for decode |
| 718 |
//! \return MOS_STATUS |
| 719 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 720 |
//! |
| 721 |
virtual MOS_STATUS SetFrameStates() = 0; |
| 722 |
|
| 723 |
//! |
| 724 |
//! \brief State level function for standard specific decoder |
| 725 |
//! \return MOS_STATUS |
| 726 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 727 |
//! |
| 728 |
virtual MOS_STATUS DecodeStateLevel() = 0; |
| 729 |
|
| 730 |
//! |
| 731 |
//! \brief Primitive level function for GEN specific decoder |
| 732 |
//! \return MOS_STATUS |
| 733 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 734 |
//! |
| 735 |
virtual MOS_STATUS DecodePrimitiveLevel() = 0; |
| 736 |
|
| 737 |
//! |
| 738 |
//! \brief Calculate downsample param for GEN specific decoder |
| 739 |
//! \param [in] picParams |
| 740 |
//! Pointer to picture parameter |
| 741 |
//! \param [in] refSurfWidth |
| 742 |
//! Reference surface width |
| 743 |
//! \param [in] refSurfHeight |
| 744 |
//! Reference surface height |
| 745 |
//! \param [in] format |
| 746 |
//! Pointer to MOS_FORMAT |
| 747 |
//! \param [in] frameIdx |
| 748 |
//! Frame index |
| 749 |
//! |
| 750 |
//! \return MOS_STATUS |
| 751 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 752 |
//! |
| 753 |
virtual MOS_STATUS CalcDownsamplingParams( |
| 754 |
void *picParams, |
| 755 |
uint32_t *refSurfWidth, |
| 756 |
uint32_t *refSurfHeight, |
| 757 |
MOS_FORMAT *format, |
| 758 |
uint8_t *frameIdx) |
| 759 |
{ |
| 760 |
CODECHAL_DECODE_ASSERTMESSAGE("Unsupported Downsampling for current Codec !"); |
| 761 |
return MOS_STATUS_UNIMPLEMENTED; |
| 762 |
} |
| 763 |
|
| 764 |
//! |
| 765 |
//! \brief Get decoder status for GEN specific hybird decoder |
| 766 |
//! \param [in] decodeStatus |
| 767 |
//! Decode status |
| 768 |
//! \param [in] index |
| 769 |
//! Index of status buffer |
| 770 |
//! \param [in] defaultStatus |
| 771 |
//! Default status |
| 772 |
//! |
| 773 |
//! \return MOS_STATUS |
| 774 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 775 |
//! |
| 776 |
virtual MOS_STATUS DecodeGetHybridStatus( |
| 777 |
CodechalDecodeStatus *decodeStatus, |
| 778 |
uint32_t index, |
| 779 |
uint32_t defaultStatus) |
| 780 |
{ |
| 781 |
return MOS_STATUS_SUCCESS; |
| 782 |
} |
| 783 |
|
| 784 |
//! |
| 785 |
//! \brief Start status report for GEN specific decoder |
| 786 |
//! \param [out] cmdBuffer |
| 787 |
//! Pointer to command buffer |
| 788 |
//! \return MOS_STATUS |
| 789 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 790 |
//! |
| 791 |
MOS_STATUS StartStatusReport(PMOS_COMMAND_BUFFER cmdBuffer); |
| 792 |
|
| 793 |
//! |
| 794 |
//! \brief End status report for GEN specific decoder |
| 795 |
//! \param [in] decodeStatusReport |
| 796 |
//! Decode status |
| 797 |
//! \param [out] cmdBuffer |
| 798 |
//! Pointer to command buffer |
| 799 |
//! \return MOS_STATUS |
| 800 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 801 |
//! |
| 802 |
virtual MOS_STATUS EndStatusReport( |
| 803 |
CodechalDecodeStatusReport &decodeStatusReport, |
| 804 |
PMOS_COMMAND_BUFFER cmdBuffer); |
| 805 |
|
| 806 |
//! |
| 807 |
//! \brief Initialize MMC state for specified decode device |
| 808 |
//! |
| 809 |
//! \return MOS_STATUS |
| 810 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 811 |
//! |
| 812 |
virtual MOS_STATUS InitMmcState() |
| 813 |
{ |
| 814 |
return MOS_STATUS_SUCCESS; |
| 815 |
} |
| 816 |
|
| 817 |
//! |
| 818 |
//! \brief Linear to Y tiled address |
| 819 |
//! |
| 820 |
//! \param [in] x |
| 821 |
//! Position of X |
| 822 |
//! \param [in] y |
| 823 |
//! Position of Y |
| 824 |
//! \param [in] pitch |
| 825 |
//! Pitch |
| 826 |
//! \return uint32_t |
| 827 |
//! Return 0 if success, else -1 if fail |
| 828 |
//! |
| 829 |
uint32_t LinearToYTiledAddress( |
| 830 |
uint32_t x, |
| 831 |
uint32_t y, |
| 832 |
uint32_t pitch); |
| 833 |
|
| 834 |
#if USE_CODECHAL_DEBUG_TOOL |
| 835 |
MOS_STATUS DumpProcessingParams( |
| 836 |
DecodeProcessingParams *decProcParams); |
| 837 |
|
| 838 |
#endif |
| 839 |
|
| 840 |
private: |
| 841 |
|
| 842 |
//! |
| 843 |
//! \brief Calculate command buffer size needed for picture level and slice level commands |
| 844 |
//! \param [out] requestedSize |
| 845 |
//! Return command buffer size for picture level and slice level command |
| 846 |
//! \param [out] additionalSizeNeeded |
| 847 |
//! Return additianl size needed |
| 848 |
//! \param [out] requestedPatchListSize |
| 849 |
//! return patch list size used in this command buffer |
| 850 |
//! \return None |
| 851 |
//! |
| 852 |
virtual void CalcRequestedSpace( |
| 853 |
uint32_t &requestedSize, |
| 854 |
uint32_t &additionalSizeNeeded, |
| 855 |
uint32_t &requestedPatchListSize); |
| 856 |
|
| 857 |
//! |
| 858 |
//! \brief Verify command buffer size and patch list size, reallocate if required |
| 859 |
//! \return MOS_STATUS |
| 860 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 861 |
//! |
| 862 |
MOS_STATUS VerifySpaceAvailable (); |
| 863 |
|
| 864 |
//! |
| 865 |
//! \brief Create GPU context for GEN specific decoder |
| 866 |
//! \param [in] codecHalSettings |
| 867 |
//! Pointer to CODECHAL Settings |
| 868 |
//! \return MOS_STATUS |
| 869 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 870 |
//! |
| 871 |
MOS_STATUS CreateGpuContexts( |
| 872 |
CodechalSetting * codecHalSettings); |
| 873 |
|
| 874 |
//! |
| 875 |
//! \brief Indicates whether or not the SFC is inuse |
| 876 |
//! \param [in] codecHalSettings |
| 877 |
//! Pointer to CODECHAL Settings |
| 878 |
//! \return If SFC is inuse |
| 879 |
//! |
| 880 |
virtual bool IsSfcInUse(CodechalSetting * codecHalSettings) { return false; } |
| 881 |
|
| 882 |
//! |
| 883 |
//! \brief Indicates whether or not the frame level multiple thread is enable |
| 884 |
//! \return If frame level multiple thread is enable |
| 885 |
//! |
| 886 |
virtual bool IsFrameMTEnabled() { return false; } |
| 887 |
|
| 888 |
//! |
| 889 |
//! \brief The virtual function for decode standard to override the requested space size |
| 890 |
//! \param [in] requestedSize |
| 891 |
//! The intial request size computed by picture level and slice level |
| 892 |
//! \return The final requested space size |
| 893 |
//! |
| 894 |
virtual uint32_t RequestedSpaceSize(uint32_t requestedSize) { return requestedSize; } |
| 895 |
|
| 896 |
//! |
| 897 |
//! \brief The virtual function for decode standard to override the extra requested space size |
| 898 |
//! \param [in] requestedSize |
| 899 |
//! The intial request size computed by picture level and slice level |
| 900 |
//! \param [in] additionalSizeNeeded |
| 901 |
//! The additional request size for command buffer |
| 902 |
//! \return The extra requested space size |
| 903 |
//! |
| 904 |
virtual MOS_STATUS VerifyExtraSpace( |
| 905 |
uint32_t requestedSize, |
| 906 |
uint32_t additionalSizeNeeded) |
| 907 |
{ |
| 908 |
return MOS_STATUS_SUCCESS; |
| 909 |
} |
| 910 |
|
| 911 |
//! |
| 912 |
//! \brief Allocate reference surfaces |
| 913 |
//! \details Allocate reference surfaces for decode downsampling for all codec types |
| 914 |
//! \param allocWidth |
| 915 |
//! [in] Width of the surfaces to be allocated |
| 916 |
//! \param allocHeight |
| 917 |
//! [in] Height of the surfaces to be allocated |
| 918 |
//! \param format |
| 919 |
//! [in] Flag to indicate the format of the surfaces to be allocated |
| 920 |
//! \return MOS_STATUS |
| 921 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 922 |
//! |
| 923 |
MOS_STATUS AllocateRefSurfaces( |
| 924 |
uint32_t allocWidth, |
| 925 |
uint32_t allocHeight, |
| 926 |
MOS_FORMAT format); |
| 927 |
|
| 928 |
bool isSyncFreeNeededForMMCSurface(PMOS_SURFACE surface); |
| 929 |
//! |
| 930 |
//! \brief Resize specific reference surfaces |
| 931 |
//! \details Resize specific reference surfaces for decode downsampling for all codec types |
| 932 |
//! \param frameIdx |
| 933 |
//! [in] index of surfaces array |
| 934 |
//! \param width |
| 935 |
//! [in] Width of the surfaces to be allocated |
| 936 |
//! \param height |
| 937 |
//! [in] Height of the surfaces to be allocated |
| 938 |
//! \param format |
| 939 |
//! [in] Flag to indicate the format of the surfaces to be allocated |
| 940 |
//! \return MOS_STATUS |
| 941 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 942 |
//! |
| 943 |
MOS_STATUS RefSurfacesResize( |
| 944 |
uint32_t frameIdx, |
| 945 |
uint32_t width, |
| 946 |
uint32_t height, |
| 947 |
MOS_FORMAT format); |
| 948 |
|
| 949 |
//! |
| 950 |
//! \brief Allocate Decode Output Buffer |
| 951 |
//! \details To Allocate Decode Output Buffer for media debug hook. |
| 952 |
//! \param dstSurface |
| 953 |
//! Decoded dstSurface |
| 954 |
//! \return MOS_STATUS |
| 955 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 956 |
//! |
| 957 |
MOS_STATUS AllocateDecodeOutputBuf(); |
| 958 |
|
| 959 |
//! |
| 960 |
//! \brief Deallocate specific reference surfaces |
| 961 |
//! \details Deallocate specific reference surfaces for decode downsampling for all codec types |
| 962 |
//! \param frameIdx |
| 963 |
//! [in] index of surfaces array |
| 964 |
//! \return N/A |
| 965 |
//! |
| 966 |
void DeallocateSpecificRefSurfaces(uint32_t frameIdx); |
| 967 |
//! |
| 968 |
//! \brief Deallocate reference surfaces |
| 969 |
//! \details Deallocate reference surfaces for decode downsampling for all codec types |
| 970 |
//! \return N/A |
| 971 |
//! |
| 972 |
void DeallocateRefSurfaces(); |
| 973 |
|
| 974 |
//! |
| 975 |
//! \brief Set dummy reference |
| 976 |
//! \details Set dummy reference for error concealment |
| 977 |
//! \return MOS_STATUS |
| 978 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 979 |
//! |
| 980 |
MOS_STATUS SetDummyReference(); |
| 981 |
|
| 982 |
protected: |
| 983 |
//! \brief Mfx Interface |
| 984 |
MhwVdboxMfxInterface *m_mfxInterface = nullptr; |
| 985 |
//! \brief Hcp Interface |
| 986 |
MhwVdboxHcpInterface *m_hcpInterface = nullptr; |
| 987 |
//! \brief Huc Interface |
| 988 |
MhwVdboxHucInterface *m_hucInterface = nullptr; |
| 989 |
//! \brief Vdenc Interface |
| 990 |
MhwVdboxVdencInterface *m_vdencInterface = nullptr; |
| 991 |
//! \brief Common Mi Interface |
| 992 |
MhwMiInterface *m_miInterface = nullptr; |
| 993 |
//! \brief Cp Interface |
| 994 |
MhwCpInterface *m_cpInterface = nullptr; |
| 995 |
|
| 996 |
//! \brief Security Decode |
| 997 |
CodechalSecureDecodeInterface *m_secureDecoder = nullptr; |
| 998 |
|
| 999 |
//! \brief WA table |
| 1000 |
MEDIA_WA_TABLE *m_waTable = nullptr; |
| 1001 |
//! \brief SKU table |
| 1002 |
MEDIA_FEATURE_TABLE *m_skuTable = nullptr; |
| 1003 |
|
| 1004 |
//!< mmc state |
| 1005 |
CodecHalMmcState *m_mmc = nullptr; |
| 1006 |
//! \brief Decode parameters |
| 1007 |
CodechalDecodeParams m_decodeParams; |
| 1008 |
//! \brief Decode mode |
| 1009 |
uint32_t m_mode = CODECHAL_UNSUPPORTED_MODE; |
| 1010 |
//! \brief Decode standard |
| 1011 |
uint32_t m_standard = CODECHAL_UNDEFINED; |
| 1012 |
//! \brief Current frame number |
| 1013 |
uint32_t m_frameNum = 0; |
| 1014 |
//! \brief Indicates if current field is second field |
| 1015 |
bool m_secondField = false; |
| 1016 |
//! \brief Indidates if fields are completed |
| 1017 |
uint32_t m_fullFieldsFrame = 0; |
| 1018 |
//! \brief picture information of current render target |
| 1019 |
CODEC_PICTURE m_crrPic = {0}; |
| 1020 |
//! \brief Video GPU node inuse |
| 1021 |
MOS_GPU_NODE m_videoGpuNode = MOS_GPU_NODE_MAX; |
| 1022 |
//! \brief Video context inuse |
| 1023 |
MOS_GPU_CONTEXT m_videoContext = MOS_GPU_CONTEXT_INVALID_HANDLE; |
| 1024 |
//! \brief Video WA context inuse |
| 1025 |
MOS_GPU_CONTEXT m_videoContextForWa = MOS_GPU_CONTEXT_INVALID_HANDLE; |
| 1026 |
//! \brief Render context inuse |
| 1027 |
MOS_GPU_CONTEXT m_renderContext = MOS_GPU_CONTEXT_RENDER; |
| 1028 |
//! \brief Picture Width |
| 1029 |
uint32_t m_width = 0; |
| 1030 |
//! \brief Picture Height |
| 1031 |
uint32_t m_height = 0; |
| 1032 |
|
| 1033 |
//! \brief Picture level command buffer size is required |
| 1034 |
uint32_t m_commandBufferSizeNeeded = 0; |
| 1035 |
//! \brief Picture level patch list size is required |
| 1036 |
uint32_t m_commandPatchListSizeNeeded = 0; |
| 1037 |
//! \brief Slice level command buffer size is required |
| 1038 |
uint32_t m_standardDecodeSizeNeeded = 0; |
| 1039 |
//! \brief Slice level patch list size is required |
| 1040 |
uint32_t m_standardDecodePatchListSizeNeeded = 0; |
| 1041 |
//! \brief Indicates if current input bitstream is incomplete |
| 1042 |
bool m_incompletePicture = false; |
| 1043 |
//! \brief The index of execution call in multiple execution call mode |
| 1044 |
bool m_executeCallIndex = 0; |
| 1045 |
//! \brief Indicates if current is frist execution call in multiple execution call mode |
| 1046 |
bool m_consecutiveMbErrorConcealmentInUse = false; |
| 1047 |
//! \brief Indicates if phantom MBs is required for MPEG2 decode |
| 1048 |
bool m_decodePhantomMbs = false; |
| 1049 |
|
| 1050 |
//! \brief Flag to indicate if we support eStatus query reporting on current platform |
| 1051 |
bool m_statusQueryReportingEnabled = false; |
| 1052 |
//! \brief Flag to indicate if UMD Perf Profiler FE BE timing measurement is enabled |
| 1053 |
bool m_perfFEBETimingEnabled = false; |
| 1054 |
|
| 1055 |
#ifdef _DECODE_PROCESSING_SUPPORTED |
| 1056 |
//! \brief Flag to indicate if vd sfc is supported |
| 1057 |
bool m_vdSfcSupported = false; |
| 1058 |
#endif |
| 1059 |
|
| 1060 |
//! \brief Stores all the status_query related data |
| 1061 |
CodechalDecodeStatusBuffer m_decodeStatusBuf; |
| 1062 |
//! \brief The feedback number reported by app in picparams call |
| 1063 |
uint32_t m_statusReportFeedbackNumber = 0; |
| 1064 |
//! \brief Flag to indicate if report frame CRC |
| 1065 |
bool m_reportFrameCrc = false; |
| 1066 |
|
| 1067 |
//! \brief Indicates if stream out enabled |
| 1068 |
bool m_streamOutEnabled = false; |
| 1069 |
//! \brief Stream out buffers |
| 1070 |
MOS_RESOURCE m_streamOutBuffer[CODECHAL_DECODE_NUM_STREAM_OUT_BUFFERS] = {{0}}; |
| 1071 |
//! \brief Indicates if stream out buffer is inuse with same index |
| 1072 |
uint32_t m_streamOutCurrStatusIdx[CODECHAL_DECODE_NUM_STREAM_OUT_BUFFERS] = {CODECHAL_DECODE_STATUS_NUM}; |
| 1073 |
//! \brief Current stream out buffer index |
| 1074 |
uint32_t m_streamOutCurrBufIdx = 0; |
| 1075 |
|
| 1076 |
//! \brief Performance testing parameters |
| 1077 |
uint16_t m_perfType = 0; |
| 1078 |
|
| 1079 |
//! \brief Indicates if video context uses null hardware |
| 1080 |
bool m_videoContextUsesNullHw = false; |
| 1081 |
//! \brief Indicates if video WA context uses null hardware |
| 1082 |
bool m_videoContextForWaUsesNullHw = false; |
| 1083 |
//! \brief Indicates if render context uses null hardware |
| 1084 |
bool m_renderContextUsesNullHw = false; |
| 1085 |
|
| 1086 |
//! \brief Indicates if decode sync lock is disabled |
| 1087 |
bool m_disableDecodeSyncLock = false; |
| 1088 |
//! \brief Indicates if transcoe lock is disabled |
| 1089 |
bool m_disableLockForTranscode = false; |
| 1090 |
|
| 1091 |
//! \brief Indicate how many passes is needed to finish decoding a picture |
| 1092 |
//! \details Initialize decode pass number to 1, for those decoder need more than 1 decoding pass, |
| 1093 |
//! modify this value in specific decoder files. |
| 1094 |
uint16_t m_decodePassNum = 1; |
| 1095 |
|
| 1096 |
//! \brief MMIO Hcp Frame CRC report offset |
| 1097 |
uint32_t m_hcpFrameCrcRegOffset = 0; |
| 1098 |
|
| 1099 |
//! \brief The vdbox index for current frame |
| 1100 |
MHW_VDBOX_NODE_IND m_vdboxIndex = MHW_VDBOX_NODE_1; |
| 1101 |
//! \brief Indicates if HCP is inuse |
| 1102 |
bool m_hcpInUse = false; |
| 1103 |
|
| 1104 |
//! \brief Indicates if decoder is inuse |
| 1105 |
bool m_isHybridDecoder = false; |
| 1106 |
|
| 1107 |
//! \brief Indicates if downsampling is required |
| 1108 |
bool m_downsamplingHinted = false; |
| 1109 |
//! \brief Reference surface for downsampling |
| 1110 |
PMOS_SURFACE m_refSurfaces = nullptr; |
| 1111 |
//! \brief Number of reference surface for downsampling |
| 1112 |
uint32_t m_refFrmCnt = 0; |
| 1113 |
|
| 1114 |
//! \brief Internal buffer for predication |
| 1115 |
MOS_RESOURCE m_predicationBuffer = { 0 }; |
| 1116 |
|
| 1117 |
MOS_RESOURCE m_frameCountTypeBuf = { 0 }; |
| 1118 |
|
| 1119 |
MOS_RESOURCE m_crcBuf = { 0 }; |
| 1120 |
|
| 1121 |
CodechalOcaDumper *m_pCodechalOcaDumper = nullptr; |
| 1122 |
|
| 1123 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 1124 |
//! \brief Downsampled surfaces |
| 1125 |
PMOS_SURFACE m_downsampledSurfaces = nullptr; |
| 1126 |
#endif |
| 1127 |
uint8_t* m_decodeOutputBuf = nullptr; |
| 1128 |
|
| 1129 |
uint32_t m_decodeOutputBufSize = 0; |
| 1130 |
//! \brief Decode histogram interface |
| 1131 |
//! \details Support YUV Luma histogram. |
| 1132 |
CodechalDecodeHistogram *m_decodeHistogram = nullptr; |
| 1133 |
PMOS_GPUCTX_CREATOPTIONS m_gpuCtxCreatOpt = nullptr; |
| 1134 |
|
| 1135 |
//! \brief Performance data profiler |
| 1136 |
MediaPerfProfiler *m_perfProfiler = nullptr; |
| 1137 |
|
| 1138 |
// CencDecode buffer |
| 1139 |
CencDecodeShareBuf *m_cencBuf = nullptr; |
| 1140 |
|
| 1141 |
//! \brief Dummy reference surface |
| 1142 |
MOS_SURFACE m_dummyReference; |
| 1143 |
|
| 1144 |
//! \brief Indicate the status of dummy reference |
| 1145 |
CODECHAL_DUMMY_REFERENCE_STATUS m_dummyReferenceStatus = CODECHAL_DUMMY_REFERENCE_INVALID; |
| 1146 |
|
| 1147 |
CodechalHwInterface* m_hwInterface = nullptr; |
| 1148 |
}; |
| 1149 |
|
| 1150 |
#endif // __CODECHAL_DECODER_H__ |