| 1 | /* Copyright (c) 2022-2024, Intel Corporation |
| 2 | * |
| 3 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 4 | * copy of this software and associated documentation files (the "Software"), |
| 5 | * to deal in the Software without restriction, including without limitation |
| 6 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 7 | * and/or sell copies of the Software, and to permit persons to whom the |
| 8 | * Software is furnished to do so, subject to the following conditions: |
| 9 | * |
| 10 | * The above copyright notice and this permission notice shall be included |
| 11 | * in all copies or substantial portions of the Software. |
| 12 | * |
| 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 14 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 16 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 17 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 18 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 19 | * OTHER DEALINGS IN THE SOFTWARE. |
| 20 | */ |
| 21 | //! |
| 22 | //! \file vp_render_sfc_base.h |
| 23 | //! \brief The header file of the base class of SFC rendering component |
| 24 | //! \details The SFC renderer supports Scaling, IEF, CSC/ColorFill and Rotation. |
| 25 | //! It's responsible for setting up HW states and generating the SFC |
| 26 | //! commands. |
| 27 | //! |
| 28 | |
| 29 | #ifndef __VP_RENDER_SFC_BASE_H__ |
| 30 | #define __VP_RENDER_SFC_BASE_H__ |
| 31 | |
| 32 | #include "vp_sfc_common.h" |
| 33 | #include "vp_vebox_common.h" |
| 34 | #include "vp_allocator.h" |
| 35 | #include "media_defs.h" |
| 36 | #include "mhw_sfc_itf.h" |
| 37 | #include "media_feature.h" |
| 38 | |
| 39 | namespace vp { |
| 40 | |
| 41 | class VpIef; |
| 42 | |
| 43 | class SfcRenderBase |
| 44 | { |
| 45 | |
| 46 | public: |
| 47 | SfcRenderBase(VP_MHWINTERFACE &vpMhwinterface, PVpAllocator &allocator, bool disbaleSfcDithering); |
| 48 | virtual ~SfcRenderBase(); |
| 49 | |
| 50 | //! |
| 51 | //! \brief Initialize the object |
| 52 | //! \return MOS_STATUS |
| 53 | //! |
| 54 | virtual MOS_STATUS Init(); |
| 55 | |
| 56 | virtual MOS_STATUS Init(VIDEO_PARAMS& videoParams); |
| 57 | |
| 58 | //! |
| 59 | //! \brief Setup CSC parameters of the SFC State |
| 60 | //! \param [in,out] sfcStateParams |
| 61 | //! Pointer to SFC_STATE params |
| 62 | //! \param [out] iEFStateParams |
| 63 | //! MHW IEF state params |
| 64 | //! \return void |
| 65 | //! |
| 66 | virtual MOS_STATUS SetIefStateCscParams( |
| 67 | mhw::sfc::SFC_STATE_PAR *pSfcStateParams, |
| 68 | mhw::sfc::SFC_IEF_STATE_PAR *pIEFStateParams); |
| 69 | |
| 70 | //! |
| 71 | //! \brief Setup parameters related to SFC_IEF State |
| 72 | //! \details Setup the IEF and CSC params of the SFC_IEF State |
| 73 | //! \param [in,out] sfcStateParams |
| 74 | //! Pointer to SFC_STATE params |
| 75 | //! \return void |
| 76 | //! |
| 77 | virtual MOS_STATUS SetIefStateParams( |
| 78 | mhw::sfc::SFC_STATE_PAR *pSfcStateParams); |
| 79 | |
| 80 | //! |
| 81 | //! \brief Setup parameters related to SFC_AVS State |
| 82 | //! \details Setup the 8x8 table of SFC sampler |
| 83 | //! \return MOS_STATUS |
| 84 | //! |
| 85 | virtual MOS_STATUS SetAvsStateParams(); |
| 86 | |
| 87 | //! |
| 88 | //! \brief Send SFC pipe commands |
| 89 | //! \details Register the surfaces and send the commands needed by SFC pipe |
| 90 | //! \param [in] pRenderData |
| 91 | //! Pointer to Vebox Render data |
| 92 | //! \param [in,out] pCmdBuffer |
| 93 | //! Pointer to command buffer |
| 94 | //! \return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 95 | //! |
| 96 | virtual MOS_STATUS SendSfcCmd( |
| 97 | bool bOutputToMemory, |
| 98 | PMOS_COMMAND_BUFFER pCmdBuffer); |
| 99 | |
| 100 | //! |
| 101 | //! \brief Setup SFC states and parameters |
| 102 | //! \details Setup SFC states and parameters including SFC State, AVS |
| 103 | //! and IEF parameters |
| 104 | //! \param [in] targetSurface |
| 105 | //! Pointer to Output Surface |
| 106 | //! \return Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 107 | //! |
| 108 | virtual MOS_STATUS SetupSfcState(PVP_SURFACE targetSurface); |
| 109 | |
| 110 | virtual MOS_STATUS UpdateCscParams(FeatureParamCsc &cscParams); |
| 111 | |
| 112 | //! |
| 113 | //! \brief check whether SFC Write have offset which may hit compresed write limitation |
| 114 | //! \details check whether SFC Write have offset which may hit compresed write limitation |
| 115 | //! \param [in] targetSurface |
| 116 | //! Pointer to targetSurface |
| 117 | //! \return the output pipe compression state |
| 118 | //! |
| 119 | virtual bool IsSFCUncompressedWriteNeeded(PVP_SURFACE targetSurface) |
| 120 | { |
| 121 | VP_FUNC_CALL(); |
| 122 | return false; |
| 123 | } |
| 124 | |
| 125 | //! |
| 126 | //! \brief Set scaling parameters |
| 127 | //! \details Set scaling parameters |
| 128 | //! \param [in] scalingParams |
| 129 | //! Scaling parameters |
| 130 | //! \return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 131 | //! |
| 132 | virtual MOS_STATUS SetScalingParams(PSFC_SCALING_PARAMS scalingParams); |
| 133 | |
| 134 | //! |
| 135 | //! \brief Set csc parameters |
| 136 | //! \details Set csc parameters |
| 137 | //! \param [in] cscParams |
| 138 | //! Csc parameters |
| 139 | //! \return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 140 | //! |
| 141 | virtual MOS_STATUS SetCSCParams(PSFC_CSC_PARAMS cscParams); |
| 142 | |
| 143 | //! |
| 144 | //! \brief Set rotation and mirror parameters |
| 145 | //! \details Set rotation and mirror parameters |
| 146 | //! \param [in] rotMirParams |
| 147 | //! rotation and mirror parameters |
| 148 | //! \return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 149 | //! |
| 150 | virtual MOS_STATUS SetRotMirParams(PSFC_ROT_MIR_PARAMS rotMirParams); |
| 151 | |
| 152 | //! |
| 153 | //! \brief Set mmc parameters |
| 154 | //! \details Set mmc parameters |
| 155 | //! \param [in] renderTarget |
| 156 | //! render target surface |
| 157 | //! \param [in] isFormatMmcSupported |
| 158 | //! Is format supported by mmc |
| 159 | //! \param [in] isMmcEnabled |
| 160 | //! Is mmc enabled |
| 161 | //! \return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 162 | //! |
| 163 | virtual MOS_STATUS SetMmcParams(PMOS_SURFACE renderTarget, bool isFormatMmcSupported, bool isMmcEnabled); |
| 164 | |
| 165 | //! |
| 166 | //! \brief Check whether VDBOX-SFC Input Format Supported |
| 167 | //! \details Check whether VDBOX-SFC Input Format Supported. |
| 168 | //! \param codecStandard |
| 169 | //! [in] Codec Standard. |
| 170 | //! \param inputFormat |
| 171 | //! [in] Format of Input Frame |
| 172 | //! \return bool |
| 173 | //! Return true if supported, otherwise failed |
| 174 | //! |
| 175 | virtual bool IsVdboxSfcInputFormatSupported( |
| 176 | CODECHAL_STANDARD codecStandard, |
| 177 | MOS_FORMAT inputFormat); |
| 178 | |
| 179 | //! |
| 180 | //! \brief Check whether VDBOX-SFC Output Format Supported |
| 181 | //! \details Check whether VDBOX-SFC Output Format Supported. |
| 182 | //! \param codecStandard |
| 183 | //! [in] Codec Standard. |
| 184 | //! \param outputFormat |
| 185 | //! [in] Format of Output Frame |
| 186 | //! \return bool |
| 187 | //! Return true if supported, otherwise failed |
| 188 | //! |
| 189 | virtual bool IsVdboxSfcOutputFormatSupported( |
| 190 | CODECHAL_STANDARD codecStandard, |
| 191 | MOS_FORMAT outputFormat, |
| 192 | MOS_TILE_TYPE tileType); |
| 193 | |
| 194 | bool IsCSC() { return m_renderData.bCSC; } |
| 195 | bool IsScaling() { return m_renderData.bScaling; } |
| 196 | |
| 197 | //! |
| 198 | //! \brief Get Sfc's input format |
| 199 | //! \return MOS_FORMAT |
| 200 | //! |
| 201 | MOS_FORMAT GetInputFormat() |
| 202 | { |
| 203 | return m_renderData.SfcInputFormat; |
| 204 | } |
| 205 | |
| 206 | MOS_STATUS SetIefObj(VpIef *iefObj) |
| 207 | { |
| 208 | VP_PUBLIC_CHK_NULL_RETURN(iefObj); |
| 209 | m_iefObj = iefObj; |
| 210 | return MOS_STATUS_SUCCESS; |
| 211 | } |
| 212 | |
| 213 | PVPHAL_IEF_PARAMS GetIefParams() |
| 214 | { |
| 215 | return m_renderData.pIefParams; |
| 216 | } |
| 217 | |
| 218 | MOS_STATUS SetHistogramBuf(PMOS_BUFFER histogramBuf); |
| 219 | |
| 220 | //! |
| 221 | //! \brief Set sfc pipe selected with vebox |
| 222 | //! \details Set sfc pipe selected with vebox |
| 223 | //! \param [in] dwSfcPipe |
| 224 | //! Sfc pipe selected with vebox |
| 225 | //! \param [in] dwSfcNum |
| 226 | //! Sfc pipe num in total |
| 227 | //! \return MOS_STATUS |
| 228 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 229 | virtual MOS_STATUS SetSfcPipe(uint32_t dwSfcPipe, uint32_t dwSfcNum) |
| 230 | { |
| 231 | MOS_STATUS eStatus = MOS_STATUS_UNKNOWN; |
| 232 | MOS_UNUSED(dwSfcPipe); |
| 233 | MOS_UNUSED(dwSfcNum); |
| 234 | return eStatus; |
| 235 | } |
| 236 | |
| 237 | virtual MOS_STATUS UpdateIefParams(PVPHAL_IEF_PARAMS iefParams); |
| 238 | |
| 239 | protected: |
| 240 | //! |
| 241 | //! \brief Initialize SfcState parameters |
| 242 | //! \return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 243 | //! |
| 244 | virtual MOS_STATUS InitSfcStateParams() = 0; |
| 245 | |
| 246 | //! |
| 247 | //! \brief Set SFC input chroma subsampling |
| 248 | //! \details Set SFC input chroma subsampling according to |
| 249 | //! pipe mode |
| 250 | //! \param [out] sfcStateParams |
| 251 | //! Pointer to SFC state params |
| 252 | //! \return MOS_STATUS |
| 253 | //! |
| 254 | virtual MOS_STATUS SetSfcStateInputChromaSubSampling( |
| 255 | mhw::sfc::SFC_STATE_PAR *pSfcStateParams); |
| 256 | |
| 257 | //! |
| 258 | //! \brief Set SFC input ordering mode |
| 259 | //! \details SFC input ordering mode according to |
| 260 | //! pipe mode |
| 261 | //! \param [out] sfcStateParams |
| 262 | //! Pointer to SFC_STATE params |
| 263 | //! \return MOS_STATUS |
| 264 | //! |
| 265 | virtual MOS_STATUS SetSfcStateInputOrderingMode( |
| 266 | mhw::sfc::SFC_STATE_PAR *pSfcStateParams); |
| 267 | virtual MOS_STATUS SetSfcStateInputOrderingModeJpeg( |
| 268 | mhw::sfc::SFC_STATE_PAR *pSfcStateParams); |
| 269 | virtual MOS_STATUS SetSfcStateInputOrderingModeVdbox( |
| 270 | mhw::sfc::SFC_STATE_PAR *pSfcStateParams); |
| 271 | virtual MOS_STATUS SetSfcStateInputOrderingModeHcp( |
| 272 | mhw::sfc::SFC_STATE_PAR *pSfcStateParams); |
| 273 | |
| 274 | //! |
| 275 | //! \brief Set codec pipe mode |
| 276 | //! \details Set codec pipe mode |
| 277 | //! \param [in] codecStandard |
| 278 | //! codec standard |
| 279 | //! \return MOS_STATUS |
| 280 | virtual MOS_STATUS SetCodecPipeMode(CODECHAL_STANDARD codecStandard); |
| 281 | //! |
| 282 | //! \brief Setup ColorFill parameters |
| 283 | //! \details Setup ColorFill parameters |
| 284 | //! \param [in] sfcStateParams |
| 285 | //! Pointer to SFC_STATE params |
| 286 | //! \return void |
| 287 | void SetColorFillParams( |
| 288 | mhw::sfc::SFC_STATE_PAR *pSfcStateParams); |
| 289 | |
| 290 | //! |
| 291 | //! \brief Setup Rotation and Mirrow params |
| 292 | //! \details Setup Rotation and Mirrow params |
| 293 | //! \param [in,out] sfcStateParams |
| 294 | //! Pointer to SFC_STATE params |
| 295 | //! \return void |
| 296 | //! |
| 297 | void SetRotationAndMirrowParams( |
| 298 | mhw::sfc::SFC_STATE_PAR *pSfcStateParams); |
| 299 | |
| 300 | //! |
| 301 | //! \brief Setup Chromasting params |
| 302 | //! \details Setup Chromasting params |
| 303 | //! \param [in,out] sfcStateParams |
| 304 | //! Pointer to SFC_STATE params |
| 305 | //! \return void |
| 306 | //! |
| 307 | void SetChromasitingParams( |
| 308 | mhw::sfc::SFC_STATE_PAR *pSfcStateParams); |
| 309 | |
| 310 | //! |
| 311 | //! \brief Setup Bypass X & Y AdaptiveFilter params |
| 312 | //! \details Setup Bypass X & Y AdaptiveFilter params |
| 313 | //! \param [in,out] sfcStateParams |
| 314 | //! Pointer to SFC_STATE params |
| 315 | //! \return void |
| 316 | //! |
| 317 | void SetXYAdaptiveFilter( |
| 318 | mhw::sfc::SFC_STATE_PAR *pSfcStateParams); |
| 319 | |
| 320 | //! |
| 321 | //! \brief Setup RGB Adaptive params |
| 322 | //! \details Setup RGB Adaptive params |
| 323 | //! \param [in,out] sfcStateParams |
| 324 | //! Pointer to SFC_STATE params |
| 325 | //! \return void |
| 326 | //! |
| 327 | void SetRGBAdaptive( |
| 328 | mhw::sfc::SFC_STATE_PAR *pSfcStateParams); |
| 329 | |
| 330 | //! |
| 331 | //! \brief Initialize SFC Output Surface Command parameters |
| 332 | //! \details Initialize MHW SFC Output Surface Command parameters from SFC Pipe output Surface |
| 333 | //! \param [in] pSfcPipeOutSurface |
| 334 | //! pointer to SFC Pipe output Surface |
| 335 | //! \param [out] pMhwOutSurfParams |
| 336 | //! pointer to SFC Output Surface Command parameters |
| 337 | //! \return MOS_STATUS |
| 338 | //! |
| 339 | MOS_STATUS InitMhwOutSurfParams( |
| 340 | PVP_SURFACE pSfcPipeOutSurface, |
| 341 | PMHW_SFC_OUT_SURFACE_PARAMS pMhwOutSurfParams); |
| 342 | |
| 343 | //! |
| 344 | //! \brief Initialize AVS parameters shared by Renderers |
| 345 | //! \details Initialize the members of the AVS parameter and allocate memory for its coefficient tables |
| 346 | //! \param [in,out] pAVS_Params |
| 347 | //! Pointer to MHW AVS parameter |
| 348 | //! \param [in] uiYCoeffTableSize |
| 349 | //! Size of the Y coefficient table |
| 350 | //! \param [in] uiUVCoeffTableSize |
| 351 | //! Size of the UV coefficient table |
| 352 | //! \return void |
| 353 | //! |
| 354 | //! |
| 355 | void InitAVSParams( |
| 356 | PMHW_AVS_PARAMS pAVS_Params, |
| 357 | uint32_t uiYCoeffTableSize, |
| 358 | uint32_t uiUVCoeffTableSize); |
| 359 | |
| 360 | //! |
| 361 | //! \brief Destroy AVS parameters shared by Renderers |
| 362 | //! \details Free the memory of AVS parameter's coefficient tables |
| 363 | //! \param [in,out] pAVS_Params |
| 364 | //! Pointer to VPHAL AVS parameter |
| 365 | //! \return void |
| 366 | //! |
| 367 | void DestroyAVSParams( |
| 368 | PMHW_AVS_PARAMS pAVS_Params); |
| 369 | |
| 370 | //! |
| 371 | //! \brief Get Avs line buffer size |
| 372 | //! \details Get Avs line buffer size according to height of input surface |
| 373 | //! \param [in] lineTiledBuffer |
| 374 | //! ture if avs line tile buffer, otherwise, avs line buffer. |
| 375 | //! \param [in] b8tapChromafiltering |
| 376 | //! ture if 8-tap UV, otherwise, 4-tap UV. |
| 377 | //! \param [in] width |
| 378 | //! The width of input surface |
| 379 | //! \param [in] height |
| 380 | //! The height of input surface |
| 381 | //! \return uint32_t |
| 382 | //! |
| 383 | uint32_t GetAvsLineBufferSize(bool lineTiledBuffer, bool b8tapChromafiltering, uint32_t width, uint32_t height); |
| 384 | |
| 385 | //! |
| 386 | //! \brief Get Ief line buffer size |
| 387 | //! \details Get Ief line buffer size according to height of scaled surface |
| 388 | //! \param [in] lineTiledBuffer |
| 389 | //! ture if ief line tile buffer, otherwise, ief line buffer. |
| 390 | //! \param [in] heightOutput |
| 391 | //! The height of output surface |
| 392 | //! \return uint32_t |
| 393 | //! |
| 394 | uint32_t GetIefLineBufferSize(bool lineTiledBuffer, uint32_t heightOutput); |
| 395 | |
| 396 | //! |
| 397 | //! \brief Get Sfd line buffer size |
| 398 | //! \details Get Sfd line buffer size according to height of scaled surface |
| 399 | //! \param [in] lineTiledBuffer |
| 400 | //! ture if sdf line tile buffer, otherwise, sdf line buffer. |
| 401 | //! \param [in] formatOutput |
| 402 | //! format of output surface. |
| 403 | //! \param [in] widthOutput |
| 404 | //! The width of input surface |
| 405 | //! \param [in] heightOutput |
| 406 | //! The height of input surface |
| 407 | //! \return uint32_t |
| 408 | //! |
| 409 | virtual uint32_t GetSfdLineBufferSize(bool lineTiledBuffer, MOS_FORMAT formatOutput, uint32_t widthOutput, uint32_t heightOutput); |
| 410 | |
| 411 | //! |
| 412 | //! \brief Allocate line buffer |
| 413 | //! \details Allocate line buffer |
| 414 | //! \param [in/out] lineBuffer |
| 415 | //! pointer to line buffer. |
| 416 | //! \param [in] size |
| 417 | //! size of line buffer. |
| 418 | //! \param [in] bufName |
| 419 | //! name of line buffer. |
| 420 | //! \return MOS_STATUS |
| 421 | //! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 422 | //! |
| 423 | MOS_STATUS AllocateLineBuffer(VP_SURFACE *&lineBuffer, uint32_t size, const char *bufName); |
| 424 | |
| 425 | //! |
| 426 | //! \brief Allocate line buffer array |
| 427 | //! \details Allocate line buffer |
| 428 | //! \param [in/out] lineBufferArray |
| 429 | //! pointer to line buffer. |
| 430 | //! \param [in] size |
| 431 | //! size of line buffer. |
| 432 | //! \param [in] bufName |
| 433 | //! name of line buffer. |
| 434 | //! \return MOS_STATUS |
| 435 | //! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 436 | //! |
| 437 | MOS_STATUS AllocateLineBufferArray(VP_SURFACE **&lineBufferArray, uint32_t size, const char *bufName); |
| 438 | |
| 439 | //! |
| 440 | //! \brief Destroy line buffer array |
| 441 | //! \details Allocate line buffer |
| 442 | //! \param [in/out] lineBufferArray |
| 443 | //! pointer to line buffer. |
| 444 | //! \param [in] count |
| 445 | //! count of line buffer. |
| 446 | //! \return MOS_STATUS |
| 447 | //! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 448 | //! |
| 449 | MOS_STATUS DestroyLineBufferArray(VP_SURFACE **&lineBufferArray, int32_t count); |
| 450 | |
| 451 | //! |
| 452 | //! \brief Allocate Resources for SFC Pipe |
| 453 | //! \details Allocate the AVS and IEF line buffer surfaces for SFC |
| 454 | //! \return Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 455 | //! |
| 456 | virtual MOS_STATUS AllocateResources(); |
| 457 | |
| 458 | //! |
| 459 | //! \brief SFC free resources |
| 460 | //! \details Free resources that are used in Vebox |
| 461 | //! \return MOS_STATUS |
| 462 | //! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 463 | //! |
| 464 | virtual MOS_STATUS FreeResources(); |
| 465 | |
| 466 | virtual MOS_STATUS AddSfcLock( |
| 467 | PMOS_COMMAND_BUFFER pCmdBuffer, |
| 468 | mhw::sfc::SFC_LOCK_PAR *pSfcLockParams); |
| 469 | |
| 470 | //! |
| 471 | //! \brief Set resource of line buffer |
| 472 | //! \details Set resource of line buffer |
| 473 | //! \param [out] osResLineBuffer |
| 474 | //! resource to be set |
| 475 | //! \param [in] lineBuffer |
| 476 | //! pointer to line buffer |
| 477 | //! \return MOS_STATUS |
| 478 | //! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 479 | //! |
| 480 | MOS_STATUS SetLineBuffer(PMOS_RESOURCE &osResLineBuffer, VP_SURFACE *lineBuffer); |
| 481 | |
| 482 | virtual MOS_STATUS SetupScalabilityParams() = 0; |
| 483 | virtual bool IsInputChannelSwapNeeded(MOS_FORMAT inputFormat); |
| 484 | virtual bool IsOutputChannelSwapNeeded(MOS_FORMAT outputFormat) = 0; |
| 485 | virtual bool IsCscNeeded(SFC_CSC_PARAMS &cscParams) = 0; |
| 486 | |
| 487 | virtual MOS_STATUS AddSfcState( |
| 488 | PMOS_COMMAND_BUFFER pCmdBuffer, |
| 489 | mhw::sfc::SFC_STATE_PAR *pSfcStateParams, |
| 490 | PMHW_SFC_OUT_SURFACE_PARAMS pOutSurface); |
| 491 | |
| 492 | virtual MOS_STATUS AddSfcAvsState( |
| 493 | PMOS_COMMAND_BUFFER pCmdBuffer); |
| 494 | |
| 495 | virtual MOS_STATUS AddSfcIefState( |
| 496 | PMOS_COMMAND_BUFFER pCmdBuffer); |
| 497 | |
| 498 | virtual MOS_STATUS AddSfcAvsLumaTable( |
| 499 | PMOS_COMMAND_BUFFER pCmdBuffer); |
| 500 | |
| 501 | virtual MOS_STATUS AddSfcAvsChromaTable( |
| 502 | PMOS_COMMAND_BUFFER pCmdBuffer); |
| 503 | |
| 504 | virtual MOS_STATUS AddSfcFrameStart( |
| 505 | PMOS_COMMAND_BUFFER pCmdBuffer, |
| 506 | uint8_t sfcPipeMode); |
| 507 | |
| 508 | virtual MOS_STATUS SetSfcAVSScalingMode( |
| 509 | MHW_SCALING_MODE ScalingMode); |
| 510 | |
| 511 | virtual MOS_STATUS SetSfcSamplerTable( |
| 512 | mhw::sfc::SFC_AVS_LUMA_Coeff_Table_PAR *pLumaTable, |
| 513 | mhw::sfc::SFC_AVS_CHROMA_Coeff_Table_PAR *pChromaTable, |
| 514 | PMHW_AVS_PARAMS pAvsParams, |
| 515 | MOS_FORMAT SrcFormat, |
| 516 | float fScaleX, |
| 517 | float fScaleY, |
| 518 | uint32_t dwChromaSiting, |
| 519 | bool bUse8x8Filter, |
| 520 | float fHPStrength, |
| 521 | float fLanczosT); |
| 522 | |
| 523 | protected: |
| 524 | |
| 525 | // HW intface to access MHW |
| 526 | PMOS_INTERFACE m_osInterface = nullptr; |
| 527 | std::shared_ptr<mhw::sfc::Itf> m_sfcItf = nullptr; |
| 528 | std::shared_ptr<mhw::mi::Itf> m_miItf = nullptr; |
| 529 | MEDIA_FEATURE_TABLE *m_skuTable = nullptr; |
| 530 | MEDIA_WA_TABLE *m_waTable = nullptr; |
| 531 | |
| 532 | // AVS related params |
| 533 | MHW_AVS_PARAMS m_AvsParameters = {}; //!< AVS parameters |
| 534 | VPHAL_SFC_AVS_STATE m_avsState = {}; //!< AVS State and Coeff. table |
| 535 | static const uint32_t k_YCoefficientTableSize = 256 * sizeof(int32_t); |
| 536 | static const uint32_t k_UVCoefficientTableSize = 128 * sizeof(int32_t); |
| 537 | |
| 538 | mhw::sfc::SFC_STATE_PAR *m_sfcStateParams = nullptr; //!< Pointer to sfc state parameters |
| 539 | VP_SFC_RENDER_DATA m_renderData = {}; //!< Transient Render data populated for every BLT call |
| 540 | //VP_SFC_RENDER_DATA *m_renderData = nullptr; //!< Transient Render data populated for every BLT call |
| 541 | |
| 542 | VPHAL_CSPACE m_cscRTCspace = {}; //!< Cspace of Render Target |
| 543 | VPHAL_CSPACE m_cscInputCspace = {}; //!< Cspace of input frame |
| 544 | bool m_cscInputSwapNeeded = false; |
| 545 | |
| 546 | mhw::sfc::SFC_IEF_STATE_PAR m_IefStateParams = {}; //!< IEF Params state |
| 547 | float m_cscCoeff[9] = {}; //!< [3x3] Coeff matrix |
| 548 | float m_cscInOffset[3] = {}; //!< [3x1] Input Offset matrix |
| 549 | float m_cscOutOffset[3] = {}; //!< [3x1] Output Offset matrix |
| 550 | uint32_t m_currentChannel = 0; //!< 0=StereoLeft or nonStereo, 1=StereoRight. N/A in nonStereo |
| 551 | |
| 552 | VP_SURFACE **m_AVSLineBufferSurfaceArray = nullptr; //!< AVS Line Buffer Surface for SFC |
| 553 | VP_SURFACE **m_IEFLineBufferSurfaceArray = nullptr; //!< IEF Line Buffer Surface for SFC |
| 554 | VP_SURFACE **m_SFDLineBufferSurfaceArray = nullptr; //!< SFD Line Buffer Surface for SFC |
| 555 | |
| 556 | VP_SURFACE *m_AVSLineTileBufferSurface = nullptr; //!< AVS Line Tile Buffer Surface for SFC |
| 557 | VP_SURFACE *m_IEFLineTileBufferSurface = nullptr; //!< IEF Line Tile Buffer Surface for SFC |
| 558 | VP_SURFACE *m_SFDLineTileBufferSurface = nullptr; //!< SFD Line Tile Buffer Surface for SFC |
| 559 | |
| 560 | // Allocator interface |
| 561 | PVpAllocator m_allocator = nullptr; //!< vp pipeline allocator |
| 562 | VpIef *m_iefObj = nullptr; |
| 563 | uint8_t m_pipeMode = MhwSfcInterface::SFC_PIPE_MODE_VEBOX; //!< which FE engine pipe used |
| 564 | |
| 565 | bool m_bVdboxToSfc = false; |
| 566 | VIDEO_PARAMS m_videoConfig = {}; |
| 567 | |
| 568 | int m_lineBufferAllocatedInArray = 1; //!< Line buffer allocated in array |
| 569 | |
| 570 | SCALABILITY_PARAMS m_scalabilityParams = {}; |
| 571 | |
| 572 | MOS_SURFACE m_histogramSurf = {}; //!< Histogram buffer |
| 573 | |
| 574 | MHW_SFC_OUT_SURFACE_PARAMS m_outSurfaceParam = {}; |
| 575 | |
| 576 | bool m_disableSfcDithering = false; |
| 577 | |
| 578 | VP_SURFACE **m_AVSLineBufferSurfaceArrayfor1stPassofSfc2Pass = nullptr; //!< AVS Line Buffer Surface for SFC 1st Pass of Sfc 2Pass |
| 579 | VP_SURFACE **m_IEFLineBufferSurfaceArrayfor1stPassofSfc2Pass = nullptr; //!< IEF Line Buffer Surface for SFC 1st Pass of Sfc 2Pass |
| 580 | VP_SURFACE **m_SFDLineBufferSurfaceArrayfor1stPassofSfc2Pass = nullptr; //!< SFD Line Buffer Surface for SFC 1st Pass of Sfc 2Pass |
| 581 | int m_lineBufferAllocatedInArrayfor1stPassofSfc2Pass = 1; //!< Line buffer allocated in array for SFC 1st Pass of Sfc 2Pass |
| 582 | |
| 583 | MEDIA_CLASS_DEFINE_END(vp__SfcRenderBase) |
| 584 | }; |
| 585 | |
| 586 | |
| 587 | } |
| 588 | #endif // !__VP_RENDER_SFC_BASE_H__ |