1 /* 2 * Copyright (c) 2017-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 mhw_vdbox_mfx_interface.h 24 //! \brief MHW interface for constructing MFX commands for the Vdbox engine 25 //! \details Defines the interfaces for constructing MHW Vdbox MFX commands across all platforms 26 //! 27 28 #ifndef _MHW_VDBOX_MFX_INTERFACE_H_ 29 #define _MHW_VDBOX_MFX_INTERFACE_H_ 30 31 #include "mhw_vdbox.h" 32 #include "mhw_mi.h" 33 #include "codec_def_common_encode.h" 34 #include "codec_def_encode_vp9.h" 35 #include "codec_def_encode_vp8.h" 36 #include "codec_def_encode_hevc.h" 37 #include "codec_def_decode_mpeg2.h" 38 #include "codec_def_decode_vp8.h" 39 #include "codec_def_decode_jpeg.h" 40 #include "codec_def_vp8_probs.h" 41 42 #define MFX_PAK_STREAMOUT_DATA_BYTE_SIZE 4 43 44 typedef enum _MHW_VDBOX_AVC_DMV_OFFSET 45 { 46 MHW_VDBOX_AVC_DMV_DEST_TOP = 32, 47 MHW_VDBOX_AVC_DMV_DEST_BOTTOM = 33 48 } MHW_VDBOX_AVC_DMV_OFFSET; 49 50 typedef enum _MHW_VDBOX_DECODE_VC1_IT_ILDB_EDGE_CONTROL_LUMA 51 { 52 MHW_VDBOX_DECODE_VC1_IT_ILDB_EDGE_CONTROL_LUMA_X0Y0 = 0x0f0c0300, 53 MHW_VDBOX_DECODE_VC1_IT_ILDB_EDGE_CONTROL_LUMA_X1Y0 = 0x0f0f0303, 54 MHW_VDBOX_DECODE_VC1_IT_ILDB_EDGE_CONTROL_LUMA_X0Y1 = 0x0f0c0f0c, 55 MHW_VDBOX_DECODE_VC1_IT_ILDB_EDGE_CONTROL_LUMA_X1Y1 = 0x0f0f0f0f, 56 57 } MHW_VDBOX_DECODE_VC1_IT_ILDB_EDGE_CONTROL_LUMA; 58 59 typedef enum _MHW_VDBOX_DECODE_VC1_IT_ILDB_EDGE_CONTROL_CHROMA 60 { 61 MHW_VDBOX_DECODE_VC1_IT_ILDB_EDGE_CONTROL_CHROMA_X0Y0 = 0x00000000, 62 MHW_VDBOX_DECODE_VC1_IT_ILDB_EDGE_CONTROL_CHROMA_X1Y0 = 0x00000303, 63 MHW_VDBOX_DECODE_VC1_IT_ILDB_EDGE_CONTROL_CHROMA_X0Y1 = 0x00000c0c, 64 MHW_VDBOX_DECODE_VC1_IT_ILDB_EDGE_CONTROL_CHROMA_X1Y1 = 0x00000f0f, 65 66 } MHW_VDBOX_DECODE_VC1_IT_ILDB_EDGE_CONTROL_CHROMA; 67 68 typedef enum _MHW_VDBOX_DECODE_JPEG_FORMAT_CODE 69 { 70 MHW_VDBOX_DECODE_JPEG_FORMAT_SEPARATE_PLANE = 0, // formats of 3 separate plane for Y, U, and V respectively 71 MHW_VDBOX_DECODE_JPEG_FORMAT_NV12 = 1, 72 MHW_VDBOX_DECODE_JPEG_FORMAT_UYVY = 2, 73 MHW_VDBOX_DECODE_JPEG_FORMAT_YUY2 = 3 74 } MHW_VDBOX_DECODE_JPEG_FORMAT_CODE; 75 76 77 78 typedef struct _MHW_VDBOX_MPEG2_SLICE_STATE 79 { 80 PMOS_RESOURCE presDataBuffer; 81 PMOS_RESOURCE presPicHeaderBBSurf; // BRC only 82 uint32_t dwOffset; 83 uint32_t dwLength; 84 uint32_t dwSliceStartMbOffset; 85 uint16_t wPicWidthInMb; 86 uint16_t wPicHeightInMb; 87 bool bLastSlice; 88 89 // Decoding Only 90 CodecDecodeMpeg2SliceParams *pMpeg2SliceParams; 91 92 // Encoding Only 93 PCODEC_PIC_ID pMpeg2PicIdx; 94 PCODEC_REF_LIST *ppMpeg2RefList; 95 CodecEncodeMpeg2SequenceParams *pEncodeMpeg2SeqParams; 96 CodecEncodeMpeg2PictureParams *pEncodeMpeg2PicParams; 97 CodecEncodeMpeg2SliceParmas *pEncodeMpeg2SliceParams; 98 PBSBuffer pBsBuffer; 99 PCODECHAL_NAL_UNIT_PARAMS *ppNalUnitParams; 100 PCODEC_ENCODER_SLCDATA pSlcData; 101 bool bFirstPass; 102 bool bLastPass; 103 uint32_t dwSliceIndex; 104 uint32_t dwDataBufferOffset; 105 bool bBrcEnabled; 106 bool bRCPanicEnable; 107 bool bInsertBeforeSliceHeaders; 108 109 } MHW_VDBOX_MPEG2_SLICE_STATE, *PMHW_VDBOX_MPEG2_SLICE_STATE; 110 111 typedef struct _MHW_VDBOX_MPEG2_MB_STATE 112 { 113 CodecDecodeMpeg2MbParmas *pMBParams; 114 uint16_t wPicWidthInMb; 115 uint16_t wPicHeightInMb; 116 uint16_t wPicCodingType; 117 uint32_t dwDCTLength; 118 uint32_t dwITCoffDataAddrOffset; 119 int16_t sPackedMVs0[4]; 120 int16_t sPackedMVs1[4]; 121 } MHW_VDBOX_MPEG2_MB_STATE, *PMHW_VDBOX_MPEG2_MB_STATE; 122 123 typedef struct _MHW_VDBOX_VC1_PRED_PIPE_PARAMS 124 { 125 PCODEC_VC1_PIC_PARAMS pVc1PicParams; 126 PCODEC_REF_LIST *ppVc1RefList; 127 } MHW_VDBOX_VC1_PRED_PIPE_PARAMS, *PMHW_VDBOX_VC1_PRED_PIPE_PARAMS; 128 129 typedef struct _MHW_VDBOX_VC1_PIC_STATE 130 { 131 PCODEC_VC1_PIC_PARAMS pVc1PicParams; 132 uint32_t Mode; 133 PCODEC_REF_LIST *ppVc1RefList; 134 uint16_t wPrevAnchorPictureTFF; 135 bool bPrevEvenAnchorPictureIsP; 136 bool bPrevOddAnchorPictureIsP; 137 } MHW_VDBOX_VC1_PIC_STATE, *PMHW_VDBOX_VC1_PIC_STATE; 138 139 typedef struct _MHW_VDBOX_VC1_DIRECTMODE_PARAMS 140 { 141 PMOS_RESOURCE presDmvReadBuffer; 142 PMOS_RESOURCE presDmvWriteBuffer; 143 } MHW_VDBOX_VC1_DIRECTMODE_PARAMS, *PMHW_VDBOX_VC1_DIRECTMODE_PARAMS; 144 145 typedef struct _MHW_VDBOX_VC1_SLICE_STATE 146 { 147 PCODEC_VC1_SLICE_PARAMS pSlc; 148 PMOS_RESOURCE presDataBuffer; 149 uint32_t dwOffset; 150 uint32_t dwLength; 151 uint32_t dwNextVerticalPosition; 152 bool bShortFormatInUse; 153 } MHW_VDBOX_VC1_SLICE_STATE, *PMHW_VDBOX_VC1_SLICE_STATE; 154 155 typedef struct _MHW_VDBOX_VC1_MB_STATE 156 { 157 PCODEC_VC1_MB_PARAMS pMb; 158 PCODEC_VC1_PIC_PARAMS pVc1PicParams; 159 MEDIA_WA_TABLE *pWaTable; // WA table 160 161 PMOS_RESOURCE presDataBuffer; 162 uint8_t *pDeblockDataBuffer; 163 uint32_t dwDataSize; 164 uint32_t dwOffset; 165 uint32_t dwLength; 166 uint8_t bMbHorizOrigin; 167 uint8_t bMbVertOrigin; 168 uint8_t DeblockData[CODEC_NUM_BLOCK_PER_MB]; 169 uint32_t PackedLumaMvs[4]; // packed motion vectors for Luma 170 uint32_t PackedChromaMv; // packed motion vector for Chroma 171 uint16_t wPicWidthInMb; // Picture Width in MB width count 172 uint16_t wPicHeightInMb; // Picture Height in MB height count 173 CODEC_PICTURE_FLAG PicFlags; 174 uint8_t bMotionSwitch; // VC1 MotionSwitch 175 uint8_t bFieldPolarity; 176 uint8_t bSkipped; 177 } MHW_VDBOX_VC1_MB_STATE, *PMHW_VDBOX_VC1_MB_STATE; 178 179 typedef struct _MHW_VDBOX_HUFF_TABLE_PARAMS 180 { 181 uint32_t HuffTableID; 182 void *pDCBits; 183 void *pDCValues; 184 void *pACBits; 185 void *pACValues; 186 } MHW_VDBOX_HUFF_TABLE_PARAMS, *PMHW_VDBOX_HUFF_TABLE_PARAMS; 187 188 typedef struct _MHW_VDBOX_ENCODE_HUFF_TABLE_PARAMS 189 { 190 uint32_t HuffTableID; 191 uint8_t pDCCodeLength[JPEG_NUM_HUFF_TABLE_DC_HUFFVAL]; // 12 values of 1 byte each 192 uint16_t pDCCodeValues[JPEG_NUM_HUFF_TABLE_DC_HUFFVAL]; // 12 values of 2 bytes each 193 uint8_t pACCodeLength[JPEG_NUM_HUFF_TABLE_AC_HUFFVAL]; // 162 values of 1 byte each 194 uint16_t pACCodeValues[JPEG_NUM_HUFF_TABLE_AC_HUFFVAL]; // 162 values of 2 bytes each 195 } MHW_VDBOX_ENCODE_HUFF_TABLE_PARAMS, *PMHW_VDBOX_ENCODE_HUFF_TABLE_PARAMS; 196 197 typedef struct _MHW_VDBOX_JPEG_BSD_PARAMS 198 { 199 uint32_t dwIndirectDataLength; 200 uint32_t dwDataStartAddress; 201 uint32_t dwScanHorizontalPosition; 202 uint32_t dwScanVerticalPosition; 203 bool bInterleaved; 204 int16_t sScanComponent; 205 uint32_t dwMCUCount; 206 uint32_t dwRestartInterval; 207 } MHW_VDBOX_JPEG_BSD_PARAMS, *PMHW_VDBOX_JPEG_BSD_PARAMS; 208 209 typedef struct _MHW_VDBOX_JPEG_PIC_STATE 210 { 211 CodecDecodeJpegPicParams *pJpegPicParams; 212 uint32_t Mode; 213 uint32_t dwWidthInBlocks; 214 uint32_t dwHeightInBlocks; 215 uint32_t dwOutputFormat; 216 } MHW_VDBOX_JPEG_DECODE_PIC_STATE, *PMHW_VDBOX_JPEG_PIC_STATE; 217 218 //! 219 //! \struct MhwVdboxJpegEncodePicState 220 //! \brief MHW vdbox JPEG encode picture state 221 //! 222 struct MhwVdboxJpegEncodePicState 223 { 224 CodecEncodeJpegPictureParams *pJpegEncodePicParams; 225 uint32_t mode; 226 }; 227 228 //! 229 //! \struct MhwVdboxJpegScanParams 230 //! \brief MHW vdbox JPEG scan parameters 231 //! 232 struct MhwVdboxJpegScanParams 233 { 234 CodecEncodeJpegScanHeader *pJpegEncodeScanParams; 235 CodecEncodeJpegInputSurfaceFormat inputSurfaceFormat; 236 uint32_t dwPicWidth; 237 uint32_t dwPicHeight; 238 uint32_t mode; 239 }; 240 241 typedef struct _MHW_VDBOX_VP8_PIC_STATE 242 { 243 PCODEC_VP8_PIC_PARAMS pVp8PicParams; 244 PCODEC_VP8_IQ_MATRIX_PARAMS pVp8IqMatrixParams; 245 PMOS_RESOURCE presCoefProbBuffer; 246 PMOS_RESOURCE presSegmentationIdStreamBuffer; 247 uint32_t dwCoefProbTableOffset; 248 249 // Encoding Params 250 PCODEC_VP8_ENCODE_SEQUENCE_PARAMS pEncodeVP8SeqParams; 251 PCODEC_VP8_ENCODE_PIC_PARAMS pEncodeVP8PicParams; 252 PCODEC_VP8_ENCODE_QUANT_DATA pEncodeVP8QuantData; 253 uint16_t wPicWidthInMb; 254 uint16_t wPicHeightInMb; 255 uint8_t ucKernelMode; // normal, performance, quality. 256 257 } MHW_VDBOX_VP8_PIC_STATE, *PMHW_VDBOX_VP8_PIC_STATE; 258 259 typedef struct _MHW_VDBOX_VP8_BSP_BUF_BASE_ADDR_PARAMS 260 { 261 PMOS_RESOURCE presFrameHeaderBuffer; 262 PMOS_RESOURCE presCoeffProbsBuffer; 263 PMOS_RESOURCE presPakIntermediateBuffer; 264 PMOS_RESOURCE presPakFinalFrameBuffer; 265 PMOS_RESOURCE presTokenStatisticsBuffer; 266 PMOS_RESOURCE presBsdMpcRowStoreScratchBuffer; 267 uint32_t dwPakIntermediateTokenSize; 268 uint32_t dwPakIntermediatePartition0Size; 269 uint32_t dwPartitions; 270 } MHW_VDBOX_VP8_BSP_BUF_BASE_ADDR_PARAMS, *PMHW_VDBOX_VP8_BSP_BUF_BASE_ADDR_PARAMS; 271 272 typedef struct _MHW_VDBOX_VP8_ENCODER_CFG_PARAMS 273 { 274 bool bFirstPass; 275 bool bBRCEnabled; 276 uint32_t dwCfgBufferSize; // total buffer size 277 uint32_t dwCfgCmdOffset; // offset of the CFG command in 278 PCODEC_VP8_ENCODE_SEQUENCE_PARAMS pEncodeVP8SeqParams; 279 PCODEC_VP8_ENCODE_PIC_PARAMS pEncodeVP8PicParams; 280 PCODEC_VP8_ENCODE_QUANT_DATA pEncodeVP8QuantData; 281 } MHW_VDBOX_VP8_ENCODER_CFG_PARAMS, *PMHW_VDBOX_VP8_ENCODER_CFG_PARAMS; 282 283 typedef struct _MHW_VDBOX_VP8_BSD_PARAMS 284 { 285 PCODEC_VP8_PIC_PARAMS pVp8PicParams; 286 } MHW_VDBOX_VP8_BSD_PARAMS, *PMHW_VDBOX_VP8_BSD_PARAMS; 287 288 typedef struct _MHW_VDBOX_MPEG2_PIC_STATE 289 { 290 uint32_t Mode; 291 292 // Decoding Params 293 CodecDecodeMpeg2PicParams *pMpeg2PicParams; 294 bool bDeblockingEnabled; 295 uint32_t dwMPEG2ISliceConcealmentMode; // Mpeg2 I slice concealment mode 296 uint32_t dwMPEG2PBSliceConcealmentMode; // Mpeg2 P/B slice concealment mode 297 uint32_t dwMPEG2PBSlicePredBiDirMVTypeOverride; // Mpeg2 P/B Slice Predicted BiDir Motion Type Override 298 uint32_t dwMPEG2PBSlicePredMVOverride; // Mpeg2 P/B Slice Predicted Motion Vector Override 299 300 // Encoding Params 301 CodecEncodeMpeg2SequenceParams *pEncodeMpeg2SeqParams; 302 CodecEncodeMpeg2PictureParams *pEncodeMpeg2PicParams; 303 PCODEC_REF_LIST *ppRefList; 304 bool bBrcEnabled; 305 bool bTrellisQuantEnable; 306 uint16_t wPicWidthInMb; 307 uint16_t wPicHeightInMb; 308 uint8_t ucKernelMode; // normal, performance, quality. 309 bool bIPCMPass; 310 311 uint32_t dwFrameBitRateMaxReportMask; 312 uint32_t dwIntraMBMaxSize; 313 uint32_t dwInterMBMaxSize; 314 315 uint8_t ucSliceDeltaQPMax0; 316 uint8_t ucSliceDeltaQPMax1; 317 uint8_t ucSliceDeltaQPMax2; 318 uint8_t ucSliceDeltaQPMax3; 319 320 uint32_t dwFrameBitRateMax; 321 uint32_t dwFrameBitRateMaxUnit; 322 } MHW_VDBOX_MPEG2_PIC_STATE, *PMHW_VDBOX_MPEG2_PIC_STATE; 323 324 typedef struct _MHW_VDBOX_AVC_DPB_PARAMS 325 { 326 PCODEC_AVC_PIC_PARAMS pAvcPicParams; 327 PCODEC_MVC_EXT_PIC_PARAMS pMvcExtPicParams; 328 PCODEC_REF_LIST *ppAvcRefList; 329 PCODEC_PIC_ID pAvcPicIdx; 330 bool bPicIdRemappingInUse; 331 } MHW_VDBOX_AVC_DPB_PARAMS, *PMHW_VDBOX_AVC_DPB_PARAMS; 332 333 typedef struct _MHW_VDBOX_AVC_DIRECTMODE_PARAMS 334 { 335 CODEC_PICTURE CurrPic; 336 bool isEncode; 337 uint32_t uiUsedForReferenceFlags; 338 PMOS_RESOURCE presAvcDmvBuffers; 339 uint8_t ucAvcDmvIdx; 340 PCODEC_AVC_DMV_LIST pAvcDmvList; 341 PCODEC_PIC_ID pAvcPicIdx; 342 void **avcRefList; 343 bool bPicIdRemappingInUse; 344 int32_t CurrFieldOrderCnt[2]; 345 bool bDisableDmvBuffers; 346 PMOS_RESOURCE presMvcDummyDmvBuffer; 347 } MHW_VDBOX_AVC_DIRECTMODE_PARAMS, *PMHW_VDBOX_AVC_DIRECTMODE_PARAMS; 348 349 typedef struct _MHW_VDBOX_AVC_REF_IDX_PARAMS 350 { 351 CODEC_PICTURE CurrPic = {}; 352 uint32_t uiNumRefForList[2] = {}; 353 CODEC_PICTURE RefPicList[2][32] = {}; 354 PCODEC_PIC_ID pAvcPicIdx = {}; 355 uint32_t uiList = 0; 356 void **avcRefList = nullptr; 357 bool isEncode = false; 358 bool bVdencInUse = false; 359 bool bIntelEntrypointInUse = false; 360 bool bPicIdRemappingInUse = false; 361 bool oneOnOneMapping = false; 362 bool bDummyReference = false; 363 } MHW_VDBOX_AVC_REF_IDX_PARAMS, *PMHW_VDBOX_AVC_REF_IDX_PARAMS; 364 365 typedef struct _MHW_VDBOX_PIC_ID_PARAMS 366 { 367 bool bPicIdRemappingInUse; 368 PCODEC_PIC_ID pAvcPicIdx; 369 } MHW_VDBOX_PIC_ID_PARAMS, *PMHW_VDBOX_PIC_ID_PARAMS; 370 371 typedef struct _MHW_VDBOX_BSP_BUF_BASE_ADDR_PARAMS 372 { 373 PMOS_RESOURCE presBsdMpcRowStoreScratchBuffer; // Handle of BSD/MPC Row Store Scratch data surface 374 PMOS_RESOURCE presMprRowStoreScratchBuffer; // Handle of MPR Row Store Scratch data surface 375 PMOS_RESOURCE presBitplaneBuffer; 376 } MHW_VDBOX_BSP_BUF_BASE_ADDR_PARAMS, *PMHW_VDBOX_BSP_BUF_BASE_ADDR_PARAMS; 377 378 typedef struct _MHW_VDBOX_GPUNODE_LIMIT 379 { 380 bool bHcpInUse; 381 bool bHuCInUse; 382 bool bSfcInUse; 383 uint32_t dwGpuNodeToUse; 384 }MHW_VDBOX_GPUNODE_LIMIT, *PMHW_VDBOX_GPUNODE_LIMIT; 385 386 typedef struct _MHW_VDBOX_AVC_IMG_BITRATE_PARAMS 387 { 388 uint32_t frameBitRateMin : 14; 389 uint32_t frameBitRateMinUnitMode : 1; 390 uint32_t frameBitRateMinUnit : 1; 391 uint32_t frameBitRateMax : 14; 392 uint32_t frameBitRateMaxUnitMode : 1; 393 uint32_t frameBitRateMaxUnit : 1; 394 uint32_t frameBitRateMinDelta : 15; 395 uint32_t : 1; 396 uint32_t frameBitRateMaxDelta : 15; 397 uint32_t : 1; 398 } MHW_VDBOX_AVC_IMG_BITRATE_PARAMS, *PMHW_VDBOX_AVC_IMG_BITRATE_PARAMS; 399 400 //! 401 //! \class MhwVdboxMfxInterface 402 //! \brief MHW Vdbox Mfx interface 403 //! 404 /*! 405 This class defines the interfaces for constructing Vdbox Mfx commands across all platforms 406 */ 407 class MhwVdboxMfxInterface 408 { 409 protected: 410 static const uint8_t m_mpeg2QuantMatrixScan[64]; //!< MPEG2 quantization table scan order 411 412 //! 413 //! \enum AvcSliceType 414 //! \brief Average slice type 415 //! 416 enum AvcSliceType 417 { 418 avcSliceP = 0, 419 avcSliceB = 1, 420 avcSliceI = 2 421 }; 422 423 //! 424 //! \enum Mpeg2Vc1MacroblockIntratype 425 //! \brief MPEG2 VC1 macro block intra type 426 //! 427 enum Mpeg2Vc1MacroblockIntratype 428 { 429 mpeg2Vc1MacroblockNonintra = 0, 430 mpeg2Vc1MacroblockIntra = 1 431 }; 432 433 //! 434 //! \enum Mpeg2Vc1PictureStructure 435 //! \brief MPEG2 VC1 picture structure 436 //! 437 enum Mpeg2Vc1PictureStructure 438 { 439 mpeg2Vc1TopField = 1, 440 mpeg2Vc1BottomField, 441 mpeg2Vc1Frame 442 }; 443 444 //! 445 //! \enum Vc1FrameCodingMode 446 //! \brief VC1 frame coding mode 447 //! 448 enum Vc1FrameCodingMode 449 { 450 vc1ProgressiveFrame = 0, 451 vc1InterlacedFrame, 452 vc1TffFrame, 453 vc1BffFrame 454 }; 455 456 //! 457 //! \enum Vc1CodedMode 458 //! \brief VC1 coded mode 459 //! 460 enum Vc1CodedMode 461 { 462 vc1NonrawMode = 0, 463 vc1RawMode = 1 464 }; 465 466 //! 467 //! \struct RefBoundaryReplicationMode 468 //! \brief Reference boundary replication mode 469 //! 470 struct RefBoundaryReplicationMode 471 { 472 union 473 { 474 struct 475 { 476 uint8_t ref0 : 1; 477 uint8_t ref1 : 1; 478 uint8_t ref2 : 1; 479 uint8_t ref3 : 1; 480 }; 481 struct 482 { 483 uint8_t value; 484 }; 485 } BY0; 486 }; 487 488 //! 489 //! \enum Vc1FrameBoundaryType 490 //! \brief VC1 frame boundary type 491 //! 492 enum Vc1FrameBoundaryType 493 { 494 vc1ProgressiveBoundary = 0, 495 vc1InterlacedBoundary = 1 496 }; 497 498 //! 499 //! \struct AvcRefListWrite 500 //! \brief Average reference list write 501 //! 502 struct AvcRefListWrite 503 { 504 union 505 { 506 struct 507 { 508 uint8_t bottomField : 1; 509 uint8_t frameStoreID : 4; 510 uint8_t fieldPicFlag : 1; 511 uint8_t longTermFlag : 1; 512 uint8_t nonExisting : 1; 513 }; 514 struct 515 { 516 uint8_t value; 517 }; 518 } UC[32]; 519 }; 520 521 //! 522 //! \enum AvcQmTypes 523 //! \brief Average qm types 524 //! 525 enum AvcQmTypes 526 { 527 avcQmIntra4x4 = 0, 528 avcQmInter4x4 = 1, 529 avcQmIntra8x8 = 2, 530 avcQmInter8x8 = 3 531 }; 532 533 //! 534 //! \enum Mpeg2QmTypes 535 //! \brief MPEG2 qm types 536 //! 537 enum Mpeg2QmTypes 538 { 539 mpeg2QmIntra = 0, 540 mpeg2QmNonIntra, 541 }; 542 543 //! 544 //! \enum AvcPicid 545 //! \brief Average picid 546 //! 547 enum AvcPicid 548 { 549 avcPicidDisabled = 0, 550 avcPicidDefault = 0xFFFFFFFF 551 }; 552 553 //! 554 //! \enum AvcImgStructure 555 //! \brief Average image structure 556 //! 557 enum AvcImgStructure 558 { 559 avcFrame = 0, 560 avcTopField = 1, 561 avcBottomField = 3 562 }; 563 564 //! 565 //! \enum CodecSelect 566 //! \brief Code select 567 //! 568 enum CodecSelect 569 { 570 decoderCodec = 0, 571 encoderCodec = 1 572 }; 573 574 //! 575 //! \enum MfxDecoderModeSelect 576 //! \brief MFX decoder mode select 577 //! 578 enum MfxDecoderModeSelect 579 { 580 mfxDecoderModeVld = 0, 581 mfxDecoderModeIt = 1 582 }; 583 584 //! 585 //! \struct VDEncFrameDeltaTable 586 //! \brief VD encode frame delta table 587 //! 588 struct VDEncFrameDeltaTable 589 { 590 uint32_t PFrameDelta; 591 uint32_t IFrameDelta; 592 }; 593 594 static const uint16_t m_mpeg2DefaultIntraQuantizerMatrix[64]; //!< MPEG2 default quantization matrix for intra macroblock 595 static const uint16_t m_mpeg2DefaultNonIntraQuantizerMatrix[64]; //!< MPEG2 default quantization matrix for inter macroblock 596 static const uint32_t m_mpeg2SliceDeltaQPMax[4]; //! MPEG2 slice delta QP max value 597 static const uint32_t m_mpeg2InitSliceDeltaQPMin[4]; //!< MPEG2 slice delta QP min value 598 static const uint32_t m_mpeg2FrameBitrateMinMax[4]; //!< MPEG2 frame bitrate Min/Max value 599 static const uint32_t m_mpeg2FrameBitrateMinMaxDelta[4]; //!< MPEG2 frame bitrate Min/Max delta value 600 601 static const uint8_t m_columnScan4x4[16]; //! AVC column scan order for 4x4 block 602 static const uint8_t m_columnScan8x8[64]; //!< AVC column scan order for 8x8 block 603 static const AvcSliceType m_AvcBsdSliceType[10]; //!< AVC BSD slice type 604 605 static const uint8_t m_vp8MaxNumPartitions = 8; //!< Maximal number of partitions for VP8 606 607 static const uint32_t m_mfxErrorFlagsMask = 0xFBFF; //!< Mfx error flags mask 608 //!< Bit 10 of MFD_ERROR_STATUS register is set to a random value during RC6, so it is not used 609 610 static const VDEncFrameDeltaTable m_vdEncFrameDelta100PercentTab[CODEC_AVC_NUM_QP]; 611 static const VDEncFrameDeltaTable m_vdEncFrameDelta90PercentTab[CODEC_AVC_NUM_QP]; 612 613 static const uint32_t m_log2WeightDenomDefault = 5; //!< Default value of luma/chroma_log2_weight_denoms 614 static const uint32_t m_mpeg2WeightScaleSize = 16; //!< Size of MPEG2 weight scale 615 616 PMOS_INTERFACE m_osInterface = nullptr; //!< Pointer to OS interface 617 MhwMiInterface *m_MiInterface = nullptr; //!< Pointer to MI interface 618 MhwCpInterface *m_cpInterface = nullptr; //!< Pointer to CP interface 619 MEDIA_FEATURE_TABLE *m_skuTable = nullptr; //!< Pointer to SKU table 620 MEDIA_WA_TABLE *m_waTable = nullptr; //!< Pointer to WA table 621 bool m_decodeInUse = false; //!< Flag to indicate if the interface is for decoder or encoder use 622 623 PLATFORM m_platform = {}; //!< Gen platform 624 625 MHW_MEMORY_OBJECT_CONTROL_PARAMS m_cacheabilitySettings[MOS_CODEC_RESOURCE_USAGE_END_CODEC] = {}; //!< Cacheability settings 626 627 uint32_t m_numBrcPakPasses = 4; //!< Number of BRC PAK passes 628 bool m_rhoDomainStatsEnabled = false; //!< Flag to indicate if Rho domain stats is enabled 629 bool m_rowstoreCachingSupported = false; //!< Flag to indicate if row store cache is supported 630 631 MHW_VDBOX_ROWSTORE_CACHE m_intraRowstoreCache = {}; //!< Intra rowstore cache 632 MHW_VDBOX_ROWSTORE_CACHE m_deblockingFilterRowstoreCache = {}; //!< Deblocking filter row store cache 633 MHW_VDBOX_ROWSTORE_CACHE m_bsdMpcRowstoreCache = {}; //!< BSD/MPC row store cache 634 MHW_VDBOX_ROWSTORE_CACHE m_mprRowstoreCache = {}; //!< MPR row store cache 635 MHW_VDBOX_NODE_IND m_maxVdboxIndex = MHW_VDBOX_NODE_1; //!< max vdbox index 636 637 uint32_t m_avcImgStateSize = 0; //!< size of avcImgState 638 uint8_t m_numVdbox = 1; //!< vdbox num 639 uint32_t m_brcNumPakPasses = 4; //!< Number of brc pak passes 640 641 MmioRegistersMfx m_mmioRegisters[MHW_VDBOX_NODE_MAX] = {}; //!< mfx mmio registers 642 643 //! 644 //! \brief Constructor 645 //! 646 MhwVdboxMfxInterface( 647 PMOS_INTERFACE osInterface, 648 MhwMiInterface *miInterface, 649 MhwCpInterface *cpInterface, 650 bool decodeInUse); 651 652 //! 653 //! \brief Get Jpeg decode output surface format 654 //! \details VDBOX protected function to get jpeg decode output format 655 //! \param [in] format 656 //! MOS type format 657 //! \return MHW_VDBOX_DECODE_JPEG_FORMAT_CODE 658 //! output surface format 659 //! 660 MHW_VDBOX_DECODE_JPEG_FORMAT_CODE GetJpegDecodeFormat(MOS_FORMAT format); 661 662 //! 663 //! \brief Calculate Min/Max bitrate for AVC image state 664 //! 665 //! \param [in, out] params 666 //! AVC bitrate parameters 667 //! 668 //! \return void 669 //! 670 virtual void CalcAvcImgStateMinMaxBitrate(MHW_VDBOX_AVC_IMG_BITRATE_PARAMS& params); 671 672 //! 673 //! \brief Add a resource to the command buffer 674 //! \details Internal function to add either a graphics address of a resource or 675 //! add the resource to the patch list for the requested buffer 676 //! 677 //! \param [in] osInterface 678 //! OS interface 679 //! \param [in] cmdBuffer 680 //! Command buffer to which resource is added 681 //! \param [in] params 682 //! Parameters necessary to add the resource 683 //! 684 //! \return MOS_STATUS 685 //! MOS_STATUS_SUCCESS if success, else fail reason 686 //! 687 MOS_STATUS(*AddResourceToCmd) ( 688 PMOS_INTERFACE osInterface, 689 PMOS_COMMAND_BUFFER cmdBuffer, 690 PMHW_RESOURCE_PARAMS params); 691 692 //! 693 //! \brief Helper function for getting view order in the case of MVC 694 //! 695 //! \param [in] params 696 //! Pointer to AVC DPB params 697 //! \param [in] currIdx 698 //! Reference frame index 699 //! \param [in] list 700 //! forward (list0) or backword reference (list1) 701 //! 702 //! \return uint32_t 703 //! View order 704 //! 705 uint32_t GetViewOrder( 706 PMHW_VDBOX_AVC_DPB_PARAMS params, 707 uint32_t currIdx, 708 uint32_t list); 709 710 //! 711 //! \brief Check if the input mos type format is VPlane Present 712 //! \details VDBOX protected function to check the input mos type format 713 //! 714 //! \param [in] format 715 //! MOS type format 716 //! \return bool 717 //! return true if the input format is VPlane present 718 //! otherwise return false 719 //! 720 bool IsVPlanePresent( 721 MOS_FORMAT format); 722 723 //! 724 //! \brief Translate MOS type format to Mediastate surface format 725 //! \details VDBOX protected function to translate mos format to media state format 726 //! \param [in] format 727 //! MOS type format 728 //! \return uint32_t 729 //! media state surface format 730 //! 731 uint32_t MosToMediaStateFormat(MOS_FORMAT format); 732 733 public: 734 //! 735 //! \brief Get Jpeg horizontal sampling factor by the given format 736 //! \details Get Jpeg horizontal sampling factor by the given format 737 //! \param [in] format 738 //! Jpeg input surface format 739 //! \return uint32_t 740 //! returns the horizontal sampling factor 741 //! 742 uint32_t GetJpegHorizontalSamplingFactorForY( 743 CodecEncodeJpegInputSurfaceFormat format); 744 745 //! 746 //! \brief Get Jpeg vetical sampling factor by the given format 747 //! \details Get Jpeg vetical sampling factor by the given format 748 //! \param [in] format 749 //! Jpeg input surface format 750 //! \return uint32_t 751 //! returns the vetical sampling factor 752 //! 753 uint32_t GetJpegVerticalSamplingFactorForY( 754 CodecEncodeJpegInputSurfaceFormat format); 755 756 //! 757 //! \brief Determines if the frame/field is of I type 758 //! 759 //! \param [in] picture 760 //! CODECHAL_PICTURE structure, including frame index and picture flags 761 //! \param [in] isFirstField 762 //! True if the picture is first field, false otherwise 763 //! \param [in] picType 764 //! VC1 picture type 765 //! 766 //! \return bool 767 //! True if it's I picture, otherwise return false 768 //! 769 bool IsVc1IPicture( 770 const CODEC_PICTURE& picture, 771 bool isFirstField, 772 uint16_t picType); 773 774 //! 775 //! \brief Determines if the frame/field is of P type 776 //! 777 //! \param [in] picture 778 //! CODECHAL_PICTURE structure, including frame index and picture flags 779 //! \param [in] isFirstField 780 //! True if the picture is first field, false otherwise 781 //! \param [in] picType 782 //! VC1 picture type 783 //! 784 //! \return bool 785 //! True if it's P picture, otherwise return false 786 //! 787 bool IsVc1PPicture( 788 const CODEC_PICTURE& picture, 789 bool isFirstField, 790 uint16_t picType); 791 792 //! 793 //! \brief Determines if the frame/field is of B type 794 //! 795 //! \param [in] picture 796 //! CODECHAL_PICTURE structure, including frame index and picture flags 797 //! \param [in] isFirstField 798 //! True if the picture is first field, false otherwise 799 //! \param [in] picType 800 //! VC1 picture type 801 //! 802 //! \return bool 803 //! True if it's B picture, otherwise return false 804 //! 805 bool IsVc1BPicture( 806 const CODEC_PICTURE& picture, 807 bool isFirstField, 808 uint16_t picType); 809 810 //! 811 //! \brief Determines if the frame/field is of BI type 812 //! 813 //! \param [in] picture 814 //! CODECHAL_PICTURE structure, including frame index and picture flags 815 //! \param [in] isFirstField 816 //! True if the picture is first field, false otherwise 817 //! \param [in] picType 818 //! VC1 picture type 819 //! 820 //! \return bool 821 //! True if it's BI picture, otherwise return false 822 //! 823 bool IsVc1BIPicture( 824 const CODEC_PICTURE& picture, 825 bool isFirstField, 826 uint16_t picType); 827 828 //! 829 //! \brief Determines if the slice is P slice 830 //! \param [in] sliceType 831 //! slice type 832 //! \return bool 833 //! True if it's P slice, otherwise return false 834 //! IsAvcPSlice(uint8_t sliceType)835 bool IsAvcPSlice(uint8_t sliceType) 836 { 837 return (sliceType < MHW_ARRAY_SIZE(m_AvcBsdSliceType)) ? 838 (m_AvcBsdSliceType[sliceType] == avcSliceP) : false; 839 } 840 841 //! 842 //! \brief Determines if the slice is B slice 843 //! \param [in] sliceType 844 //! slice type 845 //! \return bool 846 //! True if it's B slice, otherwise return false 847 //! IsAvcBSlice(uint8_t sliceType)848 bool IsAvcBSlice(uint8_t sliceType) 849 { 850 return (sliceType < MHW_ARRAY_SIZE(m_AvcBsdSliceType)) ? 851 (m_AvcBsdSliceType[sliceType] == avcSliceB) : false; 852 } 853 854 //! 855 //! \brief Determines if the slice is I slice 856 //! \param [in] sliceType 857 //! slice type 858 //! \return bool 859 //! True if it's I slice, otherwise return false 860 //! IsAvcISlice(uint8_t sliceType)861 bool IsAvcISlice(uint8_t sliceType) 862 { 863 return (sliceType < MHW_ARRAY_SIZE(m_AvcBsdSliceType)) ? 864 (m_AvcBsdSliceType[sliceType] == avcSliceI) : false; 865 } 866 867 //! 868 //! \brief Destructor 869 //! ~MhwVdboxMfxInterface()870 virtual ~MhwVdboxMfxInterface() {} 871 872 //! 873 //! \brief Judge if decode is in use 874 //! 875 //! \return bool 876 //! true if decode in use, else false 877 //! IsDecodeInUse()878 inline bool IsDecodeInUse() 879 { 880 return m_decodeInUse; 881 } 882 883 //! 884 //! \brief Get Mfx Error Flags Mask 885 //! 886 //! \return [out] uint32_t 887 //! Mask got. 888 //! GetMfxErrorFlagsMask()889 inline uint32_t GetMfxErrorFlagsMask() 890 { 891 return m_mfxErrorFlagsMask; 892 } 893 894 //! 895 //! \brief Get the vdbox num 896 //! 897 //! \return bool 898 //! vdbox num got 899 //! GetNumVdbox()900 inline uint8_t GetNumVdbox() 901 { 902 return m_numVdbox; 903 } 904 905 //! 906 //! \brief set the flag of decode in use 907 //! 908 //! \param [in] decodeInUse 909 //! decodeInUse flag to set 910 //! 911 //! \return void 912 //! SetDecodeInUse(bool decodeInUse)913 inline void SetDecodeInUse(bool decodeInUse) 914 { 915 m_decodeInUse = decodeInUse; 916 } 917 918 //! 919 //! \brief Judge if row store caching supported 920 //! 921 //! \return bool 922 //! true if supported, else false 923 //! IsRowStoreCachingSupported()924 inline bool IsRowStoreCachingSupported() 925 { 926 return m_rowstoreCachingSupported; 927 } 928 929 //! 930 //! \brief Judge if intra row store caching enabled 931 //! 932 //! \return bool 933 //! true if enabled, else false 934 //! IsIntraRowstoreCacheEnabled()935 inline bool IsIntraRowstoreCacheEnabled() 936 { 937 return m_intraRowstoreCache.bEnabled ? true : false; 938 } 939 940 //! 941 //! \brief Judge if deblocking filter row store caching enabled 942 //! 943 //! \return bool 944 //! true if enabled, else false 945 //! IsDeblockingFilterRowstoreCacheEnabled()946 inline bool IsDeblockingFilterRowstoreCacheEnabled() 947 { 948 return m_deblockingFilterRowstoreCache.bEnabled ? true : false; 949 } 950 951 //! 952 //! \brief Judge if bsd mpc row store caching enabled 953 //! 954 //! \return bool 955 //! true if enabled, else false 956 //! IsBsdMpcRowstoreCacheEnabled()957 inline bool IsBsdMpcRowstoreCacheEnabled() 958 { 959 return m_bsdMpcRowstoreCache.bEnabled ? true : false; 960 } 961 962 //! 963 //! \brief Judge if mpr row store caching enabled 964 //! 965 //! \return bool 966 //! true if enabled, else false 967 //! IsMprRowstoreCacheEnabled()968 inline bool IsMprRowstoreCacheEnabled() 969 { 970 return m_mprRowstoreCache.bEnabled ? true : false; 971 } 972 973 //! 974 //! \brief Get max vdbox index 975 //! 976 //! \return MHW_VDBOX_NODE_IND 977 //! max vdbox index got 978 //! GetMaxVdboxIndex()979 inline MHW_VDBOX_NODE_IND GetMaxVdboxIndex() 980 { 981 return m_maxVdboxIndex; 982 } 983 984 //! 985 //! \brief Get mmio registers 986 //! 987 //! \param [in] index 988 //! mmio registers index. 989 //! 990 //! \return [out] MmioRegistersMfx* 991 //! mmio registers got. 992 //! GetMmioRegisters(MHW_VDBOX_NODE_IND index)993 inline MmioRegistersMfx* GetMmioRegisters(MHW_VDBOX_NODE_IND index) 994 { 995 if (index < MHW_VDBOX_NODE_MAX) 996 { 997 return &m_mmioRegisters[index]; 998 } 999 else 1000 { 1001 MHW_ASSERT("index is out of range!"); 1002 return &m_mmioRegisters[MHW_VDBOX_NODE_1]; 1003 } 1004 } 1005 1006 //! 1007 //! \brief Convert from Mfx mmio registers to MI mmio register 1008 //! 1009 //! \param [in] index 1010 //! mmio registers index. 1011 //! \param [in] mmioRegister 1012 //! reference to MHW_MI_MMIOREGISTERS. 1013 //! 1014 //! \return [out] bool 1015 //! return true if mmio register if found, otherwise return false 1016 //! ConvertToMiRegister(MHW_VDBOX_NODE_IND index,MHW_MI_MMIOREGISTERS & mmioRegister)1017 inline bool ConvertToMiRegister(MHW_VDBOX_NODE_IND index, MHW_MI_MMIOREGISTERS &mmioRegister) 1018 { 1019 MmioRegistersMfx* mfxMmioReg = GetMmioRegisters(index); 1020 if (mfxMmioReg) 1021 { 1022 mmioRegister.generalPurposeRegister0LoOffset = mfxMmioReg->generalPurposeRegister0LoOffset; 1023 mmioRegister.generalPurposeRegister0HiOffset = mfxMmioReg->generalPurposeRegister0HiOffset; 1024 mmioRegister.generalPurposeRegister4LoOffset = mfxMmioReg->generalPurposeRegister4LoOffset; 1025 mmioRegister.generalPurposeRegister4HiOffset = mfxMmioReg->generalPurposeRegister4HiOffset; 1026 mmioRegister.generalPurposeRegister11LoOffset = mfxMmioReg->generalPurposeRegister11LoOffset; 1027 mmioRegister.generalPurposeRegister11HiOffset = mfxMmioReg->generalPurposeRegister11HiOffset; 1028 mmioRegister.generalPurposeRegister12LoOffset = mfxMmioReg->generalPurposeRegister12LoOffset; 1029 mmioRegister.generalPurposeRegister12HiOffset = mfxMmioReg->generalPurposeRegister12HiOffset; 1030 return true; 1031 } 1032 else 1033 return false; 1034 } 1035 1036 //! 1037 //! \brief Get brc pak passes num 1038 //! \details Get brc pak passes num in mfx interface 1039 //! 1040 //! \return [out] uint32_t 1041 //! Brc pak passes num. 1042 //! GetBrcNumPakPasses()1043 inline uint32_t GetBrcNumPakPasses() 1044 { 1045 return m_brcNumPakPasses; 1046 } 1047 1048 //! 1049 //! \brief Set brc pak passes num 1050 //! \details Set brc pak passes num in hcp interface 1051 //! 1052 //! \param [in] brcNumPakPasses 1053 //! Brc pak passes num to set. 1054 //! 1055 //! \return void 1056 //! SetBrcNumPakPasses(uint32_t brcNumPakPasses)1057 inline void SetBrcNumPakPasses(uint32_t brcNumPakPasses) 1058 { 1059 m_brcNumPakPasses = brcNumPakPasses; 1060 } 1061 1062 //! 1063 //! \brief get AVC img state size 1064 //! 1065 //! \return uint32_t 1066 //! AVC img state size got 1067 //! 1068 virtual uint32_t GetAvcImgStateSize() = 0; 1069 1070 //! 1071 //! \brief Decide Which GPU Node to use for Decode 1072 //! \details Client facing function to create gpu context used by decoder 1073 //! \param [in] gpuNodeLimit 1074 //! GpuNode Limitation 1075 //! \return MOS_STATUS 1076 //! MOS_STATUS_SUCCESS if success, else fail reason 1077 //! 1078 virtual MOS_STATUS FindGpuNodeToUse( 1079 PMHW_VDBOX_GPUNODE_LIMIT gpuNodeLimit) = 0; 1080 1081 //! 1082 //! \brief Set cacheability settings 1083 //! 1084 //! \param [in] cacheabilitySettings 1085 //! Cacheability settings 1086 //! 1087 //! \return MOS_STATUS 1088 //! MOS_STATUS_SUCCESS if success, else fail reason 1089 //! SetCacheabilitySettings(MHW_MEMORY_OBJECT_CONTROL_PARAMS cacheabilitySettings[MOS_CODEC_RESOURCE_USAGE_END_CODEC])1090 MOS_STATUS SetCacheabilitySettings( 1091 MHW_MEMORY_OBJECT_CONTROL_PARAMS cacheabilitySettings[MOS_CODEC_RESOURCE_USAGE_END_CODEC]) 1092 { 1093 MHW_FUNCTION_ENTER; 1094 1095 uint32_t size = MOS_CODEC_RESOURCE_USAGE_END_CODEC * sizeof(MHW_MEMORY_OBJECT_CONTROL_PARAMS); 1096 MOS_STATUS eStatus = MOS_SecureMemcpy(m_cacheabilitySettings, size, 1097 cacheabilitySettings, size); 1098 1099 return eStatus; 1100 } 1101 1102 //! 1103 //! \brief Get average bsd slice type 1104 //! 1105 //! \param [in] index 1106 //! Index number 1107 //! 1108 //! \return int32_t 1109 //! Avc bsd slice type 1110 //! GetAvcBsdSliceType(uint32_t index)1111 int32_t GetAvcBsdSliceType(uint32_t index) 1112 { 1113 return m_AvcBsdSliceType[index]; 1114 } 1115 1116 //! 1117 //! \brief Calculates the maximum size for all picture level commands 1118 //! \details Client facing function to calculate the maximum size for all picture level commands 1119 //! 1120 //! \param [in] mode 1121 //! codec mode 1122 //! \param [out] commandsSize 1123 //! The maximum command buffer size 1124 //! \param [out] patchListSize 1125 //! The maximum command patch list size 1126 //! \param [in] isShortFormat 1127 //! True if short format, false long format 1128 //! 1129 //! \return MOS_STATUS 1130 //! MOS_STATUS_SUCCESS if success, else fail reason 1131 //! 1132 virtual MOS_STATUS GetMfxStateCommandsDataSize( 1133 uint32_t mode, 1134 uint32_t *commandsSize, 1135 uint32_t *patchListSize, 1136 bool isShortFormat) = 0; 1137 1138 //! 1139 //! \brief Calculates maximum size for all slice/MB level commands 1140 //! \details Client facing function to calculate maximum size for all slice/MB level commands 1141 //! 1142 //! \param [in] mode 1143 //! Codec mode 1144 //! \param [out] commandsSize 1145 //! The maximum command buffer size 1146 //! \param [out] patchListSize 1147 //! The maximum command patch list size 1148 //! \param [in] isModeSpecific 1149 //! Indicate the long or short format for decoder or single take phase for encoder 1150 //! 1151 //! \return MOS_STATUS 1152 //! MOS_STATUS_SUCCESS if success, else fail reason 1153 //! 1154 virtual MOS_STATUS GetMfxPrimitiveCommandsDataSize( 1155 uint32_t mode, 1156 uint32_t *commandsSize, 1157 uint32_t *patchListSize, 1158 bool isModeSpecific) = 0; 1159 1160 //! 1161 //! \brief Adds MFX AVC Image State command in command buffer 1162 //! \details Client facing function to add MFX AVC Image State command in command buffer 1163 //! 1164 //! \param [in] cmdBuffer 1165 //! Command buffer to which HW command is added 1166 //! \param [in] batchBuffer 1167 //! Batch buffer to which HW command is added 1168 //! \param [in] params 1169 //! Params structure used to populate the HW command 1170 //! 1171 //! \return MOS_STATUS 1172 //! MOS_STATUS_SUCCESS if success, else fail reason 1173 //! 1174 MOS_STATUS AddMfxAvcImgCmd( 1175 PMOS_COMMAND_BUFFER cmdBuffer, 1176 PMHW_BATCH_BUFFER batchBuffer, 1177 PMHW_VDBOX_AVC_IMG_PARAMS params); 1178 1179 //! 1180 //! \brief Adds MFX AVC weight offset command in command buffer 1181 //! \details Client facing function to add MFX AVC weight offset command in command buffer 1182 //! 1183 //! \param [in] cmdBuffer 1184 //! Command buffer to which HW command is added 1185 //! \param [in] batchBuffer 1186 //! Batch buffer to which HW command is added 1187 //! \param [in] params 1188 //! Params structure used to populate the HW command 1189 //! 1190 //! \return MOS_STATUS 1191 //! MOS_STATUS_SUCCESS if success, else fail reason 1192 //! 1193 MOS_STATUS AddMfxAvcWeightOffset( 1194 PMOS_COMMAND_BUFFER cmdBuffer, 1195 PMHW_BATCH_BUFFER batchBuffer, 1196 PMHW_VDBOX_AVC_WEIGHTOFFSET_PARAMS params); 1197 1198 //! 1199 //! \brief Adds MFX AVC slice state command in command buffer 1200 //! \details Client facing function to add MFX AVC slice state command in command buffer 1201 //! 1202 //! \param [in] cmdBuffer 1203 //! Command buffer to which HW command is added 1204 //! \param [in] batchBuffer 1205 //! Batch buffer to which HW command is added 1206 //! \param [in] avcSliceState 1207 //! Pointer to AVC slice state which is used to populate the HW command 1208 //! 1209 //! \return MOS_STATUS 1210 //! MOS_STATUS_SUCCESS if success, else fail reason 1211 //! 1212 MOS_STATUS AddMfxAvcSlice( 1213 PMOS_COMMAND_BUFFER cmdBuffer, 1214 PMHW_BATCH_BUFFER batchBuffer, 1215 PMHW_VDBOX_AVC_SLICE_STATE avcSliceState); 1216 1217 //! 1218 //! \brief Adds MPEG2 Image State command in command buffer 1219 //! \details Client facing function to add MPEG2 Image State command in command buffer 1220 //! 1221 //! \param [in] cmdBuffer 1222 //! Command buffer to which HW command is added 1223 //! \param [in] params 1224 //! Params structure used to populate the HW command 1225 //! 1226 //! \return MOS_STATUS 1227 //! MOS_STATUS_SUCCESS if success, else fail reason 1228 //! 1229 MOS_STATUS AddMfxMpeg2PicCmd( 1230 PMOS_COMMAND_BUFFER cmdBuffer, 1231 PMHW_VDBOX_MPEG2_PIC_STATE params); 1232 1233 //! 1234 //! \brief Adds MFX VP8 Picture State command in command buffer 1235 //! \details Client facing function to add MFX VP8 Picture State command in command buffer 1236 //! 1237 //! \param [in] cmdBuffer 1238 //! Command buffer to which HW command is added 1239 //! \param [in] params 1240 //! Params structure used to populate the HW command 1241 //! 1242 //! \return MOS_STATUS 1243 //! MOS_STATUS_SUCCESS if success, else fail reason 1244 //! 1245 MOS_STATUS AddMfxVp8PicCmd( 1246 PMOS_COMMAND_BUFFER cmdBuffer, 1247 PMHW_VDBOX_VP8_PIC_STATE params); 1248 1249 //! 1250 //! \brief Programs base address of rowstore scratch buffers 1251 //! \details Internal function to get base address of rowstore scratch buffers 1252 //! 1253 //! \param [in] rowstoreParams 1254 //! Rowstore parameters 1255 //! 1256 //! \return MOS_STATUS 1257 //! MOS_STATUS_SUCCESS if success, else fail reason 1258 //! 1259 virtual MOS_STATUS GetRowstoreCachingAddrs( 1260 PMHW_VDBOX_ROWSTORE_PARAMS rowstoreParams) = 0; 1261 1262 //! 1263 //! \brief Adds MFX pipe mode select command in command buffer 1264 //! 1265 //! \param [in] cmdBuffer 1266 //! Command buffer to which HW command is added 1267 //! \param [in] params 1268 //! Params structure used to populate the HW command 1269 //! 1270 //! \return MOS_STATUS 1271 //! MOS_STATUS_SUCCESS if success, else fail reason 1272 //! 1273 virtual MOS_STATUS AddMfxPipeModeSelectCmd( 1274 PMOS_COMMAND_BUFFER cmdBuffer, 1275 PMHW_VDBOX_PIPE_MODE_SELECT_PARAMS params) = 0; 1276 1277 //! 1278 //! \brief Adds MFX Surface State command in command buffer 1279 //! 1280 //! \param [in] cmdBuffer 1281 //! Command buffer to which HW command is added 1282 //! \param [in] params 1283 //! Params structure used to populate the HW command 1284 //! 1285 //! \return MOS_STATUS 1286 //! MOS_STATUS_SUCCESS if success, else fail reason 1287 //! 1288 virtual MOS_STATUS AddMfxSurfaceCmd( 1289 PMOS_COMMAND_BUFFER cmdBuffer, 1290 PMHW_VDBOX_SURFACE_PARAMS params) = 0; 1291 1292 //! 1293 //! \brief Adds MFX Pipe Buffer Address State command in command buffer 1294 //! 1295 //! \param [in] cmdBuffer 1296 //! Command buffer to which HW command is added 1297 //! \param [in] params 1298 //! Params structure used to populate the HW command 1299 //! 1300 //! \return MOS_STATUS 1301 //! MOS_STATUS_SUCCESS if success, else fail reason 1302 //! 1303 virtual MOS_STATUS AddMfxPipeBufAddrCmd( 1304 PMOS_COMMAND_BUFFER cmdBuffer, 1305 PMHW_VDBOX_PIPE_BUF_ADDR_PARAMS params) = 0; 1306 1307 //! 1308 //! \brief Adds MFX Indirect Object Base Address State command in command buffer 1309 //! 1310 //! \param [in] cmdBuffer 1311 //! Command buffer to which HW command is added 1312 //! \param [in] params 1313 //! Params structure used to populate the HW command 1314 //! 1315 //! \return MOS_STATUS 1316 //! MOS_STATUS_SUCCESS if success, else fail reason 1317 //! 1318 virtual MOS_STATUS AddMfxIndObjBaseAddrCmd( 1319 PMOS_COMMAND_BUFFER cmdBuffer, 1320 PMHW_VDBOX_IND_OBJ_BASE_ADDR_PARAMS params) = 0; 1321 1322 //! 1323 //! \brief Adds MFX BSP Buffer Base Address State command in command buffer 1324 //! 1325 //! \param [in] cmdBuffer 1326 //! Command buffer to which HW command is added 1327 //! \param [in] params 1328 //! Params structure used to populate the HW command 1329 //! 1330 //! \return MOS_STATUS 1331 //! MOS_STATUS_SUCCESS if success, else fail reason 1332 //! 1333 virtual MOS_STATUS AddMfxBspBufBaseAddrCmd( 1334 PMOS_COMMAND_BUFFER cmdBuffer, 1335 PMHW_VDBOX_BSP_BUF_BASE_ADDR_PARAMS params) = 0; 1336 1337 //! 1338 //! \brief Adds MFX QM State command in command buffer 1339 //! 1340 //! \param [in] cmdBuffer 1341 //! Command buffer to which HW command is added 1342 //! \param [in] params 1343 //! Params structure used to populate the HW command 1344 //! 1345 //! \return MOS_STATUS 1346 //! MOS_STATUS_SUCCESS if success, else fail reason 1347 //! 1348 virtual MOS_STATUS AddMfxQmCmd( 1349 PMOS_COMMAND_BUFFER cmdBuffer, 1350 PMHW_VDBOX_QM_PARAMS params) = 0; 1351 1352 //! 1353 //! \brief Adds MFX FQM State command in command buffer 1354 //! 1355 //! \param [in] cmdBuffer 1356 //! Command buffer to which HW command is added 1357 //! \param [in] params 1358 //! Params structure used to populate the HW command 1359 //! 1360 //! \return MOS_STATUS 1361 //! MOS_STATUS_SUCCESS if success, else fail reason 1362 //! 1363 virtual MOS_STATUS AddMfxFqmCmd( 1364 PMOS_COMMAND_BUFFER cmdBuffer, 1365 PMHW_VDBOX_QM_PARAMS params) = 0; 1366 1367 //! 1368 //! \brief Adds MFX AVC Picture ID command in command buffer (decoder only) 1369 //! 1370 //! \param [in] cmdBuffer 1371 //! Command buffer to which HW command is added 1372 //! \param [in] params 1373 //! Params structure used to populate the HW command 1374 //! 1375 //! \return MOS_STATUS 1376 //! MOS_STATUS_SUCCESS if success, else fail reason 1377 //! 1378 virtual MOS_STATUS AddMfdAvcPicidCmd( 1379 PMOS_COMMAND_BUFFER cmdBuffer, 1380 PMHW_VDBOX_PIC_ID_PARAMS params) = 0; 1381 1382 //! 1383 //! \brief Adds MFX AVC Image State command for decoder in command buffer 1384 //! 1385 //! \param [in] cmdBuffer 1386 //! Command buffer to which HW command is added 1387 //! \param [in] batchBuffer 1388 //! Pointer to MHW batch buffer 1389 //! \param [in] params 1390 //! Params structure used to populate the HW command 1391 //! 1392 //! \return MOS_STATUS 1393 //! MOS_STATUS_SUCCESS if success, else fail reason 1394 //! 1395 virtual MOS_STATUS AddMfxDecodeAvcImgCmd( 1396 PMOS_COMMAND_BUFFER cmdBuffer, 1397 PMHW_BATCH_BUFFER batchBuffer, 1398 PMHW_VDBOX_AVC_IMG_PARAMS params) = 0; 1399 1400 //! 1401 //! \brief Adds MFX AVC Image State command for encoder in command buffer 1402 //! 1403 //! \param [in] cmdBuffer 1404 //! Command buffer to which HW command is added 1405 //! \param [in] batchBuffer 1406 //! Batch buffer to which HW command is added 1407 //! \param [in] params 1408 //! Params structure used to populate the HW command 1409 //! 1410 //! \return MOS_STATUS 1411 //! MOS_STATUS_SUCCESS if success, else fail reason 1412 //! 1413 virtual MOS_STATUS AddMfxEncodeAvcImgCmd( 1414 PMOS_COMMAND_BUFFER cmdBuffer, 1415 PMHW_BATCH_BUFFER batchBuffer, 1416 PMHW_VDBOX_AVC_IMG_PARAMS params) = 0; 1417 1418 //! 1419 //! \brief Adds AVC Directmode State command in command buffer 1420 //! 1421 //! \param [in] cmdBuffer 1422 //! Command buffer to which HW command is added 1423 //! \param [in] params 1424 //! Params structure used to populate the HW command 1425 //! 1426 //! \return MOS_STATUS 1427 //! MOS_STATUS_SUCCESS if success, else fail reason 1428 //! 1429 virtual MOS_STATUS AddMfxAvcDirectmodeCmd( 1430 PMOS_COMMAND_BUFFER cmdBuffer, 1431 PMHW_VDBOX_AVC_DIRECTMODE_PARAMS params) = 0; 1432 1433 //! 1434 //! \brief Adds MFX AVC reference frame index command in command buffer 1435 //! 1436 //! \param [in] cmdBuffer 1437 //! Command buffer to which HW command is added 1438 //! \param [in] batchBuffer 1439 //! Batch buffer to which HW command is added 1440 //! \param [in] params 1441 //! Params structure used to populate the HW command 1442 //! 1443 //! \return MOS_STATUS 1444 //! MOS_STATUS_SUCCESS if success, else fail reason 1445 //! 1446 virtual MOS_STATUS AddMfxAvcRefIdx( 1447 PMOS_COMMAND_BUFFER cmdBuffer, 1448 PMHW_BATCH_BUFFER batchBuffer, 1449 PMHW_VDBOX_AVC_REF_IDX_PARAMS params) = 0; 1450 1451 //! 1452 //! \brief Adds MFX AVC weight offset command for decoder in command buffer 1453 //! 1454 //! \param [in] cmdBuffer 1455 //! Command buffer to which HW command is added 1456 //! \param [in] batchBuffer 1457 //! Batch buffer to which HW command is added 1458 //! \param [in] params 1459 //! Params structure used to populate the HW command 1460 //! 1461 //! \return MOS_STATUS 1462 //! MOS_STATUS_SUCCESS if success, else fail reason 1463 //! 1464 virtual MOS_STATUS AddMfxDecodeAvcWeightOffset( 1465 PMOS_COMMAND_BUFFER cmdBuffer, 1466 PMHW_BATCH_BUFFER batchBuffer, 1467 PMHW_VDBOX_AVC_WEIGHTOFFSET_PARAMS params) = 0; 1468 1469 //! 1470 //! \brief Adds MFX AVC weight offset command for encoder in command buffer 1471 //! 1472 //! \param [in] cmdBuffer 1473 //! Command buffer to which HW command is added 1474 //! \param [in] batchBuffer 1475 //! Batch buffer to which HW command is added 1476 //! \param [in] params 1477 //! Params structure used to populate the HW command 1478 //! 1479 //! \return MOS_STATUS 1480 //! MOS_STATUS_SUCCESS if success, else fail reason 1481 //! 1482 virtual MOS_STATUS AddMfxEncodeAvcWeightOffset( 1483 PMOS_COMMAND_BUFFER cmdBuffer, 1484 PMHW_BATCH_BUFFER batchBuffer, 1485 PMHW_VDBOX_AVC_WEIGHTOFFSET_PARAMS params) = 0; 1486 1487 //! 1488 //! \brief Adds MFX AVC slice state command for decoder in command buffer 1489 //! 1490 //! \param [in] cmdBuffer 1491 //! Command buffer to which HW command is added 1492 //! \param [in] batchBuffer 1493 //! Batch buffer to which HW command is added 1494 //! \param [in] avcSliceState 1495 //! Pointer to AVC slice state which is used to populate the HW command 1496 //! 1497 //! \return MOS_STATUS 1498 //! MOS_STATUS_SUCCESS if success, else fail reason 1499 //! 1500 virtual MOS_STATUS AddMfxDecodeAvcSlice( 1501 PMOS_COMMAND_BUFFER cmdBuffer, 1502 PMHW_BATCH_BUFFER batchBuffer, 1503 PMHW_VDBOX_AVC_SLICE_STATE avcSliceState) = 0; 1504 1505 //! 1506 //! \brief Adds MFX AVC slice state command for encoder in command buffer 1507 //! 1508 //! \param [in] cmdBuffer 1509 //! Command buffer to which HW command is added 1510 //! \param [in] batchBuffer 1511 //! Batch buffer to which HW command is added 1512 //! \param [in] avcSliceState 1513 //! Pointer to AVC slice state which is used to populate the HW command 1514 //! 1515 //! \return MOS_STATUS 1516 //! MOS_STATUS_SUCCESS if success, else fail reason 1517 //! 1518 virtual MOS_STATUS AddMfxEncodeAvcSlice( 1519 PMOS_COMMAND_BUFFER cmdBuffer, 1520 PMHW_BATCH_BUFFER batchBuffer, 1521 PMHW_VDBOX_AVC_SLICE_STATE avcSliceState) = 0; 1522 1523 //! 1524 //! \brief Adds MFX AVC DPB State command in command buffer 1525 //! 1526 //! \param [in] cmdBuffer 1527 //! Command buffer to which HW command is added 1528 //! \param [in] params 1529 //! Params structure used to populate the HW command 1530 //! 1531 //! \return MOS_STATUS 1532 //! MOS_STATUS_SUCCESS if success, else fail reason 1533 //! 1534 virtual MOS_STATUS AddMfdAvcDpbCmd( 1535 PMOS_COMMAND_BUFFER cmdBuffer, 1536 PMHW_VDBOX_AVC_DPB_PARAMS params) = 0; 1537 1538 //! 1539 //! \brief Adds MFX AVC Slice Address command in command buffer 1540 //! 1541 //! \param [in] cmdBuffer 1542 //! Command buffer to which HW command is added 1543 //! \param [in] avcSliceState 1544 //! Pointer to AVC slice state which is used to populate the HW command 1545 //! 1546 //! \return MOS_STATUS 1547 //! MOS_STATUS_SUCCESS if success, else fail reason 1548 //! 1549 virtual MOS_STATUS AddMfdAvcSliceAddrCmd( 1550 PMOS_COMMAND_BUFFER cmdBuffer, 1551 PMHW_VDBOX_AVC_SLICE_STATE avcSliceState) = 0; 1552 1553 //! 1554 //! \brief Adds AVC BSD Object command in command buffer 1555 //! 1556 //! \param [in] cmdBuffer 1557 //! Command buffer to which HW command is added 1558 //! \param [in] avcSliceState 1559 //! Pointer to AVC slice state which is used to populate the HW command 1560 //! 1561 //! \return MOS_STATUS 1562 //! MOS_STATUS_SUCCESS if success, else fail reason 1563 //! 1564 virtual MOS_STATUS AddMfdAvcBsdObjectCmd( 1565 PMOS_COMMAND_BUFFER cmdBuffer, 1566 PMHW_VDBOX_AVC_SLICE_STATE avcSliceState) = 0; 1567 1568 //! 1569 //! \brief Adds AVC Image State command in command buffer 1570 //! \details Client facing function to add AVC Image State command in command buffer 1571 //! 1572 //! \param [in] brcImgBuffer 1573 //! Command buffer to which HW command is added 1574 //! \param [in] params 1575 //! Params structure used to populate the HW command 1576 //! 1577 //! \return MOS_STATUS 1578 //! MOS_STATUS_SUCCESS if success, else fail reason 1579 //! 1580 virtual MOS_STATUS AddMfxAvcImgBrcBuffer( 1581 PMOS_RESOURCE brcImgBuffer, 1582 PMHW_VDBOX_AVC_IMG_PARAMS params) = 0; 1583 1584 //! 1585 //! \brief Adds MFX Pak Insert Object command in command buffer 1586 //! 1587 //! \param [in] cmdBuffer 1588 //! Command buffer to which HW command is added 1589 //! \param [in] batchBuffer 1590 //! Batch buffer to which HW command is added 1591 //! \param [in] params 1592 //! Params structure used to populate the HW command 1593 //! 1594 //! \return MOS_STATUS 1595 //! MOS_STATUS_SUCCESS if success, else fail reason 1596 //! 1597 virtual MOS_STATUS AddMfxPakInsertObject( 1598 PMOS_COMMAND_BUFFER cmdBuffer, 1599 PMHW_BATCH_BUFFER batchBuffer, 1600 PMHW_VDBOX_PAK_INSERT_PARAMS params) = 0; 1601 1602 //! 1603 //! \brief Adds MPEG2 Image State command for decoder in command buffer 1604 //! 1605 //! \param [in] cmdBuffer 1606 //! Command buffer to which HW command is added 1607 //! \param [in] params 1608 //! Params structure used to populate the HW command 1609 //! 1610 //! \return MOS_STATUS 1611 //! MOS_STATUS_SUCCESS if success, else fail reason 1612 //! 1613 virtual MOS_STATUS AddMfxDecodeMpeg2PicCmd( 1614 PMOS_COMMAND_BUFFER cmdBuffer, 1615 PMHW_VDBOX_MPEG2_PIC_STATE params) = 0; 1616 1617 //! 1618 //! \brief Adds MPEG2 Image State command for encoder in command buffer 1619 //! 1620 //! \param [in] cmdBuffer 1621 //! Command buffer to which HW command is added 1622 //! \param [in] params 1623 //! Params structure used to populate the HW command 1624 //! 1625 //! \return MOS_STATUS 1626 //! MOS_STATUS_SUCCESS if success, else fail reason 1627 //! 1628 virtual MOS_STATUS AddMfxEncodeMpeg2PicCmd( 1629 PMOS_COMMAND_BUFFER cmdBuffer, 1630 PMHW_VDBOX_MPEG2_PIC_STATE params) = 0; 1631 1632 //! 1633 //! \brief Adds MPEG2 BSD Object command in batch buffer or command buffer 1634 //! 1635 //! \param [in] cmdBuffer 1636 //! Command buffer to which HW command is added 1637 //! \param [in] batchBuffer 1638 //! Batch buffer to add to VDBOX_BUFFER_START 1639 //! \param [in] params 1640 //! Params structure used to populate the HW command 1641 //! 1642 //! \return MOS_STATUS 1643 //! MOS_STATUS_SUCCESS if success, else fail reason 1644 //! 1645 virtual MOS_STATUS AddMfdMpeg2BsdObject( 1646 PMOS_COMMAND_BUFFER cmdBuffer, 1647 PMHW_BATCH_BUFFER batchBuffer, 1648 PMHW_VDBOX_MPEG2_SLICE_STATE params) = 0; 1649 1650 //! 1651 //! \brief Adds Mfd mpeg2 IT object command in batch buffer or command buffer 1652 //! 1653 //! \param [in] cmdBuffer 1654 //! Command buffer to which HW command is added 1655 //! \param [in] batchBuffer 1656 //! Batch buffer to add to VDBOX_BUFFER_START 1657 //! \param [in] params 1658 //! Params structure used to populate the HW command 1659 //! 1660 //! \return MOS_STATUS 1661 //! MOS_STATUS_SUCCESS if success, else fail reason 1662 //! 1663 virtual MOS_STATUS AddMfdMpeg2ITObject( 1664 PMOS_COMMAND_BUFFER cmdBuffer, 1665 PMHW_BATCH_BUFFER batchBuffer, 1666 PMHW_VDBOX_MPEG2_MB_STATE params) = 0; 1667 1668 //! 1669 //! \brief Adds Mpeg2 Group Slice State command in command buffer 1670 //! 1671 //! \param [in] cmdBuffer 1672 //! Command buffer to which HW command is added 1673 //! \param [in] mpeg2SliceState 1674 //! Pointer to MPEG2 slice state 1675 //! 1676 //! \return MOS_STATUS 1677 //! MOS_STATUS_SUCCESS if success, else fail reason 1678 //! 1679 virtual MOS_STATUS AddMfcMpeg2SliceGroupCmd( 1680 PMOS_COMMAND_BUFFER cmdBuffer, 1681 PMHW_VDBOX_MPEG2_SLICE_STATE mpeg2SliceState) = 0; 1682 1683 //! 1684 //! \brief Adds mpeg2 Pak insert brc buffer command in command buffer 1685 //! \details Client facing function to add mpeg2 Pak insert brc buffer command in command buffer 1686 //! 1687 //! \param [in] brcPicHeaderInputBuffer 1688 //! Picture header input buffer to which HW command is added 1689 //! \param [in] params 1690 //! Params structure used to populate the HW command 1691 //! 1692 //! \return MOS_STATUS 1693 //! MOS_STATUS_SUCCESS if success, else fail reason 1694 //! 1695 virtual MOS_STATUS AddMfcMpeg2PakInsertBrcBuffer( 1696 PMOS_RESOURCE brcPicHeaderInputBuffer, 1697 PMHW_VDBOX_PAK_INSERT_PARAMS params) = 0; 1698 1699 //! 1700 //! \brief Adds Mpeg2 picture State command in command buffer 1701 //! \details Client facing function to add Mpeg2 picture State command in command buffer 1702 //! 1703 //! \param [in] brcImgBuffer 1704 //! Command buffer to which HW command is added 1705 //! \param [in] params 1706 //! Pointer to MPEG2 picture state 1707 //! 1708 //! \return MOS_STATUS 1709 //! MOS_STATUS_SUCCESS if success, else fail reason 1710 //! 1711 virtual MOS_STATUS AddMfxMpeg2PicBrcBuffer( 1712 PMOS_RESOURCE brcImgBuffer, 1713 PMHW_VDBOX_MPEG2_PIC_STATE params) = 0; 1714 1715 //! 1716 //! \brief Adds VC1 Pred Pipe command in command buffer 1717 //! \details Client facing function to add VC1 Pred Pipe command in command buffer 1718 //! 1719 //! \param [in] cmdBuffer 1720 //! Command buffer to which HW command is added 1721 //! \param [in] params 1722 //! Params structure used to populate the HW command 1723 //! 1724 //! \return MOS_STATUS 1725 //! MOS_STATUS_SUCCESS if success, else fail reason 1726 //! 1727 virtual MOS_STATUS AddMfxVc1PredPipeCmd( 1728 PMOS_COMMAND_BUFFER cmdBuffer, 1729 PMHW_VDBOX_VC1_PRED_PIPE_PARAMS params) = 0; 1730 1731 //! 1732 //! \brief Adds VC1 long picture state command in command buffer 1733 //! \details Client facing function to add VC1 long picture state command in command buffer 1734 //! 1735 //! \param [in] cmdBuffer 1736 //! Command buffer to which HW command is added 1737 //! \param [in] vc1PicState 1738 //! Pointer to VC1 picture state 1739 //! 1740 //! \return MOS_STATUS 1741 //! MOS_STATUS_SUCCESS if success, else fail reason 1742 //! 1743 virtual MOS_STATUS AddMfxVc1LongPicCmd( 1744 PMOS_COMMAND_BUFFER cmdBuffer, 1745 PMHW_VDBOX_VC1_PIC_STATE vc1PicState) = 0; 1746 1747 //! 1748 //! \brief Adds VC1 short picture state command in command buffer 1749 //! \details Client facing function to add VC1 short picture state command in command buffer 1750 //! 1751 //! \param [in] cmdBuffer 1752 //! Command buffer to which HW command is added 1753 //! \param [in] vc1PicState 1754 //! Pointer to VC1 picture state 1755 //! 1756 //! \return MOS_STATUS 1757 //! MOS_STATUS_SUCCESS if success, else fail reason 1758 //! 1759 virtual MOS_STATUS AddMfdVc1ShortPicCmd( 1760 PMOS_COMMAND_BUFFER cmdBuffer, 1761 PMHW_VDBOX_VC1_PIC_STATE vc1PicState) = 0; 1762 1763 //! 1764 //! \brief Adds VC1 Direct Mode State command in command buffer 1765 //! \details Client facing function to add VC1 Direct Mode State command in command buffer 1766 //! 1767 //! \param [in] cmdBuffer 1768 //! Command buffer to which HW command is added 1769 //! \param [in] params 1770 //! Params structure used to populate the HW command 1771 //! 1772 //! \return MOS_STATUS 1773 //! MOS_STATUS_SUCCESS if success, else fail reason 1774 //! 1775 virtual MOS_STATUS AddMfxVc1DirectmodeCmd( 1776 PMOS_COMMAND_BUFFER cmdBuffer, 1777 PMHW_VDBOX_VC1_DIRECTMODE_PARAMS params) = 0; 1778 1779 //! 1780 //! \brief Adds VC1 BSD object command in command buffer 1781 //! \details Client facing function to add VC1 BSD object command in command buffer 1782 //! 1783 //! \param [in] cmdBuffer 1784 //! Command buffer to which HW command is added 1785 //! \param [in] vc1SliceState 1786 //! Pointer to VC1 slice state 1787 //! 1788 //! \return MOS_STATUS 1789 //! MOS_STATUS_SUCCESS if success, else fail reason 1790 //! 1791 virtual MOS_STATUS AddMfdVc1BsdObjectCmd( 1792 PMOS_COMMAND_BUFFER cmdBuffer, 1793 PMHW_VDBOX_VC1_SLICE_STATE vc1SliceState) = 0; 1794 1795 //! 1796 //! \brief Adds Mfd VC1 IT object command in batch buffer 1797 //! \details Client facing function to add Mfd VC1 IT object command in batch buffer 1798 //! 1799 //! \param [in] batchBuffer 1800 //! Batch buffer to add to VDBOX_BUFFER_START 1801 //! \param [in] vc1MbState 1802 //! Pointer to VC1 MB state 1803 //! 1804 //! \return MOS_STATUS 1805 //! MOS_STATUS_SUCCESS if success, else fail reason 1806 //! 1807 virtual MOS_STATUS AddMfdVc1ItObjectCmd( 1808 PMHW_BATCH_BUFFER batchBuffer, 1809 PMHW_VDBOX_VC1_MB_STATE vc1MbState) = 0; 1810 1811 //! 1812 //! \brief Adds MFX JPEG Picture State command in command buffer 1813 //! \details Client facing function to add MFX JPEG Picture State command in command buffer 1814 //! 1815 //! \param [in] cmdBuffer 1816 //! Command buffer to which HW command is added 1817 //! \param [in] params 1818 //! Params structure used to populate the HW command 1819 //! 1820 //! \return MOS_STATUS 1821 //! MOS_STATUS_SUCCESS if success, else fail reason 1822 //! 1823 virtual MOS_STATUS AddMfxJpegPicCmd( 1824 PMOS_COMMAND_BUFFER cmdBuffer, 1825 PMHW_VDBOX_JPEG_PIC_STATE params) = 0; 1826 1827 //! 1828 //! \brief Adds MFX JPEG Huffman Table State command in command buffer 1829 //! \details Client facing function to add MFX JPEG Huffman Table State command in command buffer 1830 //! 1831 //! \param [in] cmdBuffer 1832 //! Command buffer to which HW command is added 1833 //! \param [in] params 1834 //! Params structure used to populate the HW command 1835 //! 1836 //! \return MOS_STATUS 1837 //! MOS_STATUS_SUCCESS if success, else fail reason 1838 //! 1839 virtual MOS_STATUS AddMfxJpegHuffTableCmd( 1840 PMOS_COMMAND_BUFFER cmdBuffer, 1841 PMHW_VDBOX_HUFF_TABLE_PARAMS params) = 0; 1842 1843 //! 1844 //! \brief Adds MFX JPEG BSD object command in command buffer 1845 //! \details Client facing function to add MFX JPEG BSD object State command in command buffer 1846 //! 1847 //! \param [in] cmdBuffer 1848 //! Command buffer to which HW command is added 1849 //! \param [in] params 1850 //! Params structure used to populate the HW command 1851 //! 1852 //! \return MOS_STATUS 1853 //! MOS_STATUS_SUCCESS if success, else fail reason 1854 //! 1855 virtual MOS_STATUS AddMfxJpegBsdObjCmd( 1856 PMOS_COMMAND_BUFFER cmdBuffer, 1857 PMHW_VDBOX_JPEG_BSD_PARAMS params) = 0; 1858 1859 //! 1860 //! \brief Adds JPEG picture state command to the command buffer 1861 //! \details Client facing function to add JPEG picture state command to the command buffer 1862 //! 1863 //! \param [in] cmdBuffer 1864 //! Command buffer to which HW command is added 1865 //! \param [in] params 1866 //! Params structure used to populate the HW command 1867 //! 1868 //! \return MOS_STATUS 1869 //! MOS_STATUS_SUCCESS if success, else fail reason 1870 //! 1871 virtual MOS_STATUS AddMfxJpegEncodePicStateCmd( 1872 PMOS_COMMAND_BUFFER cmdBuffer, 1873 MhwVdboxJpegEncodePicState *params) = 0; 1874 1875 //! 1876 //! \brief Adds JPEG FQM command to the command buffer 1877 //! \details Client facing function to add JPEG FQM command to the command buffer 1878 //! 1879 //! \param [in] cmdBuffer 1880 //! Command buffer to which HW command is added 1881 //! \param [in] params 1882 //! Params structure used to populate the HW command 1883 //! \param [in] numQuantTables 1884 //! Numbe of quant tables 1885 //! 1886 //! \return MOS_STATUS 1887 //! MOS_STATUS_SUCCESS if success, else fail reason 1888 //! 1889 virtual MOS_STATUS AddMfxJpegFqmCmd( 1890 PMOS_COMMAND_BUFFER cmdBuffer, 1891 PMHW_VDBOX_QM_PARAMS params, 1892 uint32_t numQuantTables) = 0; 1893 1894 //! 1895 //! \brief Adds JPEG Huffman Table state command to the command buffer 1896 //! \details Client facing function to add JPEG Huffman Table state command to the command buffer 1897 //! 1898 //! \param [in] cmdBuffer 1899 //! Command buffer to which HW command is added 1900 //! \param [in] params 1901 //! Params structure used to populate the HW command 1902 //! 1903 //! \return MOS_STATUS 1904 //! MOS_STATUS_SUCCESS if success, else fail reason 1905 //! 1906 virtual MOS_STATUS AddMfcJpegHuffTableStateCmd( 1907 PMOS_COMMAND_BUFFER cmdBuffer, 1908 PMHW_VDBOX_ENCODE_HUFF_TABLE_PARAMS params) = 0; 1909 1910 //! 1911 //! \brief Adds JPEG scan object command to the command buffer 1912 //! \details Client facing function to add JPEG scan object command to the command buffer 1913 //! 1914 //! \param [in] cmdBuffer 1915 //! Command buffer to which HW command is added 1916 //! \param [in] params 1917 //! Params structure used to populate the HW command 1918 //! 1919 //! \return MOS_STATUS 1920 //! MOS_STATUS_SUCCESS if success, else fail reason 1921 //! 1922 virtual MOS_STATUS AddMfcJpegScanObjCmd( 1923 PMOS_COMMAND_BUFFER cmdBuffer, 1924 MhwVdboxJpegScanParams *params) = 0; 1925 1926 //! 1927 //! \brief Adds MFX VP8 Picture State command for decoder in command buffer 1928 //! 1929 //! \param [in] cmdBuffer 1930 //! Command buffer to which HW command is added 1931 //! \param [in] params 1932 //! Params structure used to populate the HW command 1933 //! 1934 //! \return MOS_STATUS 1935 //! MOS_STATUS_SUCCESS if success, else fail reason 1936 //! 1937 virtual MOS_STATUS AddMfxDecodeVp8PicCmd( 1938 PMOS_COMMAND_BUFFER cmdBuffer, 1939 PMHW_VDBOX_VP8_PIC_STATE params) = 0; 1940 1941 //! 1942 //! \brief Adds MFX VP8 Picture State command for encoder in command buffer 1943 //! 1944 //! \param [in] cmdBuffer 1945 //! Command buffer to which HW command is added 1946 //! \param [in] params 1947 //! Params structure used to populate the HW command 1948 //! 1949 //! \return MOS_STATUS 1950 //! MOS_STATUS_SUCCESS if success, else fail reason 1951 //! 1952 virtual MOS_STATUS AddMfxEncodeVp8PicCmd( 1953 PMOS_COMMAND_BUFFER cmdBuffer, 1954 PMHW_VDBOX_VP8_PIC_STATE params) = 0; 1955 1956 //! 1957 //! \brief Adds VP8 Decode BSD State command in command buffer 1958 //! \details Client facing function to add VP8 Decode BSD State command in command buffer 1959 //! 1960 //! \param [in] cmdBuffer 1961 //! Command buffer to which HW command is added 1962 //! \param [in] params 1963 //! Params structure used to populate the HW command 1964 //! 1965 //! \return MOS_STATUS 1966 //! MOS_STATUS_SUCCESS if success, else fail reason 1967 //! 1968 virtual MOS_STATUS AddMfdVp8BsdObjectCmd( 1969 PMOS_COMMAND_BUFFER cmdBuffer, 1970 PMHW_VDBOX_VP8_BSD_PARAMS params) = 0; 1971 1972 //! 1973 //! \brief Initializes the encoder cfg buffer with MFX_VP8_ENCODER_CFG_CMD 1974 //! \details Client facing function to initialize the encoder cfg buffer with MFX_VP8_ENCODER_CFG_CMD 1975 //! Headder offsets will be updated by kernel 1976 //! The function will also add a batch buffer at the end. 1977 //! 1978 //! \param [in] cfgCmdBuffer 1979 //! Command buffer to which HW command is added 1980 //! \param [in] params 1981 //! Params structure used to populate the HW command 1982 //! 1983 //! \return MOS_STATUS 1984 //! MOS_STATUS_SUCCESS if success, else fail reason 1985 //! 1986 virtual MOS_STATUS InitMfxVp8EncoderCfgCmd( 1987 PMOS_RESOURCE cfgCmdBuffer, 1988 PMHW_VDBOX_VP8_ENCODER_CFG_PARAMS params) = 0; 1989 1990 //! 1991 //! \brief Adds VP8 MFX BSP Buffer Base Address State command in command buffer 1992 //! \details Client facing function to add VP8 MFX BSP Buffer Base Address State command in command buffer 1993 //! 1994 //! \param [in] cmdBuffer 1995 //! Command buffer to which HW command is added 1996 //! \param [in] params 1997 //! Params structure used to populate the HW command 1998 //! 1999 //! \return MOS_STATUS 2000 //! MOS_STATUS_SUCCESS if success, else fail reason 2001 //! 2002 virtual MOS_STATUS AddMfxVp8BspBufBaseAddrCmd( 2003 PMOS_COMMAND_BUFFER cmdBuffer, 2004 PMHW_VDBOX_VP8_BSP_BUF_BASE_ADDR_PARAMS params) = 0; 2005 }; 2006 2007 #endif 2008