| 1 |
/* |
| 2 |
* Copyright (c) 2016-2021, 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 vphal_render_composite.h |
| 24 |
//! \brief Common interface and structure used in Composite |
| 25 |
//! \details Common interface and structure used in Composite |
| 26 |
//! |
| 27 |
#ifndef __VPHAL_RENDER_COMPOSITE_H__ |
| 28 |
#define __VPHAL_RENDER_COMPOSITE_H__ |
| 29 |
|
| 30 |
#include "vphal.h" |
| 31 |
#include "vphal_render_renderstate.h" |
| 32 |
#include "vphal_render_common.h" |
| 33 |
#include "mhw_render_legacy.h" |
| 34 |
|
| 35 |
//! |
| 36 |
//! \brief Compositing buffers |
| 37 |
//! |
| 38 |
#define VPHAL_COMP_BUFFERS_DEFAULT 4 |
| 39 |
#define VPHAL_COMP_BUFFERS_MAX 32 |
| 40 |
|
| 41 |
#define VPHAL_MAX_PROCAMP 2 |
| 42 |
|
| 43 |
#define VPHAL_SURFACE_INDEX_INVALID -1 |
| 44 |
#define VPHAL_COMP_MAX_PALETTES 2 |
| 45 |
#define VPHAL_COMP_MAX_LUMA_KEY 1 |
| 46 |
#define VPHAL_COMP_MAX_AVS 1 |
| 47 |
#define VPHAL_COMP_MAX_PROCAMP 1 |
| 48 |
#define VPHAL_COMP_SAMPLER_NEAREST 1 |
| 49 |
#define VPHAL_COMP_SAMPLER_BILINEAR 2 |
| 50 |
#define VPHAL_COMP_SAMPLER_LUMAKEY 4 |
| 51 |
#define VPHAL_COMP_MAX_SAMPLER (VPHAL_COMP_SAMPLER_NEAREST | VPHAL_COMP_SAMPLER_BILINEAR | VPHAL_COMP_SAMPLER_LUMAKEY) |
| 52 |
|
| 53 |
#define VPHAL_SAMPLER_Y 1 |
| 54 |
#define VPHAL_SAMPLER_U 2 |
| 55 |
#define VPHAL_SAMPLER_V 3 |
| 56 |
#define VPHAL_COMP_COMPUTE_WALKER_THREAD_SPACE_WIDTH 1 |
| 57 |
#define VPHAL_COMP_COMPUTE_WALKER_THREAD_SPACE_HEIGHT 1 |
| 58 |
#define VPHAL_COMP_COMPUTE_WALKER_THREAD_SPACE_DEPTH 1 |
| 59 |
|
| 60 |
// GRF 8 for unified kernel inline data (NLAS is enabled) |
| 61 |
struct MEDIA_OBJECT_NLAS_INLINE_DATA |
| 62 |
{ |
| 63 |
// DWORD 0 - GRF R6.0 |
| 64 |
union |
| 65 |
{ |
| 66 |
struct |
| 67 |
{ |
| 68 |
float HorizontalFrameOriginLayer0; |
| 69 |
}; |
| 70 |
|
| 71 |
uint32_t Value; |
| 72 |
} DW00; |
| 73 |
|
| 74 |
// DWORD 1 - GRF R6.1 |
| 75 |
union |
| 76 |
{ |
| 77 |
struct |
| 78 |
{ |
| 79 |
float HorizontalFrameOriginLayer1; |
| 80 |
}; |
| 81 |
|
| 82 |
uint32_t Value; |
| 83 |
} DW01; |
| 84 |
|
| 85 |
// DWORD 2 - GRF R6.2 |
| 86 |
union |
| 87 |
{ |
| 88 |
struct |
| 89 |
{ |
| 90 |
float HorizontalFrameOriginLayer2; |
| 91 |
}; |
| 92 |
|
| 93 |
uint32_t Value; |
| 94 |
} DW02; |
| 95 |
|
| 96 |
// DWORD 03 - GRF R6.3 |
| 97 |
union |
| 98 |
{ |
| 99 |
struct |
| 100 |
{ |
| 101 |
float HorizontalFrameOriginLayer3; |
| 102 |
}; |
| 103 |
|
| 104 |
uint32_t Value; |
| 105 |
} DW03; |
| 106 |
|
| 107 |
// DWORD 04 - GRF R6.4 |
| 108 |
union |
| 109 |
{ |
| 110 |
struct |
| 111 |
{ |
| 112 |
float HorizontalFrameOriginLayer4; |
| 113 |
}; |
| 114 |
|
| 115 |
uint32_t Value; |
| 116 |
} DW04; |
| 117 |
|
| 118 |
// DWORD 05 - GRF R6.5 |
| 119 |
union |
| 120 |
{ |
| 121 |
struct |
| 122 |
{ |
| 123 |
float HorizontalFrameOriginLayer5; |
| 124 |
}; |
| 125 |
|
| 126 |
uint32_t Value; |
| 127 |
} DW05; |
| 128 |
|
| 129 |
// DWORD 06 - GRF R6.6 |
| 130 |
union |
| 131 |
{ |
| 132 |
struct |
| 133 |
{ |
| 134 |
float HorizontalFrameOriginLayer6; |
| 135 |
}; |
| 136 |
|
| 137 |
uint32_t Value; |
| 138 |
} DW06; |
| 139 |
|
| 140 |
// DWORD 07 - GRF R6.7 |
| 141 |
union |
| 142 |
{ |
| 143 |
struct |
| 144 |
{ |
| 145 |
float HorizontalFrameOriginLayer7; |
| 146 |
}; |
| 147 |
|
| 148 |
uint32_t Value; |
| 149 |
} DW07; |
| 150 |
}; |
| 151 |
|
| 152 |
//! |
| 153 |
//! \brief Structure to VPHAL Composite Media Object Inline Data |
| 154 |
//! |
| 155 |
struct VPHAL_COMPOSITE_MO_INLINE_DATA |
| 156 |
{ |
| 157 |
// Do not change the two members' order because of low level memcpy |
| 158 |
MEDIA_OBJECT_NLAS_INLINE_DATA NLASInline; |
| 159 |
MEDIA_OBJECT_KA2_INLINE_DATA KA2Inline; |
| 160 |
}; |
| 161 |
|
| 162 |
//! |
| 163 |
//! \brief Structure to VPHAL Composite Parameters |
| 164 |
//! |
| 165 |
typedef struct _VPHAL_COMPOSITE_PARAMS |
| 166 |
{ |
| 167 |
// Pointer to target and source surfaces |
| 168 |
uint32_t uSourceCount; //!< Number of sources |
| 169 |
PVPHAL_SURFACE pSource[VPHAL_COMP_MAX_LAYERS]; |
| 170 |
uint32_t uTargetCount; //!< Number of targets |
| 171 |
VPHAL_SURFACE Target[VPHAL_MAX_TARGETS]; //!< Render targets |
| 172 |
// Needed by CP during MHW VP integration, due to pTokenState->pResourceInfo |
| 173 |
RENDERHAL_SURFACE RenderHalSurfaceSrc[VPHAL_COMP_MAX_LAYERS]; |
| 174 |
RENDERHAL_SURFACE RenderHalSurfaceSrcField[VPHAL_COMP_MAX_LAYERS]; |
| 175 |
RENDERHAL_SURFACE RenderHalSurfaceTarget[VPHAL_MAX_TARGETS]; |
| 176 |
|
| 177 |
bool bSkipBlocks; //!< Skip empty blocks |
| 178 |
PRECT pConstriction; //!< Constricted output |
| 179 |
PVPHAL_COLORFILL_PARAMS pColorFillParams; //!< ColorFill - BG only |
| 180 |
PVPHAL_ALPHA_PARAMS pCompAlpha; //!< Alpha for composited surface |
| 181 |
bool bAlphaCalculateEnable; |
| 182 |
bool bForceSkipColorFill; //!< Force skip colorfill even the first layer is translucent |
| 183 |
|
| 184 |
// Resource counters |
| 185 |
int32_t nLayers; |
| 186 |
int32_t nPalettes; |
| 187 |
int32_t nAVS; |
| 188 |
int32_t nProcamp; |
| 189 |
int32_t nLumaKeys; |
| 190 |
int32_t nSampler; |
| 191 |
VPHAL_ROTATION Rotation; //!< Layer 0 rotation info |
| 192 |
} VPHAL_COMPOSITE_PARAMS, *PVPHAL_COMPOSITE_PARAMS; |
| 193 |
|
| 194 |
//! |
| 195 |
//! \brief Structure to VPHAL Composite Rendering data |
| 196 |
//! |
| 197 |
typedef struct _VPHAL_RENDERING_DATA_COMPOSITE |
| 198 |
{ |
| 199 |
// Sources |
| 200 |
int32_t iLayers; |
| 201 |
PVPHAL_SURFACE pLayers[VPHAL_COMP_MAX_LAYERS]; |
| 202 |
PVPHAL_SURFACE pTarget[VPHAL_MAX_TARGETS]; |
| 203 |
PVPHAL_COLORFILL_PARAMS pColorFill; |
| 204 |
PVPHAL_ALPHA_PARAMS pCompAlpha; |
| 205 |
|
| 206 |
// Geometry |
| 207 |
int32_t iBlocksX; |
| 208 |
int32_t iBlocksY; |
| 209 |
int32_t iBindingTable; |
| 210 |
int32_t iMediaID; |
| 211 |
int32_t iCurbeOffset; |
| 212 |
int32_t iCurbeLength; |
| 213 |
RECT rcOutput; |
| 214 |
|
| 215 |
// Constriction parameters |
| 216 |
PRECT pConstriction; |
| 217 |
int32_t ConstrictionOriginX; |
| 218 |
int32_t ConstrictionOriginY; |
| 219 |
float fConstrictionStepX; |
| 220 |
float fConstrictionStepY; |
| 221 |
|
| 222 |
// HDC Direct Write flag |
| 223 |
bool bHdcDwEnable; |
| 224 |
|
| 225 |
// Alpha Calculate flag |
| 226 |
bool bAlphaCalculateEnable; |
| 227 |
|
| 228 |
// CM FC flag |
| 229 |
bool bCmFcEnable; |
| 230 |
|
| 231 |
// States |
| 232 |
PRENDERHAL_MEDIA_STATE pMediaState; |
| 233 |
MHW_SAMPLER_STATE_PARAM SamplerStateParams[MHW_RENDER_ENGINE_SAMPLERS_MAX]; |
| 234 |
int32_t iCmdInlineSize; |
| 235 |
int32_t iNLASInlineSize; |
| 236 |
MEDIA_OBJECT_KA2_STATIC_DATA Static; |
| 237 |
MEDIA_WALKER_KA2_STATIC_DATA WalkerStatic; |
| 238 |
MEDIA_OBJECT_KA2_INLINE_DATA Inline; |
| 239 |
PMHW_AVS_PARAMS pAvsParams; |
| 240 |
MEDIA_DP_FC_STATIC_DATA DPFCStatic; |
| 241 |
// Batch Buffer rendering arguments |
| 242 |
VPHAL_BB_COMP_ARGS BbArgs; |
| 243 |
|
| 244 |
// Kernel Information |
| 245 |
Kdll_CacheEntry *pKernelEntry; |
| 246 |
Kdll_Procamp *pProcamp; |
| 247 |
|
| 248 |
// Extension data |
| 249 |
void* pExtensionData; |
| 250 |
|
| 251 |
} VPHAL_RENDERING_DATA_COMPOSITE, *PVPHAL_RENDERING_DATA_COMPOSITE; |
| 252 |
|
| 253 |
//! |
| 254 |
//! \brief Structure to VPHAL 16x16 Block COMPOSITE Mask |
| 255 |
//! |
| 256 |
typedef struct _VPHAL_16X16BLOCK_COMPOSITE_MASK |
| 257 |
{ |
| 258 |
uint32_t HorizontalBlockCompositeMask : 16; |
| 259 |
uint32_t VerticalBlockCompositeMask : 16; |
| 260 |
} VPHAL_16X16BLOCK_COMPOSITE_MASK, *PVPHAL_16X16BLOCK_COMPOSITE_MASK; |
| 261 |
|
| 262 |
//! |
| 263 |
//! \brief Class to VPHAL Composite render |
| 264 |
//! |
| 265 |
class CompositeState : public RenderState |
| 266 |
{ |
| 267 |
public: |
| 268 |
//! |
| 269 |
//! \brief Composite Constructor |
| 270 |
//! \details Construct Composite render and allocate member data structure |
| 271 |
//! \param [in] pOsInterface |
| 272 |
//! Pointer to MOS interface structure |
| 273 |
//! \param [in] pRenderHal |
| 274 |
//! Pointer to RenderHal interface structure |
| 275 |
//! \param [in] pPerfData |
| 276 |
//! Pointer to performance data structure |
| 277 |
//! \param [in] compositeCacheCntl |
| 278 |
//! Composite Cache Control Data |
| 279 |
//! \param [out] peStatus |
| 280 |
//! Pointer to MOS status |
| 281 |
//! |
| 282 |
CompositeState( |
| 283 |
PMOS_INTERFACE pOsInterface, |
| 284 |
PRENDERHAL_INTERFACE pRenderHal, |
| 285 |
PVPHAL_RNDR_PERF_DATA pPerfData, |
| 286 |
const VPHAL_COMPOSITE_CACHE_CNTL &compositeCacheCntl, |
| 287 |
MOS_STATUS *peStatus); |
| 288 |
|
| 289 |
//! |
| 290 |
//! \brief Composite render Destructor |
| 291 |
//! \details Destroy Composite render and release all related RenderState resources |
| 292 |
//! |
| 293 |
virtual ~CompositeState(); |
| 294 |
|
| 295 |
//! |
| 296 |
//! \brief Initialize Composite render |
| 297 |
//! \param [in] pSettings |
| 298 |
//! Pointer to VPHAL Settings |
| 299 |
//! \param [in] pKernelDllState |
| 300 |
//! Pointer to KernelDLL State |
| 301 |
//! \return MOS_STATUS |
| 302 |
//! Return MOS_STATUS_SUCCESS if successful |
| 303 |
//! |
| 304 |
virtual MOS_STATUS Initialize( |
| 305 |
const VphalSettings *pSettings, |
| 306 |
Kdll_State *pKernelDllState); |
| 307 |
|
| 308 |
//! |
| 309 |
//! \brief Composite Destroy function |
| 310 |
//! \details Destroy resource allocated by Composite |
| 311 |
//! |
| 312 |
virtual void Destroy(); |
| 313 |
|
| 314 |
//! |
| 315 |
//! \brief Composite render Rendering |
| 316 |
//! \details VPHal Composite render entry |
| 317 |
//! \param [in] pcRenderParams |
| 318 |
//! Pointer to Render parameters |
| 319 |
//! \param [in,out] pRenderPassData |
| 320 |
//! Pointer to Render data |
| 321 |
//! \return MOS_STATUS |
| 322 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 323 |
//! |
| 324 |
MOS_STATUS Render( |
| 325 |
PCVPHAL_RENDER_PARAMS pcRenderParams, |
| 326 |
RenderpassData *pRenderPassData); |
| 327 |
|
| 328 |
//! |
| 329 |
//! \brief Judge if Composite render is needed |
| 330 |
//! \details Check Render parameter/data if Composite render needed |
| 331 |
//! \param [in] pcRenderParams |
| 332 |
//! Pointer to Render parameters |
| 333 |
//! \param [in,out] pRenderPassData |
| 334 |
//! Pointer to Render data |
| 335 |
//! \return bool |
| 336 |
//! true if meeded. Else false |
| 337 |
//! |
| 338 |
bool IsNeeded( |
| 339 |
PCVPHAL_RENDER_PARAMS pcRenderParams, |
| 340 |
RenderpassData *pRenderPassData); |
| 341 |
|
| 342 |
void PrintCurbeData(MEDIA_OBJECT_KA2_STATIC_DATA *pWalkerStatic); |
| 343 |
|
| 344 |
void PrintWalkerParas(PMHW_GPGPU_WALKER_PARAMS pWalkerParams); |
| 345 |
|
| 346 |
void PrintSamplerParams(PMHW_SAMPLER_STATE_PARAM pSamplerParams); |
| 347 |
|
| 348 |
//! |
| 349 |
//! \brief set Report data |
| 350 |
//! \details set Report data for this render |
| 351 |
//! \param [in] pSource |
| 352 |
//! pointer to the surface |
| 353 |
//! |
| 354 |
virtual void SetReporting(PVPHAL_SURFACE pSource); |
| 355 |
|
| 356 |
//! |
| 357 |
//! \brief copy Report data |
| 358 |
//! \details copy Report data from this render |
| 359 |
//! \param [out] pReporting |
| 360 |
//! pointer to the Report data to copy data to |
| 361 |
//! |
| 362 |
virtual void CopyReporting(VphalFeatureReport* pReporting); |
| 363 |
|
| 364 |
//! |
| 365 |
//! \brief Judge if Composite render support multiple stream rendering |
| 366 |
//! \details Judge if Composite render support multiple stream rendering |
| 367 |
//! \return bool |
| 368 |
//! true if supported. Else false |
| 369 |
//! |
| 370 |
bool IsMultipleStreamSupported(); |
| 371 |
|
| 372 |
//! |
| 373 |
//! \brief Search for the best match BB according to the Composition BB arguments |
| 374 |
//! \param [in] pBatchBufferTable |
| 375 |
//! Pointer to the BB table to be searched |
| 376 |
//! \param [in] pInputBbParams |
| 377 |
//! Pointer to the BB params required for the best match |
| 378 |
//! \param [in] iBbSize |
| 379 |
//! the BB size required for the best match |
| 380 |
//! \param [out] ppBatchBuffer |
| 381 |
//! Pointer to the addr of the best matched BB, pointer to nullptr if there's |
| 382 |
//! no available matched BB |
| 383 |
//! \return MOS_STATUS |
| 384 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 385 |
//! |
| 386 |
static MOS_STATUS GetBestMatchBB( |
| 387 |
PVPHAL_BATCH_BUFFER_TABLE pBatchBufferTable, |
| 388 |
PVPHAL_BATCH_BUFFER_PARAMS pInputBbParams, |
| 389 |
int32_t iBbSize, |
| 390 |
PMHW_BATCH_BUFFER *ppBatchBuffer); |
| 391 |
|
| 392 |
//! |
| 393 |
//! \brief Load Palette Data |
| 394 |
//! \details Load Palette Data according to color space and CSC matrix. |
| 395 |
//! \param [in] pInPalette |
| 396 |
//! Pointer to Input Palette structure |
| 397 |
//! \param [in] srcCspace |
| 398 |
//! Source color space |
| 399 |
//! \param [in] dstCspace |
| 400 |
//! Destination color space |
| 401 |
//! \param [in] piCscMatrix |
| 402 |
//! Pointer to CSC matrix to use in fixed point format |
| 403 |
//! \param [in] iNumEntries |
| 404 |
//! Number of Palette entries to be filled |
| 405 |
//! \param [in,out] pPaletteData |
| 406 |
//! Pointer to Output Palette Address |
| 407 |
//! \return MOS_STATUS |
| 408 |
//! MOS_STATUS_SUCCESS, otherwise MOS_STATUS_UNIMPLEMENTED if Destination Colorspace not supported, |
| 409 |
//! or MOS_STATUS_INVALID_PARAMETER/MOS_STATUS_NULL_POINTER |
| 410 |
//! |
| 411 |
MOS_STATUS LoadPaletteData( |
| 412 |
PVPHAL_PALETTE pInPalette, |
| 413 |
VPHAL_CSPACE srcCspace, |
| 414 |
VPHAL_CSPACE dstCspace, |
| 415 |
int32_t* piCscMatrix, |
| 416 |
int32_t iNumEntries, |
| 417 |
void* pPaletteData); |
| 418 |
|
| 419 |
protected: |
| 420 |
//! |
| 421 |
//! \brief Set Sampler Avs 8x8 Table |
| 422 |
//! \param [in] pRenderHal |
| 423 |
//! Pointer to RenderHal Interface Structure |
| 424 |
//! \param [in] pSamplerStateParams |
| 425 |
//! Pointer to Sampler State Params |
| 426 |
//! \param [in,out] pAvsParams |
| 427 |
//! Pointer to AVS Params |
| 428 |
//! \param [in] SrcFormat |
| 429 |
//! Source Format |
| 430 |
//! \param [in] fScaleX |
| 431 |
//! Horizontal Scale Factor |
| 432 |
//! \param [in] fScaleY |
| 433 |
//! Vertical Scale Factor |
| 434 |
//! \param [in] dwChromaSiting |
| 435 |
//! Chroma Siting |
| 436 |
//! \return MOS_STATUS |
| 437 |
//! |
| 438 |
virtual MOS_STATUS SetSamplerAvsTableParam( |
| 439 |
PRENDERHAL_INTERFACE pRenderHal, |
| 440 |
PMHW_SAMPLER_STATE_PARAM pSamplerStateParams, |
| 441 |
PMHW_AVS_PARAMS pAvsParams, |
| 442 |
MOS_FORMAT SrcFormat, |
| 443 |
float fScaleX, |
| 444 |
float fScaleY, |
| 445 |
uint32_t dwChromaSiting); |
| 446 |
|
| 447 |
//! |
| 448 |
//! \brief Get Plane Offset override parameter for Kernel WA |
| 449 |
//! \details Get Y/UV Plane Offset override parameters for Kernel WA |
| 450 |
//! \param pRenderHalSurface |
| 451 |
//! [in,out] Pointer to Render Hal Surface |
| 452 |
//! \param pParams |
| 453 |
//! [in] Pointer to Surface State Params |
| 454 |
//! \param pOverride |
| 455 |
//! [out] Pointer to override param that provides adjustments to |
| 456 |
//! Y, UV plane offsets, used for kernel WA in a few cases. |
| 457 |
//! \return RENDERHAL_OFFSET_OVERRIDE |
| 458 |
//! return pointer to RENDERHAL_OFFSET_OVERRIDE if need, otherwise return nullptr. |
| 459 |
//! |
| 460 |
virtual PRENDERHAL_OFFSET_OVERRIDE GetPlaneOffsetOverrideParam( |
| 461 |
PRENDERHAL_SURFACE pRenderHalSurface, |
| 462 |
PRENDERHAL_SURFACE_STATE_PARAMS pParams, |
| 463 |
PRENDERHAL_OFFSET_OVERRIDE pOverride) |
| 464 |
{ |
| 465 |
return nullptr; |
| 466 |
} |
| 467 |
|
| 468 |
//! |
| 469 |
//! \brief Get Thread Count for VFE state parameter |
| 470 |
//! \details Get Thread Count for VFE state parameter |
| 471 |
//! \param pRenderingData |
| 472 |
//! [in] Pointer to Composite state |
| 473 |
//! \param pTarget |
| 474 |
//! [in] Pointer to target surface |
| 475 |
//! \return INT |
| 476 |
//! return the thread count |
| 477 |
//! |
| 478 |
virtual int32_t GetThreadCountForVfeState( |
| 479 |
PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData, |
| 480 |
PVPHAL_SURFACE pTarget); |
| 481 |
|
| 482 |
//! |
| 483 |
//! \brief Calculate Composite parameter and render data |
| 484 |
//! \param [in,out] pCompParams |
| 485 |
//! Pointer to Composite parameters. |
| 486 |
//! \param [in,out] pSource |
| 487 |
//! Pointer to surface. |
| 488 |
//! \param [in,out] pRenderingData |
| 489 |
//! Pointer to Composite RenderData. |
| 490 |
//! \param [out] pbColorfill |
| 491 |
//! Pointer to color fill flag. |
| 492 |
//! \return void |
| 493 |
//! |
| 494 |
virtual void CalculateRenderData( |
| 495 |
PVPHAL_COMPOSITE_PARAMS pCompParams, |
| 496 |
PVPHAL_SURFACE pSurface, |
| 497 |
PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData, |
| 498 |
bool* pbColorfill); |
| 499 |
|
| 500 |
//! |
| 501 |
//! \brief Adjust Params Based On Fc Limit |
| 502 |
//! \param [in,out] PCVPHAL_RENDER_PARAMS |
| 503 |
//! Pointer to pcRenderParam parameters. |
| 504 |
//! \return bool |
| 505 |
//! |
| 506 |
bool AdjustParamsBasedOnFcLimit( |
| 507 |
PCVPHAL_RENDER_PARAMS pcRenderParam); |
| 508 |
|
| 509 |
//! |
| 510 |
//! \brief Set Sampler AVS parameters |
| 511 |
//! \param [in] pRenderingData |
| 512 |
//! pointer to render data |
| 513 |
//! \param [in] pSource |
| 514 |
//! pointer to source surface |
| 515 |
//! \param [in] pSurfaceEntry |
| 516 |
//! pointer to source state entry |
| 517 |
//! \param [out] pSamplerStateParams |
| 518 |
//! pointer to Sampler state params |
| 519 |
//! \param [in] fScaleX |
| 520 |
//! width scaling ratio |
| 521 |
//! \param [in] fScaleY |
| 522 |
//! height scaling ratio |
| 523 |
//! \return MOS_STATUS |
| 524 |
//! |
| 525 |
virtual MOS_STATUS SetSamplerAvsParams( |
| 526 |
PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData, |
| 527 |
PVPHAL_SURFACE pSource, |
| 528 |
PRENDERHAL_SURFACE_STATE_ENTRY pSurfaceEntry, |
| 529 |
PMHW_SAMPLER_STATE_PARAM pSamplerStateParams, |
| 530 |
float fScaleX, |
| 531 |
float fScaleY); |
| 532 |
|
| 533 |
//! |
| 534 |
//! \brief set inline data |
| 535 |
//! \param [in] pBbArgs |
| 536 |
//! Pointer to Composite BB argument |
| 537 |
//! \param [in] pRenderingData |
| 538 |
//! Pointer to Composite render data |
| 539 |
//! \param [in] pStatic |
| 540 |
//! Pointer to static data |
| 541 |
//! \param [in,out] pInline |
| 542 |
//! Pointer to inline data |
| 543 |
//! \param [in,out] pInlineNLAS |
| 544 |
//! Pointer to NLAS inline data |
| 545 |
//! \param [in] x |
| 546 |
//! horizontal origin |
| 547 |
//! \param [out] fSrcX |
| 548 |
//! horizontal origin of layers |
| 549 |
//! \return void |
| 550 |
//! |
| 551 |
virtual void ModifyInlineData( |
| 552 |
PVPHAL_BB_COMP_ARGS pBbArgs, |
| 553 |
PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData, |
| 554 |
MEDIA_OBJECT_KA2_STATIC_DATA *pStatic, |
| 555 |
MEDIA_OBJECT_KA2_INLINE_DATA *pInline, |
| 556 |
MEDIA_OBJECT_NLAS_INLINE_DATA *pInlineNLAS, |
| 557 |
int32_t x, |
| 558 |
float *fSrcX) {;} |
| 559 |
|
| 560 |
//! |
| 561 |
//! \brief Calculate crop factor |
| 562 |
//! \param [in] iLayer |
| 563 |
//! layer index |
| 564 |
//! \param [in] pRenderingData |
| 565 |
//! pointer to render data |
| 566 |
//! \param [out] pfCropX |
| 567 |
//! crop factor |
| 568 |
//! \param [out] pfCropY |
| 569 |
//! crop factor |
| 570 |
//! \return MOS_STATUS |
| 571 |
//! |
| 572 |
virtual MOS_STATUS CalculateCropParams( |
| 573 |
int32_t iLayer, |
| 574 |
PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData, |
| 575 |
float* pfCropX, |
| 576 |
float* pfCropY); |
| 577 |
|
| 578 |
//! |
| 579 |
//! \brief Calculate and set inline data size |
| 580 |
//! \param [in] pRenderingData |
| 581 |
//! pointer to render data |
| 582 |
//! \param [out] pStatic |
| 583 |
//! pointer to static data |
| 584 |
//! \return void |
| 585 |
//! |
| 586 |
virtual int32_t CalculateInlineDataSize( |
| 587 |
PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData, |
| 588 |
MEDIA_OBJECT_KA2_STATIC_DATA *pStatic); |
| 589 |
|
| 590 |
//! |
| 591 |
//! \brief Calculate Media Object size |
| 592 |
//! \param [in] pRenderingData |
| 593 |
//! Pointer to Rendering Data |
| 594 |
//! \return int32_t |
| 595 |
//! Return the size of Media Object |
| 596 |
//! |
| 597 |
virtual int32_t CalculateMediaObjectSize( |
| 598 |
PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData); |
| 599 |
|
| 600 |
//! |
| 601 |
//! \brief Modify MediaWalker Static Data |
| 602 |
//! \param [in] pRenderingData |
| 603 |
//! Pointer to Rendering Data |
| 604 |
//! \return void |
| 605 |
//! |
| 606 |
virtual void ModifyMediaWalkerStaticData( |
| 607 |
PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData); |
| 608 |
|
| 609 |
//! |
| 610 |
//! \brief Initialize Composite Rendering data |
| 611 |
//! \details Initialize Composite Rendering data, set output area, number of blocks, |
| 612 |
//! Sources, constriction parameters, rendering states, etc. |
| 613 |
//! \param [in] pCompParams |
| 614 |
//! Pointer to Composite parameters |
| 615 |
//! \param [out] pRenderingData |
| 616 |
//! Pointer to Composite Rendering data |
| 617 |
//! \return MOS_STATUS |
| 618 |
//! |
| 619 |
virtual MOS_STATUS RenderInit( |
| 620 |
PVPHAL_COMPOSITE_PARAMS pCompParams, |
| 621 |
PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData); |
| 622 |
|
| 623 |
//! |
| 624 |
//! \brief Release Composite Rendering data |
| 625 |
//! \param [in] pRenderingData |
| 626 |
//! Pointer to Composite Rendering data |
| 627 |
//! \return MOS_STATUS |
| 628 |
//! |
| 629 |
virtual void CleanRenderingData( |
| 630 |
PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData); |
| 631 |
|
| 632 |
//! |
| 633 |
//! \brief Fill in Gen specific static data |
| 634 |
//! \details Fill in Gen specific static data |
| 635 |
//! \param pRenderingData |
| 636 |
//! [in] Pointer to REnder Data |
| 637 |
//! \param pTarget |
| 638 |
//! [in] Pointer to Target Surface |
| 639 |
//! \param pStatic |
| 640 |
//! [in,out] Pointer to Static Data |
| 641 |
//! \return void |
| 642 |
//! |
| 643 |
virtual void SubmitStatesFillGenSpecificStaticData( |
| 644 |
PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData, |
| 645 |
PVPHAL_SURFACE pTarget, |
| 646 |
MEDIA_OBJECT_KA2_STATIC_DATA *pStatic) = 0; |
| 647 |
|
| 648 |
//! |
| 649 |
//! \brief Get Output Surface Chroma sitting position for kernel |
| 650 |
//! \details Get Output Surface Chroma sitting position for kernel |
| 651 |
//! \param pTarget |
| 652 |
//! [in] Pointer to Target Surface |
| 653 |
//! \return DWORD |
| 654 |
//! Return chroma sitting position |
| 655 |
//! |
| 656 |
uint32_t GetOutputChromaSitting( |
| 657 |
PVPHAL_SURFACE pTarget); |
| 658 |
|
| 659 |
//! |
| 660 |
//! \brief Set Surface Compressed Parameters |
| 661 |
//! \details Set Surface Compressed Parameters, and compression mode |
| 662 |
//! \param [in,out] pSource |
| 663 |
//! Pointer to Source Surface |
| 664 |
//! \param [in] isRenderTarget |
| 665 |
//! Render Target or not |
| 666 |
//! \return void |
| 667 |
//! |
| 668 |
virtual void SetSurfaceCompressionParams( |
| 669 |
PVPHAL_SURFACE pSource, |
| 670 |
bool isRenderTarget); |
| 671 |
|
| 672 |
//! |
| 673 |
//! \brief Check NV12 luma key sampler solution is needed or not |
| 674 |
//! \details This func is needed for Gen9 platforms |
| 675 |
//! \param pSrc |
| 676 |
//! [in] Pointer to Source Surface |
| 677 |
//! \param pRenderHal |
| 678 |
//! [in] Pointer to render hal |
| 679 |
//! \return bool |
| 680 |
//! Return TRUE if needed, otherwise FALSE |
| 681 |
//! |
| 682 |
virtual bool IsNV12SamplerLumakeyNeeded(PVPHAL_SURFACE pSrc, PRENDERHAL_INTERFACE pRenderHal) |
| 683 |
{ |
| 684 |
return false; |
| 685 |
} |
| 686 |
|
| 687 |
//! |
| 688 |
//! \brief Check whether parameters for composition valid or not. |
| 689 |
//! \param [in] CompositeParams |
| 690 |
//! Parameters for composition |
| 691 |
//! \return MOS_STATUS |
| 692 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 693 |
//! |
| 694 |
virtual MOS_STATUS IsCompositeParamsValid( |
| 695 |
const VPHAL_COMPOSITE_PARAMS& CompositeParams); |
| 696 |
|
| 697 |
//! |
| 698 |
//! \brief Get Sampler Index associated with a surface state for composite |
| 699 |
//! \param [in] pSurface |
| 700 |
//! point to input Surface |
| 701 |
//! \param [in] pEntry |
| 702 |
//! Pointer to Surface state |
| 703 |
//! \param [out] pSamplerIndex |
| 704 |
//! Pointer to Sampler Index |
| 705 |
//! \param [out] pSamplerType |
| 706 |
//! Pointer to Sampler Type |
| 707 |
//! \return MOS_STATUS |
| 708 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise MOS_STATUS_UNKNOWN |
| 709 |
//! |
| 710 |
virtual MOS_STATUS GetSamplerIndex( |
| 711 |
PVPHAL_SURFACE pSurface, |
| 712 |
PRENDERHAL_SURFACE_STATE_ENTRY pEntry, |
| 713 |
int32_t* pSamplerIndex, |
| 714 |
PMHW_SAMPLER_TYPE pSamplerType); |
| 715 |
|
| 716 |
//! |
| 717 |
//! \brief Update SamplerStateParams associated with a surface state for composite |
| 718 |
//! \param [in] pSamplerStateParams |
| 719 |
//! Pointer to SamplerStateParams |
| 720 |
//! \param [in] pEntry |
| 721 |
//! Pointer to Surface state |
| 722 |
//! \param [in] pRenderData |
| 723 |
//! Pointer to RenderData |
| 724 |
//! \param [in] uLayerNum |
| 725 |
//! Layer total number |
| 726 |
//! \param [in] SamplerFilterMode |
| 727 |
//! SamplerFilterMode to be set |
| 728 |
//! \param [out] pSamplerIndex |
| 729 |
//! Pointer to Sampler Index |
| 730 |
//! \param [out] pSurface |
| 731 |
//! point to Surface |
| 732 |
//! \return MOS_STATUS |
| 733 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise MOS_STATUS_UNKNOWN |
| 734 |
//! |
| 735 |
virtual MOS_STATUS SetSamplerFilterMode( |
| 736 |
PMHW_SAMPLER_STATE_PARAM &pSamplerStateParams, |
| 737 |
PRENDERHAL_SURFACE_STATE_ENTRY pEntry, |
| 738 |
PVPHAL_RENDERING_DATA_COMPOSITE pRenderData, |
| 739 |
uint32_t uLayerNum, |
| 740 |
MHW_SAMPLER_FILTER_MODE SamplerFilterMode, |
| 741 |
int32_t *pSamplerIndex, |
| 742 |
PVPHAL_SURFACE pSource); |
| 743 |
|
| 744 |
//! |
| 745 |
//! \brief Check whether the 3Dsampler use for Y plane |
| 746 |
//! \param [in] SamplerID |
| 747 |
//! sampler ID |
| 748 |
//! \return bool |
| 749 |
//! Return true if the 3Dsampler use for Y plane, otherwise fase |
| 750 |
//! |
| 751 |
virtual bool IsSamplerIDForY( |
| 752 |
int32_t SamplerID); |
| 753 |
|
| 754 |
//! \brief set Sampler status |
| 755 |
//! \param [in] pSurface |
| 756 |
//! point to input Surface |
| 757 |
//! \param [in] Layer |
| 758 |
//! composition layer |
| 759 |
//! \param [in] pStatic |
| 760 |
//! Pointer to static data |
| 761 |
//! \return MOS_STATUS |
| 762 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise MOS_STATUS_UNKNOWN |
| 763 |
//! |
| 764 |
virtual MOS_STATUS Set3DSamplerStatus( |
| 765 |
PVPHAL_SURFACE pSurface, |
| 766 |
uint8_t Layer, |
| 767 |
MEDIA_OBJECT_KA2_STATIC_DATA *pStatic) |
| 768 |
{ |
| 769 |
// Just need the sub class to implement if it is needed; |
| 770 |
return MOS_STATUS_SUCCESS; |
| 771 |
} |
| 772 |
|
| 773 |
//! \brief Update Inline Data status |
| 774 |
//! \param [in] pSurface |
| 775 |
//! point to input Surface |
| 776 |
//! \param [in] pStatic |
| 777 |
//! Pointer to static data |
| 778 |
//! \return MOS_STATUS |
| 779 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise MOS_STATUS_UNKNOWN |
| 780 |
//! |
| 781 |
virtual MOS_STATUS UpdateInlineDataStatus( |
| 782 |
PVPHAL_SURFACE pSurface, |
| 783 |
MEDIA_OBJECT_KA2_STATIC_DATA *pStatic) |
| 784 |
{ |
| 785 |
// Just need the sub class to implement if it is needed; |
| 786 |
return MOS_STATUS_SUCCESS; |
| 787 |
} |
| 788 |
|
| 789 |
MOS_STATUS IntermediateAllocation(PVPHAL_SURFACE &pIntermediate, |
| 790 |
PMOS_INTERFACE pOsInterface, |
| 791 |
uint32_t dwTempWidth, |
| 792 |
uint32_t dwTempHeight, |
| 793 |
PVPHAL_SURFACE pTarget); |
| 794 |
|
| 795 |
//! |
| 796 |
//! \brief Prepare phases for composite and allocate intermediate buffer for rendering |
| 797 |
//! \param [in] pcRenderParams |
| 798 |
//! Pointer to Render parameters |
| 799 |
//! \param [in] ppSources |
| 800 |
//! Pointer to the address of Source Surfaces |
| 801 |
//! \param [in] iSources |
| 802 |
//! Count of Source Surfaces |
| 803 |
//! \return bool |
| 804 |
//! Return true if multiple phases, otherwise false |
| 805 |
//! |
| 806 |
virtual bool PreparePhases( |
| 807 |
PCVPHAL_RENDER_PARAMS pcRenderParams, |
| 808 |
PVPHAL_SURFACE *ppSources, |
| 809 |
int32_t iSources); |
| 810 |
|
| 811 |
//! |
| 812 |
//! \brief Reset composite rendering parameters for the current phase |
| 813 |
//! \param [in,out] pComposite |
| 814 |
//! Pointer to Composite parameters |
| 815 |
//! \return void |
| 816 |
//! |
| 817 |
void ResetCompParams( |
| 818 |
PVPHAL_COMPOSITE_PARAMS pComposite); |
| 819 |
|
| 820 |
//! |
| 821 |
//! \brief Adds a source layer for composite |
| 822 |
//! \param [in,out] pComposite |
| 823 |
//! Pointer to Composite parameters |
| 824 |
//! \param [in] pSource |
| 825 |
//! Pointer to Source Surface |
| 826 |
//! \return bool |
| 827 |
//! Return TURE if source may be processed in the same phase, otherwise false |
| 828 |
//! |
| 829 |
bool AddCompLayer( |
| 830 |
PVPHAL_COMPOSITE_PARAMS pComposite, |
| 831 |
PVPHAL_SURFACE pSource, |
| 832 |
bool bDisableAvsSampler); |
| 833 |
|
| 834 |
//! |
| 835 |
//! \brief Adds render target layer for composite |
| 836 |
//! \param [in,out] pComposite |
| 837 |
//! Pointer to Composite parameters |
| 838 |
//! \param [in] pTarget |
| 839 |
//! Pointer to target surface |
| 840 |
//! \return bool |
| 841 |
//! Return TURE if target may be processed in the same phase, otherwise false |
| 842 |
//! |
| 843 |
bool AddCompTarget( |
| 844 |
PVPHAL_COMPOSITE_PARAMS pComposite, |
| 845 |
PVPHAL_SURFACE pTarget); |
| 846 |
|
| 847 |
//! |
| 848 |
//! \brief set sclaing Ratio |
| 849 |
//! \details set sclaing Ratio for kernels which need to use different kernel to process scaling. |
| 850 |
//! parameters |
| 851 |
//! \param [in,out] Kdll_Scalingratio |
| 852 |
//! Pointer to scaling ratio |
| 853 |
//! \return void |
| 854 |
virtual void SetFilterScalingRatio( |
| 855 |
Kdll_Scalingratio* ScalingRatio) {} |
| 856 |
|
| 857 |
//! |
| 858 |
//! \brief Render Compute Walker Buffer |
| 859 |
//! \details Render Compute Walker Buffer, fill Walker static data fields and set walker |
| 860 |
//! cmd params |
| 861 |
//! \param [in] pBatchBuffer |
| 862 |
//! Pointer to BatchBuffer |
| 863 |
//! \param [in] pRenderingData |
| 864 |
//! Pointer to Rendering Data |
| 865 |
//! \param [in] pWalkerParams |
| 866 |
//! Pointer to Walker parameters |
| 867 |
//! \return bool |
| 868 |
//! Return true if successful, otherwise false |
| 869 |
//! |
| 870 |
virtual bool RenderBufferComputeWalker( |
| 871 |
PMHW_BATCH_BUFFER pBatchBuffer, |
| 872 |
PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData, |
| 873 |
PMHW_GPGPU_WALKER_PARAMS pWalkerParams); |
| 874 |
|
| 875 |
//! |
| 876 |
//! \brief Submit Composite states |
| 877 |
//! \details Submit Composite states, including load CSC matrix, set NLAS Inline data, |
| 878 |
//! set background color, load Palettes, set output format, load kernel, load |
| 879 |
//! curbe data, set sampler state, set VFE State params, and etc |
| 880 |
//! \param [in] pRenderingData |
| 881 |
//! Pointer to Composite state |
| 882 |
//! \return bool |
| 883 |
//! Return TURE if successful, otherwise false |
| 884 |
//! |
| 885 |
virtual bool SubmitStates( |
| 886 |
PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData); |
| 887 |
|
| 888 |
virtual bool IsDisableAVSSampler( |
| 889 |
int32_t iSources, |
| 890 |
bool isTargetY); |
| 891 |
|
| 892 |
//! |
| 893 |
//! \brief Decompress the Surface |
| 894 |
//! \details Decompress the interlaced Surface which is in the RC compression mode |
| 895 |
//! \param [in,out] pSource |
| 896 |
//! Pointer to Source Surface |
| 897 |
//! \return MOS_STATUS |
| 898 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 899 |
//! |
| 900 |
virtual MOS_STATUS DecompressInterlacedSurf(PVPHAL_SURFACE pSource); |
| 901 |
|
| 902 |
private: |
| 903 |
//! |
| 904 |
//! \brief Prepare phases for composite and determine intermediate colorspace |
| 905 |
//! \param [in] pcRenderParams |
| 906 |
//! Pointer to Render parameters |
| 907 |
//! \param [in] ppSources |
| 908 |
//! Pointer to the address of Source Surfaces |
| 909 |
//! \param [in] iSources |
| 910 |
//! Count of Source Surfaces |
| 911 |
//! \return VPHAL_CSPACE |
| 912 |
//! Return intermediate colorspace |
| 913 |
//! |
| 914 |
VPHAL_CSPACE PrepareCSC( |
| 915 |
PCVPHAL_RENDER_PARAMS pcRenderParams, |
| 916 |
PVPHAL_SURFACE *ppSources, |
| 917 |
int32_t iSources); |
| 918 |
|
| 919 |
//! |
| 920 |
//! \brief Composite multiple phase rendering |
| 921 |
//! \details Composite render with multiple phases. In some cases we cannot process composition just in one phase |
| 922 |
//! for example, if the input streams count is 9 (1 primary + 8 substreams), we need to postpone the |
| 923 |
//! 9th stream to next second phase due to the input count limitation of current composition kernel. |
| 924 |
//! \param [in] pcRenderParams |
| 925 |
//! Pointer to VPHAL_RENDER_PARAMS |
| 926 |
//! \param [in] ppSources |
| 927 |
//! Pointer to PVPHAL_SURFACE, array of input surfaces |
| 928 |
//! \param [in] iSources |
| 929 |
//! constant int iSource indicating the size of ppSources |
| 930 |
//! \param [in] pOutput |
| 931 |
//! Pointer to VPHAL_SURFACE, output surface for the overall composition process |
| 932 |
//! \return MOS_STATUS |
| 933 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 934 |
//! |
| 935 |
MOS_STATUS RenderMultiPhase( |
| 936 |
PCVPHAL_RENDER_PARAMS pcRenderParams, |
| 937 |
PVPHAL_SURFACE *ppSources, |
| 938 |
const int32_t iSources, |
| 939 |
PVPHAL_SURFACE pOutput); |
| 940 |
|
| 941 |
//! |
| 942 |
//! \brief Perform multiple layer composite operation in one phase |
| 943 |
//! \details Perform multiple layer composite operation in one phase(scaling, blending, |
| 944 |
//! lumakey, CSC) |
| 945 |
//! \param [in,out] pCompParams |
| 946 |
//! Pointer to Composite parameters |
| 947 |
//! \return MOS_STATUS |
| 948 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 949 |
//! |
| 950 |
MOS_STATUS RenderPhase( |
| 951 |
PVPHAL_COMPOSITE_PARAMS pCompParams); |
| 952 |
|
| 953 |
//! |
| 954 |
//! \brief Set Composite Scaling mode |
| 955 |
//! \param [in,out] pSource |
| 956 |
//! Pointer to Source Surface |
| 957 |
//! \param [in] uSourceCount |
| 958 |
//! Count of Source Surfaces |
| 959 |
//! \return void |
| 960 |
//! |
| 961 |
void SetScalingMode( |
| 962 |
PVPHAL_SURFACE pSource, |
| 963 |
uint32_t uSourceCount); |
| 964 |
|
| 965 |
//! |
| 966 |
//! \brief Judge whether Bob Di should be enabled |
| 967 |
//! \details Judge whether Bob Di should be enabled according to the parameter |
| 968 |
//! of pDeinterlaceParams and the height of the input surface |
| 969 |
//! \param [in] pSrc |
| 970 |
//! Pointer to Source Surface |
| 971 |
//! \return bool |
| 972 |
//! Return true if Bob DI should be enabled, otherwise false |
| 973 |
//! |
| 974 |
virtual bool IsBobDiEnabled(PVPHAL_SURFACE pSrc); |
| 975 |
|
| 976 |
//! |
| 977 |
//! \brief Set Composite Layer |
| 978 |
//! \details Set Composite Layer, including setup surface state and binding table, setup |
| 979 |
//! lumakey parameters, setup samplers, setup alpha blending parameters, adjust |
| 980 |
//! geometry for BOB DI, normalize source co-ordinates, set curbe and inline |
| 981 |
//! data, and etc |
| 982 |
//! \param [in] pRenderingData |
| 983 |
//! Pointer to Composite Rendering data |
| 984 |
//! \param [in] pSource |
| 985 |
//! Pointer to Source Surface |
| 986 |
//! \param [in] iLayerIdInCompParams |
| 987 |
//! Layer id in pCompParams for pSource |
| 988 |
//! \param [in,out] pCompParams |
| 989 |
//! Pointer to Composite parameters |
| 990 |
//! \return int32_t |
| 991 |
//! Return 1 if set layer successful, otherwise -1 |
| 992 |
//! |
| 993 |
int32_t SetLayer( |
| 994 |
PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData, |
| 995 |
PVPHAL_SURFACE pSource, |
| 996 |
int iLayerIdInCompParams, |
| 997 |
PVPHAL_COMPOSITE_PARAMS pCompParams); |
| 998 |
|
| 999 |
//! |
| 1000 |
//! \brief Set Composite Render Target Layer |
| 1001 |
//! \details Set Composite Render Target Layer, setup surface state and binding table |
| 1002 |
//! \param [in] pRenderingData |
| 1003 |
//! Pointer to Composite Rendering data |
| 1004 |
//! \param [in] pCompParams |
| 1005 |
//! Pointer to Composite parameters |
| 1006 |
//! \return int32_t |
| 1007 |
//! Return number of Surface State entries if successful, otherwise -1 |
| 1008 |
//! |
| 1009 |
int32_t SetLayerRT( |
| 1010 |
PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData, |
| 1011 |
PVPHAL_COMPOSITE_PARAMS pCompParams); |
| 1012 |
|
| 1013 |
//! |
| 1014 |
//! \brief Build filter description for dynamic linking |
| 1015 |
//! \details Build filter description(render method, current layer, layer format, layer |
| 1016 |
//! rotation, layer colorspace, sampling mode, scaling mode, luma key, blending, |
| 1017 |
//! colorfill, procamp, CSC) for dynamic linking |
| 1018 |
//! parameters |
| 1019 |
//! \param [in] pCompParams |
| 1020 |
//! Pointer to Composite parameters |
| 1021 |
//! \param [out] pFilter |
| 1022 |
//! Pointer to first filter entry |
| 1023 |
//! \param [out] piFilterSize |
| 1024 |
//! Pointer to filter size |
| 1025 |
//! \return bool |
| 1026 |
//! Return true if successful, otherwise false |
| 1027 |
//! |
| 1028 |
bool BuildFilter( |
| 1029 |
PVPHAL_COMPOSITE_PARAMS pCompParams, |
| 1030 |
PKdll_FilterEntry pFilter, |
| 1031 |
int32_t* piFilterSize); |
| 1032 |
|
| 1033 |
//! |
| 1034 |
//! \brief Render Composite BatchBuffer |
| 1035 |
//! \details Render Composite BatchBuffer, fill Walker static data fields and set walker |
| 1036 |
//! cmd params |
| 1037 |
//! \param [in] pBatchBuffer |
| 1038 |
//! Pointer to BatchBuffer |
| 1039 |
//! \param [in] pRenderingData |
| 1040 |
//! Pointer to Rendering Data |
| 1041 |
//! \param [in] pWalkerParams |
| 1042 |
//! Pointer to Walker parameters |
| 1043 |
//! \return bool |
| 1044 |
//! Return true if successful, otherwise false |
| 1045 |
//! |
| 1046 |
bool RenderBufferMediaWalker( |
| 1047 |
PMHW_BATCH_BUFFER pBatchBuffer, |
| 1048 |
PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData, |
| 1049 |
PMHW_WALKER_PARAMS pWalkerParams); |
| 1050 |
|
| 1051 |
//! |
| 1052 |
//! \brief Judge whether media walker pattern will be vertical or not |
| 1053 |
//! \details if input layer is one , and input is linear format and rotation 90 |
| 1054 |
//! or 270 is needed then the media walker pattern should be vertical |
| 1055 |
//! \param [in] pRenderingData |
| 1056 |
//! Pointer to Rendering Data |
| 1057 |
//! \return bool |
| 1058 |
//! Return true if vertical media pattern used, otherwise false |
| 1059 |
//! |
| 1060 |
bool MediaWalkerVertical( |
| 1061 |
PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData); |
| 1062 |
|
| 1063 |
//! |
| 1064 |
//! \brief Set Surface Parameters |
| 1065 |
//! \details Set Surface Parameters, set flags for RT, set surface type based on scaling |
| 1066 |
//! mode, set interlacing flags, etc. |
| 1067 |
//! \param [in,out] pSource |
| 1068 |
//! Pointer to Source Surface |
| 1069 |
//! \param [out] pSurfaceParams |
| 1070 |
//! Pointer to Surface Parameters |
| 1071 |
//! \return void |
| 1072 |
//! |
| 1073 |
void SetSurfaceParams( |
| 1074 |
PVPHAL_SURFACE pSource, |
| 1075 |
PRENDERHAL_SURFACE_STATE_PARAMS pSurfaceParams); |
| 1076 |
|
| 1077 |
//! |
| 1078 |
//! \brief Allocate Composite BatchBuffer |
| 1079 |
//! \details Allocate Composite BatchBuffer, search from existing BBs for a match. If |
| 1080 |
//! none, allocate new BB |
| 1081 |
//! \param [in] pRenderingData |
| 1082 |
//! Pointer to Rendering Data |
| 1083 |
//! \param [out] ppBatchBuffer |
| 1084 |
//! Pointer to the addr of the available BB. Pointer to nullptr if there's no |
| 1085 |
//! \return MOS_STATUS |
| 1086 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 1087 |
//! |
| 1088 |
MOS_STATUS AllocateBuffer( |
| 1089 |
PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData, |
| 1090 |
PMHW_BATCH_BUFFER *ppBatchBuffer); |
| 1091 |
|
| 1092 |
//! |
| 1093 |
//! \brief Render Composite BatchBuffer |
| 1094 |
//! \details Render Composite BatchBuffer, setup Media Object header and inline data |
| 1095 |
//! \param [in] pBatchBuffer |
| 1096 |
//! Pointer to BatchBuffer |
| 1097 |
//! \param [in] pRenderingData |
| 1098 |
//! Pointer to Rendering Data |
| 1099 |
//! \return bool |
| 1100 |
//! Return true if successful, otherwise false |
| 1101 |
//! |
| 1102 |
bool RenderBuffer( |
| 1103 |
PMHW_BATCH_BUFFER pBatchBuffer, |
| 1104 |
PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData); |
| 1105 |
|
| 1106 |
//! |
| 1107 |
//! \brief Judge whether 8-tap adaptive filter for all channels should be enabled |
| 1108 |
//! \details Judge whether 8-tap adaptive filter for all channels should be enabled according to the input parameter |
| 1109 |
//! \param [in] pSrc |
| 1110 |
//! Pointer to Source Surface |
| 1111 |
//! \param [in] fScaleX |
| 1112 |
//! width scaling ratio |
| 1113 |
//! \param [in] fScaleY |
| 1114 |
//! height scaling ratio |
| 1115 |
//! \return bool |
| 1116 |
//! Return true 8-tap adaptive filter for all channels should be enabled, otherwise false |
| 1117 |
//! |
| 1118 |
bool Is8TapAdaptiveEnabled( |
| 1119 |
PVPHAL_SURFACE pSrc, |
| 1120 |
float fScaleX, |
| 1121 |
float fScaleY); |
| 1122 |
|
| 1123 |
//! |
| 1124 |
//! \brief Initialize Colorfill parameters |
| 1125 |
//! \details Initialize Colorfill parameters |
| 1126 |
//! \return void |
| 1127 |
//! |
| 1128 |
void InitColorFillParams(); |
| 1129 |
|
| 1130 |
//! |
| 1131 |
//! \brief Check if sample unorm being used for source surface. |
| 1132 |
//! \param [in] pCompParams |
| 1133 |
//! Pointer to Composite parameters |
| 1134 |
//! \param pSrc |
| 1135 |
//! [in] Pointer to Source Surface |
| 1136 |
//! \return bool |
| 1137 |
//! Return TRUE if use sample unorm, otherwise FALSE |
| 1138 |
//! |
| 1139 |
bool IsUsingSampleUnorm( |
| 1140 |
PVPHAL_COMPOSITE_PARAMS pCompParams, |
| 1141 |
PVPHAL_SURFACE pSrc); |
| 1142 |
|
| 1143 |
//! |
| 1144 |
//! \brief Check if sampler lumakey being supported or not for source surface. |
| 1145 |
//! \param pSrc |
| 1146 |
//! [in] Pointer to Source Surface |
| 1147 |
//! \return bool |
| 1148 |
//! Return TRUE if support, otherwise FALSE |
| 1149 |
//! |
| 1150 |
bool IsSamplerLumakeySupported(PVPHAL_SURFACE pSrc); |
| 1151 |
|
| 1152 |
//! |
| 1153 |
//! \brief Get intermediate surface output |
| 1154 |
//! \param pOutput |
| 1155 |
//! [in] Pointer to Intermediate Output Surface |
| 1156 |
//! \return PVPHAL_SURFACE |
| 1157 |
//! Return the chose output |
| 1158 |
//! |
| 1159 |
virtual MOS_STATUS GetIntermediateOutput(PVPHAL_SURFACE &output); |
| 1160 |
|
| 1161 |
virtual PVPHAL_SURFACE GetIntermediateSurface(); |
| 1162 |
virtual PVPHAL_SURFACE GetIntermediate1Surface(); |
| 1163 |
virtual PVPHAL_SURFACE GetIntermediate2Surface(); |
| 1164 |
// Procamp |
| 1165 |
int32_t m_iMaxProcampEntries; |
| 1166 |
int32_t m_iProcampVersion; |
| 1167 |
Kdll_Procamp m_Procamp[VPHAL_MAX_PROCAMP]; |
| 1168 |
|
| 1169 |
// Cache attributes |
| 1170 |
VPHAL_COMPOSITE_CACHE_CNTL m_SurfMemObjCtl; |
| 1171 |
|
| 1172 |
bool m_bNullHwRenderComp; //!< Null rendering flag for Composite function |
| 1173 |
|
| 1174 |
bool m_b8TapAdaptiveEnable; //!< 8 tap adaptive filter enable flag, read from user feature key |
| 1175 |
|
| 1176 |
Kdll_FilterDesc m_SearchFilter; |
| 1177 |
Kdll_SearchState m_KernelSearch; |
| 1178 |
int32_t m_ThreadCountPrimary; |
| 1179 |
|
| 1180 |
// CMFC CSC Coefficient surface |
| 1181 |
VPHAL_SURFACE m_CmfcCoeff; |
| 1182 |
RENDERHAL_SURFACE m_RenderHalCmfcCoeff; |
| 1183 |
|
| 1184 |
// Batch buffers |
| 1185 |
int32_t m_iBatchBufferCount; |
| 1186 |
MHW_BATCH_BUFFER m_BatchBuffer[VPHAL_COMP_BUFFERS_MAX]; |
| 1187 |
VPHAL_BATCH_BUFFER_PARAMS m_BufferParam[VPHAL_COMP_BUFFERS_MAX]; |
| 1188 |
|
| 1189 |
// Multiple phase support |
| 1190 |
int32_t m_iCallID; |
| 1191 |
|
| 1192 |
bool m_bLastPhase; //!< Flag for indicating the last Comp render phase |
| 1193 |
|
| 1194 |
protected: |
| 1195 |
|
| 1196 |
// Background Color fill parameters |
| 1197 |
struct |
| 1198 |
{ |
| 1199 |
VPHAL_COLOR_SAMPLE_8 m_csSrc; |
| 1200 |
VPHAL_COLOR_SAMPLE_8 m_csDst; |
| 1201 |
VPHAL_CSPACE m_CSpaceSrc; |
| 1202 |
VPHAL_CSPACE m_CSpaceDst; |
| 1203 |
}; |
| 1204 |
|
| 1205 |
// Feature flags |
| 1206 |
float m_fSamplerLinearBiasX; //!< Linear sampler bias X |
| 1207 |
float m_fSamplerLinearBiasY; //!< Linear sampler bias Y |
| 1208 |
bool m_bFtrMediaWalker; //!< Media Object Walker enabled |
| 1209 |
bool m_bFtrComputeWalker; //!< Compute Walker enabled |
| 1210 |
bool m_bFtrCSCCoeffPatchMode; //!< Set CSC Coeff using patch mode |
| 1211 |
bool m_bSamplerSupportRotation; //!< Use sampler for Rotation |
| 1212 |
bool m_bChromaUpSampling; //!< Chroma Up Sampling needed |
| 1213 |
bool m_bChromaDownSampling; //!< Chroma Down Sampling needed |
| 1214 |
bool m_bFallbackIefPatch; //!< Fall back IEF path from AVS to SFC |
| 1215 |
bool m_bKernelSupportDualOutput; //!< Kernel support Dual Output |
| 1216 |
bool m_bKernelSupportHdcDW; //!< Kernel support HDC direct write |
| 1217 |
bool m_bApplyTwoLayersCompOptimize;//!< Apply 2 layers composition optimization |
| 1218 |
bool m_need3DSampler; //!< If AVS Sampler not avaliable on specific platform, then we need 3D sampler instead |
| 1219 |
bool m_bEnableSamplerLumakey; //!< Enable/Disable sampler lumakey feature. |
| 1220 |
bool m_bYV12iAvsScaling; //!< Interlace AVS scaling support YV12 input format |
| 1221 |
|
| 1222 |
// AVS table |
| 1223 |
MHW_AVS_PARAMS m_AvsParameters; |
| 1224 |
MHW_SAMPLER_AVS_TABLE_PARAM m_mhwSamplerAvsTableParam; //!< params for AVS scaling 8x8 table |
| 1225 |
bool m_bAvsTableCoeffExtraEnabled; //!< Sampler AVS table param, bIsCoeffExtraEnabled |
| 1226 |
bool m_bAvsTableBalancedFilter; //!< Sampler AVS table param, bBalancedFilter |
| 1227 |
|
| 1228 |
static const int AVS_CACHE_SIZE = 4; //!< AVS coefficients cache size |
| 1229 |
AvsCoeffsCache<AVS_CACHE_SIZE> m_AvsCoeffsCache; //!< AVS coefficients calculation is expensive, add cache to mitigate |
| 1230 |
VPHAL_SURFACE m_IntermediateSurface = {}; //!< Intermediate surface (multiple phase / constriction support) |
| 1231 |
VPHAL_SURFACE m_IntermediateSurface1 = {}; //!< Intermediate surface (multiple phase / constriction support) |
| 1232 |
VPHAL_SURFACE *m_Intermediate = nullptr; //!< Intermediate surface (multiple phase / constriction support) |
| 1233 |
VPHAL_SURFACE *m_Intermediate1 = nullptr; //!< Intermediate surface (multiple phase / constriction support) |
| 1234 |
VPHAL_SURFACE *m_Intermediate2 = nullptr; //!< Rotation output intermediate surface |
| 1235 |
VPHAL_SURFACE m_IntermediateSurface2 = {}; //!< Rotation output intermediate surface |
| 1236 |
|
| 1237 |
VPHAL_SURFACE m_AuxiliarySyncSurface = {}; //!< This Auxiliary surface is used to sync engine workload |
| 1238 |
|
| 1239 |
Kdll_State *m_pKernelDllState = nullptr; //!< Compositing Kernel DLL/Search state |
| 1240 |
RENDERHAL_KERNEL_PARAM m_KernelParams = {0}; |
| 1241 |
|
| 1242 |
float m_fScaleX = 1.0f; |
| 1243 |
float m_fScaleY = 1.0f; |
| 1244 |
|
| 1245 |
bool m_FusedEuDispatch = false; |
| 1246 |
}; |
| 1247 |
|
| 1248 |
typedef CompositeState * PCComposite; |
| 1249 |
|
| 1250 |
#endif // __VPHAL_RENDER_COMPOSITE_H__ |