| 1 |
/* |
| 2 |
* Copyright (c) 2018-2024, 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.cpp |
| 24 |
//! \brief Defines the common interface for vp pipeline |
| 25 |
//! this file is for the base interface which is shared by all features. |
| 26 |
//! |
| 27 |
|
| 28 |
#include "vp_pipeline.h" |
| 29 |
#include "vp_scaling_filter.h" |
| 30 |
#include "vp_csc_filter.h" |
| 31 |
#include "vp_rot_mir_filter.h" |
| 32 |
#include "media_scalability_defs.h" |
| 33 |
#include "vp_feature_manager.h" |
| 34 |
#include "vp_packet_pipe.h" |
| 35 |
#include "vp_platform_interface.h" |
| 36 |
#include "vp_utils.h" |
| 37 |
#include "vp_user_feature_control.h" |
| 38 |
using namespace vp; |
| 39 |
|
| 40 |
VpPipeline::VpPipeline(PMOS_INTERFACE osInterface) : |
| 41 |
MediaPipeline(osInterface) |
| 42 |
{ |
| 43 |
} |
| 44 |
|
| 45 |
VpPipeline::~VpPipeline() |
| 46 |
{ |
| 47 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 48 |
if (m_reportOnceFlag) |
| 49 |
{ |
| 50 |
ReportUserSettingForDebug( |
| 51 |
m_userSettingPtr, |
| 52 |
__MEDIA_USER_FEATURE_VALUE_FALLBACK_SCALING_TO_RENDER_8K_REPORT, |
| 53 |
0, |
| 54 |
MediaUserSetting::Group::Sequence); |
| 55 |
} |
| 56 |
#endif |
| 57 |
// Delete m_featureManager before m_resourceManager, since |
| 58 |
// m_resourceManager is referenced by m_featureManager. |
| 59 |
MOS_Delete(m_featureManager); |
| 60 |
for (auto ctx : m_vpPipeContexts) |
| 61 |
{ |
| 62 |
MOS_Delete(ctx); |
| 63 |
} |
| 64 |
m_vpPipeContexts.clear(); |
| 65 |
// Delete m_pPacketPipeFactory before m_pPacketFactory, since |
| 66 |
// m_pPacketFactory is referenced by m_pPacketPipeFactory. |
| 67 |
MOS_Delete(m_pPacketPipeFactory); |
| 68 |
MOS_Delete(m_pPacketFactory); |
| 69 |
DeletePackets(); |
| 70 |
DeleteTasks(); |
| 71 |
|
| 72 |
if (m_osInterface && m_osInterface->pfnStopHybridCmdMgr) |
| 73 |
{ |
| 74 |
m_osInterface->pfnStopHybridCmdMgr(m_osInterface); |
| 75 |
} |
| 76 |
MOS_Delete(m_vpInterface); |
| 77 |
MOS_Delete(m_graphManager); |
| 78 |
MOS_Delete(m_kernelSet); |
| 79 |
MOS_Delete(m_graphSet); |
| 80 |
MOS_Delete(m_paramChecker); |
| 81 |
MOS_Delete(m_mmc); |
| 82 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 83 |
DestroySurface(); |
| 84 |
#endif |
| 85 |
MOS_Delete(m_allocator); |
| 86 |
MOS_Delete(m_statusReport); |
| 87 |
MOS_Delete(m_packetSharedContext); |
| 88 |
if (m_vpMhwInterface.m_reporting && this != m_vpMhwInterface.m_reporting->owner) |
| 89 |
{ |
| 90 |
m_reporting = nullptr; |
| 91 |
} |
| 92 |
else |
| 93 |
{ |
| 94 |
MOS_Delete(m_reporting); |
| 95 |
m_vpMhwInterface.m_reporting = nullptr; |
| 96 |
} |
| 97 |
#if ((_DEBUG || _RELEASE_INTERNAL) && !EMUL) |
| 98 |
VP_DEBUG_INTERFACE_DESTROY(m_debugInterface); |
| 99 |
#endif |
| 100 |
if (m_mediaContext) |
| 101 |
{ |
| 102 |
MOS_Delete(m_mediaContext); |
| 103 |
m_mediaContext = nullptr; |
| 104 |
} |
| 105 |
|
| 106 |
if (m_vpSettings) |
| 107 |
{ |
| 108 |
MOS_FreeMemory(m_vpSettings); |
| 109 |
m_vpSettings = nullptr; |
| 110 |
} |
| 111 |
|
| 112 |
if (m_userFeatureControl && |
| 113 |
(this == m_userFeatureControl->m_owner || nullptr == m_userFeatureControl->m_owner)) |
| 114 |
{ |
| 115 |
MOS_Delete(m_userFeatureControl); |
| 116 |
m_vpMhwInterface.m_userFeatureControl = nullptr; |
| 117 |
} |
| 118 |
if (m_pipelineParamFactory) |
| 119 |
{ |
| 120 |
MOS_Delete(m_pipelineParamFactory); |
| 121 |
} |
| 122 |
} |
| 123 |
|
| 124 |
MOS_STATUS VpPipeline::GetStatusReport(void *status, uint16_t numStatus) |
| 125 |
{ |
| 126 |
VP_FUNC_CALL(); |
| 127 |
|
| 128 |
return MOS_STATUS_SUCCESS; |
| 129 |
} |
| 130 |
|
| 131 |
MOS_STATUS VpPipeline::Destroy() |
| 132 |
{ |
| 133 |
VP_FUNC_CALL(); |
| 134 |
|
| 135 |
return MOS_STATUS_SUCCESS; |
| 136 |
} |
| 137 |
|
| 138 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 139 |
MOS_STATUS VpPipeline::DestroySurface() |
| 140 |
{ |
| 141 |
VP_FUNC_CALL(); |
| 142 |
|
| 143 |
if (m_tempTargetSurface) |
| 144 |
{ |
| 145 |
m_allocator->FreeResource(&m_tempTargetSurface->OsResource); |
| 146 |
MOS_FreeMemAndSetNull(m_tempTargetSurface); |
| 147 |
} |
| 148 |
|
| 149 |
return MOS_STATUS_SUCCESS; |
| 150 |
} |
| 151 |
#endif |
| 152 |
|
| 153 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 154 |
MOS_STATUS VpPipeline::ReportIFNCC(bool bStart) |
| 155 |
{ |
| 156 |
//INTER_FRAME_MEMORY_NINJA_START_COUNTER will be reported in Prepare function |
| 157 |
//INTER_FRAME_MEMORY_NINJA_END_COUNTER will be reported in UserFeatureReport() function which runs in Execute() |
| 158 |
VP_FUNC_CALL(); |
| 159 |
int32_t memninjaCounter = 0; |
| 160 |
memninjaCounter = *MosUtilities::m_mosMemAllocCounter + *MosUtilities::m_mosMemAllocCounterGfx - *MosUtilities::m_mosMemAllocFakeCounter; |
| 161 |
if (MOS_IS_MEMORY_FOOT_PRINT_ENABLED()) |
| 162 |
{ |
| 163 |
if (bStart) |
| 164 |
{ |
| 165 |
MT_LOG2(MT_MOS_MEMORY_NINJA_COUNTER, MT_NORMAL, MT_MEMORY_NINJA_IS_START, bStart, MT_MEMORY_NINJA_START_COUNTER, memninjaCounter); |
| 166 |
VP_PUBLIC_NORMALMESSAGE("MT_MOS_MEMORY_NINJA_COUNTER, MT_MEMORY_NINJA_IS_START :%d, MT_MEMORY_NINJA_START_COUNTER: %d", bStart, memninjaCounter); |
| 167 |
} |
| 168 |
else |
| 169 |
{ |
| 170 |
MT_LOG2(MT_MOS_MEMORY_NINJA_COUNTER, MT_NORMAL, MT_MEMORY_NINJA_IS_START, bStart, MT_MEMORY_NINJA_END_COUNTER, memninjaCounter); |
| 171 |
VP_PUBLIC_NORMALMESSAGE("MT_MOS_MEMORY_NINJA_COUNTER, MT_MEMORY_NINJA_IS_START :%d, MT_MEMORY_NINJA_END_COUNTER: %d", bStart, memninjaCounter); |
| 172 |
} |
| 173 |
} |
| 174 |
if (m_userFeatureControl->EnableIFNCC() && |
| 175 |
MosUtilities::m_mosMemAllocCounter && |
| 176 |
MosUtilities::m_mosMemAllocCounterGfx && |
| 177 |
MosUtilities::m_mosMemAllocFakeCounter) |
| 178 |
{ |
| 179 |
ReportUserSettingForDebug( |
| 180 |
m_userSettingPtr, |
| 181 |
bStart ? __MEDIA_USER_FEATURE_VALUE_INTER_FRAME_MEMORY_NINJA_START_COUNTER : __MEDIA_USER_FEATURE_VALUE_INTER_FRAME_MEMORY_NINJA_END_COUNTER, |
| 182 |
memninjaCounter, |
| 183 |
MediaUserSetting::Group::Sequence); |
| 184 |
} |
| 185 |
return MOS_STATUS_SUCCESS; |
| 186 |
} |
| 187 |
#endif |
| 188 |
|
| 189 |
MOS_STATUS VpPipeline::UserFeatureReport() |
| 190 |
{ |
| 191 |
VP_FUNC_CALL(); |
| 192 |
|
| 193 |
if (m_reporting) |
| 194 |
{ |
| 195 |
if (m_vpPipeContexts.size() > 0) |
| 196 |
{ |
| 197 |
VP_PUBLIC_CHK_NULL_RETURN(m_vpPipeContexts[0]); |
| 198 |
m_reporting->GetFeatures().outputPipeMode = m_vpPipeContexts[0]->GetOutputPipe(); |
| 199 |
m_reporting->GetFeatures().veFeatureInUse = m_vpPipeContexts[0]->IsVeboxInUse(); |
| 200 |
m_reporting->GetFeatures().packetReused = m_vpPipeContexts[0]->IsPacketReUsed(); |
| 201 |
} |
| 202 |
|
| 203 |
if (m_mmc) |
| 204 |
{ |
| 205 |
m_reporting->GetFeatures().vpMMCInUse = m_mmc->IsMmcEnabled(); |
| 206 |
} |
| 207 |
|
| 208 |
if (PIPELINE_PARAM_TYPE_LEGACY == m_pvpParams.type) |
| 209 |
{ |
| 210 |
PVP_PIPELINE_PARAMS params = m_pvpParams.renderParams; |
| 211 |
VP_PUBLIC_CHK_NULL_RETURN(params); |
| 212 |
if (params->pSrc[0] && params->pSrc[0]->bCompressible) |
| 213 |
{ |
| 214 |
m_reporting->GetFeatures().primaryCompressible = true; |
| 215 |
m_reporting->GetFeatures().primaryCompressMode = (uint8_t)(params->pSrc[0]->CompressionMode); |
| 216 |
} |
| 217 |
|
| 218 |
if (params->pTarget[0]->bCompressible) |
| 219 |
{ |
| 220 |
m_reporting->GetFeatures().rtCompressible = true; |
| 221 |
m_reporting->GetFeatures().rtCompressMode = (uint8_t)(params->pTarget[0]->CompressionMode); |
| 222 |
} |
| 223 |
|
| 224 |
m_reporting->GetFeatures().rtCacheSetting = (uint8_t)(params->pTarget[0]->CacheSetting); |
| 225 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 226 |
if (m_reporting->GetFeatures().outputPipeMode == VPHAL_OUTPUT_PIPE_MODE_SFC) |
| 227 |
{ |
| 228 |
if (m_vpMhwInterface.m_sfcInterface) |
| 229 |
{ |
| 230 |
m_reporting->GetFeatures().rtOldCacheSetting = (uint8_t)((m_vpMhwInterface.m_sfcInterface->m_outputSurfCtrl.Value >> 1) & 0x0000003f); |
| 231 |
} |
| 232 |
} |
| 233 |
else if (m_vpMhwInterface.m_renderHal) |
| 234 |
{ |
| 235 |
m_reporting->GetFeatures().rtOldCacheSetting = (uint8_t)(m_vpMhwInterface.m_renderHal->oldCacheSettingForTargetSurface); |
| 236 |
} |
| 237 |
if (m_reporting->GetFeatures().isOcl3DLut) |
| 238 |
{ |
| 239 |
VP_PUBLIC_NORMALMESSAGE("VP OCL 3DLut Enabled"); |
| 240 |
ReportUserSettingForDebug( |
| 241 |
m_userSettingPtr, |
| 242 |
__MEDIA_USER_FEATURE_VALUE_VP_OCL_3DLUT_ENABLED, |
| 243 |
1, |
| 244 |
MediaUserSetting::Group::Sequence); |
| 245 |
} |
| 246 |
#endif |
| 247 |
} |
| 248 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 249 |
if (m_reporting->GetFeatures().isOclFC) |
| 250 |
{ |
| 251 |
VP_PUBLIC_NORMALMESSAGE("VP OCL FC Supported"); |
| 252 |
ReportUserSettingForDebug( |
| 253 |
m_userSettingPtr, |
| 254 |
__MEDIA_USER_FEATURE_VALUE_VP_OCL_FC_SUPPORTED, |
| 255 |
1, |
| 256 |
MediaUserSetting::Group::Sequence); |
| 257 |
|
| 258 |
ReportUserSettingForDebug( |
| 259 |
m_userSettingPtr, |
| 260 |
__MEDIA_USER_FEATURE_VALUE_VP_OCL_FC_FEATURE_REPORT, |
| 261 |
m_reporting->GetFeatures().featureLogOclFC, |
| 262 |
MediaUserSetting::Group::Sequence); |
| 263 |
|
| 264 |
ReportUserSettingForDebug( |
| 265 |
m_userSettingPtr, |
| 266 |
__MEDIA_USER_FEATURE_VALUE_VP_OCL_FC_REPORT, |
| 267 |
m_reporting->GetFeatures().diffLogOclFC, |
| 268 |
MediaUserSetting::Group::Sequence); |
| 269 |
|
| 270 |
if (m_reporting->GetFeatures().isLegacyFCInUse) |
| 271 |
{ |
| 272 |
ReportUserSettingForDebug( |
| 273 |
m_userSettingPtr, |
| 274 |
__MEDIA_USER_FEATURE_VALUE_VP_LEGACY_FC_IN_USE, |
| 275 |
1, |
| 276 |
MediaUserSetting::Group::Sequence); |
| 277 |
m_reporting->GetFeatures().isLegacyFCInUse = false; |
| 278 |
} |
| 279 |
} |
| 280 |
|
| 281 |
if (m_reportOnceFlag && m_reporting->GetFeatures().fallbackScalingToRender8K) |
| 282 |
{ |
| 283 |
ReportUserSettingForDebug( |
| 284 |
m_userSettingPtr, |
| 285 |
__MEDIA_USER_FEATURE_VALUE_FALLBACK_SCALING_TO_RENDER_8K_REPORT, |
| 286 |
1, |
| 287 |
MediaUserSetting::Group::Sequence); |
| 288 |
m_reporting->GetFeatures().fallbackScalingToRender8K = false; |
| 289 |
m_reportOnceFlag = false; |
| 290 |
} |
| 291 |
|
| 292 |
#endif |
| 293 |
|
| 294 |
m_reporting->GetFeatures().VPApogeios = m_currentFrameAPGEnabled; |
| 295 |
} |
| 296 |
MediaPipeline::UserFeatureReport(); |
| 297 |
|
| 298 |
|
| 299 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 300 |
//INTER_FRAME_MEMORY_NINJA_START_COUNTER will be reported in ReportIFNCC(true) function which runs in VpPipeline::Prepare() |
| 301 |
ReportIFNCC(false); |
| 302 |
#endif |
| 303 |
return MOS_STATUS_SUCCESS; |
| 304 |
} |
| 305 |
|
| 306 |
MOS_STATUS VpPipeline::CreatePacketSharedContext() |
| 307 |
{ |
| 308 |
VP_FUNC_CALL(); |
| 309 |
|
| 310 |
m_packetSharedContext = MOS_New(VP_PACKET_SHARED_CONTEXT); |
| 311 |
VP_PUBLIC_CHK_NULL_RETURN(m_packetSharedContext); |
| 312 |
return MOS_STATUS_SUCCESS; |
| 313 |
} |
| 314 |
|
| 315 |
MOS_STATUS VpPipeline::CreateUserFeatureControl() |
| 316 |
{ |
| 317 |
VP_FUNC_CALL(); |
| 318 |
|
| 319 |
VP_PUBLIC_CHK_NULL_RETURN(m_osInterface); |
| 320 |
m_userFeatureControl = MOS_New(VpUserFeatureControl, *m_osInterface, m_vpMhwInterface.m_vpPlatformInterface, this); |
| 321 |
VP_PUBLIC_CHK_NULL_RETURN(m_userFeatureControl); |
| 322 |
return MOS_STATUS_SUCCESS; |
| 323 |
} |
| 324 |
|
| 325 |
MOS_STATUS VpPipeline::CreateVPDebugInterface() |
| 326 |
{ |
| 327 |
VP_FUNC_CALL(); |
| 328 |
|
| 329 |
#if ((_DEBUG || _RELEASE_INTERNAL) && !EMUL) |
| 330 |
VP_DEBUG_INTERFACE_CREATE(m_debugInterface); |
| 331 |
SkuWaTable_DUMP_XML(m_skuTable, m_waTable); |
| 332 |
#endif |
| 333 |
return MOS_STATUS_SUCCESS; |
| 334 |
} |
| 335 |
|
| 336 |
MOS_STATUS VpPipeline::Init(void *mhwInterface) |
| 337 |
{ |
| 338 |
VP_FUNC_CALL(); |
| 339 |
VP_PUBLIC_CHK_NULL_RETURN(mhwInterface); |
| 340 |
VP_PUBLIC_CHK_NULL_RETURN(((PVP_MHWINTERFACE)mhwInterface)->m_vpPlatformInterface); |
| 341 |
|
| 342 |
m_vpMhwInterface = *(PVP_MHWINTERFACE)mhwInterface; |
| 343 |
|
| 344 |
if (m_vpMhwInterface.m_userFeatureControl) |
| 345 |
{ |
| 346 |
m_userFeatureControl = m_vpMhwInterface.m_userFeatureControl; |
| 347 |
} |
| 348 |
else |
| 349 |
{ |
| 350 |
VP_PUBLIC_CHK_STATUS_RETURN(CreateUserFeatureControl()); |
| 351 |
m_vpMhwInterface.m_userFeatureControl = m_userFeatureControl; |
| 352 |
} |
| 353 |
if (m_userFeatureControl && m_vpMhwInterface.m_settings) |
| 354 |
{ |
| 355 |
m_userFeatureControl->SetClearVideoViewMode(((VP_SETTINGS *)m_vpMhwInterface.m_settings)->clearVideoViewMode); |
| 356 |
} |
| 357 |
|
| 358 |
VP_PUBLIC_CHK_STATUS_RETURN(m_vpMhwInterface.m_vpPlatformInterface->ConfigVirtualEngine()); |
| 359 |
|
| 360 |
VP_PUBLIC_CHK_STATUS_RETURN(m_vpMhwInterface.m_vpPlatformInterface->ConfigureVpScalability(m_vpMhwInterface)); |
| 361 |
|
| 362 |
VP_PUBLIC_CHK_STATUS_RETURN(MediaPipeline::InitPlatform()); |
| 363 |
|
| 364 |
VP_PUBLIC_CHK_STATUS_RETURN(MediaPipeline::CreateMediaCopyWrapper()); |
| 365 |
|
| 366 |
VP_PUBLIC_CHK_NULL_RETURN(m_mediaCopyWrapper); |
| 367 |
|
| 368 |
if (m_mediaCopyWrapper->MediaCopyStateIsNull()) |
| 369 |
{ |
| 370 |
// Only for legacy media copy creation |
| 371 |
m_mediaCopyWrapper->SetMediaCopyState(m_vpMhwInterface.m_vpPlatformInterface->CreateMediaCopy()); |
| 372 |
} |
| 373 |
|
| 374 |
VP_PUBLIC_CHK_STATUS_RETURN(CreateFeatureReport()); |
| 375 |
|
| 376 |
m_mediaContext = MOS_New(MediaContext, scalabilityVp, &m_vpMhwInterface, m_osInterface); |
| 377 |
VP_PUBLIC_CHK_NULL_RETURN(m_mediaContext); |
| 378 |
|
| 379 |
m_mmc = MOS_New(VPMediaMemComp, m_osInterface, m_vpMhwInterface); |
| 380 |
VP_PUBLIC_CHK_NULL_RETURN(m_mmc); |
| 381 |
|
| 382 |
m_allocator = MOS_New(VpAllocator, m_osInterface, m_mmc); |
| 383 |
VP_PUBLIC_CHK_NULL_RETURN(m_allocator); |
| 384 |
|
| 385 |
m_statusReport = MOS_New(VPStatusReport, m_osInterface); |
| 386 |
VP_PUBLIC_CHK_NULL_RETURN(m_statusReport); |
| 387 |
|
| 388 |
VP_PUBLIC_CHK_STATUS_RETURN(CreateVPDebugInterface()); |
| 389 |
|
| 390 |
m_vpMhwInterface.m_debugInterface = (void*)m_debugInterface; |
| 391 |
|
| 392 |
m_pPacketFactory = MOS_New(PacketFactory, m_vpMhwInterface.m_vpPlatformInterface); |
| 393 |
VP_PUBLIC_CHK_NULL_RETURN(m_pPacketFactory); |
| 394 |
|
| 395 |
VP_PUBLIC_CHK_STATUS_RETURN(CreatePacketSharedContext()); |
| 396 |
VP_PUBLIC_CHK_STATUS_RETURN(CreateVpKernelSets()); |
| 397 |
VP_PUBLIC_CHK_STATUS_RETURN(CreateVpGraphSets()); |
| 398 |
VP_PUBLIC_CHK_STATUS_RETURN(CreateVpGraphManager()); |
| 399 |
if (m_osInterface && m_osInterface->pfnSetHybridMgrSubmitMode && m_userFeatureControl) |
| 400 |
{ |
| 401 |
VP_PUBLIC_CHK_STATUS_RETURN(m_osInterface->pfnSetHybridMgrSubmitMode(m_osInterface, m_userFeatureControl->GetHybridMgrSubmitMode())); |
| 402 |
} |
| 403 |
// Create active tasks |
| 404 |
MediaTask *pTask = GetTask(MediaTask::TaskType::cmdTask); |
| 405 |
VP_PUBLIC_CHK_NULL_RETURN(pTask); |
| 406 |
|
| 407 |
VP_PUBLIC_CHK_STATUS_RETURN(m_pPacketFactory->Initialize(pTask, &m_vpMhwInterface, m_allocator, m_mmc, m_packetSharedContext, m_kernelSet, m_debugInterface, m_graphSet)); |
| 408 |
|
| 409 |
m_pPacketPipeFactory = MOS_New(PacketPipeFactory, *m_pPacketFactory); |
| 410 |
VP_PUBLIC_CHK_NULL_RETURN(m_pPacketPipeFactory); |
| 411 |
|
| 412 |
if (m_vpPipeContexts.size() == 0) |
| 413 |
{ |
| 414 |
VP_PUBLIC_CHK_STATUS_RETURN(CreateSinglePipeContext()); |
| 415 |
} |
| 416 |
VpResourceManager *resourceManager = m_vpPipeContexts[0]->GetVpResourceManager(); |
| 417 |
VP_PUBLIC_CHK_STATUS_RETURN(CreateFeatureManager(resourceManager)); |
| 418 |
VP_PUBLIC_CHK_NULL_RETURN(m_featureManager); |
| 419 |
|
| 420 |
VP_PUBLIC_CHK_STATUS_RETURN(GetSystemVeboxNumber()); |
| 421 |
|
| 422 |
VP_PUBLIC_CHK_STATUS_RETURN(SetVideoProcessingSettings(m_vpMhwInterface.m_settings)); |
| 423 |
|
| 424 |
m_vpMhwInterface.m_settings = m_vpSettings; |
| 425 |
if (m_vpMhwInterface.m_vpPlatformInterface->IsGpuContextCreatedInPipelineInit()) |
| 426 |
{ |
| 427 |
if (m_numVebox > 0 && !(m_vpSettings && m_vpSettings->clearVideoViewMode)) |
| 428 |
{ |
| 429 |
VP_PUBLIC_NORMALMESSAGE("Create GpuContext for Vebox."); |
| 430 |
VP_PUBLIC_CHK_STATUS_RETURN(PacketPipe::SwitchContext(VP_PIPELINE_PACKET_VEBOX, m_scalability, |
| 431 |
m_mediaContext, MOS_VE_SUPPORTED(m_osInterface), m_numVebox)); |
| 432 |
} |
| 433 |
// If the environment is SA media in which there are no GT IP, we could not create/use Render or Compute GPU context. |
| 434 |
if (!(m_skuTable && MEDIA_IS_SKU(m_skuTable, FtrDisableGtIpSubmissions))) |
| 435 |
{ |
| 436 |
bool computeContextEnabled = m_userFeatureControl->IsComputeContextEnabled(); |
| 437 |
auto packetId = computeContextEnabled ? VP_PIPELINE_PACKET_COMPUTE : VP_PIPELINE_PACKET_RENDER; |
| 438 |
VP_PUBLIC_NORMALMESSAGE("Create GpuContext for Compute/Render (PacketId: %d).", packetId); |
| 439 |
VP_PUBLIC_CHK_STATUS_RETURN(PacketPipe::SwitchContext(packetId, m_scalability, |
| 440 |
m_mediaContext, MOS_VE_SUPPORTED(m_osInterface), m_numVebox)); |
| 441 |
} |
| 442 |
// create SinglePipe GpuContext for multi Vebox system to avoid first frame long latency issue |
| 443 |
if (m_numVebox > 1 && !(m_vpSettings && m_vpSettings->clearVideoViewMode)) |
| 444 |
{ |
| 445 |
VP_PUBLIC_NORMALMESSAGE("Create Single Pipe GpuContext for Vebox."); |
| 446 |
VP_PUBLIC_CHK_STATUS_RETURN(PacketPipe::SwitchContext(VP_PIPELINE_PACKET_VEBOX, m_scalability, |
| 447 |
m_mediaContext, MOS_VE_SUPPORTED(m_osInterface), 1)); |
| 448 |
} |
| 449 |
} |
| 450 |
|
| 451 |
return MOS_STATUS_SUCCESS; |
| 452 |
} |
| 453 |
|
| 454 |
bool VpPipeline::IsVeboxSfcFormatSupported(MOS_FORMAT formatInput, MOS_FORMAT formatOutput) |
| 455 |
{ |
| 456 |
VP_FUNC_CALL(); |
| 457 |
|
| 458 |
VpFeatureManagerNext *featureManagerNext = dynamic_cast<VpFeatureManagerNext *>(m_featureManager); |
| 459 |
if (nullptr == featureManagerNext) |
| 460 |
{ |
| 461 |
VP_PUBLIC_ASSERTMESSAGE("m_featureManager equals to nullptr!"); |
| 462 |
return false; |
| 463 |
} |
| 464 |
return featureManagerNext->IsVeboxSfcFormatSupported(formatInput, formatOutput); |
| 465 |
} |
| 466 |
|
| 467 |
MOS_STATUS VpPipeline::UpdateRectForNegtiveDstTopLeft(PVP_PIPELINE_PARAMS params) |
| 468 |
{ |
| 469 |
VP_FUNC_CALL(); |
| 470 |
|
| 471 |
for (uint32_t index = 0; (index < params->uSrcCount) && (index < VPHAL_MAX_SOURCES); index++) |
| 472 |
{ |
| 473 |
PVPHAL_SURFACE pcSrc = params->pSrc[index]; |
| 474 |
|
| 475 |
if (pcSrc) |
| 476 |
{ |
| 477 |
if (pcSrc->rcDst.top < 0 || pcSrc->rcDst.left < 0) |
| 478 |
{ |
| 479 |
VP_PUBLIC_NORMALMESSAGE("negtive value on rcDst top or left, top: %d, left: %d.", pcSrc->rcDst.top, pcSrc->rcDst.left); |
| 480 |
bool isVerticalRotation = VpUtils::IsVerticalRotation(pcSrc->Rotation); |
| 481 |
|
| 482 |
uint32_t srcHeight = pcSrc->rcSrc.bottom - pcSrc->rcSrc.top; |
| 483 |
uint32_t srcWidth = pcSrc->rcSrc.right - pcSrc->rcSrc.left; |
| 484 |
uint32_t dstHeight = pcSrc->rcDst.bottom - pcSrc->rcDst.top; |
| 485 |
uint32_t dstWidth = pcSrc->rcDst.right - pcSrc->rcDst.left; |
| 486 |
|
| 487 |
float fScaleX = isVerticalRotation ? (float)dstHeight / (float)srcWidth : (float)dstWidth / (float)srcWidth; |
| 488 |
float fScaleY = isVerticalRotation ? (float)dstWidth / (float)srcHeight : (float)dstHeight / (float)srcHeight; |
| 489 |
|
| 490 |
if (pcSrc->rcDst.top < 0) |
| 491 |
{ |
| 492 |
pcSrc->rcDst.top = 0; |
| 493 |
|
| 494 |
if (isVerticalRotation) |
| 495 |
{ |
| 496 |
uint32_t newDstHight = pcSrc->rcDst.bottom; |
| 497 |
uint32_t newSrcWidth = MOS_UF_ROUND(newDstHight / fScaleX); |
| 498 |
pcSrc->rcSrc.left = pcSrc->rcSrc.right - newSrcWidth; |
| 499 |
} |
| 500 |
else |
| 501 |
{ |
| 502 |
uint32_t newDstHight = pcSrc->rcDst.bottom; |
| 503 |
uint32_t newSrcHight = MOS_UF_ROUND(newDstHight / fScaleY); |
| 504 |
pcSrc->rcSrc.top = pcSrc->rcSrc.bottom - newSrcHight; |
| 505 |
} |
| 506 |
} |
| 507 |
if (pcSrc->rcDst.left < 0) |
| 508 |
{ |
| 509 |
pcSrc->rcDst.left = 0; |
| 510 |
if (isVerticalRotation) |
| 511 |
{ |
| 512 |
uint32_t newDstWidth = pcSrc->rcDst.right; |
| 513 |
uint32_t newSrcHight = MOS_UF_ROUND(newDstWidth / fScaleY); |
| 514 |
pcSrc->rcSrc.top = pcSrc->rcSrc.bottom - newSrcHight; |
| 515 |
} |
| 516 |
else |
| 517 |
{ |
| 518 |
uint32_t newDstWidth = pcSrc->rcDst.right; |
| 519 |
uint32_t newSrcWidth = MOS_UF_ROUND(newDstWidth / fScaleX); |
| 520 |
pcSrc->rcSrc.left = pcSrc->rcSrc.right - newSrcWidth; |
| 521 |
} |
| 522 |
} |
| 523 |
VP_PUBLIC_NORMALMESSAGE("updated source rectangle region: [%d,%d,%d,%d].", pcSrc->rcSrc.left, pcSrc->rcSrc.top, pcSrc->rcSrc.right, pcSrc->rcSrc.bottom); |
| 524 |
VP_PUBLIC_NORMALMESSAGE("updated destination rectangle region: [%d,%d,%d,%d].", pcSrc->rcDst.left, pcSrc->rcDst.top, pcSrc->rcDst.right, pcSrc->rcDst.bottom); |
| 525 |
} |
| 526 |
} |
| 527 |
} |
| 528 |
|
| 529 |
return MOS_STATUS_SUCCESS; |
| 530 |
} |
| 531 |
|
| 532 |
MOS_STATUS VpPipeline::ExecuteVpPipeline() |
| 533 |
{ |
| 534 |
VP_FUNC_CALL(); |
| 535 |
|
| 536 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 537 |
PacketPipe *pPacketPipe = nullptr; |
| 538 |
std::vector<SwFilterPipe*> swFilterPipes; |
| 539 |
VpFeatureManagerNext *featureManagerNext = dynamic_cast<VpFeatureManagerNext *>(m_featureManager); |
| 540 |
bool isBypassNeeded = false; |
| 541 |
PVP_PIPELINE_PARAMS params = nullptr; |
| 542 |
Policy *policy = nullptr; |
| 543 |
|
| 544 |
VP_PUBLIC_CHK_NULL_RETURN(featureManagerNext); |
| 545 |
VP_PUBLIC_CHK_NULL_RETURN(m_pPacketPipeFactory); |
| 546 |
VP_PUBLIC_CHK_NULL_RETURN(m_osInterface); |
| 547 |
|
| 548 |
if (m_vpPipeContexts.size() < 1 || m_vpPipeContexts[0] == nullptr) |
| 549 |
{ |
| 550 |
VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_INVALID_PARAMETER); |
| 551 |
} |
| 552 |
|
| 553 |
MT_LOG1(MT_VP_FEATURE_GRAPH_EXECUTE_VPPIPELINE_START, MT_NORMAL, |
| 554 |
MT_VP_FEATURE_GRAPH_FILTER_SWFILTERPIPE_COUNT, (int64_t)swFilterPipes.size()); |
| 555 |
VP_PUBLIC_NORMALMESSAGE("Feature Graph: Execute VP Pipeline Start, swfilterPipes count:%d", (int64_t)swFilterPipes.size()); |
| 556 |
|
| 557 |
if (PIPELINE_PARAM_TYPE_LEGACY == m_pvpParams.type) |
| 558 |
{ |
| 559 |
params = m_pvpParams.renderParams; |
| 560 |
VP_PUBLIC_CHK_NULL_RETURN(params); |
| 561 |
// Get the OptimizeCpuTiming flag from params |
| 562 |
m_osInterface->bOptimizeCpuTiming = params->bOptimizeCpuTiming; |
| 563 |
// Set Pipeline status Table |
| 564 |
m_statusReport->SetPipeStatusReportParams(params, m_vpMhwInterface.m_statusTable); |
| 565 |
|
| 566 |
#if ((_DEBUG || _RELEASE_INTERNAL) && !EMUL) |
| 567 |
VP_PARAMETERS_DUMPPER_DUMP_XML(m_debugInterface, |
| 568 |
params, |
| 569 |
m_vpPipeContexts[0]->GetFrameCounter()); |
| 570 |
|
| 571 |
for (uint32_t uiLayer = 0; uiLayer < params->uSrcCount && uiLayer < VPHAL_MAX_SOURCES; uiLayer++) |
| 572 |
{ |
| 573 |
VP_SURFACE_DUMP(m_debugInterface, |
| 574 |
params->pSrc[uiLayer], |
| 575 |
m_vpPipeContexts[0]->GetFrameCounter(), |
| 576 |
uiLayer, |
| 577 |
VPHAL_DUMP_TYPE_PRE_ALL, |
| 578 |
VPHAL_SURF_DUMP_DDI_VP_BLT); |
| 579 |
} |
| 580 |
#endif |
| 581 |
UpdateRectForNegtiveDstTopLeft(params); |
| 582 |
// Predication |
| 583 |
SetPredicationParams(params); |
| 584 |
|
| 585 |
eStatus = ProcessBypassHandler(params, isBypassNeeded); |
| 586 |
VP_PUBLIC_CHK_STATUS_RETURN(eStatus); |
| 587 |
if (isBypassNeeded) |
| 588 |
{ |
| 589 |
MT_LOG2(MT_VP_FEATURE_GRAPH_EXECUTE_VPPIPELINE_END, MT_NORMAL, |
| 590 |
MT_VP_FEATURE_GRAPH_FILTER_SWFILTERPIPE_COUNT, (int64_t)swFilterPipes.size(), |
| 591 |
MT_VP_FEATURE_GRAPH_FILTER_PIPELINEBYPASS, isBypassNeeded); |
| 592 |
VP_PUBLIC_NORMALMESSAGE("Feature Graph: Execute VP Pipeline End, swfilterPipes count:%d, isBypassNeeded:%d", |
| 593 |
(int64_t)swFilterPipes.size(), |
| 594 |
isBypassNeeded); |
| 595 |
return MOS_STATUS_SUCCESS; |
| 596 |
} |
| 597 |
} |
| 598 |
VP_PUBLIC_CHK_STATUS_RETURN(UpdateFrameTracker()); |
| 599 |
VP_PUBLIC_CHK_STATUS_RETURN(CreateSwFilterPipe(m_pvpParams, swFilterPipes)); |
| 600 |
|
| 601 |
// Increment frame ID for performance measurement |
| 602 |
m_osInterface->pfnIncPerfFrameID(m_osInterface); |
| 603 |
|
| 604 |
for (uint32_t pipeIdx = 0; pipeIdx < swFilterPipes.size(); pipeIdx++) |
| 605 |
{ |
| 606 |
auto &pipe = swFilterPipes[pipeIdx]; |
| 607 |
if (pipeIdx >= m_vpPipeContexts.size()) |
| 608 |
{ |
| 609 |
VP_PUBLIC_CHK_STATUS_RETURN(CreateSinglePipeContext()); |
| 610 |
} |
| 611 |
MT_LOG2(MT_VP_FEATURE_GRAPH_EXECUTE_SINGLE_VPPIPELINE_START, MT_NORMAL, |
| 612 |
MT_VP_FEATURE_GRAPH_FILTER_FRAMEID, m_vpPipeContexts[pipeIdx]->GetFrameCounter(), |
| 613 |
MT_VP_FEATURE_GRAPH_FILTER_PIPEID, pipeIdx); |
| 614 |
VP_PUBLIC_NORMALMESSAGE("Feature Graph: Execute VP Single Pipeline Start, frameid:%d, pipeid:%d", |
| 615 |
m_vpPipeContexts[pipeIdx]->GetFrameCounter(), |
| 616 |
pipeIdx); |
| 617 |
if (pipe) |
| 618 |
{ |
| 619 |
pipe->AddRTLog(); |
| 620 |
} |
| 621 |
auto &singlePipeCtx = m_vpPipeContexts[pipeIdx]; |
| 622 |
VP_PUBLIC_CHK_NULL_RETURN(singlePipeCtx->GetVpResourceManager()); |
| 623 |
VP_PUBLIC_CHK_STATUS_RETURN(m_vpInterface->SwitchResourceManager(singlePipeCtx->GetVpResourceManager())); |
| 624 |
|
| 625 |
// For multi swFilterPipe cases, it may need to udpate userFeatureControl pipe by pipe |
| 626 |
VP_PUBLIC_CHK_NULL_RETURN(m_userFeatureControl); |
| 627 |
m_userFeatureControl->UpdateOnNewPipe(pipe, swFilterPipes.size()); |
| 628 |
|
| 629 |
VP_PUBLIC_CHK_STATUS_RETURN(ExecuteSingleswFilterPipe(singlePipeCtx, pipe, pPacketPipe, featureManagerNext)); |
| 630 |
// FrameCounter will be increased inside ExecuteSingleswFilterPipe, so m_vpPipeContexts[pipeIdx]->GetFrameCounter() - 1 is needed. |
| 631 |
MT_LOG2(MT_VP_FEATURE_GRAPH_EXECUTE_SINGLE_VPPIPELINE_END, MT_NORMAL, |
| 632 |
MT_VP_FEATURE_GRAPH_FILTER_FRAMEID, m_vpPipeContexts[pipeIdx]->GetFrameCounter() - 1, |
| 633 |
MT_VP_FEATURE_GRAPH_FILTER_PIPEID, pipeIdx); |
| 634 |
VP_PUBLIC_NORMALMESSAGE("Feature Graph: Execute VP Single Pipeline End, frameid:%d, pipeid:%d", |
| 635 |
m_vpPipeContexts[pipeIdx]->GetFrameCounter() - 1, |
| 636 |
pipeIdx); |
| 637 |
} |
| 638 |
|
| 639 |
MT_LOG2(MT_VP_FEATURE_GRAPH_EXECUTE_VPPIPELINE_END, MT_NORMAL, |
| 640 |
MT_VP_FEATURE_GRAPH_FILTER_SWFILTERPIPE_COUNT, (int64_t)swFilterPipes.size(), |
| 641 |
MT_VP_FEATURE_GRAPH_FILTER_PIPELINEBYPASS, isBypassNeeded); |
| 642 |
VP_PUBLIC_NORMALMESSAGE("Feature Graph: Execute VP Pipeline End, swfilterPipes count:%d, isBypassNeeded:%d", |
| 643 |
(int64_t)swFilterPipes.size(), |
| 644 |
isBypassNeeded); |
| 645 |
return eStatus; |
| 646 |
} |
| 647 |
|
| 648 |
MOS_STATUS VpPipeline::ExecuteSingleswFilterPipe(VpSinglePipeContext *singlePipeCtx, SwFilterPipe *&pipe, PacketPipe *pPacketPipe, VpFeatureManagerNext *featureManagerNext) |
| 649 |
{ |
| 650 |
VP_FUNC_CALL(); |
| 651 |
VpResourceManager *resourceManager = singlePipeCtx->GetVpResourceManager(); |
| 652 |
VpPacketReuseManager *packetReuseMgr = singlePipeCtx->GetPacketReUseManager(); |
| 653 |
uint32_t frameCounter = singlePipeCtx->GetFrameCounter(); |
| 654 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 655 |
|
| 656 |
auto retHandler = [&]() { |
| 657 |
m_pPacketPipeFactory->ReturnPacketPipe(pPacketPipe); |
| 658 |
m_vpInterface->GetSwFilterPipeFactory().Destory(pipe); |
| 659 |
m_statusReport->UpdateStatusTableAfterSubmit(eStatus); |
| 660 |
// Notify resourceManager for end of new frame processing. |
| 661 |
resourceManager->OnNewFrameProcessEnd(); |
| 662 |
MT_LOG1(MT_VP_HAL_ONNEWFRAME_PROC_END, MT_NORMAL, MT_VP_HAL_ONNEWFRAME_COUNTER, frameCounter); |
| 663 |
singlePipeCtx->AddFrameCount(); |
| 664 |
}; |
| 665 |
|
| 666 |
auto chkStatusHandler = [&](MOS_STATUS status) { |
| 667 |
if (MOS_FAILED(status)) |
| 668 |
{ |
| 669 |
retHandler(); |
| 670 |
} |
| 671 |
return status; |
| 672 |
}; |
| 673 |
|
| 674 |
auto chkNullHandler = [&](void *p) { |
| 675 |
if (nullptr == p) |
| 676 |
{ |
| 677 |
retHandler(); |
| 678 |
} |
| 679 |
return p; |
| 680 |
}; |
| 681 |
uint64_t gpuCtxOnHybridCmd = pipe->GetGpuCtxOnHybridCmd(); |
| 682 |
// Notify resourceManager for start of new frame processing. |
| 683 |
MT_LOG1(MT_VP_HAL_ONNEWFRAME_PROC_START, MT_NORMAL, MT_VP_HAL_ONNEWFRAME_COUNTER, frameCounter); |
| 684 |
VP_PUBLIC_CHK_STATUS_RETURN(chkStatusHandler(resourceManager->OnNewFrameProcessStart(*pipe))); |
| 685 |
|
| 686 |
Policy *policy = featureManagerNext->GetPolicy(); |
| 687 |
VP_PUBLIC_CHK_NULL_RETURN(chkNullHandler(policy)); |
| 688 |
|
| 689 |
bool isPacketPipeReused = false; |
| 690 |
VP_PUBLIC_CHK_NULL_RETURN(m_pvpParams.renderParams); |
| 691 |
VP_PUBLIC_CHK_STATUS_RETURN(chkStatusHandler(packetReuseMgr->PreparePacketPipeReuse(pipe, *policy, *resourceManager, isPacketPipeReused, m_pvpParams.renderParams->bOptimizeCpuTiming))); |
| 692 |
|
| 693 |
if (isPacketPipeReused) |
| 694 |
{ |
| 695 |
VP_PUBLIC_NORMALMESSAGE("Packet reused."); |
| 696 |
MT_LOG(MT_VP_FEATURE_GRAPH_FEATUREPIPE_REUSE, MT_NORMAL); |
| 697 |
singlePipeCtx->SetPacketReused(true); |
| 698 |
|
| 699 |
PacketPipe *pipeReused = packetReuseMgr->GetPacketPipeReused(); |
| 700 |
VP_PUBLIC_CHK_NULL_RETURN(chkNullHandler(pipeReused)); |
| 701 |
|
| 702 |
// Update output pipe mode. |
| 703 |
singlePipeCtx->SetOutputPipeMode(pipeReused->GetOutputPipeMode()); |
| 704 |
singlePipeCtx->SetIsVeboxFeatureInuse(pipeReused->IsVeboxFeatureInuse()); |
| 705 |
// MediaPipeline::m_statusReport is always nullptr in VP APO path right now. |
| 706 |
eStatus = pipeReused->Execute(MediaPipeline::m_statusReport, m_scalability, m_mediaContext, MOS_VE_SUPPORTED(m_osInterface), m_numVebox, gpuCtxOnHybridCmd, frameCounter); |
| 707 |
MT_LOG1(MT_VP_HAL_VEBOXNUM_CHECK, MT_NORMAL, MT_VP_HAL_VEBOX_NUMBER, m_numVebox) |
| 708 |
VP_PUBLIC_NORMALMESSAGE("Vebox Number for check %d", m_numVebox); |
| 709 |
if (MOS_SUCCEEDED(eStatus)) |
| 710 |
{ |
| 711 |
VP_PUBLIC_CHK_STATUS_RETURN(chkStatusHandler(UpdateExecuteStatus(frameCounter))); |
| 712 |
} |
| 713 |
|
| 714 |
m_vpInterface->GetSwFilterPipeFactory().Destory(pipe); |
| 715 |
|
| 716 |
m_statusReport->UpdateStatusTableAfterSubmit(eStatus); |
| 717 |
// Notify resourceManager for end of new frame processing. |
| 718 |
resourceManager->OnNewFrameProcessEnd(); |
| 719 |
MT_LOG1(MT_VP_HAL_ONNEWFRAME_PROC_END, MT_NORMAL, MT_VP_HAL_ONNEWFRAME_COUNTER, frameCounter); |
| 720 |
singlePipeCtx->AddFrameCount(); |
| 721 |
return eStatus; |
| 722 |
} |
| 723 |
else |
| 724 |
{ |
| 725 |
singlePipeCtx->SetPacketReused(false); |
| 726 |
} |
| 727 |
|
| 728 |
pPacketPipe = m_pPacketPipeFactory->CreatePacketPipe(); |
| 729 |
VP_PUBLIC_CHK_NULL_RETURN(chkNullHandler(pPacketPipe)); |
| 730 |
|
| 731 |
eStatus = featureManagerNext->InitPacketPipe(*pipe, *pPacketPipe); |
| 732 |
m_vpInterface->GetSwFilterPipeFactory().Destory(pipe); |
| 733 |
VP_PUBLIC_CHK_STATUS_RETURN(chkStatusHandler(eStatus)); |
| 734 |
|
| 735 |
// Update output pipe mode. |
| 736 |
singlePipeCtx->SetOutputPipeMode(pPacketPipe->GetOutputPipeMode()); |
| 737 |
singlePipeCtx->SetIsVeboxFeatureInuse(pPacketPipe->IsVeboxFeatureInuse()); |
| 738 |
|
| 739 |
// MediaPipeline::m_statusReport is always nullptr in VP APO path right now. |
| 740 |
|
| 741 |
eStatus = pPacketPipe->Execute(MediaPipeline::m_statusReport, m_scalability, m_mediaContext, MOS_VE_SUPPORTED(m_osInterface), m_numVebox, gpuCtxOnHybridCmd, frameCounter); |
| 742 |
|
| 743 |
MT_LOG1(MT_VP_HAL_VEBOXNUM_CHECK, MT_NORMAL, MT_VP_HAL_VEBOX_NUMBER, m_numVebox) |
| 744 |
VP_PUBLIC_NORMALMESSAGE("Vebox Number for check %d", m_numVebox); |
| 745 |
if (MOS_SUCCEEDED(eStatus)) |
| 746 |
{ |
| 747 |
VP_PUBLIC_CHK_STATUS_RETURN(chkStatusHandler(packetReuseMgr->UpdatePacketPipeConfig(pPacketPipe))); |
| 748 |
VP_PUBLIC_CHK_STATUS_RETURN(chkStatusHandler(UpdateExecuteStatus(frameCounter))); |
| 749 |
} |
| 750 |
|
| 751 |
m_pPacketPipeFactory->ReturnPacketPipe(pPacketPipe); |
| 752 |
retHandler(); |
| 753 |
|
| 754 |
return eStatus; |
| 755 |
} |
| 756 |
|
| 757 |
MOS_STATUS VpPipeline::UpdateExecuteStatus(uint32_t frameCnt) |
| 758 |
{ |
| 759 |
VP_FUNC_CALL(); |
| 760 |
|
| 761 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 762 |
#if ((_DEBUG || _RELEASE_INTERNAL)) |
| 763 |
if (PIPELINE_PARAM_TYPE_LEGACY == m_pvpParams.type) |
| 764 |
{ |
| 765 |
PVP_PIPELINE_PARAMS params = m_pvpParams.renderParams; |
| 766 |
VP_PUBLIC_CHK_NULL(params); |
| 767 |
VP_SURFACE_PTRS_DUMP(m_debugInterface, |
| 768 |
params->pTarget, |
| 769 |
VPHAL_MAX_TARGETS, |
| 770 |
params->uDstCount, |
| 771 |
frameCnt, |
| 772 |
VPHAL_DUMP_TYPE_POST_ALL, |
| 773 |
params->uSrcCount > 0 ? VPHAL_SURF_DUMP_DDI_VP_BLT : VPHAL_SURF_DUMP_DDI_CLEAR_VIEW); |
| 774 |
|
| 775 |
// Decompre output surface for debug |
| 776 |
bool uiForceDecompressedOutput = false; |
| 777 |
uiForceDecompressedOutput = m_userFeatureControl->IsForceDecompressedOutput(); |
| 778 |
|
| 779 |
if (uiForceDecompressedOutput) |
| 780 |
{ |
| 781 |
VP_PUBLIC_NORMALMESSAGE("uiForceDecompressedOutput: %d", uiForceDecompressedOutput); |
| 782 |
m_mmc->DecompressVPResource(params->pTarget[0]); |
| 783 |
} |
| 784 |
} |
| 785 |
finish: |
| 786 |
#endif |
| 787 |
return eStatus; |
| 788 |
} |
| 789 |
|
| 790 |
MOS_STATUS VpPipeline::CreateSwFilterPipe(VP_PARAMS ¶ms, std::vector<SwFilterPipe*> &swFilterPipe) |
| 791 |
{ |
| 792 |
VP_FUNC_CALL(); |
| 793 |
switch (m_pvpParams.type) |
| 794 |
{ |
| 795 |
case PIPELINE_PARAM_TYPE_LEGACY: |
| 796 |
VP_PUBLIC_CHK_STATUS_RETURN(m_vpInterface->GetSwFilterPipeFactory().Create(m_pvpParams.renderParams, swFilterPipe, m_pipelineParamFactory)); |
| 797 |
break; |
| 798 |
case PIPELINE_PARAM_TYPE_MEDIA_SFC_INTERFACE: |
| 799 |
VP_PUBLIC_CHK_STATUS_RETURN(m_vpInterface->GetSwFilterPipeFactory().Create(m_pvpParams.sfcParams, swFilterPipe)); |
| 800 |
break; |
| 801 |
default: |
| 802 |
VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_INVALID_PARAMETER); |
| 803 |
} |
| 804 |
|
| 805 |
if (swFilterPipe.size() == 0) |
| 806 |
{ |
| 807 |
VP_PUBLIC_ASSERTMESSAGE("Fail to create SwFilterPipe."); |
| 808 |
return MOS_STATUS_NULL_POINTER; |
| 809 |
} |
| 810 |
|
| 811 |
return MOS_STATUS_SUCCESS; |
| 812 |
} |
| 813 |
|
| 814 |
MOS_STATUS VpPipeline::UpdateFrameTracker() |
| 815 |
{ |
| 816 |
VP_FUNC_CALL(); |
| 817 |
|
| 818 |
VP_PUBLIC_CHK_NULL_RETURN(m_vpMhwInterface.m_vpPlatformInterface); |
| 819 |
VP_PUBLIC_CHK_STATUS_RETURN(m_vpMhwInterface.m_vpPlatformInterface->InitFrameTracker()); |
| 820 |
return MOS_STATUS_SUCCESS; |
| 821 |
} |
| 822 |
|
| 823 |
MOS_STATUS VpPipeline::UpdateVeboxNumberforScalability() |
| 824 |
{ |
| 825 |
VP_FUNC_CALL(); |
| 826 |
|
| 827 |
VP_PUBLIC_CHK_NULL_RETURN(m_vpMhwInterface.m_vpPlatformInterface); |
| 828 |
|
| 829 |
// Check whether scalability being disabled. |
| 830 |
int32_t enableVeboxScalability = 0; |
| 831 |
|
| 832 |
if (m_numVebox <= 0) |
| 833 |
{ |
| 834 |
VP_PUBLIC_NORMALMESSAGE("Vebox Number of Enabled %d", m_numVebox); |
| 835 |
return MOS_STATUS_SUCCESS; |
| 836 |
} |
| 837 |
|
| 838 |
MOS_STATUS statusKey = MOS_STATUS_SUCCESS; |
| 839 |
statusKey = ReadUserSetting( |
| 840 |
m_userSettingPtr, |
| 841 |
enableVeboxScalability, |
| 842 |
__MEDIA_USER_FEATURE_VALUE_ENABLE_VEBOX_SCALABILITY_MODE, |
| 843 |
MediaUserSetting::Group::Device); |
| 844 |
|
| 845 |
bool disableScalability = false; |
| 846 |
if (statusKey == MOS_STATUS_SUCCESS) |
| 847 |
{ |
| 848 |
disableScalability = enableVeboxScalability ? false : true; |
| 849 |
if (disableScalability == false) |
| 850 |
{ |
| 851 |
m_forceMultiplePipe = MOS_SCALABILITY_ENABLE_MODE_USER_FORCE | MOS_SCALABILITY_ENABLE_MODE_DEFAULT; |
| 852 |
} |
| 853 |
else |
| 854 |
{ |
| 855 |
m_forceMultiplePipe = MOS_SCALABILITY_ENABLE_MODE_USER_FORCE | MOS_SCALABILITY_ENABLE_MODE_FALSE; |
| 856 |
} |
| 857 |
} |
| 858 |
else |
| 859 |
{ |
| 860 |
m_forceMultiplePipe = MOS_SCALABILITY_ENABLE_MODE_DEFAULT; |
| 861 |
} |
| 862 |
|
| 863 |
VP_PUBLIC_CHK_NULL_RETURN(m_skuTable); |
| 864 |
if (MEDIA_IS_SKU(m_skuTable, FtrEngineGroupScheduling)) |
| 865 |
{ |
| 866 |
VP_PUBLIC_NORMALMESSAGE("FtrEngineGroupScheduling is set. Disable Scalability!"); |
| 867 |
disableScalability = true; |
| 868 |
} |
| 869 |
|
| 870 |
if (disableScalability == true) |
| 871 |
{ |
| 872 |
m_numVebox = 1; |
| 873 |
VP_PUBLIC_NORMALMESSAGE("DisableScalability Vebox Number of Enabled %d", m_numVebox); |
| 874 |
return MOS_STATUS_SUCCESS; |
| 875 |
} |
| 876 |
else if (m_forceMultiplePipe == MOS_SCALABILITY_ENABLE_MODE_DEFAULT) |
| 877 |
{ |
| 878 |
if (m_vpMhwInterface.m_vpPlatformInterface->IsVeboxScalabilityWith4KNotSupported(m_vpMhwInterface) == true) |
| 879 |
{ |
| 880 |
m_numVebox = 1; |
| 881 |
VP_PUBLIC_NORMALMESSAGE("ForceMultiplePipe Vebox Number of Enabled %d", m_numVebox); |
| 882 |
return MOS_STATUS_SUCCESS; |
| 883 |
} |
| 884 |
} |
| 885 |
|
| 886 |
return MOS_STATUS_SUCCESS; |
| 887 |
} |
| 888 |
|
| 889 |
MOS_STATUS VpPipeline::GetSystemVeboxNumber() |
| 890 |
{ |
| 891 |
VP_FUNC_CALL(); |
| 892 |
|
| 893 |
// Get vebox number from meida sys info. |
| 894 |
MEDIA_ENGINE_INFO mediaSysInfo = {}; |
| 895 |
MOS_STATUS eStatus = m_osInterface->pfnGetMediaEngineInfo(m_osInterface, mediaSysInfo); |
| 896 |
if (MOS_SUCCEEDED(eStatus)) |
| 897 |
{ |
| 898 |
// Both VE mode and media solo mode should be able to get the VEBOX number via the same interface |
| 899 |
m_numVebox = (uint8_t)(mediaSysInfo.VEBoxInfo.NumberOfVEBoxEnabled); |
| 900 |
VP_PUBLIC_NORMALMESSAGE("Vebox Number of Enabled %d", m_numVebox); |
| 901 |
if (m_numVebox == 0 && !IsGtEnv()) |
| 902 |
{ |
| 903 |
VP_PUBLIC_ASSERTMESSAGE("Fail to get the m_numVebox with value 0"); |
| 904 |
VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_INVALID_PARAMETER); |
| 905 |
} |
| 906 |
else if (m_numVebox == 0 && MEDIA_IS_SKU(m_osInterface->pfnGetSkuTable(m_osInterface), FtrVERing)) |
| 907 |
{ |
| 908 |
m_numVebox = 1; |
| 909 |
} |
| 910 |
} |
| 911 |
else |
| 912 |
{ |
| 913 |
m_numVebox = 1; |
| 914 |
} |
| 915 |
|
| 916 |
VP_PUBLIC_CHK_STATUS_RETURN(UpdateVeboxNumberforScalability()); |
| 917 |
|
| 918 |
m_numVeboxOriginal = m_numVebox; |
| 919 |
|
| 920 |
return MOS_STATUS_SUCCESS; |
| 921 |
} |
| 922 |
|
| 923 |
MOS_STATUS VpPipeline::CreateSinglePipeContext() |
| 924 |
{ |
| 925 |
VP_FUNC_CALL(); |
| 926 |
VpSinglePipeContext *singlePipeCtx = MOS_New(VpSinglePipeContext); |
| 927 |
VP_PUBLIC_CHK_NULL_RETURN(singlePipeCtx); |
| 928 |
MOS_STATUS status = singlePipeCtx->Init(m_osInterface, m_allocator, m_reporting, m_vpMhwInterface.m_vpPlatformInterface, m_pPacketPipeFactory, m_userFeatureControl, m_mediaCopyWrapper, m_graphManager); |
| 929 |
if (MOS_FAILED(status)) |
| 930 |
{ |
| 931 |
MOS_Delete(singlePipeCtx); |
| 932 |
VP_PUBLIC_CHK_STATUS_RETURN(status); |
| 933 |
} |
| 934 |
else |
| 935 |
{ |
| 936 |
m_vpPipeContexts.push_back(singlePipeCtx); |
| 937 |
} |
| 938 |
return status; |
| 939 |
} |
| 940 |
|
| 941 |
MOS_STATUS VpPipeline::CreateFeatureManager(VpResourceManager *vpResourceManager) |
| 942 |
{ |
| 943 |
VP_FUNC_CALL(); |
| 944 |
|
| 945 |
VP_PUBLIC_CHK_NULL_RETURN(m_osInterface); |
| 946 |
VP_PUBLIC_CHK_NULL_RETURN(m_allocator); |
| 947 |
VP_PUBLIC_CHK_NULL_RETURN(m_reporting); |
| 948 |
VP_PUBLIC_CHK_NULL_RETURN(m_vpMhwInterface.m_vpPlatformInterface); |
| 949 |
VP_PUBLIC_CHK_NULL_RETURN(vpResourceManager); |
| 950 |
|
| 951 |
// Add CheckFeatures api later in FeatureManagerNext. |
| 952 |
m_paramChecker = m_vpMhwInterface.m_vpPlatformInterface->CreateFeatureChecker(&m_vpMhwInterface); |
| 953 |
VP_PUBLIC_CHK_NULL_RETURN(m_paramChecker); |
| 954 |
|
| 955 |
m_vpInterface = MOS_New(VpInterface, &m_vpMhwInterface, *m_allocator, vpResourceManager, m_graphManager); |
| 956 |
|
| 957 |
VP_PUBLIC_CHK_NULL_RETURN(m_vpInterface); |
| 958 |
|
| 959 |
m_featureManager = MOS_New(VpFeatureManagerNext, *m_vpInterface); |
| 960 |
VP_PUBLIC_CHK_NULL_RETURN(m_featureManager); |
| 961 |
|
| 962 |
VP_PUBLIC_CHK_STATUS_RETURN(((VpFeatureManagerNext *)m_featureManager)->Init(nullptr)); |
| 963 |
|
| 964 |
m_pipelineParamFactory = MOS_New(VpPipelineParamFactory); |
| 965 |
VP_PUBLIC_CHK_NULL_RETURN(m_pipelineParamFactory); |
| 966 |
|
| 967 |
return MOS_STATUS_SUCCESS; |
| 968 |
} |
| 969 |
|
| 970 |
MOS_STATUS VpPipeline::CreateVpKernelSets() |
| 971 |
{ |
| 972 |
VP_FUNC_CALL(); |
| 973 |
if (nullptr == m_kernelSet) |
| 974 |
{ |
| 975 |
m_kernelSet = MOS_New(VpKernelSet, &m_vpMhwInterface, m_allocator); |
| 976 |
VP_PUBLIC_CHK_NULL_RETURN(m_kernelSet); |
| 977 |
} |
| 978 |
return MOS_STATUS_SUCCESS; |
| 979 |
} |
| 980 |
|
| 981 |
MOS_STATUS VpPipeline::CreateVpGraphSets() |
| 982 |
{ |
| 983 |
if (nullptr == m_graphSet) |
| 984 |
{ |
| 985 |
m_graphSet = MOS_New(VpGraphSet, &m_vpMhwInterface, m_allocator); |
| 986 |
VP_PUBLIC_CHK_NULL_RETURN(m_graphSet); |
| 987 |
} |
| 988 |
return MOS_STATUS_SUCCESS; |
| 989 |
} |
| 990 |
|
| 991 |
MOS_STATUS VpPipeline::CreateVpGraphManager() |
| 992 |
{ |
| 993 |
if (nullptr == m_graphManager) |
| 994 |
{ |
| 995 |
m_graphManager = MOS_New(VpGraphManager, m_graphSet, m_osInterface, m_allocator); |
| 996 |
VP_PUBLIC_CHK_NULL_RETURN(m_graphManager); |
| 997 |
} |
| 998 |
return MOS_STATUS_SUCCESS; |
| 999 |
} |
| 1000 |
|
| 1001 |
MOS_STATUS VpPipeline::CheckFeatures(void *params, bool &bapgFuncSupported) |
| 1002 |
{ |
| 1003 |
VP_FUNC_CALL(); |
| 1004 |
|
| 1005 |
VP_PUBLIC_CHK_NULL_RETURN(m_paramChecker); |
| 1006 |
return m_paramChecker->CheckFeatures(params, bapgFuncSupported); |
| 1007 |
} |
| 1008 |
|
| 1009 |
MOS_STATUS VpPipeline::CreateFeatureReport() |
| 1010 |
{ |
| 1011 |
VP_FUNC_CALL(); |
| 1012 |
|
| 1013 |
if (m_vpMhwInterface.m_reporting) |
| 1014 |
{ |
| 1015 |
if (m_reporting && m_reporting->owner == this && m_vpMhwInterface.m_reporting != m_reporting) |
| 1016 |
{ |
| 1017 |
MOS_FreeMemory(m_reporting); |
| 1018 |
} |
| 1019 |
m_reporting = m_vpMhwInterface.m_reporting; |
| 1020 |
} |
| 1021 |
else |
| 1022 |
{ |
| 1023 |
if (m_reporting == nullptr) |
| 1024 |
{ |
| 1025 |
VP_PUBLIC_CHK_STATUS_RETURN(CreateReport()); |
| 1026 |
} |
| 1027 |
m_vpMhwInterface.m_reporting = m_reporting; |
| 1028 |
} |
| 1029 |
|
| 1030 |
VP_PUBLIC_CHK_NULL_RETURN(m_reporting); |
| 1031 |
return MOS_STATUS_SUCCESS; |
| 1032 |
} |
| 1033 |
|
| 1034 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 1035 |
VPHAL_SURFACE *VpPipeline::AllocateTempTargetSurface(VPHAL_SURFACE *m_tempTargetSurface) |
| 1036 |
{ |
| 1037 |
VP_FUNC_CALL(); |
| 1038 |
|
| 1039 |
m_tempTargetSurface = (VPHAL_SURFACE *)MOS_AllocAndZeroMemory(sizeof(VPHAL_SURFACE)); |
| 1040 |
if (!m_tempTargetSurface) |
| 1041 |
{ |
| 1042 |
return nullptr; |
| 1043 |
} |
| 1044 |
return m_tempTargetSurface; |
| 1045 |
} |
| 1046 |
|
| 1047 |
MOS_STATUS VpPipeline::SurfaceReplace(PVP_PIPELINE_PARAMS params) |
| 1048 |
{ |
| 1049 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 1050 |
bool allocated; |
| 1051 |
|
| 1052 |
MEDIA_FEATURE_TABLE *skuTable = nullptr; |
| 1053 |
skuTable = m_vpMhwInterface.m_osInterface->pfnGetSkuTable(m_vpMhwInterface.m_osInterface); |
| 1054 |
VP_PUBLIC_CHK_NULL_RETURN(skuTable); |
| 1055 |
VP_PUBLIC_CHK_NULL_RETURN(m_userFeatureControl); |
| 1056 |
|
| 1057 |
if (m_userFeatureControl->EnabledSFCNv12P010LinearOutput() && |
| 1058 |
MOS_TILE_LINEAR != params->pTarget[0]->TileType && |
| 1059 |
(Format_P010 == params->pTarget[0]->Format || Format_NV12 == params->pTarget[0]->Format) && |
| 1060 |
MEDIA_IS_SKU(skuTable, FtrSFC420LinearOutputSupport)) |
| 1061 |
{ |
| 1062 |
if (!m_tempTargetSurface) |
| 1063 |
{ |
| 1064 |
m_tempTargetSurface = AllocateTempTargetSurface(m_tempTargetSurface); |
| 1065 |
} |
| 1066 |
VP_PUBLIC_CHK_NULL_RETURN(m_tempTargetSurface); |
| 1067 |
eStatus = m_allocator->ReAllocateSurface( |
| 1068 |
m_tempTargetSurface, |
| 1069 |
"TempTargetSurface", |
| 1070 |
params->pTarget[0]->Format, |
| 1071 |
MOS_GFXRES_2D, |
| 1072 |
MOS_TILE_LINEAR, |
| 1073 |
params->pTarget[0]->dwWidth, |
| 1074 |
params->pTarget[0]->dwHeight, |
| 1075 |
false, |
| 1076 |
MOS_MMC_DISABLED, |
| 1077 |
&allocated); |
| 1078 |
|
| 1079 |
m_tempTargetSurface->ColorSpace = params->pTarget[0]->ColorSpace; |
| 1080 |
m_tempTargetSurface->rcSrc = params->pTarget[0]->rcSrc; |
| 1081 |
m_tempTargetSurface->rcDst = params->pTarget[0]->rcDst; |
| 1082 |
m_tempTargetSurface->rcMaxSrc = params->pTarget[0]->rcMaxSrc; |
| 1083 |
|
| 1084 |
if (eStatus == MOS_STATUS_SUCCESS) |
| 1085 |
{ |
| 1086 |
params->pTarget[0] = m_tempTargetSurface; //params is the copy of pcRenderParams which will not cause the memleak, |
| 1087 |
} |
| 1088 |
} |
| 1089 |
|
| 1090 |
typedef struct _RGBFormatConfig |
| 1091 |
{ |
| 1092 |
MOS_FORMAT format; |
| 1093 |
MOS_TILE_TYPE tielType; |
| 1094 |
} RGBFormatConfig; |
| 1095 |
|
| 1096 |
static const RGBFormatConfig rgbCfg[VP_RGB_OUTPUT_OVERRIDE_ID_MAX] = { |
| 1097 |
{Format_Invalid, MOS_TILE_INVALID}, |
| 1098 |
{Format_RGBP, MOS_TILE_LINEAR}, |
| 1099 |
{Format_RGBP, MOS_TILE_Y}, |
| 1100 |
{Format_R8G8B8, MOS_TILE_LINEAR}, |
| 1101 |
{Format_BGRP, MOS_TILE_LINEAR}, |
| 1102 |
{Format_BGRP, MOS_TILE_Y} |
| 1103 |
}; |
| 1104 |
|
| 1105 |
if (m_userFeatureControl->EnabledSFCRGBPRGB24Output() == VP_RGB_OUTPUT_OVERRIDE_ID_INVALID || |
| 1106 |
m_userFeatureControl->EnabledSFCRGBPRGB24Output() >= VP_RGB_OUTPUT_OVERRIDE_ID_MAX) |
| 1107 |
{ |
| 1108 |
return MOS_STATUS_SUCCESS; |
| 1109 |
} |
| 1110 |
|
| 1111 |
if (rgbCfg[m_userFeatureControl->EnabledSFCRGBPRGB24Output()].format != params->pTarget[0]->Format && |
| 1112 |
MEDIA_IS_SKU(skuTable, FtrSFCRGBPRGB24OutputSupport)) |
| 1113 |
{ |
| 1114 |
if (!m_tempTargetSurface) |
| 1115 |
{ |
| 1116 |
m_tempTargetSurface = AllocateTempTargetSurface(m_tempTargetSurface); |
| 1117 |
} |
| 1118 |
VP_PUBLIC_CHK_NULL_RETURN(m_tempTargetSurface); |
| 1119 |
eStatus = m_allocator->ReAllocateSurface( |
| 1120 |
m_tempTargetSurface, |
| 1121 |
"TempTargetSurface", |
| 1122 |
rgbCfg[m_userFeatureControl->EnabledSFCRGBPRGB24Output()].format, |
| 1123 |
MOS_GFXRES_2D, |
| 1124 |
rgbCfg[m_userFeatureControl->EnabledSFCRGBPRGB24Output()].tielType, |
| 1125 |
params->pTarget[0]->dwWidth, |
| 1126 |
params->pTarget[0]->dwHeight, |
| 1127 |
false, |
| 1128 |
MOS_MMC_DISABLED, |
| 1129 |
&allocated); |
| 1130 |
|
| 1131 |
m_tempTargetSurface->ColorSpace = params->pTarget[0]->ColorSpace; |
| 1132 |
m_tempTargetSurface->rcSrc = params->pTarget[0]->rcSrc; |
| 1133 |
m_tempTargetSurface->rcDst = params->pTarget[0]->rcDst; |
| 1134 |
m_tempTargetSurface->rcMaxSrc = params->pTarget[0]->rcMaxSrc; |
| 1135 |
|
| 1136 |
if (eStatus == MOS_STATUS_SUCCESS) |
| 1137 |
{ |
| 1138 |
params->pTarget[0] = m_tempTargetSurface; //params is the copy of pcRenderParams which will not cause the memleak, |
| 1139 |
} |
| 1140 |
} |
| 1141 |
|
| 1142 |
return eStatus; |
| 1143 |
} |
| 1144 |
#endif |
| 1145 |
|
| 1146 |
MOS_STATUS VpPipeline::PrepareVpPipelineParams(PVP_PIPELINE_PARAMS params) |
| 1147 |
{ |
| 1148 |
VP_FUNC_CALL(); |
| 1149 |
VP_PUBLIC_CHK_NULL_RETURN(params); |
| 1150 |
|
| 1151 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 1152 |
SurfaceReplace(params); // replace output surface from Tile-Y to Linear |
| 1153 |
#endif |
| 1154 |
|
| 1155 |
if ((m_vpMhwInterface.m_osInterface != nullptr)) |
| 1156 |
{ |
| 1157 |
// Set the component info |
| 1158 |
m_vpMhwInterface.m_osInterface->Component = params->Component; |
| 1159 |
|
| 1160 |
// Init component(DDI entry point) info for perf measurement |
| 1161 |
m_vpMhwInterface.m_osInterface->pfnSetPerfTag(m_vpMhwInterface.m_osInterface, VPHAL_NONE); |
| 1162 |
} |
| 1163 |
|
| 1164 |
PMOS_RESOURCE ppSource[VPHAL_MAX_SOURCES] = {nullptr}; |
| 1165 |
PMOS_RESOURCE ppTarget[VPHAL_MAX_TARGETS] = {nullptr}; |
| 1166 |
|
| 1167 |
VP_PUBLIC_CHK_NULL_RETURN(params->pTarget[0]); |
| 1168 |
VP_PUBLIC_CHK_NULL_RETURN(m_allocator); |
| 1169 |
VP_PUBLIC_CHK_NULL_RETURN(m_featureManager); |
| 1170 |
|
| 1171 |
// Can be removed, as all info can be gotten during AllocateVpSurface. |
| 1172 |
VPHAL_GET_SURFACE_INFO info = {}; |
| 1173 |
for (uint32_t i = 0; i < params->uSrcCount; ++i) |
| 1174 |
{ |
| 1175 |
MOS_ZeroMemory(&info, sizeof(VPHAL_GET_SURFACE_INFO)); |
| 1176 |
VP_PUBLIC_CHK_STATUS_RETURN(m_allocator->GetSurfaceInfo( |
| 1177 |
params->pSrc[i], |
| 1178 |
info)); |
| 1179 |
} |
| 1180 |
|
| 1181 |
MOS_ZeroMemory(&info, sizeof(VPHAL_GET_SURFACE_INFO)); |
| 1182 |
VP_PUBLIC_CHK_STATUS_RETURN(m_allocator->GetSurfaceInfo( |
| 1183 |
params->pTarget[0], |
| 1184 |
info)); |
| 1185 |
|
| 1186 |
if (params->uSrcCount>0) |
| 1187 |
{ |
| 1188 |
if (params->pSrc[0]->pBwdRef && params->pSrc[0]->uBwdRefCount > 0) |
| 1189 |
{ |
| 1190 |
MOS_ZeroMemory(&info, sizeof(VPHAL_GET_SURFACE_INFO)); |
| 1191 |
|
| 1192 |
VP_PUBLIC_CHK_STATUS_RETURN(m_allocator->GetSurfaceInfo( |
| 1193 |
params->pSrc[0]->pBwdRef, |
| 1194 |
info)); |
| 1195 |
} |
| 1196 |
|
| 1197 |
if (!RECT1_CONTAINS_RECT2(params->pSrc[0]->rcMaxSrc, params->pSrc[0]->rcSrc)) |
| 1198 |
{ |
| 1199 |
params->pSrc[0]->rcMaxSrc = params->pSrc[0]->rcSrc; |
| 1200 |
} |
| 1201 |
} |
| 1202 |
|
| 1203 |
bool bApgFuncSupported = false; |
| 1204 |
VP_PUBLIC_CHK_STATUS_RETURN(CheckFeatures(params, bApgFuncSupported)); |
| 1205 |
|
| 1206 |
if (!bApgFuncSupported) |
| 1207 |
{ |
| 1208 |
VP_PUBLIC_NORMALMESSAGE("Features are not supported on APG now \n"); |
| 1209 |
|
| 1210 |
if (m_currentFrameAPGEnabled) |
| 1211 |
{ |
| 1212 |
params->bAPGWorkloadEnable = true; |
| 1213 |
m_currentFrameAPGEnabled = false; |
| 1214 |
} |
| 1215 |
else |
| 1216 |
{ |
| 1217 |
params->bAPGWorkloadEnable = false; |
| 1218 |
} |
| 1219 |
|
| 1220 |
return MOS_STATUS_UNIMPLEMENTED; |
| 1221 |
} |
| 1222 |
else |
| 1223 |
{ |
| 1224 |
m_currentFrameAPGEnabled = true; |
| 1225 |
params->bAPGWorkloadEnable = false; |
| 1226 |
VP_PUBLIC_NORMALMESSAGE("Features can be enabled on APG"); |
| 1227 |
} |
| 1228 |
|
| 1229 |
// Init Resource Max Rect for primary video |
| 1230 |
|
| 1231 |
if ((nullptr != m_vpMhwInterface.m_osInterface) && |
| 1232 |
(nullptr != m_vpMhwInterface.m_osInterface->osCpInterface)) |
| 1233 |
{ |
| 1234 |
for (uint32_t uiIndex = 0; uiIndex < params->uSrcCount; uiIndex++) |
| 1235 |
{ |
| 1236 |
ppSource[uiIndex] = &(params->pSrc[uiIndex]->OsResource); |
| 1237 |
} |
| 1238 |
for (uint32_t uiIndex = 0; uiIndex < params->uDstCount; uiIndex++) |
| 1239 |
{ |
| 1240 |
ppTarget[uiIndex] = &(params->pTarget[uiIndex]->OsResource); |
| 1241 |
} |
| 1242 |
m_vpMhwInterface.m_osInterface->osCpInterface->PrepareResources( |
| 1243 |
(void **)ppSource, params->uSrcCount, (void **)ppTarget, params->uDstCount); |
| 1244 |
} |
| 1245 |
|
| 1246 |
PrepareVpPipelineScalabilityParams(params); |
| 1247 |
|
| 1248 |
for (uint32_t uiIndex = 0; uiIndex < params->uSrcCount; uiIndex++) |
| 1249 |
{ |
| 1250 |
// Add Procamp limitation before Render pass selected |
| 1251 |
// Brightness[-100.0,100.0], Contrast & Saturation[0.0,10.0] |
| 1252 |
PVPHAL_PROCAMP_PARAMS pProcampParams = params->pSrc[uiIndex]->pProcampParams; |
| 1253 |
if (pProcampParams && pProcampParams->bEnabled) |
| 1254 |
{ |
| 1255 |
pProcampParams->fBrightness = MOS_MIN(MOS_MAX(-100.0f, pProcampParams->fBrightness), 100.0f); |
| 1256 |
pProcampParams->fContrast = MOS_MIN(MOS_MAX(0.0f, pProcampParams->fContrast), 10.0f); |
| 1257 |
pProcampParams->fSaturation = MOS_MIN(MOS_MAX(0.0f, pProcampParams->fSaturation), 10.0f); |
| 1258 |
} |
| 1259 |
} |
| 1260 |
|
| 1261 |
return MOS_STATUS_SUCCESS; |
| 1262 |
} |
| 1263 |
|
| 1264 |
//! |
| 1265 |
//! \brief prepare execution params for vp scalability pipeline |
| 1266 |
//! \param [in] params |
| 1267 |
//! src and dst surface's width and height |
| 1268 |
//! \return MOS_STATUS |
| 1269 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1270 |
//! |
| 1271 |
MOS_STATUS VpPipeline::PrepareVpPipelineScalabilityParams(uint32_t srcWidth, uint32_t srcHeight, uint32_t dstWidth, uint32_t dstHeight) |
| 1272 |
{ |
| 1273 |
VP_FUNC_CALL(); |
| 1274 |
VP_PUBLIC_NORMALMESSAGE("Reset m_numVebox %d -> %d", m_numVebox, m_numVeboxOriginal); |
| 1275 |
m_numVebox = m_numVeboxOriginal; |
| 1276 |
MT_LOG1(MT_VP_HAL_VEBOXNUM_RESET, MT_NORMAL, MT_VP_HAL_VEBOX_NUMBER, m_numVebox) |
| 1277 |
|
| 1278 |
// Disable vesfc scalability when reg key "Enable Vebox Scalability" was set to zero |
| 1279 |
if (m_forceMultiplePipe == (MOS_SCALABILITY_ENABLE_MODE_USER_FORCE | MOS_SCALABILITY_ENABLE_MODE_FALSE)) |
| 1280 |
{ |
| 1281 |
m_numVebox = 1; |
| 1282 |
} |
| 1283 |
else |
| 1284 |
{ |
| 1285 |
if (((srcWidth > m_scalability_threshWidth) && |
| 1286 |
(srcHeight > m_scalability_threshHeight)) || |
| 1287 |
((dstWidth > m_scalability_threshWidth) && |
| 1288 |
(dstHeight > m_scalability_threshHeight))) |
| 1289 |
{ |
| 1290 |
// Enable vesfc scalability only with 4k+ clips |
| 1291 |
} |
| 1292 |
else |
| 1293 |
{ |
| 1294 |
// disable vesfc scalability with 4k- resolution clips if reg "Enable Vebox Scalability" was not set as true |
| 1295 |
if (m_forceMultiplePipe != (MOS_SCALABILITY_ENABLE_MODE_USER_FORCE | MOS_SCALABILITY_ENABLE_MODE_DEFAULT)) |
| 1296 |
{ |
| 1297 |
m_numVebox = 1; |
| 1298 |
} |
| 1299 |
} |
| 1300 |
} |
| 1301 |
|
| 1302 |
return MOS_STATUS_SUCCESS; |
| 1303 |
} |
| 1304 |
|
| 1305 |
//! |
| 1306 |
//! \brief prepare execution params for vp scalability pipeline |
| 1307 |
//! \param [in] params |
| 1308 |
//! Pointer to VP scalability pipeline params |
| 1309 |
//! \return MOS_STATUS |
| 1310 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1311 |
//! |
| 1312 |
MOS_STATUS VpPipeline::PrepareVpPipelineScalabilityParams(VEBOX_SFC_PARAMS* params) |
| 1313 |
{ |
| 1314 |
VP_FUNC_CALL(); |
| 1315 |
VP_PUBLIC_CHK_NULL_RETURN(params); |
| 1316 |
VP_PUBLIC_CHK_NULL_RETURN(params->input.surface); |
| 1317 |
VP_PUBLIC_CHK_NULL_RETURN(params->output.surface); |
| 1318 |
|
| 1319 |
VP_PUBLIC_CHK_STATUS_RETURN(PrepareVpPipelineScalabilityParams( |
| 1320 |
MOS_MIN(params->input.surface->dwWidth, (uint32_t)params->input.rcSrc.right), |
| 1321 |
MOS_MIN(params->input.surface->dwHeight, (uint32_t)params->input.rcSrc.bottom), |
| 1322 |
MOS_MIN(params->output.surface->dwWidth, (uint32_t)params->output.rcDst.right), |
| 1323 |
MOS_MIN(params->output.surface->dwHeight, (uint32_t)params->output.rcDst.bottom))); |
| 1324 |
|
| 1325 |
return MOS_STATUS_SUCCESS; |
| 1326 |
} |
| 1327 |
|
| 1328 |
//! |
| 1329 |
//! \brief prepare execution params for vp scalability pipeline |
| 1330 |
//! \param [in] params |
| 1331 |
//! Pointer to VP scalability pipeline params |
| 1332 |
//! \return MOS_STATUS |
| 1333 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1334 |
//! |
| 1335 |
MOS_STATUS VpPipeline::PrepareVpPipelineScalabilityParams(PVP_PIPELINE_PARAMS params) |
| 1336 |
{ |
| 1337 |
VP_FUNC_CALL(); |
| 1338 |
VP_PUBLIC_CHK_NULL_RETURN(params); |
| 1339 |
if (params->pSrc[0] == nullptr) |
| 1340 |
{ |
| 1341 |
VP_PUBLIC_NORMALMESSAGE("No input will not need scalability! "); |
| 1342 |
return MOS_STATUS_SUCCESS; |
| 1343 |
} |
| 1344 |
|
| 1345 |
VP_PUBLIC_CHK_NULL_RETURN(params->pTarget[0]); |
| 1346 |
|
| 1347 |
VP_PUBLIC_CHK_STATUS_RETURN(PrepareVpPipelineScalabilityParams( |
| 1348 |
MOS_MIN(params->pSrc[0]->dwWidth, (uint32_t)params->pSrc[0]->rcSrc.right), |
| 1349 |
MOS_MIN(params->pSrc[0]->dwHeight, (uint32_t)params->pSrc[0]->rcSrc.bottom), |
| 1350 |
MOS_MIN(params->pTarget[0]->dwWidth, (uint32_t)params->pTarget[0]->rcSrc.right), |
| 1351 |
MOS_MIN(params->pTarget[0]->dwHeight, (uint32_t)params->pTarget[0]->rcSrc.bottom))); |
| 1352 |
|
| 1353 |
// Disable DN when vesfc scalability was enabled for output mismatch issue |
| 1354 |
if (IsMultiple()) |
| 1355 |
{ |
| 1356 |
if (params->pSrc[0]->pDenoiseParams) |
| 1357 |
{ |
| 1358 |
params->pSrc[0]->pDenoiseParams->bAutoDetect = false; |
| 1359 |
params->pSrc[0]->pDenoiseParams->bEnableChroma = false; |
| 1360 |
params->pSrc[0]->pDenoiseParams->bEnableLuma = false; |
| 1361 |
} |
| 1362 |
} |
| 1363 |
|
| 1364 |
return MOS_STATUS_SUCCESS; |
| 1365 |
} |
| 1366 |
|
| 1367 |
MOS_STATUS VpPipeline::Prepare(void * params) |
| 1368 |
{ |
| 1369 |
MOS_STATUS eStatus = MOS_STATUS_UNKNOWN; |
| 1370 |
|
| 1371 |
VP_FUNC_CALL(); |
| 1372 |
|
| 1373 |
VP_PUBLIC_CHK_NULL_RETURN(params); |
| 1374 |
VP_PUBLIC_CHK_NULL_RETURN(m_userFeatureControl); |
| 1375 |
|
| 1376 |
m_pvpParams = *(VP_PARAMS *)params; |
| 1377 |
|
| 1378 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 1379 |
// INTER_FRAME_MEMORY_NINJA_END_COUNTER will be reported in UserFeatureReport() function which runs in Execute() |
| 1380 |
ReportIFNCC(true); |
| 1381 |
#endif |
| 1382 |
// Get Output Pipe for Features. It should be configured in ExecuteVpPipeline. |
| 1383 |
if (m_vpPipeContexts.size() <= 0 || m_vpPipeContexts[0] == nullptr) |
| 1384 |
{ |
| 1385 |
VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_INVALID_PARAMETER); |
| 1386 |
} |
| 1387 |
|
| 1388 |
m_vpPipeContexts[0]->InitializeOutputPipe(); |
| 1389 |
|
| 1390 |
if (PIPELINE_PARAM_TYPE_LEGACY == m_pvpParams.type) |
| 1391 |
{ |
| 1392 |
m_userFeatureControl->Update((PVP_PIPELINE_PARAMS)m_pvpParams.renderParams); |
| 1393 |
// VP Execution Params Prepare |
| 1394 |
eStatus = PrepareVpPipelineParams(m_pvpParams.renderParams); |
| 1395 |
if (eStatus != MOS_STATUS_SUCCESS) |
| 1396 |
{ |
| 1397 |
if (eStatus == MOS_STATUS_UNIMPLEMENTED) |
| 1398 |
{ |
| 1399 |
VP_PUBLIC_NORMALMESSAGE("Features are UNIMPLEMENTED on APG now \n"); |
| 1400 |
return eStatus; |
| 1401 |
} |
| 1402 |
else |
| 1403 |
{ |
| 1404 |
VP_PUBLIC_CHK_STATUS_RETURN(eStatus); |
| 1405 |
} |
| 1406 |
} |
| 1407 |
} |
| 1408 |
else if (PIPELINE_PARAM_TYPE_MEDIA_SFC_INTERFACE == m_pvpParams.type) |
| 1409 |
{ |
| 1410 |
VEBOX_SFC_PARAMS *sfcParams = m_pvpParams.sfcParams; |
| 1411 |
VP_PUBLIC_CHK_NULL_RETURN(sfcParams); |
| 1412 |
|
| 1413 |
VP_PUBLIC_CHK_STATUS_RETURN(PrepareVpPipelineScalabilityParams(sfcParams)); |
| 1414 |
} |
| 1415 |
|
| 1416 |
return MOS_STATUS_SUCCESS; |
| 1417 |
} |
| 1418 |
|
| 1419 |
MOS_STATUS VpPipeline::Execute() |
| 1420 |
{ |
| 1421 |
VP_FUNC_CALL(); |
| 1422 |
|
| 1423 |
VP_PUBLIC_CHK_STATUS_RETURN(ExecuteVpPipeline()) |
| 1424 |
VP_PUBLIC_CHK_STATUS_RETURN(UserFeatureReport()); |
| 1425 |
|
| 1426 |
bool veboxFeatureInuse = (m_vpPipeContexts.size() >= 1) && (m_vpPipeContexts[0]) && (m_vpPipeContexts[0]->IsVeboxInUse()); |
| 1427 |
if (m_packetSharedContext && m_packetSharedContext->isVeboxFirstFrame && veboxFeatureInuse) |
| 1428 |
{ |
| 1429 |
m_packetSharedContext->isVeboxFirstFrame = false; |
| 1430 |
} |
| 1431 |
|
| 1432 |
return MOS_STATUS_SUCCESS; |
| 1433 |
} |
| 1434 |
|
| 1435 |
/****************************************************************************************************/ |
| 1436 |
/* VpSinglePipeContext */ |
| 1437 |
/****************************************************************************************************/ |
| 1438 |
|
| 1439 |
VpSinglePipeContext::VpSinglePipeContext() |
| 1440 |
{ |
| 1441 |
} |
| 1442 |
|
| 1443 |
VpSinglePipeContext::~VpSinglePipeContext() |
| 1444 |
{ |
| 1445 |
MOS_Delete(m_packetReuseMgr); |
| 1446 |
MOS_Delete(m_resourceManager); |
| 1447 |
} |
| 1448 |
|
| 1449 |
MOS_STATUS VpSinglePipeContext::Init(PMOS_INTERFACE osInterface, VpAllocator *allocator, VphalFeatureReport *reporting, vp::VpPlatformInterface *vpPlatformInterface, PacketPipeFactory *packetPipeFactory, VpUserFeatureControl *userFeatureControl, MediaCopyWrapper *mediaCopyWrapper, VpGraphManager *graphManager) |
| 1450 |
{ |
| 1451 |
VP_FUNC_CALL(); |
| 1452 |
VP_PUBLIC_CHK_STATUS_RETURN(CreateResourceManager(osInterface, allocator, reporting, vpPlatformInterface, userFeatureControl, mediaCopyWrapper, graphManager)); |
| 1453 |
VP_PUBLIC_CHK_NULL_RETURN(m_resourceManager); |
| 1454 |
VP_PUBLIC_CHK_STATUS_RETURN(CreatePacketReuseManager(packetPipeFactory, userFeatureControl)); |
| 1455 |
VP_PUBLIC_CHK_NULL_RETURN(m_packetReuseMgr); |
| 1456 |
|
| 1457 |
return MOS_STATUS_SUCCESS; |
| 1458 |
} |
| 1459 |
|
| 1460 |
//! |
| 1461 |
//! \brief create reource manager |
| 1462 |
//! \return MOS_STATUS |
| 1463 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1464 |
//! |
| 1465 |
MOS_STATUS VpSinglePipeContext::CreateResourceManager(PMOS_INTERFACE osInterface, VpAllocator *allocator, VphalFeatureReport *reporting, vp::VpPlatformInterface *vpPlatformInterface, vp::VpUserFeatureControl *userFeatureControl, MediaCopyWrapper *mediaCopyWrapper, VpGraphManager *graphManager) |
| 1466 |
{ |
| 1467 |
VP_FUNC_CALL(); |
| 1468 |
if (nullptr == m_resourceManager) |
| 1469 |
{ |
| 1470 |
m_resourceManager = MOS_New(VpResourceManager, *osInterface, *allocator, *reporting, *vpPlatformInterface, mediaCopyWrapper, userFeatureControl, graphManager); |
| 1471 |
VP_PUBLIC_CHK_NULL_RETURN(m_resourceManager); |
| 1472 |
} |
| 1473 |
|
| 1474 |
return MOS_STATUS_SUCCESS; |
| 1475 |
} |
| 1476 |
|
| 1477 |
MOS_STATUS VpSinglePipeContext::CreatePacketReuseManager(PacketPipeFactory *pPacketPipeFactory, VpUserFeatureControl *userFeatureControl) |
| 1478 |
{ |
| 1479 |
VP_FUNC_CALL(); |
| 1480 |
if (nullptr == m_packetReuseMgr) |
| 1481 |
{ |
| 1482 |
m_packetReuseMgr = NewVpPacketReuseManagerObj(pPacketPipeFactory, userFeatureControl); |
| 1483 |
VP_PUBLIC_CHK_NULL_RETURN(m_packetReuseMgr); |
| 1484 |
VP_PUBLIC_CHK_STATUS_RETURN(m_packetReuseMgr->RegisterFeatures()); |
| 1485 |
} |
| 1486 |
return MOS_STATUS_SUCCESS; |
| 1487 |
} |