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