1 /*
2 * Copyright (c) 2017-2021, 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 
135     // VP9
136     PCODEC_VP9_ENCODE_PIC_PARAMS            pVp9EncPicParams = nullptr;
137     bool                                    bSegmentationEnabled = false;
138     PMHW_VDBOX_VP9_SEGMENT_STATE            pVp9SegmentState = nullptr;
139     PCODEC_VP9_ENCODE_SEQUENCE_PARAMS       pVp9EncSeqParams = nullptr;
140     bool                                    bPrevFrameSegEnabled = false;
141     bool                                    bDynamicScalingEnabled = false;
142     bool                                    temporalMVpEnable = false;
143 
144     // Common
145     uint8_t                                 ucNumRefIdxL0ActiveMinus1 = 0;
146     uint8_t                                 ucNumRefIdxL1ActiveMinus1 = 0;
147     uint16_t                                usSADQPLambda = 0;
148     uint16_t                                usRDQPLambda = 0;
149     bool                                    bPakOnlyMultipassEnable = false;
150     void                                    *pInputParams = nullptr;
151     bool                                    bHevcVisualQualityImprovement = false;  //!< VQI enable flag
152 
153     bool                                    bTileReplayEnable = false;
154     bool                                    bCaptureModeEnable = false;
155     uint8_t                                 m_WirelessSessionID = 0;
156     bool                                    bIsLowDelayB = false;
157     int8_t                                  *pRefIdxMapping = nullptr;
158     uint8_t                                 recNotFilteredID = 0;
~MHW_VDBOX_VDENC_CMD2_STATEMHW_VDBOX_VDENC_CMD2_STATE159     virtual ~MHW_VDBOX_VDENC_CMD2_STATE() {}
160 };
161 using PMHW_VDBOX_VDENC_CMD2_STATE = std::shared_ptr<MHW_VDBOX_VDENC_CMD2_STATE>;
162 
163 struct MHW_VDBOX_VDENC_WALKER_STATE_PARAMS
164 {
165     uint32_t                                Mode = 0;
166     uint32_t                                slcIdx = 0;
167     PCODEC_AVC_ENCODE_SEQUENCE_PARAMS       pAvcSeqParams = nullptr;
168     PCODEC_AVC_ENCODE_PIC_PARAMS            pAvcPicParams = nullptr;
169     PCODEC_AVC_ENCODE_SLICE_PARAMS          pAvcSlcParams = nullptr;
170     PCODEC_HEVC_ENCODE_SEQUENCE_PARAMS      pHevcEncSeqParams = nullptr;
171     PCODEC_HEVC_ENCODE_PICTURE_PARAMS       pHevcEncPicParams = nullptr;
172     PCODEC_HEVC_ENCODE_SLICE_PARAMS         pEncodeHevcSliceParams = nullptr;
173     PCODEC_VP9_ENCODE_PIC_PARAMS            pVp9EncPicParams = nullptr;
~MHW_VDBOX_VDENC_WALKER_STATE_PARAMSMHW_VDBOX_VDENC_WALKER_STATE_PARAMS174     virtual ~MHW_VDBOX_VDENC_WALKER_STATE_PARAMS() {}
175 };
176 using PMHW_VDBOX_VDENC_WALKER_STATE_PARAMS = MHW_VDBOX_VDENC_WALKER_STATE_PARAMS * ;
177 
178 //!  MHW Vdbox Vdenc interface
179 /*!
180 This class defines the interfaces for constructing Vdbox Vdenc commands across all platforms
181 */
182 class MhwVdboxVdencInterface
183 {
184 protected:
185 
186     PMOS_INTERFACE              m_osInterface = nullptr; //!< Pointer to OS interface
187 
188     MHW_MEMORY_OBJECT_CONTROL_PARAMS m_cacheabilitySettings[MOS_CODEC_RESOURCE_USAGE_END_CODEC] = {}; //!< Cacheability settings
189 
190     bool                        m_rowstoreCachingSupported = 0;
191     MHW_VDBOX_ROWSTORE_CACHE    m_vdencRowStoreCache = {};    //!< vdenc row store cache
192     MHW_VDBOX_ROWSTORE_CACHE    m_vdencIpdlRowstoreCache = {}; //!< vdenc IntraPred row store cache
193     bool                        m_rhoDomainStatsEnabled = false; //! indicate if rho domain stats is enabled
194     bool                        m_perfModeSupported = true; //! indicate perf mode is supported
195 
196     std::shared_ptr<mhw::vdbox::vdenc::Itf> m_vdencItfNew = nullptr;
197 
198     static const bool m_vdencFTQEnabled[NUM_VDENC_TARGET_USAGE_MODES];
199     static const bool m_vdencBlockBasedSkipEnabled[NUM_VDENC_TARGET_USAGE_MODES];
200 
201     //!
202     //! \brief    Constructor
203     //!
204     MhwVdboxVdencInterface(PMOS_INTERFACE osInterface);
205 
206     //!
207     //! \brief    Add a resource to the command buffer
208     //! \details  Internal function to add either a graphics address of a resource or
209     //!           add the resource to the patch list for the requested buffer
210     //!
211     //! \param    [in] osInterface
212     //!           OS interface
213     //! \param    [in] cmdBuffer
214     //!           Command buffer to which resource is added
215     //! \param    [in] params
216     //!           Parameters necessary to add the resource
217     //!
218     //! \return   MOS_STATUS
219     //!           MOS_STATUS_SUCCESS if success, else fail type
220     //!
221     MOS_STATUS(*AddResourceToCmd) (
222         PMOS_INTERFACE osInterface,
223         PMOS_COMMAND_BUFFER cmdBuffer,
224         PMHW_RESOURCE_PARAMS params);
225 
226     virtual MOS_STATUS InitRowstoreUserFeatureSettings() = 0;
227 
228     //!
229     //! \brief    Translate MOS type format to Mediastate surface format
230     //! \details  VDBOX protected function to translate mos format to media state format
231     //! \param    [in] format
232     //!           MOS type format
233     //! \return   uint32_t
234     //!           media state surface format
235     //!
236     uint32_t MosToMediaStateFormat(MOS_FORMAT format);
237 
238 public:
239 
240     //!
241     //! \brief    Destructor
242     //!
~MhwVdboxVdencInterface()243     virtual ~MhwVdboxVdencInterface() {}
244 
245     //!
246     //! \brief    Get new VDENC interface, temporal solution before switching from
247     //!           old interface to new one
248     //!
249     //! \return   pointer to new VDENC interface
250     //!
GetNewVdencInterface()251     virtual std::shared_ptr<mhw::vdbox::vdenc::Itf> GetNewVdencInterface() { return nullptr; }
252 
253     //!
254     //! \brief    Judge if row store caching supported
255     //!
256     //! \return   bool
257     //!           true if supported, else false
258     //!
IsRowStoreCachingSupported()259     inline bool IsRowStoreCachingSupported()
260     {
261         return m_rowstoreCachingSupported;
262     }
263 
264     //!
265     //! \brief    Judge if vdenc row store caching enabled
266     //!
267     //! \return   bool
268     //!           true if enabled, else false
269     //!
IsvdencRowstoreCacheEnabled()270     inline bool IsvdencRowstoreCacheEnabled()
271     {
272         return m_vdencRowStoreCache.bEnabled ? true : false;
273     }
274 
275     //!
276     //! \brief    Judge if rho domain stats is enabled
277     //!
278     //! \return   bool
279     //!           true if enabled, else false
280     //!
IsRhoDomainStatsEnabled()281     inline bool IsRhoDomainStatsEnabled()
282     {
283         return m_rhoDomainStatsEnabled;
284     }
285 
286     //!
287     //! \brief    Judge if perf mode is supported
288     //!
289     //! \return   bool
290     //!           true if enabled, else false
291     //!
IsPerfModeSupported()292     inline bool IsPerfModeSupported()
293     {
294         return m_perfModeSupported;
295     }
296 
297     //!
298     //! \brief    get vdenc FTQ supported
299     //!
300     //! \param    [in] idx
301     //!           index of the array
302     //! \return   bool
303     //!           true if enabled, else false
304     //!
VdencFTQEnabled(uint32_t idx)305     inline bool VdencFTQEnabled(uint32_t idx)
306     {
307         return m_vdencFTQEnabled[idx];
308     }
309 
310     //!
311     //! \brief    get Vdenc img state size
312     //!
313     //! \return   uint32_t
314     //!           Vdenc img state size got
315     //!
316     virtual uint32_t GetVdencAvcImgStateSize() = 0;
317 
318     //!
319     //! \brief    get Vdenc slc state size
320     //!
321     //! \return   uint32_t
322     //!           Vdenc slc state size got
323     //!
324     virtual uint32_t GetVdencAvcSlcStateSize() = 0;
325 
326     //!
327     //! \brief    get Vdenc cost state size
328     //!
329     //! \return   uint32_t
330     //!           Vdenc cost state size got
331     //!
332     virtual uint32_t GetVdencAvcCostStateSize() = 0;
333 
334     //!
335     //! \brief    get cmd1
336     //!
337     //! \return   uint32_t
338     //!           cmd1 size got
339     //!
340     virtual uint32_t GetVdencCmd1Size() = 0;
341 
342     //!
343     //! \brief    get cmd2
344     //!
345     //! \return   uint32_t
346     //!           cmd2 size got
347     //!
348     virtual uint32_t GetVdencCmd2Size() = 0;
349 
350     //!
351     //! \brief    get Vdenc state commands data size
352     //!
353     //! \return   uint32_t
354     //!           Vdenc state commands data size got
355     //!
356     virtual MOS_STATUS GetVdencStateCommandsDataSize(
357         uint32_t                        mode,
358         uint32_t                        waAddDelayInVDEncDynamicSlice,
359         uint32_t                        *commandsSize,
360         uint32_t                        *patchListSize) = 0;
361 
362     //!
363     //! \brief    get Vdenc slice commands data size
364     //!
365     //! \return   uint32_t
366     //!           Vdenc slice commands data size got
367     //!
368     virtual MOS_STATUS GetVdencPrimitiveCommandsDataSize(
369         uint32_t                        mode,
370         uint32_t                        *commandsSize,
371         uint32_t                        *patchListSize) = 0;
372 
373     //!
374     //! \brief    Set cacheability settings
375     //!
376     //! \param    [in] cacheabilitySettings
377     //!           Cacheability settings
378     //!
379     //! \return   MOS_STATUS
380     //!           MOS_STATUS_SUCCESS if success, else fail type
381     //!
SetCacheabilitySettings(MHW_MEMORY_OBJECT_CONTROL_PARAMS cacheabilitySettings[MOS_CODEC_RESOURCE_USAGE_END_CODEC])382     MOS_STATUS SetCacheabilitySettings(
383         MHW_MEMORY_OBJECT_CONTROL_PARAMS cacheabilitySettings[MOS_CODEC_RESOURCE_USAGE_END_CODEC])
384     {
385         MHW_FUNCTION_ENTER;
386 
387         uint32_t size = MOS_CODEC_RESOURCE_USAGE_END_CODEC * sizeof(MHW_MEMORY_OBJECT_CONTROL_PARAMS);
388         return MOS_SecureMemcpy(m_cacheabilitySettings, size, cacheabilitySettings, size);
389     }
390 
391     //!
392     //! \brief    Programs base address of rowstore scratch buffers
393     //! \details  Internal function to get base address of rowstore scratch buffers
394     //!
395     //! \param    [in] rowstoreParams
396     //!           Rowstore parameters
397     //!
398     //! \return   MOS_STATUS
399     //!           MOS_STATUS_SUCCESS if success, else fail type
400     //!
401     virtual MOS_STATUS GetRowstoreCachingAddrs(
402         PMHW_VDBOX_ROWSTORE_PARAMS rowstoreParams) = 0;
403 
404     //!
405     //! \brief    Adds VD Pipeline Flush command in command buffer
406     //! \details  Client facing function to add VD Pipeline Flush command in command buffer
407     //! \param    [in] cmdBuffer
408     //!           Command buffer to which HW command is added
409     //! \param    [in] params
410     //!           Params structure used to populate the HW command
411     //! \return   MOS_STATUS
412     //!           MOS_STATUS_SUCCESS if success, else fail type
413     //!
414     virtual MOS_STATUS AddVdPipelineFlushCmd(
415         PMOS_COMMAND_BUFFER              cmdBuffer,
416         PMHW_VDBOX_VD_PIPE_FLUSH_PARAMS  params) = 0;
417 
418     //!
419     //! \brief    Adds VDENC Pipe Mode Select command in command buffer
420     //! \details  Client facing function to add VDENC Pipe Mode Select command in command buffer
421     //! \param    [in] cmdBuffer
422     //!           Command buffer to which HW command is added
423     //! \param    [in] params
424     //!           Params structure used to populate the HW command
425     //! \return   MOS_STATUS
426     //!           MOS_STATUS_SUCCESS if success, else fail type
427     //!
428     virtual MOS_STATUS AddVdencPipeModeSelectCmd(
429         PMOS_COMMAND_BUFFER                  cmdBuffer,
430         PMHW_VDBOX_PIPE_MODE_SELECT_PARAMS   params) = 0;
431 
432     //!
433     //! \brief    Adds VDENC Pipe Buffer Address State command in command buffer
434     //! \details  Client facing function to add VDENC Pipe Buffer Address State command in command buffer
435     //! \param    [in] cmdBuffer
436     //!           Command buffer to which HW command is added
437     //! \param    [in] params
438     //!           Params structure used to populate the HW command
439     //! \return   MOS_STATUS
440     //!           MOS_STATUS_SUCCESS if success, else fail type
441     //!
442     virtual MOS_STATUS AddVdencPipeBufAddrCmd(
443         PMOS_COMMAND_BUFFER              cmdBuffer,
444         PMHW_VDBOX_PIPE_BUF_ADDR_PARAMS  params) = 0;
445 
446     //!
447     //! \brief    Adds VDENC Src Surface State command in command buffer
448     //! \details  Client facing function to add VDENC Src Surface State command in command buffer
449     //! \param    [in] cmdBuffer
450     //!           Command buffer to which HW command is added
451     //! \param    [in] params
452     //!           Params structure used to populate the HW command
453     //! \return   MOS_STATUS
454     //!           MOS_STATUS_SUCCESS if success, else fail type
455     //!
456     virtual MOS_STATUS AddVdencSrcSurfaceStateCmd(
457         PMOS_COMMAND_BUFFER                  cmdBuffer,
458         PMHW_VDBOX_SURFACE_PARAMS            params) = 0;
459 
460     //!
461     //! \brief    Adds VDENC Ref Surface State command in command buffer
462     //! \details  Client facing function to add VDENC Ref Surface State command in command buffer
463     //! \param    [in] cmdBuffer
464     //!           Command buffer to which HW command is added
465     //! \param    [in] params
466     //!           Params structure used to populate the HW command
467     //! \return   MOS_STATUS
468     //!           MOS_STATUS_SUCCESS if success, else fail type
469     //!
470     virtual MOS_STATUS AddVdencRefSurfaceStateCmd(
471         PMOS_COMMAND_BUFFER                  cmdBuffer,
472         PMHW_VDBOX_SURFACE_PARAMS            params) = 0;
473 
474     //!
475     //! \brief    Adds VDENC Dst Surface State command in command buffer
476     //! \details  Client facing function to add VDENC Dst Surface State command in command buffer
477     //! \param    [in] cmdBuffer
478     //!           Command buffer to which HW command is added
479     //! \param    [in] params
480     //!           Params structure used to populate the HW command
481     //! \param    [in] numSurfaces
482     //!           Number of surfaces
483     //! \return   MOS_STATUS
484     //!           MOS_STATUS_SUCCESS if success, else fail type
485     //!
486     virtual MOS_STATUS AddVdencDsRefSurfaceStateCmd(
487         PMOS_COMMAND_BUFFER                  cmdBuffer,
488         PMHW_VDBOX_SURFACE_PARAMS            params,
489         uint8_t                              numSurfaces) = 0;
490 
AddVdencAvcCostStateCmd(PMOS_COMMAND_BUFFER cmdBuffer,PMHW_BATCH_BUFFER batchBuffer,PMHW_VDBOX_AVC_IMG_PARAMS params)491     virtual MOS_STATUS AddVdencAvcCostStateCmd(
492         PMOS_COMMAND_BUFFER       cmdBuffer,
493         PMHW_BATCH_BUFFER         batchBuffer,
494         PMHW_VDBOX_AVC_IMG_PARAMS params)
495     {
496         return MOS_STATUS_SUCCESS;
497     }
498 
499     //!
500     //! \brief    Adds VDENC AVC Image State command in command buffer
501     //! \details  Client facing function to add VDENC AVC Image State command in command buffer
502     //! \param    [in] cmdBuffer
503     //!           Command buffer to which HW command is added
504     //! \param    [in] batchBuffer
505     //!           Batch buffer to add to VDBOX_BUFFER_START
506     //! \param    [in] params
507     //!           Params structure used to populate the HW command
508     //! \return   MOS_STATUS
509     //!           MOS_STATUS_SUCCESS if success, else fail type
510     //!
511     virtual MOS_STATUS AddVdencImgStateCmd(
512         PMOS_COMMAND_BUFFER              cmdBuffer,
513         PMHW_BATCH_BUFFER                batchBuffer,
514         PMHW_VDBOX_AVC_IMG_PARAMS        params) = 0;
515 
516     //!
517     //! \brief    Adds VDENC Walker State command in command buffer
518     //! \details  Client facing function to add VDENC Walker State command in command buffer
519     //! \param    [in] cmdBuffer
520     //!           Command buffer to which HW command is added
521     //! \param    [in] params
522     //!           Params structure used to populate the HW command
523     //! \return   MOS_STATUS
524     //!           MOS_STATUS_SUCCESS if success, else fail type
525     //!
526     virtual MOS_STATUS AddVdencWalkerStateCmd(
527         PMOS_COMMAND_BUFFER                  cmdBuffer,
528         PMHW_VDBOX_VDENC_WALKER_STATE_PARAMS params) = 0;
529 
530     //!
531     //! \brief    Adds VDENC Const QPT State command in command buffer
532     //! \details  Client facing function to add VDENC Const QPT State command in command buffer
533     //! \param    [in] cmdBuffer
534     //!           Command buffer to which HW command is added
535     //! \param    [in] params
536     //!           Params structure used to populate the HW command
537     //! \return   MOS_STATUS
538     //!           MOS_STATUS_SUCCESS if success, else fail type
539     //!
540     virtual MOS_STATUS AddVdencConstQPStateCmd(
541         PMOS_COMMAND_BUFFER                cmdBuffer,
542         PMHW_VDBOX_VDENC_CQPT_STATE_PARAMS params) = 0;
543 
544     //!
545     //! \brief    Adds VDENC WeightsOffsets State command in command buffer
546     //! \details  Client facing function to add VDENC WeightsOffsets State command in command buffer
547     //! \param    [in] cmdBuffer
548     //!           Command buffer to which HW command is added
549     //! \param    [in] params
550     //!           Params structure used to populate the HW command
551     //! \return   MOS_STATUS
552     //!           MOS_STATUS_SUCCESS if success, else fail type
553     //!
554 
555     virtual MOS_STATUS AddVdencAvcWeightsOffsetsStateCmd(
556         PMOS_COMMAND_BUFFER                 cmdBuffer,
557         PMHW_VDBOX_AVC_WEIGHTOFFSET_PARAMS  params) = 0;
558 
559     //!
560     //! \brief    Adds VDENC Costs State command in command buffer
561     //! \details  Client facing function to add VDENC Costs State command in command buffer
562     //! \param    [in] cmdBuffer
563     //!           Command buffer to which HW command is added
564     //! \param    [in] batchBuffer
565     //!           Batch buffer to add to VDBOX_BUFFER_START
566     //! \param    [in] params
567     //!           Params structure used to populate the HW command
568     //! \return   MOS_STATUS
569     //!           MOS_STATUS_SUCCESS if success, else fail type
570     //!
571     virtual MOS_STATUS AddVdencWeightsOffsetsStateCmd(
572         PMOS_COMMAND_BUFFER                     cmdBuffer,
573         PMHW_BATCH_BUFFER                       batchBuffer,
574         PMHW_VDBOX_VDENC_WEIGHT_OFFSET_PARAMS   params) = 0;
575 
AddVdencSliceStateCmd(PMOS_COMMAND_BUFFER cmdBuffer,PMHW_VDBOX_AVC_SLICE_STATE params)576     virtual MOS_STATUS AddVdencSliceStateCmd(
577         PMOS_COMMAND_BUFFER        cmdBuffer,
578         PMHW_VDBOX_AVC_SLICE_STATE params)
579     {
580         return MOS_STATUS_SUCCESS;
581     }
582 
AddVdencControlStateCmd(PMOS_COMMAND_BUFFER cmdBuffer)583     virtual MOS_STATUS AddVdencControlStateCmd(
584         PMOS_COMMAND_BUFFER cmdBuffer)
585     {
586         return MOS_STATUS_SUCCESS;
587     }
588 
589     //!
590     //! \brief    Adds CMD1 command in command buffer
591     //! \details  Client facing function to add CMD1 command in command buffer
592     //! \param    [in] cmdBuffer
593     //!           Command buffer to which HW command is added
594     //! \param    [in] batchBuffer
595     //!           Batch buffer to add to VDBOX_BUFFER_START
596     //! \param    [in] params
597     //!           Params structure used to populate the HW command
598     //! \return   MOS_STATUS
599     //!           MOS_STATUS_SUCCESS if success, else fail type
600     //!
601     virtual MOS_STATUS AddVdencCmd1Cmd(
602         PMOS_COMMAND_BUFFER                 cmdBuffer,
603         PMHW_BATCH_BUFFER                   batchBuffer,
604         PMHW_VDBOX_VDENC_CMD1_PARAMS        params) = 0;
605 
606     //!
607     //! \brief    Adds CMD2 command in command buffer
608     //! \details  Client facing function to add VDENC HEVC VP9 IMG State command in command buffer
609     //! \param    [in] cmdBuffer
610     //!           Command buffer to which HW command is added
611     //! \param    [in] batchBuffer
612     //!           Batch buffer to add to VDBOX_BUFFER_START
613     //! \param    [in] params
614     //!           Params structure used to populate the HW command
615     //! \return   MOS_STATUS
616     //!           MOS_STATUS_SUCCESS if success, else fail type
617     //!
618     virtual MOS_STATUS AddVdencCmd2Cmd(
619         PMOS_COMMAND_BUFFER                 cmdBuffer,
620         PMHW_BATCH_BUFFER                   batchBuffer,
621         PMHW_VDBOX_VDENC_CMD2_STATE         params) = 0;
622 
623     virtual PMHW_VDBOX_PIPE_MODE_SELECT_PARAMS CreateMhwVdboxPipeModeSelectParams() = 0;
624     virtual void ReleaseMhwVdboxPipeModeSelectParams(PMHW_VDBOX_PIPE_MODE_SELECT_PARAMS pipeModeSelectParams) = 0;
625 };
626 
627 #endif
628