| 1 |
/* |
| 2 |
* Copyright (c) 2018-2022, 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 vp_pipeline.h |
| 24 |
//! \brief Defines the interfaces for vp pipeline |
| 25 |
//! this file is for the base interface which is shared by all features. |
| 26 |
//! |
| 27 |
|
| 28 |
#ifndef __VP_PIPELINE_H__ |
| 29 |
#define __VP_PIPELINE_H__ |
| 30 |
|
| 31 |
#include <map> |
| 32 |
#include "media_pipeline.h" |
| 33 |
#include "vp_filter.h" |
| 34 |
#include "vp_pipeline_common.h" |
| 35 |
#include "vp_utils.h" |
| 36 |
#include "vp_allocator.h" |
| 37 |
#include "vp_status_report.h" |
| 38 |
#include "vp_dumper.h" |
| 39 |
#include "vp_debug_interface.h" |
| 40 |
#include "vp_feature_manager.h" |
| 41 |
#include "vp_packet_shared_context.h" |
| 42 |
#include "vp_kernelset.h" |
| 43 |
#include "vp_packet_reuse_manager.h" |
| 44 |
#include "vp_graphset.h" |
| 45 |
#include "vp_graph_manager.h" |
| 46 |
|
| 47 |
namespace vp |
| 48 |
{ |
| 49 |
|
| 50 |
class PacketFactory; |
| 51 |
class PacketPipeFactory; |
| 52 |
class VpResourceManager; |
| 53 |
class SwFilterFeatureHandler; |
| 54 |
|
| 55 |
enum PIPELINE_PARAM_TYPE |
| 56 |
{ |
| 57 |
PIPELINE_PARAM_TYPE_LEGACY = 1, |
| 58 |
PIPELINE_PARAM_TYPE_MEDIA_SFC_INTERFACE, |
| 59 |
}; |
| 60 |
|
| 61 |
struct VP_PARAMS |
| 62 |
{ |
| 63 |
PIPELINE_PARAM_TYPE type; |
| 64 |
union |
| 65 |
{ |
| 66 |
PVP_PIPELINE_PARAMS renderParams; |
| 67 |
VEBOX_SFC_PARAMS *sfcParams; |
| 68 |
}; |
| 69 |
}; |
| 70 |
|
| 71 |
class VpPipelineParamFactory |
| 72 |
{ |
| 73 |
public: |
| 74 |
VpPipelineParamFactory(){}; |
| 75 |
virtual ~VpPipelineParamFactory() |
| 76 |
{ |
| 77 |
while (!m_Pool.empty()) |
| 78 |
{ |
| 79 |
PVP_PIPELINE_PARAMS param = m_Pool.back(); |
| 80 |
m_Pool.pop_back(); |
| 81 |
MOS_Delete(param); |
| 82 |
} |
| 83 |
} |
| 84 |
|
| 85 |
virtual PVP_PIPELINE_PARAMS Clone(PVP_PIPELINE_PARAMS param) |
| 86 |
{ |
| 87 |
PVP_PIPELINE_PARAMS paramDst = nullptr; |
| 88 |
|
| 89 |
if (m_Pool.empty()) |
| 90 |
{ |
| 91 |
paramDst = MOS_New(VP_PIPELINE_PARAMS); |
| 92 |
*paramDst = *param; |
| 93 |
} |
| 94 |
else |
| 95 |
{ |
| 96 |
paramDst = m_Pool.back(); |
| 97 |
if (paramDst) |
| 98 |
{ |
| 99 |
m_Pool.pop_back(); |
| 100 |
*paramDst = *param; |
| 101 |
} |
| 102 |
} |
| 103 |
return paramDst; |
| 104 |
} |
| 105 |
|
| 106 |
virtual MOS_STATUS Destroy(PVP_PIPELINE_PARAMS ¶m) |
| 107 |
{ |
| 108 |
if (param == nullptr) |
| 109 |
{ |
| 110 |
return MOS_STATUS_SUCCESS; |
| 111 |
} |
| 112 |
m_Pool.push_back(param); |
| 113 |
param = nullptr; |
| 114 |
return MOS_STATUS_SUCCESS; |
| 115 |
} |
| 116 |
|
| 117 |
std::vector<PVP_PIPELINE_PARAMS> m_Pool; |
| 118 |
|
| 119 |
MEDIA_CLASS_DEFINE_END(vp__VpPipelineParamFactory) |
| 120 |
}; |
| 121 |
|
| 122 |
class VpPipeline : public MediaPipeline |
| 123 |
{ |
| 124 |
public: |
| 125 |
VpPipeline(PMOS_INTERFACE osInterface); |
| 126 |
|
| 127 |
virtual ~VpPipeline(); |
| 128 |
|
| 129 |
//! |
| 130 |
//! \brief Initialize the vp pipeline |
| 131 |
//! \param [in] mhwInterface |
| 132 |
//! Pointer to VP_MHWINTERFACE |
| 133 |
//! \return MOS_STATUS |
| 134 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 135 |
//! |
| 136 |
virtual MOS_STATUS Init(void *mhwInterface) override; |
| 137 |
|
| 138 |
//! |
| 139 |
//! \brief Prepare interal parameters, should be invoked for each frame |
| 140 |
//! \param [in] params |
| 141 |
//! Pointer to the input parameters |
| 142 |
//! \return MOS_STATUS |
| 143 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 144 |
//! |
| 145 |
virtual MOS_STATUS Prepare(void *params) override; |
| 146 |
|
| 147 |
//! |
| 148 |
//! \brief Finish the execution for each frame |
| 149 |
//! \return MOS_STATUS |
| 150 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 151 |
//! |
| 152 |
virtual MOS_STATUS Execute() override; |
| 153 |
|
| 154 |
//! |
| 155 |
//! \brief Get media pipeline execution status |
| 156 |
//! \param [out] status |
| 157 |
//! The point to encode status |
| 158 |
//! \param [in] numStatus |
| 159 |
//! The requested number of status reports |
| 160 |
//! \return MOS_STATUS |
| 161 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 162 |
//! |
| 163 |
virtual MOS_STATUS GetStatusReport(void *status, uint16_t numStatus) override; |
| 164 |
|
| 165 |
//! |
| 166 |
//! \brief Destory the media pipeline and release internal resources |
| 167 |
//! \return MOS_STATUS |
| 168 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 169 |
//! |
| 170 |
virtual MOS_STATUS Destroy() override; |
| 171 |
|
| 172 |
//! |
| 173 |
//! \brief Destory the tempSurface and release internal resources |
| 174 |
//! \return MOS_STATUS |
| 175 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 176 |
//! |
| 177 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 178 |
MOS_STATUS DestroySurface(); |
| 179 |
#endif |
| 180 |
|
| 181 |
//! |
| 182 |
//! \brief get Status Report Table |
| 183 |
//! \return PVPHAL_STATUS_TABLE |
| 184 |
//! Pointers to status Table |
| 185 |
//! |
| 186 |
PVPHAL_STATUS_TABLE GetStatusReportTable() |
| 187 |
{ |
| 188 |
return m_vpMhwInterface.m_statusTable; |
| 189 |
} |
| 190 |
|
| 191 |
//! |
| 192 |
//! \brief User Feature Key Report |
| 193 |
//! \return MOS_STATUS |
| 194 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 195 |
//! |
| 196 |
virtual MOS_STATUS UserFeatureReport() override; |
| 197 |
|
| 198 |
virtual VphalFeatureReport *GetFeatureReport() |
| 199 |
{ |
| 200 |
return m_reporting; |
| 201 |
} |
| 202 |
|
| 203 |
//! |
| 204 |
//! \brief Check whether VEBOX-SFC Format Supported |
| 205 |
//! \details Check whether VEBOX-SFC Format Supported. |
| 206 |
//! \param inputFormat |
| 207 |
//! [in] Format of Input Frame |
| 208 |
//! \param outputFormat |
| 209 |
//! [in] Format of Output Frame |
| 210 |
//! \return bool |
| 211 |
//! Return true if supported, otherwise failed |
| 212 |
//! |
| 213 |
bool IsVeboxSfcFormatSupported(MOS_FORMAT formatInput, MOS_FORMAT formatOutput); |
| 214 |
|
| 215 |
virtual MOS_STATUS ProcessBypassHandler(PVP_PIPELINE_PARAMS renderParams, bool &isBypassNeeded) |
| 216 |
{ |
| 217 |
return MOS_STATUS_SUCCESS; |
| 218 |
} |
| 219 |
|
| 220 |
virtual MOS_STATUS CreateVPDebugInterface(); |
| 221 |
|
| 222 |
VpUserFeatureControl *GetUserFeatureControl() |
| 223 |
{ |
| 224 |
return m_userFeatureControl; |
| 225 |
} |
| 226 |
|
| 227 |
VpAllocator *GetAllocator() |
| 228 |
{ |
| 229 |
return m_allocator; |
| 230 |
} |
| 231 |
|
| 232 |
virtual bool IsOclFCEnabled() |
| 233 |
{ |
| 234 |
return m_vpMhwInterface.m_userFeatureControl->EnableOclFC(); |
| 235 |
} |
| 236 |
|
| 237 |
// for debug purpose |
| 238 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 239 |
//! |
| 240 |
//! \brief replace output surface from Tile-Y to Linear |
| 241 |
//! \param [in] params |
| 242 |
//! Pointer to VP pipeline params |
| 243 |
//! \return MOS_STATUS |
| 244 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 245 |
//! |
| 246 |
MOS_STATUS SurfaceReplace(PVP_PIPELINE_PARAMS params); |
| 247 |
virtual VPHAL_SURFACE *AllocateTempTargetSurface(VPHAL_SURFACE *m_tempTargetSurface); |
| 248 |
#endif |
| 249 |
|
| 250 |
static const uint32_t m_scalability_threshWidth = 4096; |
| 251 |
static const uint32_t m_scalability_threshHeight = 2880; |
| 252 |
|
| 253 |
protected: |
| 254 |
|
| 255 |
//! |
| 256 |
//! \brief prepare execution params for vp pipeline |
| 257 |
//! \param [in] params |
| 258 |
//! Pointer to VP pipeline params |
| 259 |
//! \return MOS_STATUS |
| 260 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 261 |
//! |
| 262 |
virtual MOS_STATUS PrepareVpPipelineParams(PVP_PIPELINE_PARAMS params); |
| 263 |
|
| 264 |
//! |
| 265 |
//! \brief prepare execution params for vp scalability pipeline |
| 266 |
//! \param [in] params |
| 267 |
//! Pointer to VP scalability pipeline params |
| 268 |
//! \return MOS_STATUS |
| 269 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 270 |
//! |
| 271 |
virtual MOS_STATUS PrepareVpPipelineScalabilityParams(VEBOX_SFC_PARAMS* params); |
| 272 |
|
| 273 |
|
| 274 |
//! |
| 275 |
//! \brief prepare execution params for vp scalability pipeline |
| 276 |
//! \param [in] params |
| 277 |
//! Pointer to VP scalability pipeline params |
| 278 |
//! \return MOS_STATUS |
| 279 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 280 |
//! |
| 281 |
virtual MOS_STATUS PrepareVpPipelineScalabilityParams(PVP_PIPELINE_PARAMS params); |
| 282 |
|
| 283 |
//! |
| 284 |
//! \brief prepare execution params for vp scalability pipeline |
| 285 |
//! \param [in] params |
| 286 |
//! src and dst surface's width and height |
| 287 |
//! \return MOS_STATUS |
| 288 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 289 |
//! |
| 290 |
virtual MOS_STATUS PrepareVpPipelineScalabilityParams(uint32_t srcWidth, uint32_t srcHeight, uint32_t dstWidth, uint32_t dstHeight); |
| 291 |
|
| 292 |
//! |
| 293 |
//! \brief Execute Vp Pipeline, and generate VP Filters |
| 294 |
//! \return MOS_STATUS |
| 295 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 296 |
//! |
| 297 |
virtual MOS_STATUS ExecuteVpPipeline(); |
| 298 |
|
| 299 |
//! |
| 300 |
//! \brief updated Execute Vp Pipeline status |
| 301 |
//! \return MOS_STATUS |
| 302 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 303 |
//! |
| 304 |
virtual MOS_STATUS UpdateExecuteStatus(uint32_t frameCn); |
| 305 |
|
| 306 |
//! |
| 307 |
//! \brief Create SwFilterPipe |
| 308 |
//! \param [in] params |
| 309 |
//! Pointer to the input parameters |
| 310 |
//! \param [out] swFilterPipe |
| 311 |
//! Pointer to swFilterPipe |
| 312 |
//! \return MOS_STATUS |
| 313 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 314 |
//! |
| 315 |
virtual MOS_STATUS CreateSwFilterPipe(VP_PARAMS ¶ms, std::vector<SwFilterPipe*> &swFilterPipe); |
| 316 |
|
| 317 |
//! |
| 318 |
//! \brief Get System Vebox Number |
| 319 |
//! \return MOS_STATUS |
| 320 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 321 |
//! |
| 322 |
virtual MOS_STATUS GetSystemVeboxNumber(); |
| 323 |
|
| 324 |
//! |
| 325 |
//! \brief create media feature manager |
| 326 |
//! \return MOS_STATUS |
| 327 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 328 |
//! |
| 329 |
virtual MOS_STATUS CreateFeatureManager(VpResourceManager * vpResourceManager); |
| 330 |
|
| 331 |
virtual MOS_STATUS CreateSinglePipeContext(); |
| 332 |
|
| 333 |
//! |
| 334 |
//! \brief create media kernel sets |
| 335 |
//! \return MOS_STATUS |
| 336 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 337 |
//! |
| 338 |
virtual MOS_STATUS CreateVpKernelSets(); |
| 339 |
|
| 340 |
//! |
| 341 |
//! \brief create media graph sets |
| 342 |
//! \return MOS_STATUS |
| 343 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 344 |
//! |
| 345 |
virtual MOS_STATUS CreateVpGraphSets(); |
| 346 |
|
| 347 |
//! |
| 348 |
//! \brief create media graph manager |
| 349 |
//! \return MOS_STATUS |
| 350 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 351 |
//! |
| 352 |
virtual MOS_STATUS CreateVpGraphManager(); |
| 353 |
|
| 354 |
virtual MOS_STATUS CheckFeatures(void *params, bool &bapgFuncSupported); |
| 355 |
|
| 356 |
//! |
| 357 |
//! \brief create packet shared context |
| 358 |
//! \return MOS_STATUS |
| 359 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 360 |
//! |
| 361 |
virtual MOS_STATUS CreatePacketSharedContext(); |
| 362 |
|
| 363 |
//! |
| 364 |
//! \brief create feature report |
| 365 |
//! \return MOS_STATUS |
| 366 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 367 |
//! |
| 368 |
virtual MOS_STATUS CreateFeatureReport(); |
| 369 |
|
| 370 |
virtual MOS_STATUS CreateReport() |
| 371 |
{ |
| 372 |
m_reporting = MOS_New(VphalFeatureReport); |
| 373 |
VP_PUBLIC_CHK_NULL_RETURN(m_reporting); |
| 374 |
m_reporting->owner = this; |
| 375 |
return MOS_STATUS_SUCCESS; |
| 376 |
} |
| 377 |
|
| 378 |
virtual MOS_STATUS CreateUserFeatureControl(); |
| 379 |
|
| 380 |
//! |
| 381 |
//! \brief set Predication Params |
| 382 |
//! \return MOS_STATUS |
| 383 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 384 |
//! |
| 385 |
virtual MOS_STATUS SetPredicationParams(PVP_PIPELINE_PARAMS params) |
| 386 |
{ |
| 387 |
return MOS_STATUS_SUCCESS; |
| 388 |
} |
| 389 |
|
| 390 |
virtual MOS_STATUS UpdateFrameTracker(); |
| 391 |
|
| 392 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 393 |
//! |
| 394 |
//! \brief Report INTER_FRAME_MEMORY_NINJA_START_COUNTER and INTER_FRAME_MEMORY_NINJA_END_COUNTER |
| 395 |
//! INTER_FRAME_MEMORY_NINJA_START_COUNTER will be reported in Prepare() function |
| 396 |
//! INTER_FRAME_MEMORY_NINJA_END_COUNTER will be reported in UserFeatureReport() function which runs in EXecute() |
| 397 |
//! \param |
| 398 |
//! \return MOS_STATUS |
| 399 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 400 |
//! |
| 401 |
virtual MOS_STATUS ReportIFNCC(bool bStart); |
| 402 |
#endif |
| 403 |
|
| 404 |
//! |
| 405 |
//! \brief set Video Processing Settings |
| 406 |
//! \param [in] params |
| 407 |
//! Pointer to the input parameters |
| 408 |
//! \return MOS_STATUS |
| 409 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 410 |
//! |
| 411 |
virtual MOS_STATUS SetVideoProcessingSettings(void* settings) |
| 412 |
{ |
| 413 |
if (!settings) |
| 414 |
{ |
| 415 |
VP_PUBLIC_NORMALMESSAGE("No VPP Settings needed, driver to handle features behavious by self"); |
| 416 |
return MOS_STATUS_SUCCESS; |
| 417 |
} |
| 418 |
|
| 419 |
VP_SETTINGS* vpSettings = (VP_SETTINGS*)settings; |
| 420 |
|
| 421 |
if (m_vpSettings == nullptr) |
| 422 |
{ |
| 423 |
m_vpSettings = (VP_SETTINGS*)MOS_AllocAndZeroMemory(sizeof(VP_SETTINGS)); |
| 424 |
|
| 425 |
if (m_vpSettings == nullptr) |
| 426 |
{ |
| 427 |
VP_PUBLIC_ASSERTMESSAGE("No Space, VP Settings created failed"); |
| 428 |
return MOS_STATUS_NO_SPACE; |
| 429 |
} |
| 430 |
} |
| 431 |
|
| 432 |
*m_vpSettings = *vpSettings; |
| 433 |
|
| 434 |
return MOS_STATUS_SUCCESS; |
| 435 |
} |
| 436 |
|
| 437 |
//! |
| 438 |
//! \brief Judge if it is gt test environment |
| 439 |
//! \return bool |
| 440 |
//! true if success, else false |
| 441 |
//! |
| 442 |
virtual bool IsGtEnv() |
| 443 |
{ |
| 444 |
return false; |
| 445 |
} |
| 446 |
|
| 447 |
//! |
| 448 |
//! \brief Judge if it is gt test environment |
| 449 |
//! \return bool |
| 450 |
//! true if success, else false |
| 451 |
//! |
| 452 |
virtual bool IsMultiple() |
| 453 |
{ |
| 454 |
return (m_numVebox > 1) ? true : false; |
| 455 |
} |
| 456 |
|
| 457 |
MOS_STATUS UpdateVeboxNumberforScalability(); |
| 458 |
|
| 459 |
MOS_STATUS ExecuteSingleswFilterPipe(VpSinglePipeContext *singlePipeCtx, SwFilterPipe *&pipe, PacketPipe *pPacketPipe, VpFeatureManagerNext *featureManagerNext); |
| 460 |
MOS_STATUS UpdateRectForNegtiveDstTopLeft(PVP_PIPELINE_PARAMS params); |
| 461 |
|
| 462 |
protected: |
| 463 |
VP_PARAMS m_pvpParams = {}; //!< vp Pipeline params |
| 464 |
VP_MHWINTERFACE m_vpMhwInterface = {}; //!< vp Pipeline Mhw Interface |
| 465 |
|
| 466 |
uint8_t m_numVebox = 0; |
| 467 |
uint8_t m_numVeboxOriginal = 0; |
| 468 |
uint32_t m_forceMultiplePipe = 0; |
| 469 |
VpAllocator *m_allocator = nullptr; //!< vp Pipeline allocator |
| 470 |
VPMediaMemComp *m_mmc = nullptr; //!< vp Pipeline mmc |
| 471 |
|
| 472 |
// For user feature report |
| 473 |
VphalFeatureReport *m_reporting = nullptr; //!< vp Pipeline user feature report |
| 474 |
|
| 475 |
VPStatusReport *m_statusReport = nullptr; //!< vp Pipeline status report |
| 476 |
|
| 477 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 478 |
VpDebugInterface *m_debugInterface = nullptr; |
| 479 |
#endif |
| 480 |
bool m_currentFrameAPGEnabled = false; |
| 481 |
PacketFactory *m_pPacketFactory = nullptr; |
| 482 |
PacketPipeFactory *m_pPacketPipeFactory = nullptr; |
| 483 |
VpKernelSet *m_kernelSet = nullptr; |
| 484 |
VPFeatureManager *m_paramChecker = nullptr; |
| 485 |
VP_PACKET_SHARED_CONTEXT *m_packetSharedContext = nullptr; |
| 486 |
VpInterface *m_vpInterface = nullptr; |
| 487 |
VpGraphSet *m_graphSet = nullptr; |
| 488 |
VpGraphManager *m_graphManager = nullptr; |
| 489 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 490 |
VPHAL_SURFACE *m_tempTargetSurface = nullptr; |
| 491 |
#endif |
| 492 |
VP_SETTINGS *m_vpSettings = nullptr; |
| 493 |
VpUserFeatureControl *m_userFeatureControl = nullptr; |
| 494 |
std::vector<VpSinglePipeContext *> m_vpPipeContexts = {}; |
| 495 |
VpPipelineParamFactory *m_pipelineParamFactory = nullptr; |
| 496 |
bool m_reportOnceFlag = true; |
| 497 |
|
| 498 |
MEDIA_CLASS_DEFINE_END(vp__VpPipeline) |
| 499 |
}; |
| 500 |
|
| 501 |
struct _VP_SFC_PACKET_PARAMS |
| 502 |
{ |
| 503 |
PSFC_SCALING_PARAMS sfcScalingParams; //!< Params for SFC Scaling |
| 504 |
}; |
| 505 |
|
| 506 |
using VP_SFC_PACKET_PARAMS = _VP_SFC_PACKET_PARAMS; |
| 507 |
|
| 508 |
class VpSinglePipeContext |
| 509 |
{ |
| 510 |
public: |
| 511 |
VpSinglePipeContext(); |
| 512 |
virtual ~VpSinglePipeContext(); |
| 513 |
|
| 514 |
virtual MOS_STATUS Init(PMOS_INTERFACE osInterface, VpAllocator *allocator, VphalFeatureReport *reporting, vp::VpPlatformInterface *vpPlatformInterface, PacketPipeFactory *packetPipeFactory, VpUserFeatureControl *userFeatureControl, MediaCopyWrapper *mediaCopyWrapper, VpGraphManager *graphManager); |
| 515 |
|
| 516 |
//! |
| 517 |
//! \brief create reource manager |
| 518 |
//! \return MOS_STATUS |
| 519 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 520 |
//! |
| 521 |
virtual MOS_STATUS CreateResourceManager(PMOS_INTERFACE osInterface, VpAllocator *allocator, VphalFeatureReport *reporting, vp::VpPlatformInterface *vpPlatformInterface, vp::VpUserFeatureControl *userFeatureControl, MediaCopyWrapper *mediaCopyWrapper, VpGraphManager *graphManager); |
| 522 |
|
| 523 |
virtual MOS_STATUS CreatePacketReuseManager(PacketPipeFactory *pPacketPipeFactory, VpUserFeatureControl *userFeatureControl); |
| 524 |
|
| 525 |
virtual VpPacketReuseManager *NewVpPacketReuseManagerObj(PacketPipeFactory *packetPipeFactory, VpUserFeatureControl *userFeatureControl) |
| 526 |
{ |
| 527 |
return packetPipeFactory && userFeatureControl ? MOS_New(VpPacketReuseManager, *packetPipeFactory, *userFeatureControl) : nullptr; |
| 528 |
} |
| 529 |
|
| 530 |
VpPacketReuseManager *GetPacketReUseManager() |
| 531 |
{ |
| 532 |
return m_packetReuseMgr; |
| 533 |
} |
| 534 |
|
| 535 |
VpResourceManager *GetVpResourceManager() |
| 536 |
{ |
| 537 |
return m_resourceManager; |
| 538 |
} |
| 539 |
|
| 540 |
bool IsPacketReUsed() |
| 541 |
{ |
| 542 |
return m_packetReused; |
| 543 |
} |
| 544 |
|
| 545 |
bool IsVeboxInUse() |
| 546 |
{ |
| 547 |
return m_veboxFeatureInuse; |
| 548 |
} |
| 549 |
|
| 550 |
uint32_t GetFrameCounter() |
| 551 |
{ |
| 552 |
return m_frameCounter; |
| 553 |
} |
| 554 |
|
| 555 |
void AddFrameCount() |
| 556 |
{ |
| 557 |
m_frameCounter++; |
| 558 |
} |
| 559 |
|
| 560 |
void InitializeOutputPipe() |
| 561 |
{ |
| 562 |
m_vpOutputPipe = VPHAL_OUTPUT_PIPE_MODE_INVALID; |
| 563 |
m_veboxFeatureInuse = false; |
| 564 |
} |
| 565 |
|
| 566 |
VPHAL_OUTPUT_PIPE_MODE GetOutputPipe() |
| 567 |
{ |
| 568 |
return m_vpOutputPipe; |
| 569 |
} |
| 570 |
|
| 571 |
void SetOutputPipeMode(VPHAL_OUTPUT_PIPE_MODE mode) |
| 572 |
{ |
| 573 |
m_vpOutputPipe = mode; |
| 574 |
} |
| 575 |
|
| 576 |
void SetPacketReused(bool isReused) |
| 577 |
{ |
| 578 |
m_packetReused = isReused; |
| 579 |
} |
| 580 |
|
| 581 |
void SetIsVeboxFeatureInuse(bool isInuse) |
| 582 |
{ |
| 583 |
m_veboxFeatureInuse = isInuse; |
| 584 |
} |
| 585 |
|
| 586 |
protected: |
| 587 |
VpPacketReuseManager *m_packetReuseMgr = nullptr; |
| 588 |
VpResourceManager *m_resourceManager = nullptr; |
| 589 |
// Surface dumper fields (counter and specification) |
| 590 |
uint32_t m_frameCounter = 0; |
| 591 |
bool m_packetReused = false; //!< true is packet reused. |
| 592 |
VPHAL_OUTPUT_PIPE_MODE m_vpOutputPipe = VPHAL_OUTPUT_PIPE_MODE_INVALID; |
| 593 |
bool m_veboxFeatureInuse = false; |
| 594 |
MEDIA_CLASS_DEFINE_END(vp__VpSinglePipeContext) |
| 595 |
}; |
| 596 |
|
| 597 |
class VpInterface |
| 598 |
{ |
| 599 |
public: |
| 600 |
VpInterface(PVP_MHWINTERFACE pHwInterface, VpAllocator &allocator, VpResourceManager *resourceManager, VpGraphManager *graphManager) : |
| 601 |
m_swFilterPipeFactory(*this), |
| 602 |
m_hwFilterPipeFactory(*this), |
| 603 |
m_hwFilterFactory(*this), |
| 604 |
m_hwInterface(pHwInterface), |
| 605 |
m_allocator(allocator), |
| 606 |
m_resourceManager(resourceManager), |
| 607 |
m_swFilterHandler(nullptr), // setting when create feature manager |
| 608 |
m_graphManager(graphManager), |
| 609 |
m_primaryResourceManager(resourceManager) |
| 610 |
{ |
| 611 |
} |
| 612 |
|
| 613 |
virtual ~VpInterface() |
| 614 |
{ |
| 615 |
} |
| 616 |
|
| 617 |
SwFilterPipeFactory& GetSwFilterPipeFactory() |
| 618 |
{ |
| 619 |
return m_swFilterPipeFactory; |
| 620 |
} |
| 621 |
|
| 622 |
void SetSwFilterHandlers(std::map<FeatureType, SwFilterFeatureHandler*>& swFilterHandler) |
| 623 |
{ |
| 624 |
m_swFilterHandler = &swFilterHandler; |
| 625 |
} |
| 626 |
|
| 627 |
SwFilterFeatureHandler* GetSwFilterHandler(FeatureType type) |
| 628 |
{ |
| 629 |
if (!m_swFilterHandler) |
| 630 |
{ |
| 631 |
return nullptr; |
| 632 |
} |
| 633 |
|
| 634 |
type = (FeatureType)(type & FEATURE_TYPE_MASK); |
| 635 |
|
| 636 |
auto handler = m_swFilterHandler->find(type); |
| 637 |
|
| 638 |
if (handler != m_swFilterHandler->end()) |
| 639 |
{ |
| 640 |
return handler->second; |
| 641 |
} |
| 642 |
else |
| 643 |
{ |
| 644 |
return nullptr; |
| 645 |
} |
| 646 |
} |
| 647 |
|
| 648 |
std::map<FeatureType, SwFilterFeatureHandler*>* GetSwFilterHandlerMap() |
| 649 |
{ |
| 650 |
return m_swFilterHandler; |
| 651 |
} |
| 652 |
|
| 653 |
HwFilterPipeFactory& GetHwFilterPipeFactory() |
| 654 |
{ |
| 655 |
return m_hwFilterPipeFactory; |
| 656 |
} |
| 657 |
|
| 658 |
HwFilterFactory& GetHwFilterFactory() |
| 659 |
{ |
| 660 |
return m_hwFilterFactory; |
| 661 |
} |
| 662 |
|
| 663 |
VpAllocator& GetAllocator() |
| 664 |
{ |
| 665 |
return m_allocator; |
| 666 |
} |
| 667 |
|
| 668 |
VpResourceManager* GetResourceManager() |
| 669 |
{ |
| 670 |
return m_resourceManager; |
| 671 |
} |
| 672 |
|
| 673 |
VpResourceManager *GetPrimaryResourceManager() |
| 674 |
{ |
| 675 |
//This is the resource manager in the m_vpPipeContexts[0]. The resources across different pipe contexts will be stored in the primary resource manager |
| 676 |
return m_primaryResourceManager; |
| 677 |
} |
| 678 |
|
| 679 |
PVP_MHWINTERFACE GetHwInterface() |
| 680 |
{ |
| 681 |
return m_hwInterface; |
| 682 |
} |
| 683 |
|
| 684 |
VpGraphManager* GetGraphManager() |
| 685 |
{ |
| 686 |
return m_graphManager; |
| 687 |
} |
| 688 |
|
| 689 |
MOS_STATUS SwitchResourceManager(VpResourceManager *resManager) |
| 690 |
{ |
| 691 |
m_resourceManager = resManager; |
| 692 |
return MOS_STATUS_SUCCESS; |
| 693 |
} |
| 694 |
|
| 695 |
private: |
| 696 |
SwFilterPipeFactory m_swFilterPipeFactory; |
| 697 |
HwFilterPipeFactory m_hwFilterPipeFactory; |
| 698 |
HwFilterFactory m_hwFilterFactory; |
| 699 |
|
| 700 |
PVP_MHWINTERFACE m_hwInterface; |
| 701 |
VpAllocator& m_allocator; |
| 702 |
VpResourceManager* m_resourceManager; |
| 703 |
std::map<FeatureType, SwFilterFeatureHandler*>* m_swFilterHandler = nullptr; |
| 704 |
VpGraphManager *m_graphManager = nullptr; |
| 705 |
|
| 706 |
//This is the resource manager in the m_vpPipeContexts[0]. The resources across different pipe contexts will be stored in the primary resource manager |
| 707 |
VpResourceManager *m_primaryResourceManager = nullptr; |
| 708 |
|
| 709 |
MEDIA_CLASS_DEFINE_END(vp__VpInterface) |
| 710 |
}; |
| 711 |
} // namespace vp |
| 712 |
|
| 713 |
#endif |