1 /* 2 * Copyright (c) 2014-2017, 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_sfc.h 24 //! \brief MHW interface for constructing commands for the SFC 25 //! \details Impelements the functionalities common across all platforms for MHW_SFC 26 //! 27 #ifndef __MHW_SFC_H__ 28 #define __MHW_SFC_H__ 29 30 #include "mhw_cp_interface.h" 31 #include "mhw_state_heap.h" 32 #include "mhw_utilities.h" 33 #include "mos_os.h" 34 #include "media_defs.h" 35 36 static const int MHW_SFC_CACHELINE_SIZE = 64; 37 static const int MHW_SFC_MIN_HEIGHT = 128; 38 static const int MHW_SFC_MIN_WIDTH = 128; 39 static const int MHW_SFC_MAX_HEIGHT = 4096; 40 static const int MHW_SFC_MAX_WIDTH = 4096; 41 static const int MHW_SFC_VE_HEIGHT_ALIGN = 4; 42 static const int MHW_SFC_VE_WIDTH_ALIGN = 16; 43 static const float MHW_SFC_MIN_SCALINGFACTOR = (1.0F / 8.0F); 44 static const float MHW_SFC_MAX_SCALINGFACTOR = 8.0F; 45 // After resuming from S3/S4, SFD surface is also need even scaled height smaller than 4160, such as 4154. 46 // Lower the MHW_SFC_SFD_BUFF_HEIGHT_BAR from 4160 to 4000 to ensure SFD surface can be allocated for such case. 47 static const uint32_t MHW_SFC_SFD_BUFF_HEIGHT_BAR = 4000; 48 49 #define NEED_SFD_LINE_BUFFER(_SURFACE_HEIGHT) ((_SURFACE_HEIGHT) > MHW_SFC_SFD_BUFF_HEIGHT_BAR) 50 #define SFD_LINE_BUFFER_SIZE(_SURFACE_HEIGHT) (NEED_SFD_LINE_BUFFER(_SURFACE_HEIGHT) ? (uint32_t)ceil((_SURFACE_HEIGHT) * MHW_SFC_CACHELINE_SIZE / 10) : 0) 51 52 typedef class MhwSfcInterface MHW_SFC_INTERFACE, *PMHW_SFC_INTERFACE; 53 54 typedef enum _SFC_AVS_INPUT_SITING_COEF 55 { 56 SFC_AVS_INPUT_SITING_COEF_0_OVER_8 = 0x0, 57 SFC_AVS_INPUT_SITING_COEF_1_OVER_8 = 0x1, 58 SFC_AVS_INPUT_SITING_COEF_2_OVER_8 = 0x2, 59 SFC_AVS_INPUT_SITING_COEF_3_OVER_8 = 0x3, 60 SFC_AVS_INPUT_SITING_COEF_4_OVER_8 = 0x4, 61 SFC_AVS_INPUT_SITING_COEF_5_OVER_8 = 0x5, 62 SFC_AVS_INPUT_SITING_COEF_6_OVER_8 = 0x6, 63 SFC_AVS_INPUT_SITING_COEF_7_OVER_8 = 0x7, 64 SFC_AVS_INPUT_SITING_COEF_8_OVER_8 = 0x8 65 } SFC_AVS_INPUT_SITING_COEF, *PSFC_AVS_INPUT_SITING_COEF; 66 67 //! 68 //! \brief Structure to hold AVS Luma Filter Coeff, same as SFC_AVS_LUMA_FILTER_COEFF_G9 69 //! 70 typedef struct _SFC_AVS_LUMA_FILTER_COEFF 71 { 72 // DWORD 0 73 union 74 { 75 struct 76 { 77 uint32_t Table0XFilterCoefficient0 : MHW_BITFIELD_RANGE(0,7); 78 uint32_t Table0YFilterCoefficient0 : MHW_BITFIELD_RANGE(8,15); 79 uint32_t Table0XFilterCoefficient1 : MHW_BITFIELD_RANGE(16,23); 80 uint32_t Table0YFilterCoefficient1 : MHW_BITFIELD_RANGE(24,31); 81 }; 82 struct 83 { 84 uint32_t Value; 85 }; 86 } DW0; 87 88 // DWORD 1 89 union 90 { 91 struct 92 { 93 uint32_t Table0XFilterCoefficient2 : MHW_BITFIELD_RANGE(0,7); 94 uint32_t Table0YFilterCoefficient2 : MHW_BITFIELD_RANGE(8,15); 95 uint32_t Table0XFilterCoefficient3 : MHW_BITFIELD_RANGE(16,23); 96 uint32_t Table0YFilterCoefficient3 : MHW_BITFIELD_RANGE(24,31); 97 }; 98 struct 99 { 100 uint32_t Value; 101 }; 102 } DW1; 103 104 // DWORD 2 105 union 106 { 107 struct 108 { 109 uint32_t Table0XFilterCoefficient4 : MHW_BITFIELD_RANGE(0,7); 110 uint32_t Table0YFilterCoefficient4 : MHW_BITFIELD_RANGE(8,15); 111 uint32_t Table0XFilterCoefficient5 : MHW_BITFIELD_RANGE(16,23); 112 uint32_t Table0YFilterCoefficient5 : MHW_BITFIELD_RANGE(24,31); 113 }; 114 struct 115 { 116 uint32_t Value; 117 }; 118 } DW2; 119 120 // DWORD 3 121 union 122 { 123 struct 124 { 125 uint32_t Table0XFilterCoefficient6 : MHW_BITFIELD_RANGE(0,7); 126 uint32_t Table0YFilterCoefficient6 : MHW_BITFIELD_RANGE(8,15); 127 uint32_t Table0XFilterCoefficient7 : MHW_BITFIELD_RANGE(16,23); 128 uint32_t Table0YFilterCoefficient7 : MHW_BITFIELD_RANGE(24,31); 129 }; 130 struct 131 { 132 uint32_t Value; 133 }; 134 } DW3; 135 } SFC_AVS_LUMA_FILTER_COEFF, *PSFC_AVS_LUMA_FILTER_COEFF; 136 137 //! 138 //! \brief Structure to hold AVS Chroma Filter Coeff, same as SFC_AVS_CHROMA_FILTER_COEFF_G9 139 //! 140 typedef struct _SFC_AVS_CHROMA_FILTER_COEFF 141 { 142 // DWORD 0 143 union 144 { 145 struct 146 { 147 uint32_t Table1XFilterCoefficient2 : MHW_BITFIELD_RANGE(0,7); 148 uint32_t Table1YFilterCoefficient2 : MHW_BITFIELD_RANGE(8,15); 149 uint32_t Table1XFilterCoefficient3 : MHW_BITFIELD_RANGE(16,23); 150 uint32_t Table1YFilterCoefficient3 : MHW_BITFIELD_RANGE(24,31); 151 }; 152 struct 153 { 154 uint32_t Value; 155 }; 156 } DW0; 157 158 // DWORD 1 159 union 160 { 161 struct 162 { 163 uint32_t Table1XFilterCoefficient4 : MHW_BITFIELD_RANGE(0,7); 164 uint32_t Table1YFilterCoefficient4 : MHW_BITFIELD_RANGE(8,15); 165 uint32_t Table1XFilterCoefficient5 : MHW_BITFIELD_RANGE(16,23); 166 uint32_t Table1YFilterCoefficient5 : MHW_BITFIELD_RANGE(24,31); 167 }; 168 struct 169 { 170 uint32_t Value; 171 }; 172 } DW1; 173 } SFC_AVS_CHROMA_FILTER_COEFF, *PSFC_AVS_CHROMA_FILTER_COEFF; 174 175 //! 176 //! \brief Structure to hold AVS Luma Coeff tables 177 //! 178 typedef struct _MHW_SFC_AVS_LUMA_TABLE 179 { 180 uint8_t sfcPipeMode; //!< SFC Pipe Mode 181 SFC_AVS_LUMA_FILTER_COEFF LumaTable[NUM_HW_POLYPHASE_TABLES]; 182 } MHW_SFC_AVS_LUMA_TABLE, *PMHW_SFC_AVS_LUMA_TABLE; 183 184 //! 185 //! \brief Structure to hold AVS Chroma Coeff tables 186 //! 187 typedef struct _MHW_SFC_AVS_CHROMA_TABLE 188 { 189 uint8_t sfcPipeMode; //!< SFC Pipe Mode 190 SFC_AVS_CHROMA_FILTER_COEFF ChromaTable[NUM_HW_POLYPHASE_TABLES]; 191 } MHW_SFC_AVS_CHROMA_TABLE, *PMHW_SFC_AVS_CHROMA_TABLE; 192 193 //! 194 //! \brief Structure to hold AVS State 195 //! 196 typedef struct _MHW_SFC_AVS_STATE 197 { 198 uint8_t sfcPipeMode; //!< SFC Pipe Mode 199 uint32_t dwInputHorizontalSiting; 200 uint32_t dwInputVerticalSitting; 201 uint32_t dwAVSFilterMode; // Bilinear, 5x5 or 8x8 202 } MHW_SFC_AVS_STATE, *PMHW_SFC_AVS_STATE; 203 204 //! 205 //! \brief SFC State Command parameters 206 //! 207 typedef struct _MHW_SFC_STATE_PARAMS 208 { 209 uint8_t sfcPipeMode; //!< SFC Pipe Mode: VD-to-SFC or VE-to-SFC 210 uint32_t dwVDVEInputOrderingMode; 211 uint32_t dwInputChromaSubSampling; // Chroma subsampling at SFC input 212 float fAlphaPixel; // Alpha pixel 213 float fChromaSubSamplingXSiteOffset; // Chroma siting X offset 214 float fChromaSubSamplingYSiteOffset; // Chroma siting Y offset 215 uint32_t dwChromaDownSamplingMode; // Chroma Downsampling Mode 216 uint32_t dwChromaDownSamplingVerticalCoef; // Chomra Downsampling Vertical Coef 217 uint32_t dwChromaDownSamplingHorizontalCoef; // Chomra Downsampling Horizontal Coef 218 219 uint32_t dwOutputFrameHeight; // Output Frame Height 220 uint32_t dwOutputFrameWidth; // Output Frame Width 221 MOS_FORMAT OutputFrameFormat; // Output Frame Format 222 uint32_t dwInputFrameHeight; // Input Frame Height 223 uint32_t dwInputFrameWidth; // Input Frame Width 224 MOS_FORMAT InputFrameFormat; // Input Frame Format 225 226 // Scaling parameters 227 uint32_t dwAVSFilterMode; // Bilinear, 5x5 or 8x8 228 uint32_t dwSourceRegionHeight; // Source/Crop region height 229 uint32_t dwSourceRegionWidth; // Source/Crop region width 230 uint32_t dwSourceRegionVerticalOffset; // Source/Crop region vertical offset 231 uint32_t dwSourceRegionHorizontalOffset; // Source/Crop region horizontal offset 232 uint32_t dwScaledRegionHeight; // Scaled region height 233 uint32_t dwScaledRegionWidth; // Scaled region width 234 uint32_t dwScaledRegionVerticalOffset; // Scaled region vertical offset 235 uint32_t dwScaledRegionHorizontalOffset; // Scaled region horizontal offset 236 uint32_t dwTargetRectangleStartHorizontalOffset; // Target rectangle start horizontal offset 237 uint32_t dwTargetRectangleEndHorizontalOffset; // Target rectangle end horizontal offset 238 uint32_t dwTargetRectangleStartVerticalOffset; // Target rectangle start vertical offset 239 uint32_t dwTargetRectangleEndVerticalOffset; // Target rectangle end vertical offset 240 bool bRectangleEnabled; // Target rectangle enabled 241 float fAVSXScalingRatio; // X Scaling Ratio 242 float fAVSYScalingRatio; // Y Scaling Ratio 243 bool bBypassXAdaptiveFilter; // If true, X direction will use Default Sharpness level to blend 244 // b/w smooth and sharp filters rather than the calculated value 245 bool bBypassYAdaptiveFilter; // If true, Y direction will use Default Sharpness level to blend 246 // b/w smooth and sharp filters rather than the calculated value 247 bool bRGBAdaptive; // If true, Enable the RGB Adaptive filter 248 // IEF params 249 bool bIEFEnable; // IEF Filter enable 250 bool bSkinToneTunedIEFEnable; // Skin Tone Tuned IEF enable 251 bool bAVSChromaUpsamplingEnable; // Up sample chroma prior to IEF filter 252 bool b8tapChromafiltering; // This bit enables 8 tap filtering for Chroma Channels 253 254 // Rotation Params 255 MHW_ROTATION RotationMode; // Rotation mode -- 0, 90, 180 or 270 256 uint32_t dwMirrorType; // Mirror Type -- vert/horiz 257 bool bMirrorEnable; // Mirror mode -- enable/disable 258 259 // ColorFill params 260 bool bColorFillEnable; // ColorFill enable 261 float fColorFillYRPixel; // ColorFill Y/R pixel 262 float fColorFillUGPixel; // ColorFill U/G pixel 263 float fColorFillVBPixel; // ColorFill V/B pixel 264 float fColorFillAPixel; // ColorFill A pixel 265 266 // CSC Params 267 bool bCSCEnable; // YUV->RGB/YUV->YUV CSC enable 268 bool bRGBASwapEnable; // R, B Channel Swap enable 269 bool bInputColorSpace; //0: YUV color space, 1:RGB color space 270 271 // Memory compression Enable Flag 272 bool bMMCEnable; // Flag used to decide whether sfc output should be compressed 273 MOS_RESOURCE_MMC_MODE MMCMode; // Memory compression mode 274 275 // Resources used by SFC 276 PMOS_RESOURCE pOsResOutputSurface; // Output Frame written by SFC 277 PMOS_RESOURCE pOsResAVSLineBuffer; // AVS Line buffer used by SFC 278 PMOS_RESOURCE pOsResIEFLineBuffer; // IEF Line buffer used by SFC 279 280 uint32_t dwOutputSurfaceOffset; // Output Frame offset (page based offset) 281 uint16_t wOutputSurfaceUXOffset; // Output Frame offset (page internal U offset for X axis) 282 uint16_t wOutputSurfaceUYOffset; // Output Frame offset (page internal U offset for Y axis) 283 uint16_t wOutputSurfaceVXOffset; // Output Frame offset (page internal V offset for X axis) 284 uint16_t wOutputSurfaceVYOffset; // Output Frame offset (page internal V offset for Y axis) 285 bool isDemosaicEnabled = false; //!< Enable Demosaic 286 287 } MHW_SFC_STATE_PARAMS, *PMHW_SFC_STATE_PARAMS; 288 289 //! 290 //! \brief SFC Output Surface Command parameters 291 //! 292 typedef struct _MHW_SFC_OUT_SURFACE_PARAMS 293 { 294 uint32_t ChromaSiting; //!< Chroma siting 295 MOS_FORMAT Format; //!< Surface format 296 uint32_t dwWidth; //!< Surface width 297 uint32_t dwHeight; //!< Surface height 298 uint32_t dwPitch; //!< Surface pitch 299 MOS_TILE_TYPE TileType; //!< Tile Type 300 MOS_TILE_MODE_GMM TileModeGMM; //!< Tile Type from GMM Definition 301 bool bGMMTileEnabled; //!< GMM defined tile mode flag 302 uint32_t dwStreamID; //!< Surface StreamID 303 uint32_t dwSurfaceXOffset; //!< Surface X offset 304 uint32_t dwSurfaceYOffset; //!< Surface Y offset 305 uint32_t dwUYoffset; //!< Surface Uoffset in Vertical 306 uint32_t dwVUoffset; //!< Surface Voffset in Vertical, named by Vplane relative to Uplane 307 PMOS_RESOURCE pOsResource; //!< Surface resource 308 bool bCompressible; //!< Surface can be compressed 309 uint32_t dwCompressionFormat;//!< Surface Compression format 310 } MHW_SFC_OUT_SURFACE_PARAMS, *PMHW_SFC_OUT_SURFACE_PARAMS; 311 312 //! 313 //! \brief SFC Lock Command parameters 314 //! 315 typedef struct _MHW_SFC_LOCK_PARAMS 316 { 317 uint8_t sfcPipeMode; //!< SFC Pipe Mode 318 uint32_t dwGaClientId; // Ga Client Id 319 bool bOutputToMemory; // Write Vebox or Vdbox o/p to memory 320 } MHW_SFC_LOCK_PARAMS, *PMHW_SFC_LOCK_PARAMS; 321 322 //! 323 //! \brief SFC IEF State parameters 324 //! 325 typedef struct _MHW_SFC_IEF_STATE_PARAMS 326 { 327 uint8_t sfcPipeMode; //!< SFC Pipe Mode 328 329 // IEF params 330 bool bSkinDetailFactor; // Skin Detail Factor 331 bool bVYSTDEnable; // Enable STD in VY subspace 332 bool bIEFEnable; // Enable IEF 333 uint8_t StrongEdgeWeight; 334 uint8_t RegularWeight; 335 uint8_t StrongEdgeThreshold; 336 uint32_t dwGainFactor; 337 uint32_t dwR5xCoefficient; 338 uint32_t dwR5cxCoefficient; 339 uint32_t dwR5cCoefficient; 340 uint32_t dwR3xCoefficient; 341 uint32_t dwR3cCoefficient; 342 343 // CSC params 344 bool bCSCEnable; // Enable CSC transform 345 float *pfCscCoeff; // [3x3] CSC Coeff matrix 346 float *pfCscInOffset; // [3x1] CSC Input Offset matrix 347 float *pfCscOutOffset; // [3x1] CSC Output Offset matrix 348 } MHW_SFC_IEF_STATE_PARAMS, *PMHW_SFC_IEF_STATE_PARAMS; 349 350 class MhwSfcInterface 351 { 352 public: ~MhwSfcInterface()353 virtual ~MhwSfcInterface() 354 { 355 } 356 357 //! 358 //! \brief Adds a resource to the command buffer or indirect state (SSH) 359 //! \details Internal MHW function to add either a graphics address of a resource or 360 //! add the resource to the patch list for the requested buffer or state 361 //! \param [in] pOsInterface 362 //! OS interface 363 //! \param [in] pCmdBuffer 364 //! If adding a resource to the command buffer, the buffer to which the resource 365 //! is added 366 //! \param [in] pParams 367 //! Parameters necessary to add the graphics address 368 //! \return MOS_STATUS 369 //! MOS_STATUS_SUCCESS if success, else fail reason 370 //! 371 MOS_STATUS(*pfnAddResourceToCmd) ( 372 PMOS_INTERFACE pOsInterface, 373 PMOS_COMMAND_BUFFER pCmdBuffer, 374 PMHW_RESOURCE_PARAMS pParams); 375 376 //! 377 //! \brief Add SFC Lock 378 //! \param [in] pCmdBuffer 379 //! Pointer to Command buffer 380 //! \param [in] pSfcLockParams 381 //! Pointer to SFC_LOCK params 382 //! \return MOS_STATUS 383 //! 384 virtual MOS_STATUS AddSfcLock ( 385 PMOS_COMMAND_BUFFER pCmdBuffer, 386 PMHW_SFC_LOCK_PARAMS pSfcLockParams) = 0; 387 388 //! 389 //! \brief Add SFC State 390 //! \param [in] pCmdBuffer 391 //! Pointer to Command Buffer 392 //! \param [in] pSfcStateParams 393 //! Pointer to SFC_STATE params 394 //! \param [in] pOutSurface 395 //! Pointer to Output surface params 396 //! \return MOS_STATUS 397 //! 398 virtual MOS_STATUS AddSfcState( 399 PMOS_COMMAND_BUFFER pCmdBuffer, 400 PMHW_SFC_STATE_PARAMS pSfcStateParams, 401 PMHW_SFC_OUT_SURFACE_PARAMS pOutSurface) = 0; 402 403 //! 404 //! \brief Add SFC AVS State command 405 //! \param [in] pCmdBuffer 406 //! Pointer to Command Buffer 407 //! \param [in] pSfcAvsState 408 //! Pointer to SFC AVS State 409 //! \return MOS_STATUS 410 //! 411 virtual MOS_STATUS AddSfcAvsState( 412 PMOS_COMMAND_BUFFER pCmdBuffer, 413 PMHW_SFC_AVS_STATE pSfcAvsState) = 0; 414 415 //! 416 //! \brief Add SFC Frame Start command 417 //! \param [in] pCmdBuffer 418 //! Pointer to Command Buffer 419 //! \param [in] sfcPipeMode 420 //! SFC pipe mode 421 //! \return MOS_STATUS 422 //! 423 virtual MOS_STATUS AddSfcFrameStart ( 424 PMOS_COMMAND_BUFFER pCmdBuffer, 425 uint8_t sfcPipeMode) = 0; 426 427 //! 428 //! \brief Add SFC IEF State command 429 //! \param [in] pCmdBuffer 430 //! Pointer to Command Buffer 431 //! \param [in] pSfcIefStateParams 432 //! Pointer to IEF State params 433 //! \return MOS_STATUS 434 //! 435 virtual MOS_STATUS AddSfcIefState( 436 PMOS_COMMAND_BUFFER pCmdBuffer, 437 PMHW_SFC_IEF_STATE_PARAMS pSfcIefStateParams) = 0; 438 439 //! 440 //! \brief Add SFC AVS Chroma Table command 441 //! \param [in] pCmdBuffer 442 //! Pointer to Command Buffer 443 //! \param [in] pChromaTable 444 //! Pointer to Chroma Coefficient table 445 //! \return MOS_STATUS 446 //! 447 virtual MOS_STATUS AddSfcAvsChromaTable ( 448 PMOS_COMMAND_BUFFER pCmdBuffer, 449 PMHW_SFC_AVS_CHROMA_TABLE pChromaTable) = 0; 450 451 //! 452 //! \brief Add SFC AVS Chroma Table command 453 //! \param [in] pCmdBuffer 454 //! Pointer to Command Buffer 455 //! \param [in] pChromaTable 456 //! Pointer to Chroma Coefficient table 457 //! \return MOS_STATUS 458 //! 459 virtual MOS_STATUS AddSfcAvsLumaTable ( 460 PMOS_COMMAND_BUFFER pCmdBuffer, 461 PMHW_SFC_AVS_LUMA_TABLE pLumaTable) = 0; 462 463 //! 464 //! \brief Set Sfc Sampler8x8 Table 465 //! \details Set Sfc AVS Luma and Chroma table 466 //! \param [out] pLumaTable 467 //! Pointer to AVS luma table 468 //! \param [out] pChromaTable 469 //! Pointer to AVS chroma table 470 //! \param [in] pAvsParams 471 //! Pointer to AVS params 472 //! \param [in] SrcFormat 473 //! Input Source Format 474 //! \param [in] fScaleX 475 //! Scaling ratio in width 476 //! \param [in] fScaleY 477 //! Scaling ratio in height 478 //! \param [in] dwChromaSiting 479 //! Chroma Siting info 480 //! \return MOS_STATUS 481 //! 482 virtual MOS_STATUS SetSfcSamplerTable ( 483 PMHW_SFC_AVS_LUMA_TABLE pLumaTable, 484 PMHW_SFC_AVS_CHROMA_TABLE pChromaTable, 485 PMHW_AVS_PARAMS pAvsParams, 486 MOS_FORMAT SrcFormat, 487 float fScaleX, 488 float fScaleY, 489 uint32_t dwChromaSiting, 490 bool bUse8x8Filter, 491 float fHPStrength, 492 float fLanczosT); 493 494 //! 495 //! \brief Sets AVS Scaling Mode. Will configure the different coefficients of 8-Tap polyphase filter according to scaling mode. 496 //! \param [in] ScalingMode 497 //! AVS scaling mode e.g. Nearest, 8-Tap polyphase etc. 498 //! \return MOS_STATUS 499 //! SetSfcAVSScalingMode(MHW_SCALING_MODE ScalingMode)500 virtual MOS_STATUS SetSfcAVSScalingMode( 501 MHW_SCALING_MODE ScalingMode) 502 { 503 m_scalingMode = ScalingMode; 504 return MOS_STATUS_SUCCESS; 505 } 506 507 virtual MOS_STATUS GetInputFrameWidthHeightAlignUnit(uint32_t &widthAlignUnit, uint32_t &heightAlignUnit, 508 bool bVdbox, CODECHAL_STANDARD codecStandard, CodecDecodeJpegChromaType jpegChromaType); 509 510 //! 511 //! \brief Set Sfc Index 512 //! \details Set Sfc Index 513 //! \param [in] dwSfcIndex 514 //! set Sfc Index 515 //! \param [in] dwSfcCount 516 //! set Sfc Count 517 //! \return MOS_STATUS 518 //! MOS_STATUS_SUCCESS if success, else fail reason SetSfcIndex(uint32_t dwSfcIndex,uint32_t dwSfcCount)519 virtual MOS_STATUS SetSfcIndex( 520 uint32_t dwSfcIndex, 521 uint32_t dwSfcCount) 522 { 523 MOS_UNUSED(dwSfcIndex); 524 MOS_UNUSED(dwSfcCount); 525 return MOS_STATUS_SUCCESS; 526 } 527 528 //! 529 //! \brief Get new sfc interface, temporal solution before switching from 530 //! old interface to new one 531 //! 532 //! \return pointer to new render interface 533 //! GetNewSfcInterface()534 virtual std::shared_ptr<void> GetNewSfcInterface() { return nullptr; } 535 536 protected: 537 538 MhwSfcInterface(PMOS_INTERFACE pOsInterface); 539 540 //! 541 //! \brief Sets AVS Luma Coefficient table 542 //! \param [in] SrcFormat 543 //! Source format 544 //! \param [in] pCoeffTable 545 //! Pointer to coefficient table 546 //! \param [in] piYCoefsX 547 //! Pointer to Y coefficients X 548 //! \param [in] piYCoefsY 549 //! Pointer to Y coefficients Y 550 //! \param [in] bUse8x8Filter 551 //! Is 8x8 Filter used 552 //! \return void 553 //! 554 void SetSfcAVSLumaTable( 555 MOS_FORMAT SrcFormat, 556 PSFC_AVS_LUMA_FILTER_COEFF pCoeffTable, 557 int32_t *piYCoefsX, 558 int32_t *piYCoefsY, 559 bool bUse8x8Filter); 560 //! 561 //! \brief Sets AVS Chroma Coefficient table 562 //! \param [in] pUVCoeffTable 563 //! Pointer to UV coefficient table 564 //! \param [in] piUVCoefsX 565 //! Pointer to UV coefficients X 566 //! \param [in] piUVCoefsY 567 //! Pointer to UV coefficients Y 568 //! \return void 569 //! 570 void SetSfcAVSChromaTable( 571 PSFC_AVS_CHROMA_FILTER_COEFF pUVCoeffTable, 572 int32_t *piUVCoefsX, 573 int32_t *piUVCoefsY); 574 575 public: 576 enum SFC_PIPE_MODE 577 { 578 SFC_PIPE_MODE_VDBOX = 0, 579 SFC_PIPE_MODE_VEBOX = 1 580 }; 581 582 enum SfcScalabMode 583 { 584 sfcScalabModeSingle = 0, //!< 0 - single pipe 585 sfcScalabModeLeftCol, //!< 1 - left most column 586 sfcScalabModeRightCol, //!< 2 - right most column 587 sfcScalabModeMiddleCol //!< 3 - middle column 588 }; 589 590 enum SfcScalabTileType 591 { 592 sfcScalabRealTile = 0, //!< 0 - real tile 593 sfcScalabVirtualTile //!< 1 - virtual tile 594 }; 595 596 public: 597 PMOS_INTERFACE m_osInterface = nullptr; 598 599 uint16_t m_veWidthAlignment = MHW_SFC_VE_WIDTH_ALIGN; 600 uint16_t m_veHeightAlignment = MHW_SFC_VE_HEIGHT_ALIGN; 601 uint32_t m_maxWidth = MHW_SFC_MAX_WIDTH; 602 uint32_t m_maxHeight = MHW_SFC_MAX_HEIGHT; 603 uint32_t m_minWidth = MHW_SFC_MIN_WIDTH; 604 uint32_t m_minHeight = MHW_SFC_MIN_HEIGHT; 605 606 float m_maxScalingRatio = MHW_SFC_MAX_SCALINGFACTOR; 607 float m_minScalingRatio = MHW_SFC_MIN_SCALINGFACTOR; 608 609 MHW_MEMORY_OBJECT_CONTROL_PARAMS m_outputSurfCtrl; // Output Frame caching control bits 610 MHW_MEMORY_OBJECT_CONTROL_PARAMS m_avsLineBufferCtrl; // AVS Line Buffer caching control bits 611 MHW_MEMORY_OBJECT_CONTROL_PARAMS m_iefLineBufferCtrl; // IEF Line Buffer caching control bits 612 MHW_MEMORY_OBJECT_CONTROL_PARAMS m_sfdLineBufferCtrl; // SFD Line Buffer caching control bits 613 MHW_MEMORY_OBJECT_CONTROL_PARAMS m_avsLineTileBufferCtrl; // AVS Line Tile Buffer caching control bits 614 MHW_MEMORY_OBJECT_CONTROL_PARAMS m_iefLineTileBufferCtrl; // IEF Line Tile Buffer caching control bits 615 MHW_MEMORY_OBJECT_CONTROL_PARAMS m_sfdLineTileBufferCtrl; // SFD Line Tile Buffer caching control bits 616 MHW_MEMORY_OBJECT_CONTROL_PARAMS m_histogramBufferCtrl; // Histogram Buffer caching control bits 617 618 MHW_SCALING_MODE m_scalingMode; 619 std::shared_ptr<void> m_sfcItfNew = nullptr; 620 }; 621 622 #endif // __MHW_SFC_H__ 623