1 /*
2 * Copyright (c) 2020, 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 //!
24 //! \file     media_libva_caps_pvc.h
25 //! \brief    This file implements the C++ class/interface for pvc capbilities.
26 //!
27 
28 #ifndef __MEDIA_LIBVA_CAPS_XE_XPM_PLUS_H__
29 #define __MEDIA_LIBVA_CAPS_XE_XPM_PLUS_H__
30 
31 #include "media_libva.h"
32 #include "media_libva_caps_factory.h"
33 
34 #include "media_libva_caps_g12.h"
35 #include "linux_system_info.h"
36 
37 //!
38 //! \class  MediaLibvaCapsPVC
39 //! \brief  Media libva caps PVC
40 //!
41 class MediaLibvaCapsPVC : public MediaLibvaCapsG12
42 {
43 public:
44     //!
45     //! \brief    Constructor
46     //!
MediaLibvaCapsPVC(DDI_MEDIA_CONTEXT * mediaCtx)47     MediaLibvaCapsPVC(DDI_MEDIA_CONTEXT *mediaCtx) : MediaLibvaCapsG12(mediaCtx)
48     {
49         return;
50     }
51 
52     //!
53     //! \brief    Destructor
54     //!
~MediaLibvaCapsPVC()55     virtual ~MediaLibvaCapsPVC() {};
56 
57     virtual VAStatus LoadAv1DecProfileEntrypoints();
58 
59     //!
60     //! \brief        Initialize HEVC low-power encode profiles, entrypoints and attributes
61     //!
62     //! \return VAStatus
63     //!     if call succeeds
64     //!
65     virtual VAStatus LoadHevcEncLpProfileEntrypoints() override;
66 
67     //!
68     //! \brief    Check if the resolution is valid for a encode profile
69     //!
70     //! \param    [in] profile
71     //!           Specify the VAProfile
72     //!
73     //! \param    [in] width
74     //!           Specify the width for checking
75     //!
76     //! \param    [in] height
77     //!           Specify the height for checking
78     //!
79     //! \return   VAStatus
80     //!           VA_STATUS_SUCCESS if the resolution is supported
81     //!           VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED if the resolution isn't valid
82     //!
83     virtual VAStatus CheckEncodeResolution(
84         VAProfile profile,
85         uint32_t width,
86         uint32_t height) override;
87 
88     //!
89     //! \brief    Add surface attributes for Encoding
90     //!
91     //! \param    [in] profile
92     //!           VAProfile of the configuration
93     //!
94     //! \param    [in] entrypoint
95     //!           VAEntrypoint of the configuration
96     //!
97     //! \param    [in,out] attribList
98     //!           Pointer to VASurfaceAttrib array. It returns
99     //!           the supported  surface attributes
100     //!
101     //! \param    [in,out] numAttribs
102     //!           The number of elements allocated on input
103     //!           Return the number of elements actually filled in output
104     //!
105     //! \return   VAStatus
106     //!           VA_STATUS_SUCCESS if success
107     //!
108     virtual VAStatus AddEncSurfaceAttributes(
109         VAProfile profile,
110         VAEntrypoint entrypoint,
111         VASurfaceAttrib  *attribList,
112         uint32_t &numAttribs) override;
113 
114     //!
115     //! \brief    Return the platform specific value by given attribute type
116     //!
117     //! \param    [in] profile
118     //!           VAProfile
119     //!
120     //! \param    [in] entrypoint
121     //!           VAEntrypoint
122     //!
123     //! \param    [in] type
124     //!           VAConfigAttribType
125     //!
126     //! \param    [in,out] value
127     //!           Pointer to uint32_t that stores the returned value.
128     //!
129     //! \return   VAStatus
130     //!           VA_STATUS_SUCCESS if success
131     //!
132     virtual VAStatus GetPlatformSpecificAttrib(
133         VAProfile profile,
134         VAEntrypoint entrypoint,
135         VAConfigAttribType type,
136         unsigned int *value) override;
137 
138     //!
139     //! \brief    Get display attributes
140     //!           returns the current attributes values in "attribList"
141     //!
142     //! \param    [in, out] attribList
143     //!           the attrib type should be filled.
144     //!           returns the supported display attributes
145     //!
146     //! \param    [in] numAttribs
147     //!           the number of supported attributes
148     //!
149     //! \return   VAStatus
150     //!           VA_STATUS_SUCCESS if success
151     //!           VA_STATUS_ERROR_MAX_NUM_EXCEEDED if size of attribList is too small
152     //!
153     virtual VAStatus GetDisplayAttributes(
154             VADisplayAttribute *attribList,
155             int32_t numAttribs) override;
156 };
157 #endif
158