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     media_libva_caps.h
24 //! \brief    This file defines the base C++ class/interface for media capbilities.
25 //!
26 
27 #ifndef __MEDIA_LIBVA_CAPS_H__
28 #define __MEDIA_LIBVA_CAPS_H__
29 
30 #include "va/va.h"
31 
32 #include <vector>
33 #include <map>
34 
35 #ifndef CONTEXT_PRIORITY_MAX
36 #define CONTEXT_PRIORITY_MAX 1024
37 #endif
38 
39 struct DDI_MEDIA_CONTEXT;
40 class MediaLibvaCapsCpInterface;
41 
42 typedef std::map<VAConfigAttribType, uint32_t> AttribMap;
43 
44 //!
45 //! \class  MediaLibvaCaps
46 //! \brief  Media libva caps
47 //!
48 class MediaLibvaCaps
49 {
50 protected:
51     MediaLibvaCaps(DDI_MEDIA_CONTEXT *mediaCtx);
52 public:
53 
54     //!
55     //! \brief    Destructor
56     //!
57     virtual ~MediaLibvaCaps();
58 
59     //!
60     //! \brief    Get attributes for a given profile/entrypoint pair
61     //! \details  The caller must provide an "attribList" with all attributes to be
62     //!           retrieved.  Upon return, the attributes in "attribList" have been
63     //!           updated with their value.  Unknown attributes or attributes that are
64     //!           not supported for the given profile/entrypoint pair will have their
65     //!           value set to VA_ATTRIB_NOT_SUPPORTED.
66     //!
67     //! \param    [in] profile
68     //!           VA profile
69     //!
70     //! \param    [in] entrypoint
71     //!           VA entrypoint
72     //!
73     //! \param    [in,out] attribList
74     //!           Pointer to VAConfigAttrib array. The attribute type is set by caller and
75     //!           attribute value is set by this function.
76     //!
77     //! \param    [in] numAttribs
78     //!           Number of VAConfigAttrib in the array attribList
79     //!
80     //! \return   VAStatus
81     //!           VA_STATUS_SUCCESS if success
82     //!
83     VAStatus GetConfigAttributes(
84             VAProfile profile,
85             VAEntrypoint entrypoint,
86             VAConfigAttrib *attribList,
87             int32_t numAttribs);
88 
89     //!
90     //! \brief    Check a profile valid or not
91     //!
92     //! \param    [in] profile
93     //!           VA profile
94     //!
95     //! \return   VAStatus
96     //!           VA_STATUS_SUCCESS if success
97     //!
98     VAStatus CheckProfile(VAProfile profile);
99     //!
100     //!
101     //! \brief    Create a configuration for the encode/decode/vp pipeline
102     //! \details  It passes in the attribute list that specifies the attributes it
103     //!           cares about, with the rest taking default values.
104     //!
105     //! \param    [in] profile
106     //!           VA profile
107     //!
108     //! \param    [in] entrypoint
109     //!           VA entrypoint
110     //!
111     //! \param    [in] attribList
112     //!           Pointer to VAConfigAttrib array that specifies the attributes
113     //!
114     //! \param    [in] numAttribs
115     //!           Number of VAConfigAttrib in the array attribList
116     //!
117     //! \param    [out] configId
118     //!           Pointer to returned VAConfigID if success
119     //!
120     //! \return   VAStatus
121     //!           VA_STATUS_SUCCESS if success
122     //!
123     VAStatus CreateConfig(
124             VAProfile profile,
125             VAEntrypoint entrypoint,
126             VAConfigAttrib *attribList,
127             int32_t numAttribs,
128             VAConfigID *configId);
129 
130     //!
131     //! \brief    Query supported profiles
132     //!
133     //! \param    [in] profileList
134     //!           Pointer to VAProfile array that can hold at least vaMaxNumProfile() entries
135     //!
136     //! \param    [out] numProfiles
137     //!           Pointer to int32_t. It returns the actual number of supported profiles.
138     //!
139     //! \return   VAStatus
140     //!           VA_STATUS_SUCCESS if success
141     //!
142     VAStatus QueryConfigProfiles(
143             VAProfile *profileList,
144             int32_t *numProfiles);
145 
146     //!
147     //! \brief    Query supported entrypoints for a given profile
148     //!
149     //! \param    [in] profile
150     //!           VA profile
151     //!
152     //! \param    [in] entrypointList
153     //!           Pointer to VAEntrypoint array that can hold at least vaMaxNumEntrypoints() entries
154     //!
155     //! \param    [out] numEntryPoints
156     //!           It returns the actual number of supported VAEntrypoints.
157     //!
158     //! \return   VAStatus
159     //!           VA_STATUS_SUCCESS if success
160     //!
161     VAStatus QueryConfigEntrypoints(
162             VAProfile profile,
163             VAEntrypoint *entrypointList,
164             int32_t *numEntryPoints);
165 
166     //!
167     //! \brief    Query all attributes for a given configuration
168     //!
169     //! \param    [in] configId
170     //!           VA configuration
171     //!
172     //! \param    [in,out] profile
173     //!           Pointer to VAProfile of the configuration
174     //!
175     //! \param    [in,out] entrypoint
176     //!           Pointer to VAEntrypoint of the configuration
177     //!
178     //! \param    [in,out] attribList
179     //!           Pointer to VAConfigAttrib array that can hold at least
180     //!           vaMaxNumConfigAttributes() entries.
181     //!
182     //! \param    [in,out] numAttribs
183     //!           The actual number of VAConfigAttrib returned in the array attribList
184     //!
185     //! \return   VAStatus
186     //!           VA_STATUS_SUCCESS if success
187     //!
188     VAStatus QueryConfigAttributes(
189             VAConfigID configId,
190             VAProfile *profile,
191             VAEntrypoint *entrypoint,
192             VAConfigAttrib *attribList,
193             int32_t *numAttribs);
194 
195     //!
196     //! \brief    Get attributes for a given encode config ID
197     //!
198     //! \param    [in] configId
199     //!           VA configuration
200     //!
201     //! \param    [in,out] profile
202     //!           Pointer to VAProfile of the configuration
203     //!
204     //! \param    [in,out] entrypoint
205     //!           Pointer to VAEntrypoint of the configuration
206     //!
207     //! \param    [in,out] rcMode
208     //!           Return the rcMode for the config ID.
209     //!
210     //! \param    [in,out] feiFunction
211     //!           Return the fei function type for the config ID.
212     //!
213     //! \return   VAStatus
214     //!           VA_STATUS_SUCCESS if success
215     //!
216     VAStatus GetEncConfigAttr(
217             VAConfigID configId,
218             VAProfile *profile,
219             VAEntrypoint *entrypoint,
220             uint32_t *rcMode,
221             uint32_t *feiFunction);
222 
223     //!
224     //! \brief    Get attributes for a given decode config ID
225     //!
226     //! \param    [in] configId
227     //!           VA configuration
228     //!
229     //! \param    [in,out] profile
230     //!           Pointer to VAProfile of the configuration
231     //!
232     //! \param    [in,out] entrypoint
233     //!           Pointer to VAEntrypoint of the configuration
234     //!
235     //! \param    [in,out] slicemode
236     //!           Return the slice mode for the config ID.
237     //!
238     //! \param    [in,out] encrypttype
239     //!           Return the encryption type for the config ID.
240     //!
241     //! \param    [in,out] processmode
242     //!           Return the process mode for the config ID.
243     //!
244     //! \return   VAStatus
245     //!           VA_STATUS_SUCCESS if success
246     //!
247     VAStatus GetDecConfigAttr(
248             VAConfigID configId,
249             VAProfile *profile,
250             VAEntrypoint *entrypoint,
251             uint32_t *slicemode,
252             uint32_t *encrypttype,
253             uint32_t *processmode);
254 
255     //!
256     //! \brief    Get attributes for a given Vp config ID
257     //!
258     //! \param    [in] configId
259     //!           VA configuration
260     //!
261     //! \param    [in,out] profile
262     //!           Pointer to VAProfile of the configuration
263     //!
264     //! \param    [in,out] entrypoint
265     //!           Pointer to VAEntrypoint of the configuration
266     //!
267     //! \return   VAStatus
268     //!           VA_STATUS_SUCCESS if success
269     //!
270     VAStatus GetVpConfigAttr(
271             VAConfigID configId,
272             VAProfile *profile,
273             VAEntrypoint *entrypoint);
274 
275     //!
276     //! \brief    Get process rate for a given config ID
277     //!
278     //! \param    [in] config_id
279     //!           VA configuration
280     //!
281     //! \param    [in,out] procBuf
282     //!           Pointer to VAProcessingRateParameter
283     //!
284     //! \param    [in,out] processingRate
285     //!           Return the process rate
286     //!
287     //! \return   VAStatus
288     //!           VA_STATUS_SUCCESS if success
289     //!
290     VAStatus QueryProcessingRate(
291             VAConfigID config_id,
292             VAProcessingRateParameter *procBuf,
293             uint32_t *processingRate);
294 
295     //!
296     //! \brief    Get surface attributes for a given config ID
297     //!
298     //! \param    [in] configId
299     //!           VA configuration
300     //!
301     //! \param    [in,out] attribList
302     //!           Pointer to VASurfaceAttrib array. It returns
303     //!           the supported  surface attributes
304     //!
305     //! \param    [in,out] numAttribs
306     //!           The number of elements allocated on input
307     //!           Return the number of elements actually filled in output
308     //!
309     //! \return   VAStatus
310     //!           VA_STATUS_SUCCESS if success
311     //!           VA_STATUS_ERROR_MAX_NUM_EXCEEDED if size of attribList is too small
312     //!
313     virtual VAStatus QuerySurfaceAttributes(
314             VAConfigID configId,
315             VASurfaceAttrib *attribList,
316             uint32_t *numAttribs);
317 
318     //!
319     //! \brief    Query display attributes
320     //!
321     //! \param    [in, out] attribList
322     //!           it returns the supported display attributes
323     //!
324     //!
325     //! \param    [in, out] numAttribs
326     //!           it returns the actual number of supported attributes
327     //!
328     //! \return   VAStatus
329     //!           VA_STATUS_SUCCESS if success
330     //!           VA_STATUS_ERROR_MAX_NUM_EXCEEDED if size of attribList is too small
331     //!
332     virtual VAStatus QueryDisplayAttributes(
333             VADisplayAttribute *attribList,
334             int32_t *numAttribs);
335 
336     //!
337     //! \brief    Get display attributes
338     //!           returns the current attributes values in "attribList"
339     //!
340     //! \param    [in, out] attribList
341     //!           the attrib type should be filled.
342     //!           returns the supported display attributes
343     //!
344     //! \param    [in] numAttribs
345     //!           the number of supported attributes
346     //!
347     //! \return   VAStatus
348     //!           VA_STATUS_SUCCESS if success
349     //!           VA_STATUS_ERROR_MAX_NUM_EXCEEDED if size of attribList is too small
350     //!
351     virtual VAStatus GetDisplayAttributes(
352             VADisplayAttribute *attribList,
353             int32_t numAttribs);
354 
355     //!
356     //! \brief    Check if the resolution is valid for a given decode codec mode
357     //!
358     //! \param    [in] codecMode
359     //!           Specify the codec mode
360     //!
361     //! \param    [in] profile
362     //!           VA profile
363     //!
364     //! \param    [in] width
365     //!           Specify the width for checking
366     //!
367     //! \param    [in] height
368     //!           Specify the height for checking
369     //!
370     //! \return   VAStatus
371     //!           VA_STATUS_SUCCESS if the resolution is supported
372     //!           VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED if the resolution isn't valid
373     //!
374     virtual VAStatus CheckDecodeResolution(
375             int32_t codecMode,
376             VAProfile profile,
377             uint32_t width,
378             uint32_t height);
379 
380     //!
381     //! \brief    Check if the resolution is valid for a encode profile
382     //!
383     //! \param    [in] profile
384     //!           Specify the VAProfile
385     //!
386     //! \param    [in] width
387     //!           Specify the width for checking
388     //!
389     //! \param    [in] height
390     //!           Specify the height for checking
391     //!
392     //! \return   VAStatus
393     //!           VA_STATUS_SUCCESS if the resolution is supported
394     //!           VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED if the resolution isn't valid
395     //!
396     virtual VAStatus CheckEncodeResolution(
397             VAProfile profile,
398             uint32_t width,
399             uint32_t height);
400 
401     //!
402     //! \brief    Check if the give profile is VC1
403     //!
404     //! \param    [in] profile
405     //!           Specify the VAProfile
406     //!
407     //! \return   True if the profile is a VC1 profile
408     //!           False if the profile isn't a VC1 profile
409     //!
410     static bool IsVc1Profile(VAProfile profile);
411 
412     //!
413     //! \brief    Check if the give profile is MPEG2
414     //!
415     //! \param    [in] profile
416     //!           Specify the VAProfile
417     //!
418     //! \return   True if the profile is a MPEG2 profile
419     //!           False if the profile isn't a MPEG2 profile
420     //!
421     static bool IsMpeg2Profile(VAProfile profile);
422 
423     //!
424     //! \brief    Check if the give profile is AVC
425     //!
426     //! \param    [in] profile
427     //!           Specify the VAProfile
428     //!
429     //! \return   True if the profile is a AVC profile
430     //!           False if the profile isn't a AVC profile
431     //!
432     static bool IsAvcProfile(VAProfile profile);
433 
434     //!
435     //! \brief    Check if the give profile is HEVC
436     //!
437     //! \param    [in] profile
438     //!           Specify the VAProfile
439     //!
440     //! \return   True if the profile is a HEVC profile
441     //!           False if the profile isn't a HEVC profile
442     //!
443     virtual bool IsHevcProfile(VAProfile profile);
444 
445     //!
446     //! \brief    Check if the give profile is VP8
447     //!
448     //! \param    [in] profile
449     //!           Specify the VAProfile
450     //!
451     //! \return   true if the profile is a VP8 profile
452     //!           false if the profile isn't a VP8 profile
453     //!
454     static bool IsVp8Profile(VAProfile profile);
455 
456     //!
457     //! \brief    Check if the give profile is VP9
458     //!
459     //! \param    [in] profile
460     //!           Specify the VAProfile
461     //!
462     //! \return   True if the profile is a VP9 profile
463     //!           False if the profile isn't a VP9 profile
464     //!
465     static bool IsVp9Profile(VAProfile profile);
466 
467     //!
468     //! \brief    Check if the give profile is JPEG
469     //!
470     //! \param    [in] profile
471     //!           Specify the VAProfile
472     //!
473     //! \return   True if the profile is a JPEG profile
474     //!           False if the profile isn't a JPEG profile
475     //!
476     static bool IsJpegProfile(VAProfile profile);
477 
478     //!
479     //! \brief    Check if current FeiFuncton or give entrypoint is FEI
480     //!
481     //! \param    [in] entrypoint
482     //!           Specify the VAEntrypoint for checking
483     //!
484     //! \param    [in] feiFunction
485     //!           Specify the VA_FEI_FUNCTION for checking
486     //!
487     //! \return   True if the entrypoint or the feiFuncton belong to FEI
488     //!           False if the entrypoint and the FeiFuncton aren't FEI
489     //!
490     bool IsEncFei(VAEntrypoint entrypoint, uint32_t feiFunction);
491 
492     //!
493     //! \brief    Return the CODECHAL_FUNCTION type for give profile and entrypoint
494     //!
495     //! \param    [in] profile
496     //!           Specify the VAProfile
497     //!
498     //! \param    [in] entrypoint
499     //!           Specify the VAEntrypoint
500     //!
501     //! \param    [in] feiFunction
502     //!           Specify the VA_FEI_FUNCTION
503     //!
504     //! \return   Codehal function
505     //!
506     CODECHAL_FUNCTION GetEncodeCodecFunction(VAProfile profile, VAEntrypoint entrypoint, uint32_t feiFunction);
507 
508     //!
509     //! \brief    Return internal encode mode for given profile and entrypoint
510     //!
511     //! \param    [in] profile
512     //!           Specify the VAProfile
513     //!
514     //! \param    [in] entrypoint
515     //!           Specify the VAEntrypoint
516     //!
517     //! \return   Codehal mode
518     //!
519     virtual CODECHAL_MODE GetEncodeCodecMode(VAProfile profile, VAEntrypoint entrypoint);
520 
521     //!
522     //! \brief    Return internal decode mode for given profile
523     //!
524     //! \param    [in] profile
525     //!           Specify the VAProfile
526     //!
527     //! \return   Codehal mode: decode codec mode
528     //!
529     virtual CODECHAL_MODE GetDecodeCodecMode(VAProfile profile);
530 
531     //!
532     //! \brief    Return the decode codec key for given profile
533     //!
534     //! \param    [in] profile
535     //!           Specify the VAProfile
536     //!
537     //! \return   Std::string decode codec key
538     //!
539     virtual std::string GetDecodeCodecKey(VAProfile profile);
540 
541     //!
542     //! \brief    Return the encode codec key for given profile and entrypoint
543     //!
544     //! \param    [in] profile
545     //!           Specify the VAProfile
546     //!
547     //! \param    [in] entrypoint
548     //!           Specify the entrypoint
549     //!
550     //! \param    [in] feiFunction
551     //!           Specify the feiFunction
552     //!
553     //! \return   Std::string encode codec key
554     //!
555     virtual std::string GetEncodeCodecKey(VAProfile profile, VAEntrypoint entrypoint, uint32_t feiFunction);
556 
557     //!
558     //! \brief    Query the suppported image formats
559     //!
560     //! \param    [in,out] formatList
561     //!           Pointer to a VAImageFormat array. The array size shouldn't be less than vaMaxNumImageFormats
562     //!           It will return the supported image formats.
563     //!
564     //! \param    [in,out] num_formats
565     //!           Pointer to a integer that will return the real size of formatList.
566     //!
567     //! \return   VAStatus
568     //!           VA_STATUS_SUCCESS if succeed
569     //!
570     virtual VAStatus QueryImageFormats(VAImageFormat *formatList, int32_t *num_formats) = 0;
571 
572     //!
573     //! \brief    Return the maxinum number of supported image formats
574     //!
575     //! \return   The maxinum number of supported image formats
576     //!
577     virtual uint32_t GetImageFormatsMaxNum() = 0;
578 
579     //!
580     //! \brief    Populate the color masks info
581     //!
582     //! \param    [in,out] Image format
583     //!           Pointer to a VAImageFormat array. Color masks information will be populated to this
584     //!           structure.
585     //!
586     //! \return   VAStatus
587     //!           VA_STATUS_SUCCESS if succeed
588     //!
589     virtual VAStatus PopulateColorMaskInfo(VAImageFormat *vaImgFmt) = 0;
590 
591     virtual bool IsImageSupported(uint32_t fourcc) = 0;
592 
593     //!
594     //! \brief    Query AVC ROI maxinum numbers and if support ROI in delta QP
595     //!
596     //! \param    [in] rcMode
597     //!           Specify the rate control mode to query
598     //!
599     //! \param    [in] isVdenc
600     //!           Specify whether it is vdenc or not
601     //!
602     //! \param    [in,out] maxNum
603     //!           Pointer to a integer that will return the maximum number of ROI.
604     //!
605     //! \param    [in,out] isRoiInDeltaQP
606     //!           Pointer to a bool that will return if ROI in delta QP is supported
607     //!
608     //! \return   VAStatus
609     //!           VA_STATUS_SUCCESS if succeed
610     //!
611     virtual VAStatus QueryAVCROIMaxNum(uint32_t rcMode, bool isVdenc, uint32_t *maxNum, bool *isRoiInDeltaQP) = 0;
612 
613     //!
614     //! \brief    Check if the configID is a valid decode config
615     //!
616     //! \param    [in] configId
617     //!           Specify the VAConfigID
618     //!
619     //! \return   True if the configID is a valid decode config, otherwise false
620     //!
621     bool IsDecConfigId(VAConfigID configId);
622 
623     //!
624     //! \brief    Check if the configID is a valid encode config
625     //!
626     //! \param    [in] configId
627     //!           Specify the VAConfigID
628     //!
629     //! \return   True if the configID is a valid encode config, otherwise false
630     //!
631     bool IsEncConfigId(VAConfigID configId);
632 
633     //!
634     //! \brief    Check if the configID is a valid vp config
635     //!
636     //! \param    [in] configId
637     //!           Specify the VAConfigID
638     //!
639     //! \return   True if the configID is a valid vp config, otherwise false
640     //!
641     bool IsVpConfigId(VAConfigID configId);
642 
643     //!
644     //! \brief    Get CP Caps object
645     //!
646     //! \return   return MediaLibvaCapsCpInterface*
647     //!
648     MediaLibvaCapsCpInterface* GetCpCaps();
649 
650     //!
651     //! \brief    Check if the entrypoint is supported by MFE
652     //!
653     //! \param    [in] entrypoint
654     //!           Specify the VAEntrypoint
655     //!
656     //! \return   true if supported, otherwise false
657     //!
658     bool IsMfeSupportedEntrypoint(VAEntrypoint entrypoint);
659 
660     //!
661     //! \brief    Check if the profile is supported by MFE
662     //!
663     //! \param    [in] profile
664     //!           Specify the VAProfile
665     //!
666     //! \return   true if supported, otherwise false
667     //!
668     bool IsMfeSupportedProfile(VAProfile profile);
669 
670     //!
671     //! \brief    Destory the VAConfigID
672     //!
673     //! \param    [in] configId
674     //!           Specify the VAConfigID
675     //!
676     //! \return   VAStatus
677     //!       VA_STATUS_SUCCESS if succeed
678     //!           VA_STATUS_ERROR_INVALID_CONFIG if the conifgId is invalid
679     //!
680     VAStatus DestroyConfig(VAConfigID configId);
681 
682     //!
683     //! \brief    Create MediaLibvaCaps instance for current platform
684     //!
685     //! \param    [in] mediaCtx
686     //!           Pointer to DDI_MEDIA_CONTEXT
687     //!
688     //! \return   MediaLibvaCaps *
689     //!           Pointer to Gen specific MediaLibvaCaps if success, otherwise return nullptr
690     //!
691     static MediaLibvaCaps * CreateMediaLibvaCaps(DDI_MEDIA_CONTEXT *mediaCtx);
692 
693     //!
694     //! \brief convert Media Format to Gmm Format for GmmResCreate parameter.
695     //!
696     //! \param    [in] format
697     //!         Pointer to DDI_MEDIA_FORMAT
698     //!
699     //! \return GMM_RESOURCE_FORMAT
700     //!         Pointer to gmm format type
701     //!
702     virtual GMM_RESOURCE_FORMAT ConvertMediaFmtToGmmFmt(DDI_MEDIA_FORMAT format);
703 
704     //!
705     //! \brief convert FOURCC to Gmm Format.
706     //!
707     //! \param    [in] fourcc
708     //!
709     //! \return GMM_RESOURCE_FORMAT
710     //!         Pointer to gmm format type
711     //!
712     virtual GMM_RESOURCE_FORMAT ConvertFourccToGmmFmt(uint32_t fourcc);
713 
714     //!
715     //! \brief    Check if MFE is supported on the platform
716     //!
717     //! \param    [in] PLATFORM
718     //!
719     //! \return   true if supported, otherwise false
720     //!
721     virtual bool IsMfeSupportedOnPlatform(const PLATFORM &platform);
722 
723     //!
724     //! \brief    Initialize the MediaLibvaCaps instance for current platform
725     //!
726     //! \return   VAStatus
727     //!           return VA_STATUS_SUCCESS for success
728     //!
Init()729     virtual VAStatus Init()
730     {
731         // do nothing by default
732         return VA_STATUS_SUCCESS;
733     }
734 
735     //! \brief Get surface drm modifier
736     //!
737     //! \param    [in] mediaSurface
738     //!           Pointer to the media surface
739     //! \param    [out] modifier
740     //!           reference of the modifier
741     //!
742     //! \return   VAStatus
743     //!           VA_STATUS_SUCCESS if success
744     //!
745     virtual VAStatus GetSurfaceModifier(DDI_MEDIA_SURFACE* mediaSurface, uint64_t &modifier);
746 
747     //! \brief Set tile format according to external surface's modifier
748     //!
749     //! \param    [in] mediaSurface
750     //!           Pointer to the media surface
751     //! \param    [out] tileformat
752     //!           Reference to the tileformat
753     //! \param    [out] bMemCompEnable
754     //!           Reference to the memory compress flag
755     //! \param    [out] bMemCompRC
756     //!           Reference to the memory compress rate control
757     //!
758     //! \return   VAStatus
759     //!           VA_STATUS_SUCCESS if success
760     //!
761     virtual VAStatus SetExternalSurfaceTileFormat(DDI_MEDIA_SURFACE* mediaSurface, uint32_t &tileformat, bool &bMemCompEnable, bool &bMemCompRC);
762 
763 protected:
764     //!
765     //! \class    ProfileEntrypoint
766     //! \brief    Profile entrypoint
767     //!
768     class ProfileEntrypoint
769     {
770         public:
771             VAProfile m_profile = VAProfileNone; //!< Profile
772             VAEntrypoint m_entrypoint = (VAEntrypoint)0; //!< Entrypoint
773             AttribMap *m_attributes = nullptr; //!< Pointer to attributes map
774             int32_t m_configStartIdx = 0; //!< Config Id offset to the decode or encode or vp config Id base
775             //! \brief  The number of config Id that this profile & entrypoint combination supports
776             //!
777             int32_t m_configNum = 0; //!< Number of configs that above profile & entrypoint combination supports
778     };
779 
780     //!
781     //! \struct   DecConfig
782     //! \brief    Decode configuration
783     //!
784     struct DecConfig
785     {
786         uint32_t m_sliceMode;   //!< Decode slice mode
787         uint32_t m_encryptType; //!< Decode entrypoint Type
788         uint32_t m_processType; //!< Decode processing Type
789 
DecConfigDecConfig790         DecConfig(const uint32_t sliceMode, const uint32_t encryptType, const uint32_t processType)
791         : m_sliceMode(sliceMode), m_encryptType(encryptType), m_processType(processType) {}
792     };
793 
794     //!
795     //! \struct   EncConfig
796     //! \brief    Encode configuration
797     //!
798     struct EncConfig
799     {
800         uint32_t m_rcMode;      //!< RateControl Mode
801         uint32_t m_FeiFunction; //!< Decode entrypoint Type
EncConfigEncConfig802         EncConfig(const uint32_t rcMode, const uint32_t FeiFunction)
803         : m_rcMode(rcMode), m_FeiFunction(FeiFunction) {}
804     };
805 
806     //!
807     //! \enum     CodecType
808     //! \brief    Codec type
809     //!
810     enum CodecType
811     {
812         videoEncode, //!< Video encode
813         videoDecode, //!< Video decode
814         videoProcess,//!< Video processing
815         videoProtect //!< Video protection
816     };
817 
818     enum EncodeFormat
819     {
820         AVC = 0,
821         HEVC,
822         VP9,
823         Others = 0xff,
824     };
825 
826     enum EncodeType
827     {
828         DualPipe = 0,
829         Vdenc,
830     };
831 
832     struct EncodeFormatTable
833     {
834         EncodeFormat    encodeFormat;
835         EncodeType      encodeType;
836         uint32_t        colorFormat;
837     };
838 
839 #if VA_CHECK_VERSION(1, 10, 0)
840     static const uint32_t m_numEncRcMode = 10;
841 #else
842     static const uint32_t m_numEncRcMode = 9;
843 #endif
844     static const uint16_t m_maxProfiles = 17; //!< Maximum number of supported profiles
845     static const uint16_t m_maxProfileEntries = 64; //!< Maximum number of supported profile & entrypoint combinations
846     static const uint32_t m_numVpSurfaceAttr = 20; //!< Number of VP surface attributes
847     static const uint32_t m_numJpegSurfaceAttr = 7; //!< Number of JPEG surface attributes
848     static const uint32_t m_numJpegEncSurfaceAttr = 4; //!< Number of JPEG encode surface attributes
849     static const uint16_t m_maxEntrypoints = 7; //!<  Maximum number of supported entrypoints
850     static const uint32_t m_decSliceMode[2]; //!< Store 2 decode slices modes
851     static const uint32_t m_decProcessMode[2]; //!< Store 2 decode process modes
852     static const uint32_t m_encRcMode[m_numEncRcMode]; //!< Store encode rate control modes
853     static const uint32_t m_vpSurfaceAttr[m_numVpSurfaceAttr]; //!< Store the VP surface attributes
854     static const uint32_t m_jpegSurfaceAttr[m_numJpegSurfaceAttr]; //!< Store the JPEG surface attributes
855     static const uint32_t m_jpegEncSurfaceAttr[m_numJpegEncSurfaceAttr]; //!< Store the JPEG encode surface attributes
856 
857     static const uint32_t m_decMpeg2MaxWidth = 2048; //!< Maximum width for Mpeg2 decode
858     static const uint32_t m_decMpeg2MaxHeight = 2048; //!< Maximum height for Mpeg2 decode
859     static const uint32_t m_decVc1MaxWidth = 3840; //!< Maximum width for VC1 decode
860     static const uint32_t m_decVc1MaxHeight = 3840; //!< Maximum height for VC1 decode
861     static const uint32_t m_decJpegMaxWidth = 16384;  //!< Maximum width for JPEG decode
862     static const uint32_t m_decJpegMaxHeight = 16384; //!< Maximum height for JPEG decode
863     static const uint32_t m_decHevcMaxWidth = 8192; //!< Maximum width for HEVC decode
864     static const uint32_t m_decHevcMaxHeight = 8192; //!< Maximum height for HEVC decode
865     static const uint32_t m_decVp9MaxWidth = 8192; //!< Maximum width for VP9 decode
866     static const uint32_t m_decVp9MaxHeight = 8192; //!< Maximum height for VP9 decode
867     static const uint32_t m_decDefaultMaxWidth = 4096; //!< Default maximum width for decode
868     static const uint32_t m_decDefaultMaxHeight = 4096; //!< Default maximum height for decode
869 
870     static const uint32_t m_encMinWidth = 32; //!< Minimum width for encoding
871     static const uint32_t m_encMinHeight = 32; //!< Minimum height for encoding
872     static const uint32_t m_hevcVDEncMinWidth = 128; //!< Minimum width for HEVC VDEnc
873     static const uint32_t m_hevcVDEncMinHeight = 128; //!< Minimum height for HEVC VDEnc
874     static const uint32_t m_encMax4kWidth =
875         CODEC_4K_MAX_PIC_WIDTH; //!< Minimum width for encoding
876     static const uint32_t m_encMax4kHeight =
877         CODEC_4K_MAX_PIC_HEIGHT; //!< Minimum height for encoding
878     static const uint32_t m_encJpegMinWidth = 16; //!< Minimum width for encoding
879     static const uint32_t m_encJpegMinHeight = 16; //!< Minimum height for encoding
880     static const uint32_t m_encJpegMaxWidth =
881         ENCODE_JPEG_MAX_PIC_WIDTH; //!< Maximum width for JPEG encoding
882     static const uint32_t m_encJpegMaxHeight =
883         ENCODE_JPEG_MAX_PIC_HEIGHT; //!< Maximum height for JPEG encoding
884     DDI_MEDIA_CONTEXT *m_mediaCtx; //!< Pointer to media context
885 
886     friend class MediaLibvaCapsCpInterface;
887     MediaLibvaCapsCpInterface* m_CapsCp;
888 
889     static constexpr uint32_t m_configAttribNone = 0x00000000; //!< Define for empty attrib
890 
891     //!
892     //! \brief  Store all the supported encode format
893     //!
894     struct EncodeFormatTable* m_encodeFormatTable = nullptr;
895     uint32_t m_encodeFormatCount = 0;
896 
897     //!
898     //! \brief  Store all the profile and entrypoint combinations
899     //!
900     ProfileEntrypoint m_profileEntryTbl[m_maxProfileEntries];
901     uint16_t m_profileEntryCount = 0; //!< Count valid entries in m_profileEntryTbl
902 
903     //!
904     //! \brief  Store attribute list pointers
905     //!
906     std::vector<AttribMap *> m_attributeLists;
907 
908     bool m_isEntryptSupported = false; //!< If decode encryption is supported on current platform
909 
910     std::vector<EncConfig> m_encConfigs; //!< Store supported encode configs
911     std::vector<DecConfig> m_decConfigs; //!< Store supported decode configs
912     std::vector<uint32_t> m_vpConfigs;   //!< Store supported vp configs
913 
914     bool m_vdencActive = false;  //!< If vdenc is active on current platform
915 
916     //!
917     //! \brief    Check entrypoint codec type
918     //!
919     //! \param    [in] entrypoint
920     //!       VA entrypoint
921     //! \param    [in] codecType
922     //!       Codec type
923     //!
924     //! \return   True if entrypoint match the codecType
925     //!
926     bool CheckEntrypointCodecType(VAEntrypoint entrypoint, CodecType codecType);
927 
928     //!
929     //! \brief    Add one decode configuration
930     //!
931     //! \param    [in] slicemode
932     //!           VA_DEC_SLICE_MODE_xxx
933     //!
934     //! \param    [in] encryptType
935     //!           Encryption Type
936     //!
937     //! \param    [in]  processType
938     //!           VA_DEC_PROCESSINGxxx
939     //!
940     //! \return   VAStatus
941     //!           VA_STATUS_SUCCESS if success
942     //!
943     VAStatus AddDecConfig(uint32_t slicemode, uint32_t encryptType, uint32_t processType);
944 
945     //!
946     //! \brief    Add one encode configuration
947     //!
948     //! \param    [in] rcMode
949     //!           VA_RC_XXX
950     //! \param    [in] feiFunction
951     //!           VA_FEI_FUNCTION_XXX [optional parameter]
952     //!
953     //! \return   VAStatus
954     //!           VA_STATUS_SUCCESS if success
955     //!
956     VAStatus AddEncConfig(uint32_t rcMode, uint32_t feiFunction = 0);
957 
958     //!
959     //! \brief    Add one vp configuration
960     //!
961     //! \param    [in] attrib
962     //!           VP attribute
963     //!
964     //! \return   VAStatus
965     //!           VA_STATUS_SUCCESS if success
966     //!
967     VAStatus AddVpConfig(uint32_t attrib);
968 
969     //!
970     //! \brief    Return profile and entrypoint for a give config ID
971     //!
972     //! \param    [in] configId
973     //!           VA configuration
974     //!
975     //! \param    [in,out] profile
976     //!           Pointer to VAProfile of the configuration
977     //!
978     //! \param    [in,out] entrypoint
979     //!           Pointer to VAEntrypoint of the configuration
980     //!
981     //! \param    [in,out] profileTableIdx
982     //!           The index in m_profileEntryTbl. Return -1 if config ID is invalid
983     //!
984     //! \return   VAStatus
985     //!           VA_STATUS_SUCCESS if success
986     //!
987     VAStatus GetProfileEntrypointFromConfigId(VAConfigID configId,
988             VAProfile *profile,
989             VAEntrypoint *entrypoint,
990             int32_t *profileTableIdx);
991 
992     //!
993     //! \brief    Add one entry to profile & entrypoint table
994     //!
995     //! \param    [in] profile
996     //!           Pointer to VAProfile of the configuration
997     //!
998     //! \param    [in] entrypoint
999     //!           Pointer to VAEntrypoint of the configuration
1000     //!
1001     //! \param    [in] attributeList
1002     //!           Pointer to VAConfigAttrib vector that stores attributes
1003     //!
1004     //! \param    [in] configIdxStart
1005     //!           Offset of config index in m_encConfigs, m_decConfigs or m_vpConfigs
1006     //!
1007     //! \param    [in] configNum
1008     //!           The number of supported configs.
1009     //!
1010     //! \return   VAStatus
1011     //!           VA_STATUS_SUCCESS if success
1012     //!
1013     VAStatus AddProfileEntry(VAProfile profile,
1014             VAEntrypoint entrypoint,
1015             AttribMap *attributeList,
1016             int32_t configIdxStart,
1017             int32_t configNum);
1018 
1019     //!
1020     //! \brief    Return the index in m_profileEntryTble by given profile and entrypoint
1021     //!
1022     //! \param    [in] profile
1023     //!           Specify VAProfile
1024     //!
1025     //! \param    [in] entrypoint
1026     //!           Specify VAEntrypoint
1027     //!
1028     //! \return   int32_t
1029     //!           Equal or bigger than zero if success, otherwise return -1
1030     //!
1031     int32_t GetProfileTableIdx(VAProfile profile, VAEntrypoint entrypoint);
1032 
1033     //!
1034     //! \brief    Create attributes map
1035     //!
1036     //! \param    [in,out] attributeList
1037     //!           Return the pointer to AttribMap
1038     //!
1039     //! \return   VAStatus
1040     //!           VA_STATUS_SUCCESS if success
1041     //!
1042     VAStatus CreateAttributeList(AttribMap **attributeList);
1043 
1044     //!
1045     //! \brief    Free attribuate lists
1046     //!
1047     VAStatus FreeAttributeList();
1048 
1049     //!
1050     //! \brief    Initialize the attribute types of a VAConfigAttrib array
1051     //!
1052     //! \param    [in,out] attribList
1053     //!           Pointer to VAConfigAttrib vector
1054     //!
1055     //! \return   VAStatus
1056     //!           VA_STATUS_SUCCESS if success
1057     //!
1058     VAStatus InitAttributeTypes(std::vector<VAConfigAttrib> *attribList);
1059 
1060     //!
1061     //! \brief    Return index of given attribute type in a VAConfigAttrib vector
1062     //!
1063     //! \param    [in] attribList
1064     //!           Pointer to VAConfigAttrib vector.
1065     //!
1066     //! \param    [in] type
1067     //!           Specify the VAConfigAttribType to query
1068     //!
1069     //! \return   int32_t
1070     //!           Equal or bigger than zero if success, otherwise return -1
1071     //!
1072     int32_t GetAttributeIndex(std::vector<VAConfigAttrib> *attribList, VAConfigAttribType type);
1073 
1074     //!
1075     //! \brief    Set the attribute in a VAConfigAttrib array
1076     //!
1077     //! \param    [in,out] attributeList
1078     //!           Pointer to VAConfigAttrib vector
1079     //!
1080     //! \param    [in] type
1081     //!           VAConfigAttribType
1082     //!
1083     //! \param    [in] value
1084     //!           Attribute value
1085     //!
1086     //! \return   VAStatus
1087     //!           VA_STATUS_SUCCESS if success
1088     //!
1089     VAStatus SetAttribute(
1090             std::vector<VAConfigAttrib> *attributeList,
1091             VAConfigAttribType type,
1092             uint32_t value);
1093 
1094     //!
1095     //! \brief    Set the attribute for the given profile and entrypoint
1096     //!
1097     //! \param    [in] profile
1098     //!           Specify VAProfile
1099     //!
1100     //! \param    [in] entrypoint
1101     //!           Specify VAEntrypoint
1102     //!
1103     //! \param    [in] type
1104     //!           VAConfigAttribType
1105     //!
1106     //! \param    [in] value
1107     //!           Attribute value
1108     //!
1109     //! \return   VAStatus
1110     //!           VA_STATUS_SUCCESS if success
1111     //!
1112     VAStatus SetAttribute(
1113             VAProfile profile,
1114             VAEntrypoint entrypoint,
1115             VAConfigAttribType type,
1116             uint32_t value);
1117 
1118     //!
1119     //! \brief    Create and intialize an attribute vector give encode profile and entrypoint
1120     //!
1121     //! \param    [in] profile
1122     //!           VA profile
1123     //!
1124     //! \param    [in] entrypoint
1125     //!           VA entrypoint
1126     //!
1127     //! \param    [in,out] attributeList
1128     //!           Pointer to a pointer of AttribMap that will be created
1129     //!
1130     //! \return   VAStatus
1131     //!           VA_STATUS_SUCCESS if success
1132     //!
1133     virtual VAStatus CreateEncAttributes(
1134             VAProfile profile,
1135             VAEntrypoint entrypoint,
1136             AttribMap **attributeList);
1137 
1138     //!
1139     //! \brief    Create and intialize an attribute array give decode profile and entrypoint
1140     //!
1141     //! \param    [in] profile
1142     //!           VA profile
1143     //!
1144     //! \param    [in] entrypoint
1145     //!           VA entrypoint
1146     //!
1147     //! \param    [in,out] attributeList
1148     //!           Pointer to a pointer of AttribMap that will be created
1149     //!
1150     //! \return   VAStatus
1151     //!           VA_STATUS_SUCCESS if success
1152     //!
1153     virtual VAStatus CreateDecAttributes(
1154             VAProfile profile,
1155             VAEntrypoint entrypoint,
1156             AttribMap **attributeList);
1157 
1158     //!
1159     //! \brief    Create and intialize an attribute array give Vp profile and entrypoint
1160     //!
1161     //! \param    [in] profile
1162     //!           VA profile
1163     //!
1164     //! \param    [in] entrypoint
1165     //!           VA entrypoint
1166     //!
1167     //! \param    [in,out] attributeList
1168     //!           Pointer to a pointer of AttribMap that will be created
1169     //!
1170     //! \return   VAStatus
1171     //!           VA_STATUS_SUCCESS if success
1172     //!
1173     VAStatus CreateVpAttributes(
1174             VAProfile profile,
1175             VAEntrypoint entrypoint,
1176             AttribMap **attributeList);
1177 
1178     //!
1179     //! \brief    Initialize AVC decode profiles, entrypoints and attributes
1180     //!
1181     VAStatus LoadAvcDecProfileEntrypoints();
1182 
1183     //!
1184     //! \brief    Initialize AVC encode profiles, entrypoints and attributes
1185     //!
1186     virtual VAStatus LoadAvcEncProfileEntrypoints();
1187 
1188     //!
1189     //! \brief    Initialize AVC Low-power encode profiles, entrypoints and attributes
1190     //!
1191     virtual VAStatus LoadAvcEncLpProfileEntrypoints();
1192 
1193     //!
1194     //! \brief    Initialize MPEG2 decode profiles, entrypoints and attributes
1195     //!
1196     VAStatus LoadMpeg2DecProfileEntrypoints();
1197 
1198     //!
1199     //! \brief    Initialize MPEG2 encode profiles, entrypoints and attributes
1200     //!
1201     virtual VAStatus LoadMpeg2EncProfileEntrypoints();
1202 
1203     //!
1204     //! \brief    Initialize JPEG decode profiles, entrypoints and attributes
1205     //!
1206     VAStatus LoadJpegDecProfileEntrypoints();
1207 
1208     //!
1209     //! \brief    Initialize JPEG encode profiles, entrypoints and attributes
1210     //!
1211     virtual VAStatus LoadJpegEncProfileEntrypoints();
1212 
1213     //!
1214     //! \brief    Initialize VC1 decode profiles, entrypoints and attributes
1215     //!
1216     VAStatus LoadVc1DecProfileEntrypoints();
1217 
1218     //!
1219     //! \brief    Initialize VP8 decode profiles, entrypoints and attributes
1220     //!
1221     VAStatus LoadVp8DecProfileEntrypoints();
1222 
1223     //!
1224     //! \brief    Initialize VP8 encode profiles, entrypoints and attributes
1225     //!
1226     VAStatus LoadVp8EncProfileEntrypoints();
1227 
1228     //!
1229     //! \brief    Initialize VP9 decode profiles, entrypoints and attributes
1230     //!
1231     VAStatus LoadVp9DecProfileEntrypoints();
1232 
1233     //!
1234     //! \brief    Initialize VP9 encode profiles, entrypoints and attributes
1235     //!
1236     virtual VAStatus LoadVp9EncProfileEntrypoints();
1237 
1238     //!
1239     //! \brief    Initialize HEVC decode profiles, entrypoints and attributes
1240     //!
1241     virtual VAStatus LoadHevcDecProfileEntrypoints();
1242 
1243     //!
1244     //! \brief    Initialize HEVC decode profiles, entrypoints and attributes for specified hevc profile
1245     //!
1246     VAStatus LoadDecProfileEntrypoints(VAProfile profile);
1247 
1248     //!
1249     //! \brief    Initialize HEVC encode profiles, entrypoints and attributes
1250     //!
1251     virtual VAStatus LoadHevcEncProfileEntrypoints();
1252 
1253     //!
1254     //! \brief    Initialize none profiles, entrypoints and attributes
1255     //!
1256     VAStatus LoadNoneProfileEntrypoints();
1257 
1258     //!
1259     //! \brief    Initialize Advanced decode profiles, entrypoints and attributes
1260     //!
1261     virtual VAStatus LoadAdvancedDecProfileEntrypoints();
1262 
1263     //!
1264     //! \brief    Initialize encode/decode/vp profiles, entrypoints and attributes
1265     //!
1266     virtual VAStatus LoadProfileEntrypoints() = 0;
1267 
1268     //!
1269     //! \brief    Create decode config by given attributes
1270     //!
1271     //! \param    [in] profileTableIdx
1272     //!           The index in m_profileEntryTbl.
1273     //!
1274     //! \param    [in] attribList
1275     //!           Pointer to VAConfigAttrib array
1276     //!
1277     //! \param    [in] numAttribs
1278     //!           Number of VAConfigAttrib in attribList
1279     //!
1280     //! \param    [in,out] configId
1281     //!           Pointer to VAConfigID.
1282     //!
1283     //! \return   VAStatus
1284     //!           VA_STATUS_SUCCESS if success
1285     //!
1286     VAStatus CreateDecConfig(
1287         int32_t profileTableIdx,
1288         VAConfigAttrib *attribList,
1289         int32_t numAttribs,
1290         VAConfigID *configId);
1291 
1292     //!
1293     //! \brief    Create encode config by given attributes
1294     //!
1295     //! \param    [in] profileTableIdx
1296     //!           The index in m_profileEntryTbl.
1297     //!
1298     //! \param    [in] attribList
1299     //!           Pointer to VAConfigAttrib array
1300     //!
1301     //! \param    [in] numAttribs
1302     //!           Number of VAConfigAttrib in attribList
1303     //!
1304     //! \param    [in,out] configId
1305     //!           Pointer to VAConfigID.
1306     //!
1307     //! \return   VAStatus
1308     //!           VA_STATUS_SUCCESS if success
1309     //!
1310     VAStatus CreateEncConfig(
1311         int32_t profileTableIdx,
1312         VAEntrypoint entrypoint,
1313         VAConfigAttrib *attribList,
1314         int32_t numAttribs,
1315         VAConfigID *configId);
1316 
1317     //!
1318     //! \brief    Create vp config by given attributes
1319     //!
1320     //! \param    [in] profileTableIdx
1321     //!           The index in m_profileEntryTbl.
1322     //!
1323     //! \param    [in] attribList
1324     //!           Pointer to VAConfigAttrib array
1325     //!
1326     //! \param    [in] numAttribs
1327     //!           Number of VAConfigAttrib in attribList
1328     //!
1329     //! \param    [in,out] configId
1330     //!           Pointer to VAConfigID.
1331     //!
1332     //! \return   VAStatus
1333     //!           VA_STATUS_SUCCESS if success
1334     //!
1335     VAStatus CreateVpConfig(
1336         int32_t profileTableIdx,
1337         VAConfigAttrib *attribList,
1338         int32_t numAttribs,
1339         VAConfigID *configId);
1340 
1341     //!
1342     //! \brief    Return the platform specific value by given attribute type
1343     //!
1344     //! \param    [in] profile
1345     //!           VAProfile
1346     //!
1347     //! \param    [in] entrypoint
1348     //!           VAEntrypoint
1349     //!
1350     //! \param    [in] type
1351     //!           VAConfigAttribType
1352     //!
1353     //! \param    [in,out] value
1354     //!           Pointer to uint32_t that stores the returned value.
1355     //!
1356     //! \return   VAStatus
1357     //!           VA_STATUS_SUCCESS if success
1358     //!
1359     virtual VAStatus GetPlatformSpecificAttrib(
1360             VAProfile profile,
1361             VAEntrypoint entrypoint,
1362             VAConfigAttribType type,
1363             uint32_t *value) = 0;
1364 
1365     //!
1366     //! \brief    Return encode Mb processing rate on current platform
1367     //!
1368     //! \param    [in] skuTable
1369     //!           Point to MEDIA_FEATURE_TABLE
1370     //!
1371     //! \param    [in] tuIdx
1372     //!           Specify the index of target usage
1373     //!
1374     //! \param    [in] codecMode
1375     //!           Specify the codec mode
1376     //!
1377     //! \param    [in] vdencActive
1378     //!           Specify if vdenc is used
1379     //!
1380     //! \param    [in,out] mbProcessingRatePerSec
1381     //!           Pointer to uint32_t that stores the returned value.
1382     //!
1383     //! \return   VAStatus
1384     //!           VA_STATUS_SUCCESS if success
1385     //!
1386     virtual VAStatus GetMbProcessingRateEnc(
1387             MEDIA_FEATURE_TABLE *skuTable,
1388             uint32_t tuIdx,
1389             uint32_t codecMode,
1390             bool vdencActive,
1391             uint32_t *mbProcessingRatePerSec);
1392 
1393     //!
1394     //! \brief    Return decode Mb processing rate on current platform
1395     //!
1396     //! \param    [in] skuTable
1397     //!           Point to MEDIA_FEATURE_TABLE
1398     //!
1399     //! \param    [in,out] mbProcessingRatePerSec
1400     //!           Pointer to uint32_t that stores the returned value.
1401     //!
1402     //! \return   VAStatus
1403     //!           VA_STATUS_SUCCESS if success
1404     //!
1405     virtual VAStatus GetMbProcessingRateDec(
1406             MEDIA_FEATURE_TABLE *skuTable,
1407             uint32_t *mbProcessingRatePerSec);
1408 
1409     //!
1410     //! \brief    Check the encode RT format according to platform and encode format
1411     //!
1412     //! \param    [in] profile
1413     //!           VAProfile
1414     //!
1415     //! \param    [in] entrypoint
1416     //!           VAEntrypoint
1417     //!
1418     //! \param    [in,out] attrib
1419     //!           Pointer to a pointer of VAConfigAttrib that will be created
1420     //!
1421     //! \return   VAStatus
1422     //!           VA_STATUS_SUCCESS if success
1423     //!
1424     virtual VAStatus CheckEncRTFormat(
1425             VAProfile profile,
1426             VAEntrypoint entrypoint,
1427             VAConfigAttrib* attrib);
1428     //!
1429     //! \brief    Check the encode attribute list  according to profile and entrypoint
1430     //!
1431     //! \param    [in] profile
1432     //!           VAProfile
1433     //!
1434     //! \param    [in] entrypoint
1435     //!           VAEntrypoint
1436     //!
1437     //! \param    [in] attrib
1438     //!           Pointer to a pointer of VAConfigAttrib
1439     //!
1440     //! \param    [in] numAttribs
1441     //!           number of of VAConfigAttrib
1442     //!
1443     //! \return   VAStatus
1444     //!           VA_STATUS_SUCCESS if success
1445     //!
1446     VAStatus CheckAttribList(
1447             VAProfile profile,
1448             VAEntrypoint entrypoint,
1449             VAConfigAttrib* attrib,
1450             int32_t numAttribs);
1451 
1452     //! \brief Get the general attribute
1453     //!
1454     //! \param    [in,out] attrib
1455     //!           Pointer to the CAConfigAttrib
1456     //!
1457     //! \return   VAStatus
1458     //!           VA_STATUS_SUCCESS if success
1459     //!
1460     VAStatus GetGeneralConfigAttrib(VAConfigAttrib* attrib);
1461 
1462 };
1463 #endif
1464