1 /*
2 * Copyright (c) 2014-2018, 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     mhw_vdbox_hcp_interface.h
24 //! \brief    MHW interface for constructing HCP commands for the Vdbox engine
25 //! \details  Defines the interfaces for constructing MHW Vdbox HCP commands across all platforms
26 //!
27 
28 #ifndef _MHW_VDBOX_HCP_INTERFACE_H_
29 #define _MHW_VDBOX_HCP_INTERFACE_H_
30 
31 #include "mhw_vdbox.h"
32 #include "mhw_mi.h"
33 #include "codec_def_encode_hevc.h"
34 
35 #define MHW_HCP_WORST_CASE_LCU_CU_TU_INFO        (26 * MHW_CACHELINE_SIZE) // 18+4+4
36 #define MHW_HCP_WORST_CASE_LCU_CU_TU_INFO_REXT   (35 * MHW_CACHELINE_SIZE) // 27+4+4
37 
38 #define MHW_HCP_WORST_CASE_CU_TU_INFO            (4 * MHW_CACHELINE_SIZE) // 2+1+1
39 #define MHW_HCP_WORST_CASE_CU_TU_INFO_REXT       (6 * MHW_CACHELINE_SIZE) // 4+1+1
40 
41 struct MHW_VDBOX_HEVC_PIC_STATE
42 {
43     // Decode
44     PCODEC_HEVC_PIC_PARAMS                  pHevcPicParams = nullptr;
45 
46     // Encode
47     PCODEC_HEVC_ENCODE_SEQUENCE_PARAMS      pHevcEncSeqParams = nullptr;
48     PCODEC_HEVC_ENCODE_PICTURE_PARAMS       pHevcEncPicParams = nullptr;
49     bool                                    bSAOEnable = false;
50     bool                                    bNotFirstPass = false;
51     bool                                    bHevcRdoqEnabled = false;
52     bool                                    bUseVDEnc = false;
53     bool                                    sseEnabledInVmeEncode = false;
54     PMHW_BATCH_BUFFER                       pBatchBuffer = nullptr;
55     bool                                    bBatchBufferInUse = false;
56     bool                                    bRDOQIntraTUDisable = false;
57     uint16_t                                wRDOQIntraTUThreshold = 0;
58     uint32_t                                brcNumPakPasses = 0;
59     bool                                    rhodomainRCEnable = false;
60     bool                                    bTransformSkipEnable = false;
61 
62     //FEI multiple passes PAK ---max frame size
63     uint8_t                                 currPass = 0;
64     uint8_t                                *deltaQp = nullptr;
65     uint32_t                                maxFrameSize = 0;
~MHW_VDBOX_HEVC_PIC_STATEMHW_VDBOX_HEVC_PIC_STATE66     virtual ~MHW_VDBOX_HEVC_PIC_STATE(){}
67 };
68 using PMHW_VDBOX_HEVC_PIC_STATE = MHW_VDBOX_HEVC_PIC_STATE * ;
69 
70 typedef struct _MHW_VDBOX_HEVC_TILE_STATE
71 {
72     PCODEC_HEVC_PIC_PARAMS          pHevcPicParams;
73     uint16_t                       *pTileColWidth;
74     uint16_t                       *pTileRowHeight;
75 } MHW_VDBOX_HEVC_TILE_STATE, *PMHW_VDBOX_HEVC_TILE_STATE;
76 
77 typedef struct _MHW_VDBOX_HCP_BUFFER_SIZE_PARAMS
78 {
79     uint8_t    ucMaxBitDepth;
80     uint8_t    ucChromaFormat;
81     uint32_t   dwCtbLog2SizeY;
82     uint32_t   dwPicWidth;
83     uint32_t   dwPicHeight;
84     uint32_t   dwBufferSize;
85     uint32_t   dwMaxFrameSize;
86 }MHW_VDBOX_HCP_BUFFER_SIZE_PARAMS, *PMHW_VDBOX_HCP_BUFFER_SIZE_PARAMS;
87 
88 typedef struct _MHW_VDBOX_HCP_BUFFER_REALLOC_PARAMS
89 {
90     uint8_t    ucMaxBitDepth;
91     uint8_t    ucChromaFormat;
92     uint32_t   dwPicWidth;
93     uint32_t   dwPicHeight;
94     uint32_t   dwPicWidthAlloced;
95     uint32_t   dwPicHeightAlloced;
96     uint32_t   dwCtbLog2SizeY;
97     uint32_t   dwCtbLog2SizeYMax;
98     uint32_t   dwFrameSize;
99     uint32_t   dwFrameSizeAlloced;
100     bool       bNeedBiggerSize;
101 }MHW_VDBOX_HCP_BUFFER_REALLOC_PARAMS, *PMHW_VDBOX_HCP_BUFFER_REALLOC_PARAMS;
102 
103 struct MHW_VDBOX_HEVC_REF_IDX_PARAMS
104 {
105     CODEC_PICTURE                   CurrPic = {};
106     bool                            isEncode = false;
107     uint8_t                         ucList = 0;
108     uint8_t                         ucNumRefForList = 0;
109     CODEC_PICTURE                   RefPicList[2][CODEC_MAX_NUM_REF_FRAME_HEVC] = {};
110     void                            **hevcRefList = nullptr;
111     int32_t                         poc_curr_pic = 0;
112     int32_t                         poc_list[CODEC_MAX_NUM_REF_FRAME_HEVC] = {};
113     int8_t                         *pRefIdxMapping = 0;
114     uint16_t                        RefFieldPicFlag = 0;
115     uint16_t                        RefBottomFieldFlag = 0;
116     bool                            bDummyReference = false;
~MHW_VDBOX_HEVC_REF_IDX_PARAMSMHW_VDBOX_HEVC_REF_IDX_PARAMS117     virtual ~MHW_VDBOX_HEVC_REF_IDX_PARAMS(){}
118 };
119 using PMHW_VDBOX_HEVC_REF_IDX_PARAMS = MHW_VDBOX_HEVC_REF_IDX_PARAMS * ;
120 
121 typedef struct _MHW_VDBOX_HEVC_WEIGHTOFFSET_PARAMS
122 {
123     uint8_t                         ucList;
124     char                            LumaWeights[2][15];
125     int16_t                         LumaOffsets[2][15];
126     char                            ChromaWeights[2][15][2];
127     int16_t                         ChromaOffsets[2][15][2];
128 } MHW_VDBOX_HEVC_WEIGHTOFFSET_PARAMS, *PMHW_VDBOX_HEVC_WEIGHTOFFSET_PARAMS;
129 
130 typedef struct _MHW_VDBOX_ENCODE_HEVC_TRANSFORM_SKIP_PARAMS
131 {
132     bool     Transformskip_enabled;
133     uint16_t Transformskip_lambda;
134     uint8_t  Transformskip_Numzerocoeffs_Factor0;
135     uint8_t  Transformskip_Numnonzerocoeffs_Factor0;
136     uint8_t  Transformskip_Numzerocoeffs_Factor1;
137     uint8_t  Transformskip_Numnonzerocoeffs_Factor1;
138 }MHW_VDBOX_ENCODE_HEVC_TRANSFORM_SKIP_PARAMS, *PMHW_VDBOX_ENCODE_HEVC_TRANSFORM_SKIP_PARAMS;
139 
140 struct MHW_VDBOX_HEVC_SLICE_STATE
141 {
142     PCODEC_PIC_ID                   pHevcPicIdx = nullptr;
143     PMOS_RESOURCE                   presDataBuffer = nullptr;
144     uint32_t                        dwDataBufferOffset = 0;
145     uint32_t                        dwOffset = 0;
146     uint32_t                        dwLength = 0;
147     uint32_t                        dwSliceIndex = 0;
148     bool                            bLastSlice = false;
149     bool                            bLastSliceInTile = false;
150     bool                            bLastSliceInTileColumn = false;
151     bool                            bHucStreamOut = false;
152     int8_t                         *pRefIdxMapping = nullptr;
153     bool                            bSaoLumaFlag = false;
154     bool                            bSaoChromaFlag = false;
155 
156     PCODEC_HEVC_SLICE_PARAMS        pHevcSliceParams = nullptr;
157     PCODEC_HEVC_PIC_PARAMS          pHevcPicParams = nullptr;
158 
159     // Encoding Only
160     PCODEC_HEVC_ENCODE_SEQUENCE_PARAMS      pEncodeHevcSeqParams = nullptr;
161     PCODEC_HEVC_ENCODE_PICTURE_PARAMS       pEncodeHevcPicParams = nullptr;
162     PCODEC_HEVC_ENCODE_SLICE_PARAMS         pEncodeHevcSliceParams = nullptr;
163     PBSBuffer                               pBsBuffer = nullptr;
164     PCODECHAL_NAL_UNIT_PARAMS              *ppNalUnitParams = nullptr;
165     bool                                    bFirstPass = false;
166     bool                                    bLastPass = false;
167     bool                                    bIntraRefFetchDisable = false;
168     bool                                    bBrcEnabled = false;
169     uint32_t                                dwHeaderBytesInserted = 0;
170     uint32_t                                dwHeaderDummyBytes = 0;
171     uint32_t                                uiSkipEmulationCheckCount = 0;
172     bool                                    bInsertBeforeSliceHeaders = false;
173     bool                                    bIsLowDelay = false;
174     // Encoding + BRC only
175     PMHW_BATCH_BUFFER                       pBatchBufferForPakSlices = nullptr;
176     bool                                    bSingleTaskPhaseSupported = false;
177     uint32_t                                dwBatchBufferForPakSlicesStartOffset = 0;
178     bool                                    bVdencInUse = false;
179     bool                                    bVdencHucInUse = false;
180     bool                                    bWeightedPredInUse = false;
181     PMHW_BATCH_BUFFER                       pVdencBatchBuffer = nullptr;
182 
183     //Pak related params
184     MHW_VDBOX_ENCODE_HEVC_TRANSFORM_SKIP_PARAMS EncodeHevcTransformSkipParams = {};
185     bool                                    DeblockingFilterDisable = false;
186     char                                    TcOffsetDiv2 = 0;
187     char                                    BetaOffsetDiv2 = 0;
188 
189     uint8_t                                 RoundingIntra = 0;
190     uint8_t                                 RoundingInter = 0;
~MHW_VDBOX_HEVC_SLICE_STATEMHW_VDBOX_HEVC_SLICE_STATE191     virtual ~MHW_VDBOX_HEVC_SLICE_STATE(){}
192 };
193 using PMHW_VDBOX_HEVC_SLICE_STATE = MHW_VDBOX_HEVC_SLICE_STATE * ;
194 
195 typedef struct _MHW_VDBOX_VP9_ENCODE_PIC_STATE
196 {
197     PCODEC_VP9_ENCODE_PIC_PARAMS        pVp9PicParams;
198     PCODEC_REF_LIST                    *ppVp9RefList;
199     PCODEC_VP9_ENCODE_SEQUENCE_PARAMS   pVp9SeqParams;
200 
201     union
202     {
203         struct
204         {
205             uint8_t                    KeyFrame : 1;        // [0..1]
206             uint8_t                    IntraOnly : 1;        // [0..1]
207             uint8_t                    Display : 1;        // [0..1]
208             uint8_t                    ReservedField : 5;        // [0]
209         } fields;
210         uint8_t                        value;
211     } PrevFrameParams;
212 
213     uint32_t                        dwPrevFrmWidth;
214     uint32_t                        dwPrevFrmHeight;
215     uint8_t                         ucTxMode;
216     bool                            bUseDysRefSurface;
217     bool                            bNonFirstPassFlag;
218     bool                            bSSEEnable;
219     bool                            bVdencPakOnlyPassFlag;
220     uint32_t                        uiMaxBitRate;
221     uint32_t                        uiMinBitRate;
222 
223 } MHW_VDBOX_VP9_ENCODE_PIC_STATE, *PMHW_VDBOX_VP9_ENCODE_PIC_STATE;
224 
225 typedef struct _MHW_VDBOX_VP9_PIC_STATE
226 {
227     // Decode
228     PCODEC_VP9_PIC_PARAMS              pVp9PicParams;
229     PCODEC_REF_LIST                   *ppVp9RefList;
230 
231     union
232     {
233         struct
234         {
235             uint8_t                    KeyFrame : 1;        // [0..1]
236             uint8_t                    IntraOnly : 1;        // [0..1]
237             uint8_t                    Display : 1;        // [0..1]
238             uint8_t                    ReservedField : 5;        // [0]
239         } fields;
240         uint8_t                        value;
241     } PrevFrameParams;
242 
243     uint32_t                           dwPrevFrmWidth;
244     uint32_t                           dwPrevFrmHeight;
245 
246 } MHW_VDBOX_VP9_PIC_STATE, *PMHW_VDBOX_VP9_PIC_STATE;
247 
248 typedef struct _MHW_VDBOX_IMAGE_STATUS_CONTROL
249 {
250     union
251     {
252         struct
253         {
254             uint32_t   MaxMbConformanceFlag : 1;
255             uint32_t   FrameBitcountFlag : 1;
256             uint32_t   Panic : 1;
257             uint32_t   MissingHuffmanCode : 1; // new addition for JPEG encode
258             uint32_t   : 4;
259             uint32_t   TotalNumPass : 4;
260             uint32_t   VDENCSliceOverflowErrorOccurred : 1;
261             uint32_t   NumPassPolarityChange : 2;
262             uint32_t   CumulativeSliceQpPolarityChange : 1;
263             uint32_t   SuggestedSliceQPDelta : 8;
264             uint32_t   CumulativeSliceDeltaQP : 8;
265         };
266 
267         struct
268         {
269             uint32_t   hcpLCUMaxSizeViolate : 1;
270             uint32_t   hcpFrameBitCountViolateOverRun : 1;
271             uint32_t   hcpFrameBitCountViolateUnderRun : 1;
272             uint32_t   : 5;
273             uint32_t   hcpTotalPass : 4;
274             uint32_t   : 4;
275             uint32_t   hcpCumulativeFrameDeltaLF : 7;
276             uint32_t   : 1;
277             uint32_t   hcpCumulativeFrameDeltaQp : 8;
278         };
279 
280         struct
281         {
282             uint32_t   Value;
283         };
284     };
285 }MHW_VDBOX_IMAGE_STATUS_CONTROL, *PMHW_VDBOX_IMAGE_STATUS_CONTROL;
286 
287 typedef struct _MHW_VDBOX_PAK_NUM_OF_SLICES
288 {
289     // Num Slices
290     union
291     {
292         struct
293         {
294             uint32_t   NumberOfSlices : 16;
295             uint32_t   Reserved : 16;
296         };
297 
298         struct
299         {
300             uint32_t   Value;
301         };
302     };
303 }MHW_VDBOX_PAK_NUM_OF_SLICES, *PMHW_VDBOX_PAK_NUM_OF_SLICES;
304 
305 // definition for HEVC/VP9 internal buffer type
306 typedef enum _MHW_VDBOX_HCP_INTERNAL_BUFFER_TYPE
307 {
308     MHW_VDBOX_HCP_INTERNAL_BUFFER_DBLK_LINE = 0x0,
309     MHW_VDBOX_HCP_INTERNAL_BUFFER_DBLK_TILE_LINE,
310     MHW_VDBOX_HCP_INTERNAL_BUFFER_DBLK_TILE_COL,
311     MHW_VDBOX_HCP_INTERNAL_BUFFER_MV_UP_RT_COL,
312     MHW_VDBOX_HCP_INTERNAL_BUFFER_META_LINE,
313     MHW_VDBOX_HCP_INTERNAL_BUFFER_META_TILE_LINE,
314     MHW_VDBOX_HCP_INTERNAL_BUFFER_META_TILE_COL,
315     MHW_VDBOX_HCP_INTERNAL_BUFFER_TR_NBR,
316     MHW_VDBOX_HCP_INTERNAL_BUFFER_SAO_LINE,
317     MHW_VDBOX_HCP_INTERNAL_BUFFER_SAO_TILE_LINE,
318     MHW_VDBOX_HCP_INTERNAL_BUFFER_SAO_TILE_COL,
319     MHW_VDBOX_HCP_INTERNAL_BUFFER_HSSE_RS,
320     MHW_VDBOX_HCP_INTERNAL_BUFFER_HSAO_RS,
321     MHW_VDBOX_HCP_INTERNAL_BUFFER_CURR_MV_TEMPORAL,
322     MHW_VDBOX_HCP_INTERNAL_BUFFER_COLL_MV_TEMPORAL,
323     MHW_VDBOX_HCP_INTERNAL_BUFFER_SLC_STATE_STREAMOUT,
324     MHW_VDBOX_HCP_INTERNAL_BUFFER_CABAC_STREAMOUT,
325     MHW_VDBOX_HCP_INTERNAL_BUFFER_MV_UP_RIGHT_COL,
326     MHW_VDBOX_HCP_INTERNAL_BUFFER_INTRA_PRED_UP_RIGHT_COL,
327     MHW_VDBOX_HCP_INTERNAL_BUFFER_INTRA_PRED_LFT_RECON_COL,
328     MHW_VDBOX_VP9_INTERNAL_BUFFER_SEGMENT_ID,
329     MHW_VDBOX_VP9_INTERNAL_BUFFER_HVD_LINE,
330     MHW_VDBOX_VP9_INTERNAL_BUFFER_HVD_TILE
331 } MHW_VDBOX_HCP_INTERNAL_BUFFER_TYPE;
332 
333 
334 
335 //!  MHW Vdbox Hcp interface
336 /*!
337 This class defines the interfaces for constructing Vdbox Hcp commands across all platforms
338 */
339 class MhwVdboxHcpInterface
340 {
341 public:
342     //!
343     //! \enum     HevcSliceType
344     //! \brief    HEVC slice type
345     //!
346     enum HevcSliceType
347     {
348         hevcSliceB  = 0,
349         hevcSliceP  = 1,
350         hevcSliceI  = 2
351     };
352 
353 protected:
354     PMOS_INTERFACE              m_osInterface = nullptr; //!< Pointer to OS interface
355     MhwMiInterface              *m_miInterface = nullptr; //!< Pointer to MI interface
356     MhwCpInterface              *m_cpInterface = nullptr; //!< Pointer to CP interface
357     MEDIA_FEATURE_TABLE         *m_skuTable = nullptr; //!< Pointer to SKU table
358     MEDIA_WA_TABLE              *m_waTable = nullptr; //!< Pointer to WA table
359     bool                        m_decodeInUse = false; //!< Flag to indicate if the interface is for decoder or encoder use
360 
361     MHW_MEMORY_OBJECT_CONTROL_PARAMS m_cacheabilitySettings[MOS_CODEC_RESOURCE_USAGE_END_CODEC] = {}; //!< Cacheability settings
362 
363     bool                        m_rhoDomainStatsEnabled = false; //!< Flag to indicate if Rho domain stats is enabled
364     bool                        m_rowstoreCachingSupported = false; //!< Flag to indicate if row store cache is supported
365     uint32_t                    m_brcNumPakPasses = 4; //!< Number of brc pak passes
366 
367     MHW_VDBOX_ROWSTORE_CACHE    m_hevcDatRowStoreCache = {};
368     MHW_VDBOX_ROWSTORE_CACHE    m_hevcDfRowStoreCache = {};
369     MHW_VDBOX_ROWSTORE_CACHE    m_hevcSaoRowStoreCache = {};
370     MHW_VDBOX_ROWSTORE_CACHE    m_hevcHSaoRowStoreCache = {};
371     MHW_VDBOX_ROWSTORE_CACHE    m_vp9HvdRowStoreCache = {};
372     MHW_VDBOX_ROWSTORE_CACHE    m_vp9DfRowStoreCache = {};
373     MHW_VDBOX_ROWSTORE_CACHE    m_vp9DatRowStoreCache = {};
374 
375     uint32_t                    m_hevcEncCuRecordSize = 0; //!< size of hevc enc cu record
376     uint32_t                    m_pakHWTileSizeRecordSize = 0; //! pak HW tile size recored size
377 
378     static const uint32_t       m_timeStampCountsPerMillisecond = (12000048 / 1000);  //<! Time stamp coounts per millisecond
379     static const uint32_t       m_hcpCabacErrorFlagsMask = 0x0879; //<! Hcp CABAC error flags mask
380 
381     MmioRegistersHcp            m_mmioRegisters[MHW_VDBOX_NODE_MAX] = {};  //!< hcp mmio registers
382 
383     static const HevcSliceType  m_hevcBsdSliceType[3]; //!< HEVC Slice Types for Long Format
384 
385     //!
386     //! \brief    Constructor
387     //!
388     MhwVdboxHcpInterface(
389         PMOS_INTERFACE osInterface,
390         MhwMiInterface *miInterface,
391         MhwCpInterface *cpInterface,
392         bool decodeInUse);
393 
394     //!
395     //! \brief    Add a resource to the command buffer
396     //! \details  Internal function to add either a graphics address of a resource or
397     //!           add the resource to the patch list for the requested buffer
398     //!
399     //! \param    [in] osInterface
400     //!           OS interface
401     //! \param    [in] cmdBuffer
402     //!           Command buffer to which resource is added
403     //! \param    [in] params
404     //!           Parameters necessary to add the resource
405     //!
406     //! \return   MOS_STATUS
407     //!           MOS_STATUS_SUCCESS if success, else fail reason
408     //!
409     MOS_STATUS(*pfnAddResourceToCmd) (
410         PMOS_INTERFACE osInterface,
411         PMOS_COMMAND_BUFFER cmdBuffer,
412         PMHW_RESOURCE_PARAMS params);
413 
414     //!
415     //! \brief    Convert to Sign Magnitude
416     //! \details  Implementation of signed bitfield as specified
417     //!
418     //! \param    [in] val
419     //!           Input value to calculate
420     //! \param    [in] signBitPos
421     //!           The position of sign bit
422     //!
423     //! \return   uint16_t
424     //!           value calculated
425     //!
426     uint16_t Convert2SignMagnitude(
427         int32_t val,
428         uint32_t signBitPos);
429 
430 public:
431 
432     //!
433     //! \brief    Destructor
434     //!
~MhwVdboxHcpInterface()435     virtual ~MhwVdboxHcpInterface() {}
436 
437     //!
438     //! \brief    Get OS interface
439     //!
440     //! \return   [out] PMOS_INTERFACE
441     //!           Pointer to the OS interface.
442     //!
GetOsInterface()443     inline PMOS_INTERFACE GetOsInterface()
444     {
445         return m_osInterface;
446     }
447 
448     //!
449     //! \brief    Get mmio registers
450     //!
451     //! \param    [in] index
452     //!           mmio registers index.
453     //!
454     //! \return   [out] MmioRegistersHcp*
455     //!           mmio registers got.
456     //!
GetMmioRegisters(MHW_VDBOX_NODE_IND index)457     inline MmioRegistersHcp* GetMmioRegisters(MHW_VDBOX_NODE_IND index)
458     {
459         if (index < MHW_VDBOX_NODE_MAX)
460         {
461             return &m_mmioRegisters[index];
462         }
463         else
464         {
465             MHW_ASSERT("index is out of range!");
466             return &m_mmioRegisters[MHW_VDBOX_NODE_1];
467         }
468     }
469 
470     //!
471     //! \brief    Get Hcp Cabac Error Flags Mask
472     //!
473     //! \return   [out] uint32_t
474     //!           Mask got.
475     //!
GetHcpCabacErrorFlagsMask()476     virtual inline uint32_t GetHcpCabacErrorFlagsMask()
477     {
478         return m_hcpCabacErrorFlagsMask;
479     }
480 
481     //!
482     //! \brief    Get Watch Dog Timer Threhold
483     //!
484     //! \return   [out] uint32_t
485     //!           Threhold got.
486     //!
GetWatchDogTimerThrehold()487     virtual inline uint32_t GetWatchDogTimerThrehold()
488     {
489         return 0;
490     }
491 
492     //!
493     //! \brief    Get Time Stamp Counts Per Millisecond
494     //!
495     //! \return   [out] uint32_t
496     //!           Counts got.
497     //!
GetTimeStampCountsPerMillisecond()498     inline uint32_t GetTimeStampCountsPerMillisecond()
499     {
500         return m_timeStampCountsPerMillisecond;
501     }
502 
503     //!
504     //! \brief    Get hevc enc cu record size
505     //! \return   [out] uint32_t
506     //!           Brc pak passes num.
507     //!
GetHevcEncCuRecordSize()508     inline uint32_t GetHevcEncCuRecordSize()
509     {
510         return m_hevcEncCuRecordSize;
511     }
512 
513     //!
514     //! \brief    Get pak HW tile size record size
515     //! \return   [out] uint32_t
516     //!           Brc pak passes num.
517     //!
GetPakHWTileSizeRecordSize()518     inline uint32_t GetPakHWTileSizeRecordSize()
519     {
520         return m_pakHWTileSizeRecordSize;
521     }
522 
523     //!
524     //! \brief    Judge if row store caching supported
525     //!
526     //! \return   bool
527     //!           true if supported, else false
528     //!
IsRowStoreCachingSupported()529     inline bool IsRowStoreCachingSupported()
530     {
531         return m_rowstoreCachingSupported;
532     }
533 
534     //!
535     //! \brief    Judge if hevc dat store caching enabled
536     //!
537     //! \return   bool
538     //!           true if enabled, else false
539     //!
IsHevcDatRowstoreCacheEnabled()540     inline bool IsHevcDatRowstoreCacheEnabled()
541     {
542         return m_hevcDatRowStoreCache.bEnabled ? true : false;
543     }
544 
545     //!
546     //! \brief    Judge if hevc df row store caching enabled
547     //!
548     //! \return   bool
549     //!           true if enabled, else false
550     //!
IsHevcDfRowstoreCacheEnabled()551     inline bool IsHevcDfRowstoreCacheEnabled()
552     {
553         return m_hevcDfRowStoreCache.bEnabled ? true : false;
554     }
555 
556     //!
557     //! \brief    Judge if hevc sao row store caching enabled
558     //!
559     //! \return   bool
560     //!           true if enabled, else false
561     //!
IsHevcSaoRowstoreCacheEnabled()562     inline bool IsHevcSaoRowstoreCacheEnabled()
563     {
564         return m_hevcSaoRowStoreCache.bEnabled ? true : false;
565     }
566 
567     //!
568     //! \brief    Judge if vp9 hvd row store caching enabled
569     //!
570     //! \return   bool
571     //!           true if enabled, else false
572     //!
IsVp9HvdRowstoreCacheEnabled()573     inline bool IsVp9HvdRowstoreCacheEnabled()
574     {
575         return m_vp9HvdRowStoreCache.bEnabled ? true : false;
576     }
577 
578     //!
579     //! \brief    Judge if vp9 df row store caching enabled
580     //!
581     //! \return   bool
582     //!           true if enabled, else false
583     //!
IsVp9DfRowstoreCacheEnabled()584     inline bool IsVp9DfRowstoreCacheEnabled()
585     {
586         return m_vp9DfRowStoreCache.bEnabled ? true : false;
587     }
588 
589     //!
590     //! \brief    Judge if vp9 dat row store caching enabled
591     //!
592     //! \return   bool
593     //!           true if enabled, else false
594     //!
IsVp9DatRowstoreCacheEnabled()595     inline bool IsVp9DatRowstoreCacheEnabled()
596     {
597         return m_vp9DatRowStoreCache.bEnabled ? true : false;
598     }
599 
600     //!
601     //! \brief    Set cacheability settings
602     //!
603     //! \param    [in] cacheabilitySettings
604     //!           Cacheability settings
605     //!
606     //! \return   MOS_STATUS
607     //!           MOS_STATUS_SUCCESS if success, else fail reason
608     //!
SetCacheabilitySettings(MHW_MEMORY_OBJECT_CONTROL_PARAMS cacheabilitySettings[MOS_CODEC_RESOURCE_USAGE_END_CODEC])609     MOS_STATUS SetCacheabilitySettings(
610         MHW_MEMORY_OBJECT_CONTROL_PARAMS cacheabilitySettings[MOS_CODEC_RESOURCE_USAGE_END_CODEC])
611     {
612         MHW_FUNCTION_ENTER;
613 
614         uint32_t size = MOS_CODEC_RESOURCE_USAGE_END_CODEC * sizeof(MHW_MEMORY_OBJECT_CONTROL_PARAMS);
615         MOS_STATUS eStatus = MOS_SecureMemcpy(m_cacheabilitySettings, size,
616             cacheabilitySettings, size);
617 
618         return eStatus;
619     }
620 
621     //!
622     //! \brief    Determines if the slice is P slice
623     //! \param    [in] sliceType
624     //!           slice type
625     //! \return   bool
626     //!           True if it's P slice, otherwise return false
627     //!
IsHevcPSlice(uint8_t sliceType)628     inline bool IsHevcPSlice(uint8_t sliceType)
629     {
630         return (sliceType < MHW_ARRAY_SIZE(m_hevcBsdSliceType)) ?
631             (m_hevcBsdSliceType[sliceType] == hevcSliceP) : false;
632     }
633 
634     //!
635     //! \brief    Determines if the slice is B slice
636     //! \param    [in] sliceType
637     //!           slice type
638     //! \return   bool
639     //!           True if it's B slice, otherwise return false
640     //!
IsHevcBSlice(uint8_t sliceType)641     inline bool IsHevcBSlice(uint8_t sliceType)
642     {
643         return (sliceType < MHW_ARRAY_SIZE(m_hevcBsdSliceType)) ?
644             (m_hevcBsdSliceType[sliceType] == hevcSliceB) : false;
645     }
646 
647     //!
648     //! \brief    Determines if the slice is I slice
649     //! \param    [in] sliceType
650     //!           slice type
651     //! \return   bool
652     //!           True if it's I slice, otherwise return false
653     //!
IsHevcISlice(uint8_t sliceType)654     inline bool IsHevcISlice(uint8_t sliceType)
655     {
656         return (sliceType < MHW_ARRAY_SIZE(m_hevcBsdSliceType)) ?
657             (m_hevcBsdSliceType[sliceType] == hevcSliceI) : false;
658     }
659 
660     //!
661     //! \brief    Get pak object size
662     //!
663     //! \return   uint32_t
664     //!           The size got
665     //!
666     virtual uint32_t GetHcpPakObjSize() = 0;
667 
668     //!
669     //! \brief    Calculates the maximum size for HCP picture level commands
670     //! \details  Client facing function to calculate the maximum size for HCP picture level commands
671     //! \param    [in] mode
672     //!           Indicate the codec mode
673     //! \param    [out] commandsSize
674     //!           The maximum command buffer size
675     //! \param    [out] patchListSize
676     //!           The maximum command patch list size
677     //! \param    [in] params
678     //!           Indicate the command size parameters
679     //! \return   MOS_STATUS
680     //!           MOS_STATUS_SUCCESS if success, else fail reason
681     //!
682     virtual MOS_STATUS GetHcpStateCommandSize(
683         uint32_t                        mode,
684         uint32_t                        *commandsSize,
685         uint32_t                        *patchListSize,
686         PMHW_VDBOX_STATE_CMDSIZE_PARAMS params) = 0;
687 
688     //!
689     //! \brief    Calculates maximum size for HCP slice/MB level commands
690     //! \details  Client facing function to calculate maximum size for HCP slice/MB level commands
691     //! \param    [in] mode
692     //!           Indicate the codec mode
693     //! \param    [out] commandsSize
694     //!            The maximum command buffer size
695     //! \param    [out] patchListSize
696     //!           The maximum command patch list size
697     //! \param    [in] modeSpecific
698     //!           Indicate the long or short format
699     //! \return   MOS_STATUS
700     //!           MOS_STATUS_SUCCESS if success, else fail reason
701     //!
702     virtual MOS_STATUS GetHcpPrimitiveCommandSize(
703         uint32_t                        mode,
704         uint32_t                        *commandsSize,
705         uint32_t                        *patchListSize,
706         bool                            modeSpecific) = 0;
707 
708     //!
709     //! \brief    get the size of hw command
710     //! \details  Internal function to get the size of HEVC_VP9_RDOQ_STATE_CMD
711     //! \return   commandSize
712     //!           The command size
713     //!
714     virtual uint32_t GetHcpHevcVp9RdoqStateCommandSize() = 0;
715 
716     //!
717     //! \brief    get the size of hw command
718     //! \details  Internal function to get the size of HCP_VP9_PIC_STATE_CMD
719     //! \return   commandSize
720     //!           The command size
721     //!
722     virtual uint32_t GetHcpVp9PicStateCommandSize() = 0;
723 
724     //!
725     //! \brief    get the size of hw command
726     //! \details  Internal function to get the size of HCP_VP9_SEGMENT_STATE_CMD
727     //! \return   commandSize
728     //!           The command size
729     //!
730     virtual uint32_t GetHcpVp9SegmentStateCommandSize() = 0;
731 
732     //!
733     //! \brief    Get the required buffer size for VDBOX
734     //! \details  Internal function to get required buffer size for HEVC codec (both dual pipe and vdenc, enc and dec)
735     //!
736     //! \param    [in] bufferType
737     //!           HEVC Buffer type
738     //! \param    [in, out] hcpBufSizeParam
739     //!           HCP buffer size parameters
740     //!
741     //! \return   MOS_STATUS
742     //!           MOS_STATUS_SUCCESS if success, else fail reason
743     //!
744     virtual MOS_STATUS GetHevcBufferSize(
745         MHW_VDBOX_HCP_INTERNAL_BUFFER_TYPE  bufferType,
746         PMHW_VDBOX_HCP_BUFFER_SIZE_PARAMS   hcpBufSizeParam) = 0;
747 
748     //!
749     //! \brief    Get the required buffer size for VDBOX
750     //! \details  Internal function to get required buffer size for VP9 codec
751     //!
752     //! \param    [in] bufferType
753     //!           HEVC Buffer type
754     //! \param    [in, out] hcpBufSizeParam
755     //!           HCP buffer size parameters
756     //!
757     //! \return   MOS_STATUS
758     //!           MOS_STATUS_SUCCESS if success, else fail reason
759     //!
760     virtual MOS_STATUS GetVp9BufferSize(
761         MHW_VDBOX_HCP_INTERNAL_BUFFER_TYPE  bufferType,
762         PMHW_VDBOX_HCP_BUFFER_SIZE_PARAMS   hcpBufSizeParam) = 0;
763 
764     //!
765     //! \brief    Get the required buffer size for VDBOX
766     //! \details  Internal function to judge if buffer realloc is needed for HEVC codec
767     //!
768     //! \param    [in] bufferType
769     //!          HEVC Buffer type
770     //! \param    [in, out] reallocParam
771     //!          HCP Re-allocate parameters
772     //!
773     //! \return   MOS_STATUS
774     //!           MOS_STATUS_SUCCESS if success, else fail reason
775     //!
776     virtual MOS_STATUS IsHevcBufferReallocNeeded(
777         MHW_VDBOX_HCP_INTERNAL_BUFFER_TYPE   bufferType,
778         PMHW_VDBOX_HCP_BUFFER_REALLOC_PARAMS reallocParam) = 0;
779 
780     //!
781     //! \brief    Get the required buffer size for VDBOX
782     //! \details  Internal function to judge if buffer realloc is needed for VP9 codec
783     //!
784     //! \param    [in] bufferType
785     //!           HEVC Buffer type
786     //! \param    [in, out] reallocParam
787     //!           HCP Re-allocate parameters
788     //!
789     //! \return   MOS_STATUS
790     //!           MOS_STATUS_SUCCESS if success, else fail reason
791     //!
792     virtual MOS_STATUS IsVp9BufferReallocNeeded(
793         MHW_VDBOX_HCP_INTERNAL_BUFFER_TYPE   bufferType,
794         PMHW_VDBOX_HCP_BUFFER_REALLOC_PARAMS reallocParam) = 0;
795 
796     //!
797     //! \brief    Adds HCP Pipe Pipe Mode Select command in command buffer
798     //! \details  Client facing function to add HCP Pipe Mode Select command in command buffer
799     //!
800     //! \param    [in] cmdBuffer
801     //!           Command buffer to which HW command is added
802     //! \param    [in] params
803     //!           Params structure used to populate the HW command
804     //!
805     //! \return   MOS_STATUS
806     //!           MOS_STATUS_SUCCESS if success, else fail reason
807     //!
808     MOS_STATUS AddHcpSurfaceCmd(
809         PMOS_COMMAND_BUFFER                  cmdBuffer,
810         PMHW_VDBOX_SURFACE_PARAMS            params);
811 
812     //!
813     //! \brief    Adds HCP slice state command in command buffer
814     //! \details  Client facing function to add HCP slice state command in command buffer
815     //!
816     //! \param    [in] cmdBuffer
817     //!           Command buffer to which HW command is added
818     //! \param    [in] hevcSliceState
819     //!           Params structure used to populate the HW command
820     //!
821     //! \return   MOS_STATUS
822     //!           MOS_STATUS_SUCCESS if success, else fail reason
823     //!
824     MOS_STATUS AddHcpSliceStateCmd(
825         PMOS_COMMAND_BUFFER              cmdBuffer,
826         PMHW_VDBOX_HEVC_SLICE_STATE      hevcSliceState);
827 
828     //!
829     //! \brief    Adds HCP picture State command in command buffer
830     //! \details  Client facing function to add HCP picture State command for encode in command buffer
831     //!
832     //! \param    [in] cmdBuffer
833     //!           Command buffer to which HW command is added
834     //! \param    [in] params
835     //!           Params structure used to populate the HW command
836     //!
837     //! \return   MOS_STATUS
838     //!           MOS_STATUS_SUCCESS if success, else fail reason
839     //!
840     MOS_STATUS AddHcpPicStateCmd(
841         PMOS_COMMAND_BUFFER              cmdBuffer,
842         PMHW_VDBOX_HEVC_PIC_STATE        params);
843 
844     //!
845     //! \brief    Programs base address of rowstore scratch buffers
846     //! \details  Internal function to get base address of rowstore scratch buffers
847     //!
848     //! \param    [in] rowstoreParams
849     //!           Rowstore parameters
850     //!
851     //! \return   MOS_STATUS
852     //!           MOS_STATUS_SUCCESS if success, else fail reason
853     //!
854     virtual MOS_STATUS GetRowstoreCachingAddrs(
855         PMHW_VDBOX_ROWSTORE_PARAMS rowstoreParams) = 0;
856 
857     //!
858     //! \brief    Adds HCP Pipe Pipe Mode Select command in command buffer
859     //!
860     //! \param    [in] cmdBuffer
861     //!           Command buffer to which HW command is added
862     //! \param    [in] params
863     //!           Params structure used to populate the HW command
864     //!
865     //! \return   MOS_STATUS
866     //!           MOS_STATUS_SUCCESS if success, else fail reason
867     //!
868     virtual MOS_STATUS AddHcpPipeModeSelectCmd(
869         PMOS_COMMAND_BUFFER                  cmdBuffer,
870         PMHW_VDBOX_PIPE_MODE_SELECT_PARAMS   params) = 0;
871 
872     //!
873     //! \brief    Adds HCP Surface State command for decode in command buffer
874     //!
875     //! \param    [in] cmdBuffer
876     //!           Command buffer to which HW command is added
877     //! \param    [in] params
878     //!           Params structure used to populate the HW command
879     //!
880     //! \return   MOS_STATUS
881     //!           MOS_STATUS_SUCCESS if success, else fail reason
882     //!
883     virtual MOS_STATUS AddHcpDecodeSurfaceStateCmd(
884         PMOS_COMMAND_BUFFER                  cmdBuffer,
885         PMHW_VDBOX_SURFACE_PARAMS            params) = 0;
886 
887     //!
888     //! \brief    Adds HCP Surface State command for encode in command buffer
889     //!
890     //! \param    [in] cmdBuffer
891     //!           Command buffer to which HW command is added
892     //! \param    [in] params
893     //!           Params structure used to populate the HW command
894     //!
895     //! \return   MOS_STATUS
896     //!           MOS_STATUS_SUCCESS if success, else fail reason
897     //!
898     virtual MOS_STATUS AddHcpEncodeSurfaceStateCmd(
899         PMOS_COMMAND_BUFFER                  cmdBuffer,
900         PMHW_VDBOX_SURFACE_PARAMS            params) = 0;
901 
902     //!
903     //! \brief    Adds HCP Pipe Buffer Address State command in command buffer
904     //!
905     //! \param    [in] cmdBuffer
906     //!           Command buffer to which HW command is added
907     //! \param    [in] params
908     //!           Params structure used to populate the HW command
909     //!
910     //! \return   MOS_STATUS
911     //!           MOS_STATUS_SUCCESS if success, else fail reason
912     //!
913     virtual MOS_STATUS AddHcpPipeBufAddrCmd(
914         PMOS_COMMAND_BUFFER                  cmdBuffer,
915         PMHW_VDBOX_PIPE_BUF_ADDR_PARAMS      params) = 0;
916 
917     //!
918     //! \brief    Adds HCP Indirect Object Base Address State command in command buffer
919     //!
920     //! \param    [in] cmdBuffer
921     //!           Command buffer to which HW command is added
922     //! \param    [in] params
923     //!           Params structure used to populate the HW command
924     //!
925     //! \return   MOS_STATUS
926     //!           MOS_STATUS_SUCCESS if success, else fail reason
927     //!
928     virtual MOS_STATUS AddHcpIndObjBaseAddrCmd(
929         PMOS_COMMAND_BUFFER                  cmdBuffer,
930         PMHW_VDBOX_IND_OBJ_BASE_ADDR_PARAMS  params) = 0;
931 
932     //!
933     //! \brief    Adds HCP QM State command in command buffer
934     //!
935     //! \param    [in] cmdBuffer
936     //!          Command buffer to which HW command is added
937     //! \param    [in] params
938     //!          Params structure used to populate the HW command
939     //! \return   MOS_STATUS
940     //!           MOS_STATUS_SUCCESS if success, else fail reason
941     //!
942     virtual MOS_STATUS AddHcpQmStateCmd(
943         PMOS_COMMAND_BUFFER                  cmdBuffer,
944         PMHW_VDBOX_QM_PARAMS                 params) = 0;
945 
946     //!
947     //! \brief    Adds HCP FQM State command in command buffer
948     //!
949     //! \param    [in] cmdBuffer
950     //!           Command buffer to which HW command is added
951     //! \param    [in] params
952     //!           Params structure used to populate the HW command
953     //!
954     //! \return   MOS_STATUS
955     //!           MOS_STATUS_SUCCESS if success, else fail reason
956     //!
957     virtual MOS_STATUS AddHcpFqmStateCmd(
958         PMOS_COMMAND_BUFFER                  cmdBuffer,
959         PMHW_VDBOX_QM_PARAMS                 params) = 0;
960 
961     //!
962     //! \brief    Adds HCP picture State command for decode in command buffer
963     //!
964     //! \param    [in] cmdBuffer
965     //!           Command buffer to which HW command is added
966     //! \param    [in] params
967     //!           Params structure used to populate the HW command
968     //!
969     //! \return   MOS_STATUS
970     //!           MOS_STATUS_SUCCESS if success, else fail reason
971     //!
972     virtual MOS_STATUS AddHcpDecodePicStateCmd(
973         PMOS_COMMAND_BUFFER              cmdBuffer,
974         PMHW_VDBOX_HEVC_PIC_STATE        params) = 0;
975 
976     //!
977     //! \brief    Adds HCP picture State command for encode in command buffer
978     //!
979     //! \param    [in] cmdBuffer
980     //!           Command buffer to which HW command is added
981     //! \param    [in] params
982     //!           Params structure used to populate the HW command
983     //!
984     //! \return   MOS_STATUS
985     //!           MOS_STATUS_SUCCESS if success, else fail reason
986     //!
987     virtual MOS_STATUS AddHcpEncodePicStateCmd(
988         PMOS_COMMAND_BUFFER              cmdBuffer,
989         PMHW_VDBOX_HEVC_PIC_STATE        params) = 0;
990 
991     //!
992     //! \brief    Adds HCP tile State command in command buffer
993     //!
994     //! \param    [in] cmdBuffer
995     //!           Command buffer to which HW command is added
996     //! \param    [in] params
997     //!           Params structure used to populate the HW command
998     //!
999     //! \return   MOS_STATUS
1000     //!           MOS_STATUS_SUCCESS if success, else fail reason
1001     //!
1002     virtual MOS_STATUS AddHcpTileStateCmd(
1003         PMOS_COMMAND_BUFFER              cmdBuffer,
1004         PMHW_VDBOX_HEVC_TILE_STATE       params) = 0;
1005 
1006     //!
1007     //! \brief    Adds HCP reference frame index command in command buffer
1008     //!
1009     //! \param    [in] cmdBuffer
1010     //!           Command buffer to which HW command is added
1011     //! \param    [in] batchBuffer
1012     //!           Batch buffer to add to VDBOX_BUFFER_START
1013     //! \param    [in] params
1014     //!           Params structure used to populate the HW command
1015     //!
1016     //! \return   MOS_STATUS
1017     //!           MOS_STATUS_SUCCESS if success, else fail reason
1018     //!
1019     virtual MOS_STATUS AddHcpRefIdxStateCmd(
1020         PMOS_COMMAND_BUFFER              cmdBuffer,
1021         PMHW_BATCH_BUFFER                batchBuffer,
1022         PMHW_VDBOX_HEVC_REF_IDX_PARAMS   params) = 0;
1023 
1024     //!
1025     //! \brief    Adds HCP weight offset state command in command buffer
1026     //!
1027     //! \param    [in] cmdBuffer
1028     //!           Command buffer to which HW command is added
1029     //! \param    [in] batchBuffer
1030     //!           Batch buffer to add to VDBOX_BUFFER_START
1031     //! \param    [in] params
1032     //!           Params structure used to populate the HW command
1033     //!
1034     //! \return   MOS_STATUS
1035     //!           MOS_STATUS_SUCCESS if success, else fail reason
1036     //!
1037     virtual MOS_STATUS AddHcpWeightOffsetStateCmd(
1038         PMOS_COMMAND_BUFFER                  cmdBuffer,
1039         PMHW_BATCH_BUFFER                    batchBuffer,
1040         PMHW_VDBOX_HEVC_WEIGHTOFFSET_PARAMS  params) = 0;
1041 
1042     //!
1043     //! \brief    Adds HCP slice state command for decode in command buffer
1044     //!
1045     //! \param    [in] cmdBuffer
1046     //!           Command buffer to which HW command is added
1047     //! \param    [in] hevcSliceState
1048     //!           Params structure used to populate the HW command
1049     //!
1050     //! \return   MOS_STATUS
1051     //!           MOS_STATUS_SUCCESS if success, else fail reason
1052     //!
1053     virtual MOS_STATUS AddHcpDecodeSliceStateCmd(
1054         PMOS_COMMAND_BUFFER              cmdBuffer,
1055         PMHW_VDBOX_HEVC_SLICE_STATE      hevcSliceState) = 0;
1056 
1057     //!
1058     //! \brief    Adds HCP slice state command for encode in command buffer
1059     //!
1060     //! \param    [in] cmdBuffer
1061     //!           Command buffer to which HW command is added
1062     //! \param    [in] hevcSliceState
1063     //!           Params structure used to populate the HW command
1064     //!
1065     //! \return   MOS_STATUS
1066     //!           MOS_STATUS_SUCCESS if success, else fail reason
1067     //!
1068     virtual MOS_STATUS AddHcpEncodeSliceStateCmd(
1069         PMOS_COMMAND_BUFFER              cmdBuffer,
1070         PMHW_VDBOX_HEVC_SLICE_STATE      hevcSliceState) = 0;
1071 
1072     //!
1073     //! \brief    Adds HCP BSD object state command in command buffer
1074     //!
1075     //! \param    [in] cmdBuffer
1076     //!           Command buffer to which HW command is added
1077     //! \param    [in] params
1078     //!           Params structure used to populate the HW command
1079     //!
1080     //! \return   MOS_STATUS
1081     //!           MOS_STATUS_SUCCESS if success, else fail reason
1082     //!
1083     virtual MOS_STATUS AddHcpBsdObjectCmd(
1084         PMOS_COMMAND_BUFFER              cmdBuffer,
1085         PMHW_VDBOX_HCP_BSD_PARAMS        params) = 0;
1086 
1087     //!
1088     //! \brief    Adds HCP Pak insert object State command foe encode in command buffer
1089     //!
1090     //! \param    [in] cmdBuffer
1091     //!           Command buffer to which HW command is added
1092     //! \param    [in] params
1093     //!           Params structure used to populate the HW command
1094     //!
1095     //! \return   MOS_STATUS
1096     //!           MOS_STATUS_SUCCESS if success, else fail reason
1097     //!
1098     virtual MOS_STATUS AddHcpPakInsertObject(
1099         PMOS_COMMAND_BUFFER              cmdBuffer,
1100         PMHW_VDBOX_PAK_INSERT_PARAMS     params) = 0;
1101 
1102     //!
1103     //! \brief    Adds VP9 picture state command for decode in command buffer
1104     //!
1105     //! \param    [in]  cmdBuffer
1106     //!           Command buffer to which HW command is added
1107     //! \param    [in]  batchBuffer
1108     //!           Batch buffer to which HW command is added
1109     //! \param    [in]  params
1110     //!           Params structure used to populate the HW command
1111     //!
1112     //! \return   MOS_STATUS
1113     //!           MOS_STATUS_SUCCESS if success, else fail reason
1114     //!
1115     virtual MOS_STATUS AddHcpVp9PicStateCmd(
1116         PMOS_COMMAND_BUFFER              cmdBuffer,
1117         PMHW_BATCH_BUFFER                batchBuffer,
1118         PMHW_VDBOX_VP9_PIC_STATE         params) = 0;
1119 
1120     //!
1121     //! \brief    Adds VP9 picture state command for encode in command buffer
1122     //!
1123     //! \param    [in] cmdBuffer
1124     //!           Command buffer to which HW command is added
1125     //! \param    [in] batchBuffer
1126     //!           Batch buffer to which HW command is added
1127     //! \param    [in] params
1128     //!           Params structure used to populate the HW command
1129     //! \return   MOS_STATUS
1130     //!           MOS_STATUS_SUCCESS if success, else fail reason
1131     //!
1132     virtual MOS_STATUS AddHcpVp9PicStateEncCmd(
1133         PMOS_COMMAND_BUFFER              cmdBuffer,
1134         PMHW_BATCH_BUFFER                batchBuffer,
1135         PMHW_VDBOX_VP9_ENCODE_PIC_STATE  params) = 0;
1136 
1137     //!
1138     //! \brief    Adds VP9 segment state command for decode in command buffer
1139     //!
1140     //! \param    [in] cmdBuffer
1141     //!           Command buffer to which HW command is added
1142     //! \param    [in] batchBuffer
1143     //!           Batch buffer to which HW command is added
1144     //! \param    [in] params
1145     //!           Params structure used to populate the HW command
1146     //!
1147     //! \return   MOS_STATUS
1148     //!           MOS_STATUS_SUCCESS if success, else fail reason
1149     //!
1150     virtual MOS_STATUS AddHcpVp9SegmentStateCmd(
1151         PMOS_COMMAND_BUFFER              cmdBuffer,
1152         PMHW_BATCH_BUFFER                batchBuffer,
1153         PMHW_VDBOX_VP9_SEGMENT_STATE     params) = 0;
1154 
1155     //!
1156     //! \brief    Adds VP9 RDOQ state command for encode in command buffer
1157     //!
1158     //! \param    [in] cmdBuffer
1159     //!           Command buffer to which HW command is added
1160     //! \param    [in] params
1161     //!           Params structure used to populate the HW command
1162     //!
1163     //! \return   MOS_STATUS
1164     //!           MOS_STATUS_SUCCESS if success, else fail reason
1165     //!
1166     virtual MOS_STATUS AddHcpHevcVp9RdoqStateCmd(
1167         PMOS_COMMAND_BUFFER              cmdBuffer,
1168         PMHW_VDBOX_HEVC_PIC_STATE        params) = 0;
1169 
1170     //!
1171     //! \brief    Adds HEVC Brc buffer
1172     //!
1173     //! \param    [in] hcpImgStates
1174     //!           Resource to which Brc buffer is added
1175     //! \param    [in] hevcPicState
1176     //!           Params structure used to add the Brc buffer
1177     //!
1178     //! \return   MOS_STATUS
1179     //!           MOS_STATUS_SUCCESS if success, else fail reason
1180     //!
1181     virtual MOS_STATUS AddHcpHevcPicBrcBuffer(
1182         PMOS_RESOURCE                    hcpImgStates,
1183         PMHW_VDBOX_HEVC_PIC_STATE         hevcPicState) = 0;
1184 
1185     //!
1186     //! \brief    Get OsResLaceOrAceOrRgbHistogramBuffer Size
1187     //!
1188     //! \param    [in] width
1189     //!           Width of Surface
1190     //! \param    [in] height
1191     //!           Height of Surface
1192     //! \param    [out] size
1193     //!           Size of OsResLaceOrAceOrRgbHistogramBuffer
1194     //!
1195     //! \return   MOS_STATUS
1196     //!           MOS_STATUS_SUCCESS if success, else fail reason
1197     //!
1198     virtual MOS_STATUS GetOsResLaceOrAceOrRgbHistogramBufferSize(
1199         uint32_t                         width,
1200         uint32_t                         height,
1201         uint32_t                        *size) = 0;
1202 
1203     //!
1204     //! \brief    Get OsResStatisticsOutputBuffer Size
1205     //!
1206     //! \param    [in] width
1207     //!           Width of Surface
1208     //! \param    [in] height
1209     //!           Height of Surface
1210     //! \param    [out] size
1211     //!           Size of OsResStatisticsOutputBuffer
1212     //!
1213     //! \return   MOS_STATUS
1214     //!           MOS_STATUS_SUCCESS if success, else fail reason
1215     //!
1216     virtual MOS_STATUS GetOsResStatisticsOutputBufferSize(
1217         uint32_t                         width,
1218         uint32_t                         height,
1219         uint32_t                        *size) = 0;
1220 };
1221 
1222 #endif
1223