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