| 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_resource_manager.h |
| 24 |
//! \brief The header file of the base class of vp resource manager |
| 25 |
//! \details all the vp resources will be traced here for usages using intermeida |
| 26 |
//! surfaces. |
| 27 |
//! |
| 28 |
#ifndef _VP_RESOURCE_MANAGER_H__ |
| 29 |
#define _VP_RESOURCE_MANAGER_H__ |
| 30 |
|
| 31 |
#include <map> |
| 32 |
#include "vp_allocator.h" |
| 33 |
#include "vp_pipeline_common.h" |
| 34 |
#include "vp_utils.h" |
| 35 |
#include "vp_hdr_resource_manager.h" |
| 36 |
#include "media_copy_wrapper.h" |
| 37 |
#include "vp_graph_manager.h" |
| 38 |
|
| 39 |
#define VP_MAX_NUM_VEBOX_SURFACES 4 //!< Vebox output surface creation, also can be reuse for DI usage: |
| 40 |
//!< for DI: 2 for ADI plus additional 2 for parallel execution |
| 41 |
#define VP_NUM_DN_SURFACES 2 //!< Number of DN output surfaces |
| 42 |
#define VP_NUM_STMM_SURFACES 2 //!< Number of STMM statistics surfaces |
| 43 |
#define VP_DNDI_BUFFERS_MAX 4 //!< Max DNDI buffers |
| 44 |
#define VP_NUM_KERNEL_VEBOX 8 //!< Max kernels called at Adv stage |
| 45 |
|
| 46 |
#define VP_VEBOX_PER_BLOCK_STATISTICS_SIZE 16 |
| 47 |
#define VP_VEBOX_FMD_HISTORY_SIZE (144 * sizeof(uint32_t)) |
| 48 |
|
| 49 |
#define VP_NUM_ACE_STATISTICS_HISTOGRAM 256 |
| 50 |
#define VP_NUM_STD_STATISTICS 2 |
| 51 |
|
| 52 |
#ifndef VEBOX_AUTO_DENOISE_SUPPORTED |
| 53 |
#define VEBOX_AUTO_DENOISE_SUPPORTED 1 |
| 54 |
#endif |
| 55 |
|
| 56 |
//! |
| 57 |
//! \brief Number of LACE's PWLF surfaces |
| 58 |
//! |
| 59 |
#define VP_NUM_LACE_PWLF_SURFACES 2 |
| 60 |
|
| 61 |
#define VP_MAX_HDR_INPUT_LAYER 8 |
| 62 |
|
| 63 |
#define IS_VP_VEBOX_DN_ONLY(_a) (_a.bDN && \ |
| 64 |
!(_a.bDI) && \ |
| 65 |
!(_a.bQueryVariance) && \ |
| 66 |
!(_a.bIECP) && \ |
| 67 |
!(_a.b3DlutOutput)) |
| 68 |
|
| 69 |
#define VP_NUM_FC_INTERMEDIA_SURFACES 2 |
| 70 |
|
| 71 |
namespace vp { |
| 72 |
struct VEBOX_SPATIAL_ATTRIBUTES_CONFIGURATION |
| 73 |
{ |
| 74 |
// DWORD 0 |
| 75 |
union |
| 76 |
{ |
| 77 |
// RangeThrStart0 |
| 78 |
struct |
| 79 |
{ |
| 80 |
uint32_t RangeThrStart0; |
| 81 |
}; |
| 82 |
|
| 83 |
uint32_t Value; |
| 84 |
} DW00; |
| 85 |
|
| 86 |
// DWORD 1 |
| 87 |
union |
| 88 |
{ |
| 89 |
// RangeThrStart1 |
| 90 |
struct |
| 91 |
{ |
| 92 |
uint32_t RangeThrStart1; |
| 93 |
}; |
| 94 |
|
| 95 |
uint32_t Value; |
| 96 |
} DW01; |
| 97 |
|
| 98 |
// DWORD 2 |
| 99 |
union |
| 100 |
{ |
| 101 |
// RangeThrStart2 |
| 102 |
struct |
| 103 |
{ |
| 104 |
uint32_t RangeThrStart2; |
| 105 |
}; |
| 106 |
|
| 107 |
uint32_t Value; |
| 108 |
} DW02; |
| 109 |
|
| 110 |
// DWORD 3 |
| 111 |
union |
| 112 |
{ |
| 113 |
// RangeThrStart3 |
| 114 |
struct |
| 115 |
{ |
| 116 |
uint32_t RangeThrStart3; |
| 117 |
}; |
| 118 |
|
| 119 |
uint32_t Value; |
| 120 |
} DW03; |
| 121 |
|
| 122 |
// DWORD 4 |
| 123 |
union |
| 124 |
{ |
| 125 |
// RangeThrStart4 |
| 126 |
struct |
| 127 |
{ |
| 128 |
uint32_t RangeThrStart4; |
| 129 |
}; |
| 130 |
|
| 131 |
uint32_t Value; |
| 132 |
} DW04; |
| 133 |
|
| 134 |
// DWORD 5 |
| 135 |
union |
| 136 |
{ |
| 137 |
// RangeThrStart5 |
| 138 |
struct |
| 139 |
{ |
| 140 |
uint32_t RangeThrStart5; |
| 141 |
}; |
| 142 |
|
| 143 |
uint32_t Value; |
| 144 |
} DW05; |
| 145 |
|
| 146 |
// DWORD 6 |
| 147 |
union |
| 148 |
{ |
| 149 |
// Reserved |
| 150 |
struct |
| 151 |
{ |
| 152 |
uint32_t Reserved; |
| 153 |
}; |
| 154 |
|
| 155 |
uint32_t Value; |
| 156 |
} DW06; |
| 157 |
|
| 158 |
// DWORD 7 |
| 159 |
union |
| 160 |
{ |
| 161 |
// Reserved |
| 162 |
struct |
| 163 |
{ |
| 164 |
uint32_t Reserved; |
| 165 |
}; |
| 166 |
|
| 167 |
uint32_t Value; |
| 168 |
} DW07; |
| 169 |
|
| 170 |
// DWORD 8 |
| 171 |
union |
| 172 |
{ |
| 173 |
// RangeWgt0 |
| 174 |
struct |
| 175 |
{ |
| 176 |
uint32_t RangeWgt0; |
| 177 |
}; |
| 178 |
|
| 179 |
uint32_t Value; |
| 180 |
} DW08; |
| 181 |
|
| 182 |
// DWORD 9 |
| 183 |
union |
| 184 |
{ |
| 185 |
// RangeWgt1 |
| 186 |
struct |
| 187 |
{ |
| 188 |
uint32_t RangeWgt1; |
| 189 |
}; |
| 190 |
|
| 191 |
uint32_t Value; |
| 192 |
} DW09; |
| 193 |
|
| 194 |
// DWORD 10 |
| 195 |
union |
| 196 |
{ |
| 197 |
// RangeWgt2 |
| 198 |
struct |
| 199 |
{ |
| 200 |
uint32_t RangeWgt2; |
| 201 |
}; |
| 202 |
|
| 203 |
uint32_t Value; |
| 204 |
} DW10; |
| 205 |
|
| 206 |
// DWORD 11 |
| 207 |
union |
| 208 |
{ |
| 209 |
// RangeWgt3 |
| 210 |
struct |
| 211 |
{ |
| 212 |
uint32_t RangeWgt3; |
| 213 |
}; |
| 214 |
|
| 215 |
uint32_t Value; |
| 216 |
} DW11; |
| 217 |
|
| 218 |
// DWORD 12 |
| 219 |
union |
| 220 |
{ |
| 221 |
// RangeWgt4 |
| 222 |
struct |
| 223 |
{ |
| 224 |
uint32_t RangeWgt4; |
| 225 |
}; |
| 226 |
|
| 227 |
uint32_t Value; |
| 228 |
} DW12; |
| 229 |
|
| 230 |
// DWORD 13 |
| 231 |
union |
| 232 |
{ |
| 233 |
// RangeWgt5 |
| 234 |
struct |
| 235 |
{ |
| 236 |
uint32_t RangeWgt5; |
| 237 |
}; |
| 238 |
|
| 239 |
uint32_t Value; |
| 240 |
} DW13; |
| 241 |
|
| 242 |
// DWORD 14 |
| 243 |
union |
| 244 |
{ |
| 245 |
// Reserved |
| 246 |
struct |
| 247 |
{ |
| 248 |
uint32_t Reserved; |
| 249 |
}; |
| 250 |
|
| 251 |
uint32_t Value; |
| 252 |
} DW14; |
| 253 |
|
| 254 |
// DWORD 15 |
| 255 |
union |
| 256 |
{ |
| 257 |
// Reserved |
| 258 |
struct |
| 259 |
{ |
| 260 |
uint32_t Reserved; |
| 261 |
}; |
| 262 |
|
| 263 |
uint32_t Value; |
| 264 |
} DW15; |
| 265 |
|
| 266 |
// DWORD 16 - 41: DistWgt[5][5] |
| 267 |
uint32_t DistWgt[5][5]; |
| 268 |
|
| 269 |
// Padding for 32-byte alignment, VEBOX_SPATIAL_ATTRIBUTES_CONFIGURATION_G9 is 7 uint32_ts |
| 270 |
uint32_t dwPad[7]; |
| 271 |
}; |
| 272 |
|
| 273 |
enum VEBOX_SURFACE_ID |
| 274 |
{ |
| 275 |
VEBOX_SURFACE_NULL = 0, |
| 276 |
VEBOX_SURFACE_INPUT, |
| 277 |
VEBOX_SURFACE_OUTPUT, |
| 278 |
VEBOX_SURFACE_PAST_REF, |
| 279 |
VEBOX_SURFACE_FUTURE_REF, |
| 280 |
VEBOX_SURFACE_FRAME0, |
| 281 |
VEBOX_SURFACE_FRAME1, |
| 282 |
VEBOX_SURFACE_FRAME2, |
| 283 |
VEBOX_SURFACE_FRAME3, |
| 284 |
}; |
| 285 |
|
| 286 |
struct VEBOX_SURFACES |
| 287 |
{ |
| 288 |
VEBOX_SURFACE_ID currentInputSurface; |
| 289 |
VEBOX_SURFACE_ID pastInputSurface; |
| 290 |
VEBOX_SURFACE_ID currentOutputSurface; |
| 291 |
VEBOX_SURFACE_ID pastOutputSurface; |
| 292 |
|
| 293 |
VEBOX_SURFACES(VEBOX_SURFACE_ID _currentInputSurface, VEBOX_SURFACE_ID _pastInputSurface, VEBOX_SURFACE_ID _currentOutputSurface, VEBOX_SURFACE_ID _pastOutputSurface) |
| 294 |
: currentInputSurface(_currentInputSurface), pastInputSurface(_pastInputSurface), currentOutputSurface(_currentOutputSurface), pastOutputSurface(_pastOutputSurface) |
| 295 |
{} |
| 296 |
}; |
| 297 |
|
| 298 |
inline uint32_t BoolToInt(bool b) |
| 299 |
{ |
| 300 |
return ((b) ? 1 : 0); |
| 301 |
} |
| 302 |
|
| 303 |
union VEBOX_SURFACES_CONFIG |
| 304 |
{ |
| 305 |
struct |
| 306 |
{ |
| 307 |
uint32_t b64DI : 1; |
| 308 |
uint32_t sfcEnable : 1; |
| 309 |
uint32_t sameSample : 1; |
| 310 |
uint32_t outOfBound : 1; |
| 311 |
uint32_t pastFrameAvailable : 1; |
| 312 |
uint32_t futureFrameAvailable : 1; |
| 313 |
uint32_t firstDiField : 1; |
| 314 |
uint32_t reserved : 25; |
| 315 |
}; |
| 316 |
uint32_t value; |
| 317 |
VEBOX_SURFACES_CONFIG() : value(0) |
| 318 |
{} |
| 319 |
VEBOX_SURFACES_CONFIG(bool _b64DI, bool _sfcEnable, bool _sameSample, bool _outOfBound, bool _pastFrameAvailable, bool _futureFrameAvailable, bool _firstDiField) : |
| 320 |
b64DI(BoolToInt(_b64DI)), sfcEnable(BoolToInt(_sfcEnable)), sameSample(BoolToInt(_sameSample)), outOfBound(BoolToInt(_outOfBound)), |
| 321 |
pastFrameAvailable(BoolToInt(_pastFrameAvailable)), futureFrameAvailable(BoolToInt(_futureFrameAvailable)), firstDiField(BoolToInt(_firstDiField)), reserved(0) |
| 322 |
{} |
| 323 |
}; |
| 324 |
|
| 325 |
typedef std::map<uint32_t, VEBOX_SURFACES> VEBOX_SURFACE_CONFIG_MAP; |
| 326 |
|
| 327 |
struct VP_FRAME_IDS |
| 328 |
{ |
| 329 |
bool valid; |
| 330 |
bool diEnabled; |
| 331 |
int32_t currentFrameId; |
| 332 |
bool pastFrameAvailable; |
| 333 |
bool futureFrameAvailable; |
| 334 |
int32_t pastFrameId; |
| 335 |
int32_t futureFrameId; |
| 336 |
}; |
| 337 |
|
| 338 |
struct VP_SURFACE_PARAMS |
| 339 |
{ |
| 340 |
uint32_t width = 0; |
| 341 |
uint32_t height = 0; |
| 342 |
MOS_FORMAT format = Format_None; |
| 343 |
MOS_TILE_TYPE tileType = MOS_TILE_X; |
| 344 |
MOS_RESOURCE_MMC_MODE surfCompressionMode = MOS_MMC_DISABLED; |
| 345 |
bool surfCompressible = false; |
| 346 |
VPHAL_CSPACE colorSpace = CSpace_None; |
| 347 |
RECT rcSrc = {0, 0, 0, 0}; //!< Source rectangle |
| 348 |
RECT rcDst = {0, 0, 0, 0}; //!< Destination rectangle |
| 349 |
RECT rcMaxSrc = {0, 0, 0, 0}; //!< Max source rectangle |
| 350 |
VPHAL_SAMPLE_TYPE sampleType = SAMPLE_PROGRESSIVE; |
| 351 |
VPHAL_SURFACE_TYPE surfType = SURF_NONE; |
| 352 |
}; |
| 353 |
|
| 354 |
class VpResourceManager |
| 355 |
{ |
| 356 |
public: |
| 357 |
VpResourceManager(MOS_INTERFACE &osInterface, VpAllocator &allocator, VphalFeatureReport &reporting, vp::VpPlatformInterface &vpPlatformInterface, MediaCopyWrapper *mediaCopyWrapper, vp::VpUserFeatureControl *vpUserFeatureControl, vp::VpGraphManager* graphManager); |
| 358 |
virtual ~VpResourceManager(); |
| 359 |
virtual MOS_STATUS OnNewFrameProcessStart(SwFilterPipe &pipe); |
| 360 |
virtual void OnNewFrameProcessEnd(); |
| 361 |
MOS_STATUS PrepareFcIntermediateSurface(SwFilterPipe &featurePipe); |
| 362 |
MOS_STATUS GetResourceHint(std::vector<FeatureType> &featurePool, SwFilterPipe& executedFilters, RESOURCE_ASSIGNMENT_HINT &hint); |
| 363 |
MOS_STATUS AssignExecuteResource(std::vector<FeatureType> &featurePool, VP_EXECUTE_CAPS& caps, SwFilterPipe &executedFilters); |
| 364 |
MOS_STATUS AssignExecuteResource(VP_EXECUTE_CAPS& caps, std::vector<VP_SURFACE *> &inputSurfaces, VP_SURFACE *outputSurface, |
| 365 |
std::vector<VP_SURFACE *> &pastSurfaces, std::vector<VP_SURFACE *> &futureSurfaces, |
| 366 |
RESOURCE_ASSIGNMENT_HINT resHint, VP_SURFACE_SETTING &surfSetting, SwFilterPipe& executedFilters); |
| 367 |
MOS_STATUS GetUpdatedExecuteResource(std::vector<FeatureType> &featurePool, VP_EXECUTE_CAPS &caps, SwFilterPipe &swfilterPipe, VP_SURFACE_SETTING &surfSetting); |
| 368 |
MOS_STATUS EmplaceCrossPipeContextResource(PVP_SURFACE surface, PVP_SURFACE originSurface); |
| 369 |
|
| 370 |
virtual MOS_STATUS FillLinearBufferWithEncZero(VP_SURFACE *surface, uint32_t width, uint32_t height); |
| 371 |
|
| 372 |
bool IsSameSamples() |
| 373 |
{ |
| 374 |
return m_sameSamples; |
| 375 |
} |
| 376 |
|
| 377 |
bool IsOutputSurfaceNeeded(VP_EXECUTE_CAPS caps); |
| 378 |
|
| 379 |
bool IsRefValid() |
| 380 |
{ |
| 381 |
return m_currentFrameIds.pastFrameAvailable || m_currentFrameIds.futureFrameAvailable; |
| 382 |
} |
| 383 |
|
| 384 |
bool IsPastHistogramValid() |
| 385 |
{ |
| 386 |
return m_isPastHistogramValid; |
| 387 |
} |
| 388 |
|
| 389 |
void GetImageResolutionOfPastHistogram(uint32_t &width, uint32_t &height) |
| 390 |
{ |
| 391 |
width = m_imageWidthOfPastHistogram; |
| 392 |
height = m_imageHeightOfPastHistogram; |
| 393 |
} |
| 394 |
|
| 395 |
virtual VP_SURFACE* GetVeboxLaceLut() |
| 396 |
{ |
| 397 |
return NULL; |
| 398 |
} |
| 399 |
|
| 400 |
virtual VP_SURFACE* GetVeboxAggregatedHistogramSurface() |
| 401 |
{ |
| 402 |
return NULL; |
| 403 |
} |
| 404 |
|
| 405 |
virtual VP_SURFACE* GetVeboxFrameHistogramSurface() |
| 406 |
{ |
| 407 |
return NULL; |
| 408 |
} |
| 409 |
|
| 410 |
virtual VP_SURFACE* GetVeboxStdStatisticsSurface() |
| 411 |
{ |
| 412 |
return NULL; |
| 413 |
} |
| 414 |
|
| 415 |
virtual VP_SURFACE* GetVeboxPwlfSurface() |
| 416 |
{ |
| 417 |
return NULL; |
| 418 |
} |
| 419 |
|
| 420 |
virtual VP_SURFACE* GetVeboxWeitCoefSurface() |
| 421 |
{ |
| 422 |
return NULL; |
| 423 |
} |
| 424 |
|
| 425 |
virtual VP_SURFACE* GetVeboxGlobalToneMappingCurveLUTSurface() |
| 426 |
{ |
| 427 |
return NULL; |
| 428 |
} |
| 429 |
|
| 430 |
protected: |
| 431 |
VP_SURFACE* GetVeboxOutputSurface(VP_EXECUTE_CAPS& caps, VP_SURFACE *outputSurface); |
| 432 |
MOS_STATUS InitVeboxSpatialAttributesConfiguration(); |
| 433 |
MOS_STATUS AllocateVeboxResource(VP_EXECUTE_CAPS& caps, VP_SURFACE *inputSurface, VP_SURFACE *outputSurface); |
| 434 |
MOS_STATUS AssignSurface(VP_EXECUTE_CAPS caps, VEBOX_SURFACE_ID &surfaceId, SurfaceType surfaceType, VP_SURFACE *inputSurface, VP_SURFACE *outputSurface, VP_SURFACE *pastRefSurface, VP_SURFACE *futureRefSurface, VP_SURFACE_GROUP &surfGroup); |
| 435 |
bool VeboxOutputNeeded(VP_EXECUTE_CAPS& caps); |
| 436 |
bool VeboxDenoiseOutputNeeded(VP_EXECUTE_CAPS& caps); |
| 437 |
bool VeboxHdr3DlutNeeded(VP_EXECUTE_CAPS &caps); |
| 438 |
bool Vebox1DlutNeeded(VP_EXECUTE_CAPS &caps); |
| 439 |
// In some case, STMM should not be destroyed but not be used by current workload to maintain data, |
| 440 |
// e.g. DI second field case. |
| 441 |
// If queryAssignment == true, query whether STMM needed by current workload. |
| 442 |
// If queryAssignment == false, query whether STMM needed to be allocated. |
| 443 |
bool VeboxSTMMNeeded(VP_EXECUTE_CAPS& caps, bool queryAssignment); |
| 444 |
virtual uint32_t GetHistogramSurfaceSize(VP_EXECUTE_CAPS& caps, uint32_t inputWidth, uint32_t inputHeight); |
| 445 |
virtual uint32_t Get3DLutSize(bool is33LutSizeEnabled, uint32_t &lutWidth, uint32_t &lutHeight); |
| 446 |
virtual uint32_t Get1DLutSize(); |
| 447 |
virtual Mos_MemPool GetHistStatMemType(VP_EXECUTE_CAPS &caps); |
| 448 |
MOS_STATUS ReAllocateVeboxOutputSurface(VP_EXECUTE_CAPS& caps, VP_SURFACE *inputSurface, VP_SURFACE *outputSurface, bool &allocated); |
| 449 |
MOS_STATUS ReAllocateVeboxDenoiseOutputSurface(VP_EXECUTE_CAPS& caps, VP_SURFACE *inputSurface, bool &allocated); |
| 450 |
MOS_STATUS ReAllocateVeboxSTMMSurface(VP_EXECUTE_CAPS& caps, VP_SURFACE *inputSurface, bool &allocated); |
| 451 |
void DestoryVeboxOutputSurface(); |
| 452 |
void DestoryVeboxDenoiseOutputSurface(); |
| 453 |
void DestoryVeboxSTMMSurface(); |
| 454 |
virtual MOS_STATUS AssignRenderResource(VP_EXECUTE_CAPS &caps, std::vector<VP_SURFACE *> &inputSurfaces, VP_SURFACE *outputSurface, std::vector<VP_SURFACE *> &pastSurfaces, std::vector<VP_SURFACE *> &futureSurfaces, RESOURCE_ASSIGNMENT_HINT resHint, VP_SURFACE_SETTING &surfSetting, SwFilterPipe &executedFilters); |
| 455 |
virtual MOS_STATUS Assign3DLutKernelResource(VP_EXECUTE_CAPS &caps, RESOURCE_ASSIGNMENT_HINT resHint, VP_SURFACE_SETTING &surfSetting); |
| 456 |
virtual MOS_STATUS AssignHVSKernelResource(VP_EXECUTE_CAPS &caps, RESOURCE_ASSIGNMENT_HINT resHint, VP_SURFACE_SETTING &surfSetting); |
| 457 |
virtual MOS_STATUS AssignFcResources(VP_EXECUTE_CAPS &caps, std::vector<VP_SURFACE *> &inputSurfaces, VP_SURFACE *outputSurface, |
| 458 |
std::vector<VP_SURFACE *> &pastSurfaces, std::vector<VP_SURFACE *> &futureSurfaces, |
| 459 |
RESOURCE_ASSIGNMENT_HINT resHint, VP_SURFACE_SETTING &surfSetting); |
| 460 |
virtual MOS_STATUS AssignNpuResource(VP_EXECUTE_CAPS &caps, std::vector<VP_SURFACE *> &inputSurfaces, VP_SURFACE *outputSurface, std::vector<VP_SURFACE *> &pastSurfaces, std::vector<VP_SURFACE *> &futureSurfaces, RESOURCE_ASSIGNMENT_HINT resHint, VP_SURFACE_SETTING &surfSetting, SwFilterPipe &executedFilters); |
| 461 |
virtual MOS_STATUS AssignAiNpuResource(VP_EXECUTE_CAPS &caps, std::vector<VP_SURFACE *> &inputSurfaces, VP_SURFACE *outputSurface, std::vector<VP_SURFACE *> &pastSurfaces, std::vector<VP_SURFACE *> &futureSurfaces, SwFilterPipe &executedFilters, VP_SURFACE_SETTING &surfSetting); |
| 462 |
virtual MOS_STATUS AssignAiKernelResource(VP_EXECUTE_CAPS &caps, std::vector<VP_SURFACE *> &inputSurfaces, VP_SURFACE *outputSurface, std::vector<VP_SURFACE *> &pastSurfaces, std::vector<VP_SURFACE *> &futureSurfaces, SwFilterPipe &executedFilters, VP_SURFACE_SETTING &surfSetting); |
| 463 |
virtual MOS_STATUS AssignVeboxResourceForRender(VP_EXECUTE_CAPS &caps, VP_SURFACE *inputSurface, RESOURCE_ASSIGNMENT_HINT resHint, VP_SURFACE_SETTING &surfSetting); |
| 464 |
virtual MOS_STATUS AssignVeboxResource(VP_EXECUTE_CAPS& caps, VP_SURFACE* inputSurface, VP_SURFACE* outputSurface, VP_SURFACE* pastSurface, VP_SURFACE* futureSurface, |
| 465 |
RESOURCE_ASSIGNMENT_HINT resHint, VP_SURFACE_SETTING& surfSetting, SwFilterPipe& executedFilters); |
| 466 |
MOS_STATUS ReAllocateVeboxStatisticsSurface(VP_SURFACE *&statisticsSurface, VP_EXECUTE_CAPS &caps, VP_SURFACE *inputSurface, uint32_t dwWidth, uint32_t dwHeight); |
| 467 |
void InitSurfaceConfigMap(); |
| 468 |
void AddSurfaceConfig(bool _b64DI, bool _sfcEnable, bool _sameSample, bool _outOfBound, bool _pastRefAvailable, bool _futureRefAvailable, bool _firstDiField, |
| 469 |
VEBOX_SURFACE_ID _currentInputSurface, VEBOX_SURFACE_ID _pastInputSurface, VEBOX_SURFACE_ID _currentOutputSurface, VEBOX_SURFACE_ID _pastOutputSurface) |
| 470 |
{ |
| 471 |
m_veboxSurfaceConfigMap.emplace(VEBOX_SURFACES_CONFIG(_b64DI, _sfcEnable, _sameSample, _outOfBound, _pastRefAvailable, _futureRefAvailable, _firstDiField).value, VEBOX_SURFACES(_currentInputSurface, _pastInputSurface, _currentOutputSurface, _pastOutputSurface)); |
| 472 |
} |
| 473 |
|
| 474 |
virtual MOS_STATUS GetIntermediaColorAndFormat3DLutOutput(VPHAL_CSPACE &colorSpace, MOS_FORMAT &format, SwFilterPipe &executedFilters); |
| 475 |
virtual MOS_STATUS GetIntermediaColorAndFormatBT2020toRGB(VP_EXECUTE_CAPS &caps, VPHAL_CSPACE &colorSpace, MOS_FORMAT &format, SwFilterPipe &executedFilters); |
| 476 |
virtual MOS_STATUS GetIntermediaOutputSurfaceParams(VP_EXECUTE_CAPS& caps, VP_SURFACE_PARAMS ¶ms, SwFilterPipe &executedFilters); |
| 477 |
MOS_STATUS GetIntermediaOutputSurfaceColorAndFormat(VP_EXECUTE_CAPS &caps, SwFilterPipe &executedFilters, MOS_FORMAT &format, VPHAL_CSPACE &colorSpace); |
| 478 |
MOS_STATUS AssignIntermediaSurface(VP_EXECUTE_CAPS& caps, SwFilterPipe &executedFilters); |
| 479 |
|
| 480 |
bool IsDeferredResourceDestroyNeeded() |
| 481 |
{ |
| 482 |
// For 0 == m_currentPipeIndex case, the surface being destroyed should not |
| 483 |
// be used in current DDI call any more. So no need deferred destroyed. |
| 484 |
return m_currentPipeIndex > 0; |
| 485 |
} |
| 486 |
|
| 487 |
void CleanTempSurfaces(); |
| 488 |
VP_SURFACE* GetCopyInstOfExtSurface(VP_SURFACE* surf); |
| 489 |
|
| 490 |
MOS_STATUS GetFormatForFcIntermediaSurface(MOS_FORMAT& format, MEDIA_CSPACE &colorSpace, SwFilterPipe &featurePipe); |
| 491 |
MOS_STATUS GetFcIntermediateSurfaceForOutput(VP_SURFACE *&intermediaSurface, SwFilterPipe &executedFilters); |
| 492 |
|
| 493 |
MOS_STATUS Allocate3DLut(VP_EXECUTE_CAPS& caps); |
| 494 |
MOS_STATUS AllocateResourceFor3DLutKernel(VP_EXECUTE_CAPS& caps); |
| 495 |
MOS_STATUS AllocateResourceForHVSKernel(VP_EXECUTE_CAPS &caps); |
| 496 |
MOS_STATUS AssignHdrResource(VP_EXECUTE_CAPS &caps, std::vector<VP_SURFACE *> &inputSurfaces, VP_SURFACE *outputSurface, RESOURCE_ASSIGNMENT_HINT resHint, VP_SURFACE_SETTING &surfSetting, SwFilterPipe &executedFilters); |
| 497 |
|
| 498 |
protected: |
| 499 |
MOS_INTERFACE &m_osInterface; |
| 500 |
VpAllocator &m_allocator; |
| 501 |
VphalFeatureReport &m_reporting; |
| 502 |
vp::VpPlatformInterface &m_vpPlatformInterface; |
| 503 |
vp::VpUserFeatureControl *m_vpUserFeatureControl = nullptr; |
| 504 |
vp::VpGraphManager *m_graphManager = nullptr; |
| 505 |
|
| 506 |
// Vebox Resource |
| 507 |
VP_SURFACE* m_veboxDenoiseOutput[VP_NUM_DN_SURFACES] = {}; //!< Vebox Denoise output surface |
| 508 |
VP_SURFACE* m_veboxOutput[VP_MAX_NUM_VEBOX_SURFACES] = {}; //!< Vebox output surface, can be reuse for DI usages |
| 509 |
VP_SURFACE* m_veboxSTMMSurface[VP_NUM_STMM_SURFACES] = {}; //!< Vebox STMM input/output surface |
| 510 |
VP_SURFACE *m_veboxStatisticsSurface = nullptr; //!< Statistics Surface for VEBOX |
| 511 |
VP_SURFACE *m_veboxStatisticsSurfacefor1stPassofSfc2Pass = nullptr; //!< Statistics Surface for VEBOX for 1stPassofSfc2Pass submission |
| 512 |
uint32_t m_dwVeboxPerBlockStatisticsWidth = 0; |
| 513 |
uint32_t m_dwVeboxPerBlockStatisticsHeight = 0; |
| 514 |
VP_SURFACE *m_veboxRgbHistogram = nullptr; //!< RGB Histogram surface for Vebox |
| 515 |
VP_SURFACE *m_veboxDNTempSurface = nullptr; //!< Vebox DN Update kernels temp surface |
| 516 |
VP_SURFACE *m_veboxDNSpatialConfigSurface = nullptr; //!< Spatial Attributes Configuration Surface for DN kernel |
| 517 |
VP_SURFACE *m_vebox3DLookUpTables = nullptr; |
| 518 |
VP_SURFACE *m_vebox3DLookUpTables2D = nullptr; |
| 519 |
VP_SURFACE *m_vebox1DLookUpTables = nullptr; |
| 520 |
VP_SURFACE *m_innerTileConvertInput = nullptr; |
| 521 |
VP_SURFACE *m_veboxDnHVSTables = nullptr; |
| 522 |
VP_SURFACE *m_3DLutKernelCoefSurface = nullptr; //!< Coef surface for 3DLut kernel. |
| 523 |
uint32_t m_currentDnOutput = 0; |
| 524 |
uint32_t m_currentStmmIndex = 0; |
| 525 |
uint32_t m_veboxOutputCount = 2; //!< PE on: 4 used. PE off: 2 used |
| 526 |
bool m_pastDnOutputValid = false; //!< true if vebox DN output of previous frame valid. |
| 527 |
VP_FRAME_IDS m_currentFrameIds = {}; |
| 528 |
VP_FRAME_IDS m_pastFrameIds = {}; |
| 529 |
bool m_firstFrame = true; |
| 530 |
bool m_sameSamples = false; |
| 531 |
bool m_outOfBound = false; |
| 532 |
RECT m_maxSrcRect = {}; |
| 533 |
VEBOX_SURFACE_CONFIG_MAP m_veboxSurfaceConfigMap; |
| 534 |
bool m_isHistogramReallocated = false; |
| 535 |
bool m_isCurrentHistogramInuse = false; |
| 536 |
bool m_isPastHistogramValid = false; |
| 537 |
uint32_t m_imageWidthOfPastHistogram = 0; |
| 538 |
uint32_t m_imageHeightOfPastHistogram = 0; |
| 539 |
uint32_t m_imageWidthOfCurrentHistogram = 0; |
| 540 |
uint32_t m_imageHeightOfCurrentHistogram = 0; |
| 541 |
bool m_isFcIntermediateSurfacePrepared = false; |
| 542 |
bool m_isPastFrameVeboxDiUsed = false; |
| 543 |
VP_SURFACE *m_fcIntermediateSurface[VP_NUM_FC_INTERMEDIA_SURFACES] = {}; // Ping-pong surface for multi-layer composition. |
| 544 |
std::vector<VP_SURFACE *> m_intermediaSurfaces; |
| 545 |
std::map<uint64_t, VP_SURFACE *> m_tempSurface; // allocation handle and surface pointer pair. |
| 546 |
std::map<VP_SURFACE *, void *> m_internalResourceDumpList; // surface pointer and system memory pointer. |
| 547 |
// Pipe index for one DDI call. |
| 548 |
uint32_t m_currentPipeIndex = 0; |
| 549 |
|
| 550 |
VP_SURFACE *m_veboxInputForLace = nullptr; //!< Vebox input surface for Lace kernel to use |
| 551 |
VP_SURFACE *m_veboxAggregatedHistogramSurface = nullptr; //!< VEBOX 1D LUT surface for Vebox Gen12 |
| 552 |
VP_SURFACE *m_veboxFrameHistogramSurface = nullptr; //!< VEBOX 1D LUT surface for Vebox Gen12 |
| 553 |
VP_SURFACE *m_veboxStdStatisticsSurface = nullptr; //!< VEBOX 1D LUT surface for Vebox Gen12 |
| 554 |
VP_SURFACE *m_veboxPwlfSurface[VP_NUM_LACE_PWLF_SURFACES] = {}; //!< VEBOX 1D LUT surface for Vebox Gen12 |
| 555 |
VP_SURFACE *m_veboxWeitCoefSurface = nullptr; //!< VEBOX 1D LUT surface for Vebox Gen12 |
| 556 |
VP_SURFACE *m_veboxGlobalToneMappingCurveLUTSurface = nullptr; //!< VEBOX 1D LUT surface for Vebox Gen12 |
| 557 |
VP_SURFACE *m_temperalInput = nullptr; |
| 558 |
|
| 559 |
// Fc Resource |
| 560 |
VP_SURFACE *m_cmfcCoeff = nullptr; |
| 561 |
VP_SURFACE *m_fcIntermediaSurfaceOutput = nullptr; |
| 562 |
VP_SURFACE *m_fcIntermediaSurfaceInput[VP_COMP_MAX_LAYERS] = {}; |
| 563 |
VP_SURFACE *m_fcSeparateIntermediaSurfaceSecPlaneInput[VP_COMP_MAX_LAYERS] = {}; |
| 564 |
//for decompreesion sync on interlace input of FC |
| 565 |
VP_SURFACE *m_decompressionSyncSurface = nullptr; |
| 566 |
// Hdr Resource |
| 567 |
VphdrResourceManager *m_hdrResourceManager = nullptr; |
| 568 |
MediaUserSettingSharedPtr m_userSettingPtr = nullptr; //!< usersettingInstance |
| 569 |
|
| 570 |
// AI Resource |
| 571 |
std::map<SurfaceType, VP_SURFACE *> m_aiIntermediateSurface = {}; |
| 572 |
std::map<SurfaceType, VP_SURFACE *> m_aiNpuCopiedSurface = {}; |
| 573 |
|
| 574 |
//Cross Pipe Context Resource |
| 575 |
std::set<VP_SURFACE *> m_crossPipeContextSurfaces; |
| 576 |
|
| 577 |
MediaCopyWrapper *m_mediaCopyWrapper = nullptr; |
| 578 |
|
| 579 |
MEDIA_CLASS_DEFINE_END(vp__VpResourceManager) |
| 580 |
}; |
| 581 |
} |
| 582 |
#endif // _VP_RESOURCE_MANAGER_H__ |