1 /*
2 * Copyright (c) 2017-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     mhw_vdbox_vdenc_interface.h
24 //! \brief    MHW interface for constructing Vdenc commands for the Vdbox engine
25 //! \details  Defines the interfaces for constructing MHW Vdbox Vdenc commands across all platforms
26 //!
27 
28 #ifndef _MHW_VDBOX_VDENC_INTERFACE_H_
29 #define _MHW_VDBOX_VDENC_INTERFACE_H_
30 
31 #include "mhw_vdbox.h"
32 #include "mhw_mi.h"
33 #include "codec_def_encode_hevc.h"
34 #include "mhw_vdbox_vdenc_itf.h"
35 
36 typedef struct _MHW_VDBOX_VD_PIPE_FLUSH_PARAMS
37 {
38     union
39     {
40         struct
41         {
42             uint16_t       bWaitDoneHEVC : 1;
43             uint16_t       bWaitDoneVDENC : 1;
44             uint16_t       bWaitDoneMFL : 1;
45             uint16_t       bWaitDoneMFX : 1;
46             uint16_t       bWaitDoneVDCmdMsgParser : 1;
47             uint16_t       bFlushHEVC : 1;
48             uint16_t       bFlushVDENC : 1;
49             uint16_t       bFlushMFL : 1;
50             uint16_t       bFlushMFX : 1;
51             uint16_t                 : 7;
52         };
53         struct
54         {
55             uint16_t       Value;
56         };
57     }Flags;
58 } MHW_VDBOX_VD_PIPE_FLUSH_PARAMS, *PMHW_VDBOX_VD_PIPE_FLUSH_PARAMS;
59 
60 typedef struct _MHW_VDBOX_VDENC_STREAMIN_STATE_PARAMS
61 {
62     uint8_t maxTuSize;
63     uint8_t maxCuSize;
64     uint8_t numImePredictors;
65     uint8_t numMergeCandidateCu64x64;
66     uint8_t numMergeCandidateCu32x32;
67     uint8_t numMergeCandidateCu16x16;
68     uint8_t numMergeCandidateCu8x8;
69     bool setQpRoiCtrl;
70     int8_t  forceQp[4];
71     uint8_t roiCtrl;
72     uint8_t puTypeCtrl;
73 }MHW_VDBOX_VDENC_STREAMIN_STATE_PARAMS, *PMHW_VDBOX_VDENC_STREAMIN_STATE_PARAMS;
74 
75 typedef struct _MHW_VDBOX_VDENC_CQPT_STATE_PARAMS
76 {
77     uint16_t    wPictureCodingType;
78     bool        bFTQEnabled;
79     bool        bBlockBasedSkip;
80     bool        bTransform8x8Flag;
81 } MHW_VDBOX_VDENC_CQPT_STATE_PARAMS, *PMHW_VDBOX_VDENC_CQPT_STATE_PARAMS;
82 
83 typedef struct _MHW_VDBOX_VDENC_WEIGHT_OFFSET_PARAMS
84 {
85     bool        bWeightedPredEnabled    = false;
86     uint32_t    dwDenom                 = 0;
87     uint8_t     ucList                  = 0;
88     char        LumaWeights[2][CODEC_MAX_NUM_REF_FRAME_HEVC]        = {};
89     int16_t     LumaOffsets[2][CODEC_MAX_NUM_REF_FRAME_HEVC]        = {};
90     char        ChromaWeights[2][CODEC_MAX_NUM_REF_FRAME_HEVC][2]   = {};
91     int16_t     ChromaOffsets[2][CODEC_MAX_NUM_REF_FRAME_HEVC][2]   = {};
92     uint32_t    dwChromaDenom           = 0;
93     bool        isLowDelay              = true;
94 } MHW_VDBOX_VDENC_WEIGHT_OFFSET_PARAMS, *PMHW_VDBOX_VDENC_WEIGHT_OFFSET_PARAMS;
95 
96 typedef struct _MHW_VDBOX_VDENC_CMD1_PARAMS
97 {
98     uint32_t                                Mode                = 0;
99     PCODEC_HEVC_ENCODE_PICTURE_PARAMS       pHevcEncPicParams   = nullptr;
100     PCODEC_HEVC_ENCODE_SEQUENCE_PARAMS      pHevcEncSeqParams   = nullptr;
101     PCODEC_HEVC_ENCODE_SLICE_PARAMS         pHevcEncSlcParams   = nullptr;
102     PCODEC_VP9_ENCODE_PIC_PARAMS            pVp9EncPicParams    = nullptr;
103     uint8_t                                *pucVdencMvCosts     = nullptr;
104     uint8_t                                *pucVdencRdMvCosts   = nullptr;
105     uint8_t                                *pucVdencHmeMvCosts  = nullptr;
106     uint8_t                                *pucVdencModeCosts   = nullptr;
107     void                                   *pInputParams        = nullptr;
108     uint16_t                                usSADQPLambda       = 0;
109     uint16_t                                usRDQPLambda        = 0;
110     uint8_t                                 frame_type          = 0;
111     uint8_t                                 qp                  = 0;
112     bool                                    isLowDelay          = false;
113     bool                                    bHevcVisualQualityImprovement = false;  //!< VQI enable flag
114 } MHW_VDBOX_VDENC_CMD1_PARAMS, *PMHW_VDBOX_VDENC_CMD1_PARAMS;
115 
116 struct MHW_VDBOX_VDENC_CMD2_STATE
117 {
118     uint32_t                                Mode = 0;
119 
120     // HEVC
121     PCODEC_HEVC_ENCODE_SEQUENCE_PARAMS pHevcEncSeqParams         = nullptr;
122     PCODEC_HEVC_ENCODE_PICTURE_PARAMS  pHevcEncPicParams         = nullptr;
123     PCODEC_HEVC_ENCODE_SLICE_PARAMS    pHevcEncSlcParams         = nullptr;
124     bool                               bSAOEnable                = false;
125     bool                               bRoundingEnabled          = false;
126     bool                               bStreamInEnabled          = false;
127     bool                               bROIStreamInEnabled       = false;
128     bool                               bUseDefaultQpDeltas       = false;
129     bool                               bPanicEnabled             = false;
130     bool                               bPartialFrameUpdateEnable = false;
131     uint32_t                           roundInterValue           = 0;
132     uint32_t                           roundIntraValue           = 0;
133     uint8_t                            bStreaminRoiMode          = 0;
134     bool                               bEnableSubPelMode         = false;
135     uint8_t                            SubPelMode                = 0;
136 
137     // VP9
138     PCODEC_VP9_ENCODE_PIC_PARAMS            pVp9EncPicParams = nullptr;
139     bool                                    bSegmentationEnabled = false;
140     PMHW_VDBOX_VP9_SEGMENT_STATE            pVp9SegmentState = nullptr;
141     PCODEC_VP9_ENCODE_SEQUENCE_PARAMS       pVp9EncSeqParams = nullptr;
142     bool                                    bPrevFrameSegEnabled = false;
143     bool                                    bDynamicScalingEnabled = false;
144     bool                                    temporalMVpEnable = false;
145 
146     // Common
147     uint8_t                                 ucNumRefIdxL0ActiveMinus1 = 0;
148     uint8_t                                 ucNumRefIdxL1ActiveMinus1 = 0;
149     uint16_t                                usSADQPLambda = 0;
150     uint16_t                                usRDQPLambda = 0;
151     bool                                    bPakOnlyMultipassEnable = false;
152     void                                    *pInputParams = nullptr;
153     bool                                    bHevcVisualQualityImprovement = false;  //!< VQI enable flag
154 
155     bool                                    bTileReplayEnable = false;
156     bool                                    bCaptureModeEnable = false;
157     uint8_t                                 m_WirelessSessionID = 0;
158     bool                                    bIsLowDelayB = false;
159     int8_t                                  *pRefIdxMapping = nullptr;
160     uint8_t                                 recNotFilteredID = 0;
~MHW_VDBOX_VDENC_CMD2_STATEMHW_VDBOX_VDENC_CMD2_STATE161     virtual ~MHW_VDBOX_VDENC_CMD2_STATE() {}
162 };
163 using PMHW_VDBOX_VDENC_CMD2_STATE = std::shared_ptr<MHW_VDBOX_VDENC_CMD2_STATE>;
164 
165 struct MHW_VDBOX_VDENC_WALKER_STATE_PARAMS
166 {
167     uint32_t                                Mode = 0;
168     uint32_t                                slcIdx = 0;
169     PCODEC_AVC_ENCODE_SEQUENCE_PARAMS       pAvcSeqParams = nullptr;
170     PCODEC_AVC_ENCODE_PIC_PARAMS            pAvcPicParams = nullptr;
171     PCODEC_AVC_ENCODE_SLICE_PARAMS          pAvcSlcParams = nullptr;
172     PCODEC_HEVC_ENCODE_SEQUENCE_PARAMS      pHevcEncSeqParams = nullptr;
173     PCODEC_HEVC_ENCODE_PICTURE_PARAMS       pHevcEncPicParams = nullptr;
174     PCODEC_HEVC_ENCODE_SLICE_PARAMS         pEncodeHevcSliceParams = nullptr;
175     PCODEC_VP9_ENCODE_PIC_PARAMS            pVp9EncPicParams = nullptr;
~MHW_VDBOX_VDENC_WALKER_STATE_PARAMSMHW_VDBOX_VDENC_WALKER_STATE_PARAMS176     virtual ~MHW_VDBOX_VDENC_WALKER_STATE_PARAMS() {}
177 };
178 using PMHW_VDBOX_VDENC_WALKER_STATE_PARAMS = MHW_VDBOX_VDENC_WALKER_STATE_PARAMS * ;
179 
180 //!  MHW Vdbox Vdenc interface
181 /*!
182 This class defines the interfaces for constructing Vdbox Vdenc commands across all platforms
183 */
184 class MhwVdboxVdencInterface
185 {
186 protected:
187 
188     PMOS_INTERFACE              m_osInterface = nullptr; //!< Pointer to OS interface
189 
190     MHW_MEMORY_OBJECT_CONTROL_PARAMS m_cacheabilitySettings[MOS_CODEC_RESOURCE_USAGE_END_CODEC] = {}; //!< Cacheability settings
191 
192     bool                        m_rowstoreCachingSupported = 0;
193     MHW_VDBOX_ROWSTORE_CACHE    m_vdencRowStoreCache = {};    //!< vdenc row store cache
194     MHW_VDBOX_ROWSTORE_CACHE    m_vdencIpdlRowstoreCache = {}; //!< vdenc IntraPred row store cache
195     bool                        m_rhoDomainStatsEnabled = false; //! indicate if rho domain stats is enabled
196     bool                        m_perfModeSupported = true; //! indicate perf mode is supported
197 
198     std::shared_ptr<mhw::vdbox::vdenc::Itf> m_vdencItfNew = nullptr;
199 
200     static const bool m_vdencFTQEnabled[NUM_VDENC_TARGET_USAGE_MODES];
201     static const bool m_vdencBlockBasedSkipEnabled[NUM_VDENC_TARGET_USAGE_MODES];
202 
203     //!
204     //! \brief    Constructor
205     //!
206     MhwVdboxVdencInterface(PMOS_INTERFACE osInterface);
207 
208     //!
209     //! \brief    Add a resource to the command buffer
210     //! \details  Internal function to add either a graphics address of a resource or
211     //!           add the resource to the patch list for the requested buffer
212     //!
213     //! \param    [in] osInterface
214     //!           OS interface
215     //! \param    [in] cmdBuffer
216     //!           Command buffer to which resource is added
217     //! \param    [in] params
218     //!           Parameters necessary to add the resource
219     //!
220     //! \return   MOS_STATUS
221     //!           MOS_STATUS_SUCCESS if success, else fail type
222     //!
223     MOS_STATUS(*AddResourceToCmd) (
224         PMOS_INTERFACE osInterface,
225         PMOS_COMMAND_BUFFER cmdBuffer,
226         PMHW_RESOURCE_PARAMS params);
227 
228     virtual MOS_STATUS InitRowstoreUserFeatureSettings() = 0;
229 
230     //!
231     //! \brief    Translate MOS type format to Mediastate surface format
232     //! \details  VDBOX protected function to translate mos format to media state format
233     //! \param    [in] format
234     //!           MOS type format
235     //! \return   uint32_t
236     //!           media state surface format
237     //!
238     uint32_t MosToMediaStateFormat(MOS_FORMAT format);
239 
240 public:
241 
242     //!
243     //! \brief    Destructor
244     //!
~MhwVdboxVdencInterface()245     virtual ~MhwVdboxVdencInterface() {}
246 
247     //!
248     //! \brief    Get new VDENC interface, temporal solution before switching from
249     //!           old interface to new one
250     //!
251     //! \return   pointer to new VDENC interface
252     //!
GetNewVdencInterface()253     virtual std::shared_ptr<mhw::vdbox::vdenc::Itf> GetNewVdencInterface() { return nullptr; }
254 
255     //!
256     //! \brief    Judge if row store caching supported
257     //!
258     //! \return   bool
259     //!           true if supported, else false
260     //!
IsRowStoreCachingSupported()261     inline bool IsRowStoreCachingSupported()
262     {
263         return m_rowstoreCachingSupported;
264     }
265 
266     //!
267     //! \brief    Judge if vdenc row store caching enabled
268     //!
269     //! \return   bool
270     //!           true if enabled, else false
271     //!
IsvdencRowstoreCacheEnabled()272     inline bool IsvdencRowstoreCacheEnabled()
273     {
274         return m_vdencRowStoreCache.bEnabled ? true : false;
275     }
276 
277     //!
278     //! \brief    Judge if rho domain stats is enabled
279     //!
280     //! \return   bool
281     //!           true if enabled, else false
282     //!
IsRhoDomainStatsEnabled()283     inline bool IsRhoDomainStatsEnabled()
284     {
285         return m_rhoDomainStatsEnabled;
286     }
287 
288     //!
289     //! \brief    Judge if perf mode is supported
290     //!
291     //! \return   bool
292     //!           true if enabled, else false
293     //!
IsPerfModeSupported()294     inline bool IsPerfModeSupported()
295     {
296         return m_perfModeSupported;
297     }
298 
299     //!
300     //! \brief    get vdenc FTQ supported
301     //!
302     //! \param    [in] idx
303     //!           index of the array
304     //! \return   bool
305     //!           true if enabled, else false
306     //!
VdencFTQEnabled(uint32_t idx)307     inline bool VdencFTQEnabled(uint32_t idx)
308     {
309         return m_vdencFTQEnabled[idx];
310     }
311 
312     //!
313     //! \brief    get Vdenc img state size
314     //!
315     //! \return   uint32_t
316     //!           Vdenc img state size got
317     //!
318     virtual uint32_t GetVdencAvcImgStateSize() = 0;
319 
320     //!
321     //! \brief    get Vdenc slc state size
322     //!
323     //! \return   uint32_t
324     //!           Vdenc slc state size got
325     //!
326     virtual uint32_t GetVdencAvcSlcStateSize() = 0;
327 
328     //!
329     //! \brief    get Vdenc cost state size
330     //!
331     //! \return   uint32_t
332     //!           Vdenc cost state size got
333     //!
334     virtual uint32_t GetVdencAvcCostStateSize() = 0;
335 
336     //!
337     //! \brief    get cmd1
338     //!
339     //! \return   uint32_t
340     //!           cmd1 size got
341     //!
342     virtual uint32_t GetVdencCmd1Size() = 0;
343 
344     //!
345     //! \brief    get cmd2
346     //!
347     //! \return   uint32_t
348     //!           cmd2 size got
349     //!
350     virtual uint32_t GetVdencCmd2Size() = 0;
351 
352     //!
353     //! \brief    get cmd3
354     //!
355     //! \return   uint32_t
356     //!           cmd3 size got
357     //!
358     virtual uint32_t GetVdencCmd3Size() = 0;
359 
360     //!
361     //! \brief    get Vdenc state commands data size
362     //!
363     //! \return   uint32_t
364     //!           Vdenc state commands data size got
365     //!
366     virtual MOS_STATUS GetVdencStateCommandsDataSize(
367         uint32_t                        mode,
368         uint32_t                        waAddDelayInVDEncDynamicSlice,
369         uint32_t                        *commandsSize,
370         uint32_t                        *patchListSize) = 0;
371 
372     //!
373     //! \brief    get Vdenc slice commands data size
374     //!
375     //! \return   uint32_t
376     //!           Vdenc slice commands data size got
377     //!
378     virtual MOS_STATUS GetVdencPrimitiveCommandsDataSize(
379         uint32_t                        mode,
380         uint32_t                        *commandsSize,
381         uint32_t                        *patchListSize) = 0;
382 
383     //!
384     //! \brief    Set cacheability settings
385     //!
386     //! \param    [in] cacheabilitySettings
387     //!           Cacheability settings
388     //!
389     //! \return   MOS_STATUS
390     //!           MOS_STATUS_SUCCESS if success, else fail type
391     //!
SetCacheabilitySettings(MHW_MEMORY_OBJECT_CONTROL_PARAMS cacheabilitySettings[MOS_CODEC_RESOURCE_USAGE_END_CODEC])392     MOS_STATUS SetCacheabilitySettings(
393         MHW_MEMORY_OBJECT_CONTROL_PARAMS cacheabilitySettings[MOS_CODEC_RESOURCE_USAGE_END_CODEC])
394     {
395         MHW_FUNCTION_ENTER;
396 
397         uint32_t size = MOS_CODEC_RESOURCE_USAGE_END_CODEC * sizeof(MHW_MEMORY_OBJECT_CONTROL_PARAMS);
398         return MOS_SecureMemcpy(m_cacheabilitySettings, size, cacheabilitySettings, size);
399     }
400 
401     //!
402     //! \brief    Get max vdbox index
403     //!
404     //! \return   MHW_VDBOX_NODE_IND
405     //!           max vdbox index got
406     //!
GetMaxVdboxIndex()407     inline MHW_VDBOX_NODE_IND GetMaxVdboxIndex()
408     {
409         return MEDIA_IS_SKU(m_osInterface->pfnGetSkuTable(m_osInterface), FtrVcs2) ? MHW_VDBOX_NODE_2 : MHW_VDBOX_NODE_1;
410     }
411 
412     //!
413     //! \brief    Programs base address of rowstore scratch buffers
414     //! \details  Internal function to get base address of rowstore scratch buffers
415     //!
416     //! \param    [in] rowstoreParams
417     //!           Rowstore parameters
418     //!
419     //! \return   MOS_STATUS
420     //!           MOS_STATUS_SUCCESS if success, else fail type
421     //!
422     virtual MOS_STATUS GetRowstoreCachingAddrs(
423         PMHW_VDBOX_ROWSTORE_PARAMS rowstoreParams) = 0;
424 
425     //!
426     //! \brief    Adds VD Pipeline Flush command in command buffer
427     //! \details  Client facing function to add VD Pipeline Flush command in command buffer
428     //! \param    [in] cmdBuffer
429     //!           Command buffer to which HW command is added
430     //! \param    [in] params
431     //!           Params structure used to populate the HW command
432     //! \return   MOS_STATUS
433     //!           MOS_STATUS_SUCCESS if success, else fail type
434     //!
435     virtual MOS_STATUS AddVdPipelineFlushCmd(
436         PMOS_COMMAND_BUFFER              cmdBuffer,
437         PMHW_VDBOX_VD_PIPE_FLUSH_PARAMS  params) = 0;
438 
439     //!
440     //! \brief    Adds VDENC Pipe Mode Select command in command buffer
441     //! \details  Client facing function to add VDENC Pipe Mode Select command in command buffer
442     //! \param    [in] cmdBuffer
443     //!           Command buffer to which HW command is added
444     //! \param    [in] params
445     //!           Params structure used to populate the HW command
446     //! \return   MOS_STATUS
447     //!           MOS_STATUS_SUCCESS if success, else fail type
448     //!
449     virtual MOS_STATUS AddVdencPipeModeSelectCmd(
450         PMOS_COMMAND_BUFFER                  cmdBuffer,
451         PMHW_VDBOX_PIPE_MODE_SELECT_PARAMS   params) = 0;
452 
453     //!
454     //! \brief    Adds VDENC Pipe Buffer Address State command in command buffer
455     //! \details  Client facing function to add VDENC Pipe Buffer Address State command in command buffer
456     //! \param    [in] cmdBuffer
457     //!           Command buffer to which HW command is added
458     //! \param    [in] params
459     //!           Params structure used to populate the HW command
460     //! \return   MOS_STATUS
461     //!           MOS_STATUS_SUCCESS if success, else fail type
462     //!
463     virtual MOS_STATUS AddVdencPipeBufAddrCmd(
464         PMOS_COMMAND_BUFFER              cmdBuffer,
465         PMHW_VDBOX_PIPE_BUF_ADDR_PARAMS  params) = 0;
466 
467     //!
468     //! \brief    Adds VDENC Src Surface State command in command buffer
469     //! \details  Client facing function to add VDENC Src Surface State command in command buffer
470     //! \param    [in] cmdBuffer
471     //!           Command buffer to which HW command is added
472     //! \param    [in] params
473     //!           Params structure used to populate the HW command
474     //! \return   MOS_STATUS
475     //!           MOS_STATUS_SUCCESS if success, else fail type
476     //!
477     virtual MOS_STATUS AddVdencSrcSurfaceStateCmd(
478         PMOS_COMMAND_BUFFER                  cmdBuffer,
479         PMHW_VDBOX_SURFACE_PARAMS            params) = 0;
480 
481     //!
482     //! \brief    Adds VDENC Ref Surface State command in command buffer
483     //! \details  Client facing function to add VDENC Ref Surface State command in command buffer
484     //! \param    [in] cmdBuffer
485     //!           Command buffer to which HW command is added
486     //! \param    [in] params
487     //!           Params structure used to populate the HW command
488     //! \return   MOS_STATUS
489     //!           MOS_STATUS_SUCCESS if success, else fail type
490     //!
491     virtual MOS_STATUS AddVdencRefSurfaceStateCmd(
492         PMOS_COMMAND_BUFFER                  cmdBuffer,
493         PMHW_VDBOX_SURFACE_PARAMS            params) = 0;
494 
495     //!
496     //! \brief    Adds VDENC Dst Surface State command in command buffer
497     //! \details  Client facing function to add VDENC Dst Surface State command in command buffer
498     //! \param    [in] cmdBuffer
499     //!           Command buffer to which HW command is added
500     //! \param    [in] params
501     //!           Params structure used to populate the HW command
502     //! \param    [in] numSurfaces
503     //!           Number of surfaces
504     //! \return   MOS_STATUS
505     //!           MOS_STATUS_SUCCESS if success, else fail type
506     //!
507     virtual MOS_STATUS AddVdencDsRefSurfaceStateCmd(
508         PMOS_COMMAND_BUFFER                  cmdBuffer,
509         PMHW_VDBOX_SURFACE_PARAMS            params,
510         uint8_t                              numSurfaces) = 0;
511 
AddVdencAvcCostStateCmd(PMOS_COMMAND_BUFFER cmdBuffer,PMHW_BATCH_BUFFER batchBuffer,PMHW_VDBOX_AVC_IMG_PARAMS params)512     virtual MOS_STATUS AddVdencAvcCostStateCmd(
513         PMOS_COMMAND_BUFFER       cmdBuffer,
514         PMHW_BATCH_BUFFER         batchBuffer,
515         PMHW_VDBOX_AVC_IMG_PARAMS params)
516     {
517         return MOS_STATUS_SUCCESS;
518     }
519 
520     //!
521     //! \brief    Adds VDENC AVC Image State command in command buffer
522     //! \details  Client facing function to add VDENC AVC Image State command in command buffer
523     //! \param    [in] cmdBuffer
524     //!           Command buffer to which HW command is added
525     //! \param    [in] batchBuffer
526     //!           Batch buffer to add to VDBOX_BUFFER_START
527     //! \param    [in] params
528     //!           Params structure used to populate the HW command
529     //! \return   MOS_STATUS
530     //!           MOS_STATUS_SUCCESS if success, else fail type
531     //!
532     virtual MOS_STATUS AddVdencImgStateCmd(
533         PMOS_COMMAND_BUFFER              cmdBuffer,
534         PMHW_BATCH_BUFFER                batchBuffer,
535         PMHW_VDBOX_AVC_IMG_PARAMS        params) = 0;
536 
537     //!
538     //! \brief    Adds VDENC Walker State command in command buffer
539     //! \details  Client facing function to add VDENC Walker State command in command buffer
540     //! \param    [in] cmdBuffer
541     //!           Command buffer to which HW command is added
542     //! \param    [in] params
543     //!           Params structure used to populate the HW command
544     //! \return   MOS_STATUS
545     //!           MOS_STATUS_SUCCESS if success, else fail type
546     //!
547     virtual MOS_STATUS AddVdencWalkerStateCmd(
548         PMOS_COMMAND_BUFFER                  cmdBuffer,
549         PMHW_VDBOX_VDENC_WALKER_STATE_PARAMS params) = 0;
550 
551     //!
552     //! \brief    Adds VDENC Const QPT State command in command buffer
553     //! \details  Client facing function to add VDENC Const QPT State command in command buffer
554     //! \param    [in] cmdBuffer
555     //!           Command buffer to which HW command is added
556     //! \param    [in] params
557     //!           Params structure used to populate the HW command
558     //! \return   MOS_STATUS
559     //!           MOS_STATUS_SUCCESS if success, else fail type
560     //!
561     virtual MOS_STATUS AddVdencConstQPStateCmd(
562         PMOS_COMMAND_BUFFER                cmdBuffer,
563         PMHW_VDBOX_VDENC_CQPT_STATE_PARAMS params) = 0;
564 
565     //!
566     //! \brief    Adds VDENC WeightsOffsets State command in command buffer
567     //! \details  Client facing function to add VDENC WeightsOffsets State command in command buffer
568     //! \param    [in] cmdBuffer
569     //!           Command buffer to which HW command is added
570     //! \param    [in] params
571     //!           Params structure used to populate the HW command
572     //! \return   MOS_STATUS
573     //!           MOS_STATUS_SUCCESS if success, else fail type
574     //!
575 
576     virtual MOS_STATUS AddVdencAvcWeightsOffsetsStateCmd(
577         PMOS_COMMAND_BUFFER                 cmdBuffer,
578         PMHW_VDBOX_AVC_WEIGHTOFFSET_PARAMS  params) = 0;
579 
580     //!
581     //! \brief    Adds VDENC Costs State command in command buffer
582     //! \details  Client facing function to add VDENC Costs State command in command buffer
583     //! \param    [in] cmdBuffer
584     //!           Command buffer to which HW command is added
585     //! \param    [in] batchBuffer
586     //!           Batch buffer to add to VDBOX_BUFFER_START
587     //! \param    [in] params
588     //!           Params structure used to populate the HW command
589     //! \return   MOS_STATUS
590     //!           MOS_STATUS_SUCCESS if success, else fail type
591     //!
592     virtual MOS_STATUS AddVdencWeightsOffsetsStateCmd(
593         PMOS_COMMAND_BUFFER                     cmdBuffer,
594         PMHW_BATCH_BUFFER                       batchBuffer,
595         PMHW_VDBOX_VDENC_WEIGHT_OFFSET_PARAMS   params) = 0;
596 
AddVdencSliceStateCmd(PMOS_COMMAND_BUFFER cmdBuffer,PMHW_VDBOX_AVC_SLICE_STATE params)597     virtual MOS_STATUS AddVdencSliceStateCmd(
598         PMOS_COMMAND_BUFFER        cmdBuffer,
599         PMHW_VDBOX_AVC_SLICE_STATE params)
600     {
601         return MOS_STATUS_SUCCESS;
602     }
603 
AddVdencControlStateCmd(PMOS_COMMAND_BUFFER cmdBuffer)604     virtual MOS_STATUS AddVdencControlStateCmd(
605         PMOS_COMMAND_BUFFER cmdBuffer)
606     {
607         return MOS_STATUS_SUCCESS;
608     }
609 
610     //!
611     //! \brief    Adds CMD1 command in command buffer
612     //! \details  Client facing function to add CMD1 command in command buffer
613     //! \param    [in] cmdBuffer
614     //!           Command buffer to which HW command is added
615     //! \param    [in] batchBuffer
616     //!           Batch buffer to add to VDBOX_BUFFER_START
617     //! \param    [in] params
618     //!           Params structure used to populate the HW command
619     //! \return   MOS_STATUS
620     //!           MOS_STATUS_SUCCESS if success, else fail type
621     //!
622     virtual MOS_STATUS AddVdencCmd1Cmd(
623         PMOS_COMMAND_BUFFER                 cmdBuffer,
624         PMHW_BATCH_BUFFER                   batchBuffer,
625         PMHW_VDBOX_VDENC_CMD1_PARAMS        params) = 0;
626 
627     //!
628     //! \brief    Adds CMD2 command in command buffer
629     //! \details  Client facing function to add CMD2 command in command buffer
630     //! \param    [in] cmdBuffer
631     //!           Command buffer to which HW command is added
632     //! \param    [in] batchBuffer
633     //!           Batch buffer to add to VDBOX_BUFFER_START
634     //! \param    [in] params
635     //!           Params structure used to populate the HW command
636     //! \return   MOS_STATUS
637     //!           MOS_STATUS_SUCCESS if success, else fail type
638     //!
639     virtual MOS_STATUS AddVdencCmd2Cmd(
640         PMOS_COMMAND_BUFFER                 cmdBuffer,
641         PMHW_BATCH_BUFFER                   batchBuffer,
642         PMHW_VDBOX_VDENC_CMD2_STATE         params) = 0;
643 
644     //!
645     //! \brief    Adds CMD3 command in command buffer
646     //! \details  Client facing function to add CMD3 command in command buffer
647     //! \param    [in] cmdBuffer
648     //!           Command buffer to which HW command is added
649     //! \param    [in] batchBuffer
650     //!           Batch buffer to add to VDBOX_BUFFER_START
651     //! \param    [in] params
652     //!           Params structure used to populate the HW command
653     //! \return   MOS_STATUS
654     //!           MOS_STATUS_SUCCESS if success, else fail type
655     //!
AddVdencCmd3Cmd(PMOS_COMMAND_BUFFER cmdBuffer,PMHW_BATCH_BUFFER batchBuffer,PMHW_VDBOX_AVC_IMG_PARAMS params)656     virtual MOS_STATUS AddVdencCmd3Cmd(
657         PMOS_COMMAND_BUFFER       cmdBuffer,
658         PMHW_BATCH_BUFFER         batchBuffer,
659         PMHW_VDBOX_AVC_IMG_PARAMS params)
660     {
661         return MOS_STATUS_SUCCESS;
662     }
663 
664     virtual PMHW_VDBOX_PIPE_MODE_SELECT_PARAMS CreateMhwVdboxPipeModeSelectParams() = 0;
665     virtual void ReleaseMhwVdboxPipeModeSelectParams(PMHW_VDBOX_PIPE_MODE_SELECT_PARAMS pipeModeSelectParams) = 0;
666 };
667 
668 #endif
669