1 /**************************************************************************
3 * Copyright 2010 Thomas Balling Sørensen & Orasanu Lucian.
4 * Copyright 2014 Advanced Micro Devices, Inc.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sub license, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
15 * The above copyright notice and this permission notice (including the
16 * next paragraph) shall be included in all copies or substantial portions
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22 * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR
23 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 **************************************************************************/
29 #include "pipe/p_screen.h"
31 #include "vl/vl_winsys.h"
33 #include "va_private.h"
36 vlVaQueryConfigProfiles(VADriverContextP ctx
, VAProfile
*profile_list
, int *num_profiles
)
38 struct pipe_screen
*pscreen
;
39 enum pipe_video_profile p
;
43 return VA_STATUS_ERROR_INVALID_CONTEXT
;
47 pscreen
= VL_VA_PSCREEN(ctx
);
48 for (p
= PIPE_VIDEO_PROFILE_MPEG2_SIMPLE
; p
<= PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH
; ++p
)
49 if (pscreen
->get_video_param(pscreen
, p
, PIPE_VIDEO_ENTRYPOINT_BITSTREAM
, PIPE_VIDEO_CAP_SUPPORTED
)) {
50 vap
= PipeToProfile(p
);
51 if (vap
!= VAProfileNone
)
52 profile_list
[(*num_profiles
)++] = vap
;
55 return VA_STATUS_SUCCESS
;
59 vlVaQueryConfigEntrypoints(VADriverContextP ctx
, VAProfile profile
,
60 VAEntrypoint
*entrypoint_list
, int *num_entrypoints
)
62 struct pipe_screen
*pscreen
;
63 enum pipe_video_profile p
;
66 return VA_STATUS_ERROR_INVALID_CONTEXT
;
70 p
= ProfileToPipe(profile
);
71 if (p
== PIPE_VIDEO_PROFILE_UNKNOWN
)
72 return VA_STATUS_ERROR_UNSUPPORTED_PROFILE
;
74 pscreen
= VL_VA_PSCREEN(ctx
);
75 if (!pscreen
->get_video_param(pscreen
, p
, PIPE_VIDEO_ENTRYPOINT_BITSTREAM
, PIPE_VIDEO_CAP_SUPPORTED
))
76 return VA_STATUS_ERROR_UNSUPPORTED_PROFILE
;
78 entrypoint_list
[(*num_entrypoints
)++] = VAEntrypointVLD
;
80 return VA_STATUS_SUCCESS
;
84 vlVaGetConfigAttributes(VADriverContextP ctx
, VAProfile profile
, VAEntrypoint entrypoint
,
85 VAConfigAttrib
*attrib_list
, int num_attribs
)
90 return VA_STATUS_ERROR_INVALID_CONTEXT
;
92 for (i
= 0; i
< num_attribs
; ++i
) {
94 switch (attrib_list
[i
].type
) {
95 case VAConfigAttribRTFormat
:
96 value
= VA_RT_FORMAT_YUV420
;
98 case VAConfigAttribRateControl
:
102 value
= VA_ATTRIB_NOT_SUPPORTED
;
105 attrib_list
[i
].value
= value
;
108 return VA_STATUS_SUCCESS
;
112 vlVaCreateConfig(VADriverContextP ctx
, VAProfile profile
, VAEntrypoint entrypoint
,
113 VAConfigAttrib
*attrib_list
, int num_attribs
, VAConfigID
*config_id
)
115 struct pipe_screen
*pscreen
;
116 enum pipe_video_profile p
;
119 return VA_STATUS_ERROR_INVALID_CONTEXT
;
121 p
= ProfileToPipe(profile
);
122 if (p
== PIPE_VIDEO_PROFILE_UNKNOWN
)
123 return VA_STATUS_ERROR_UNSUPPORTED_PROFILE
;
125 pscreen
= VL_VA_PSCREEN(ctx
);
126 if (!pscreen
->get_video_param(pscreen
, p
, PIPE_VIDEO_ENTRYPOINT_BITSTREAM
, PIPE_VIDEO_CAP_SUPPORTED
))
127 return VA_STATUS_ERROR_UNSUPPORTED_PROFILE
;
129 if (entrypoint
!= VAEntrypointVLD
)
130 return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT
;
134 return VA_STATUS_SUCCESS
;
138 vlVaDestroyConfig(VADriverContextP ctx
, VAConfigID config_id
)
141 return VA_STATUS_ERROR_INVALID_CONTEXT
;
143 return VA_STATUS_SUCCESS
;
147 vlVaQueryConfigAttributes(VADriverContextP ctx
, VAConfigID config_id
, VAProfile
*profile
,
148 VAEntrypoint
*entrypoint
, VAConfigAttrib
*attrib_list
, int *num_attribs
)
151 return VA_STATUS_ERROR_INVALID_CONTEXT
;
153 *profile
= PipeToProfile(config_id
);
154 *entrypoint
= VAEntrypointVLD
;
157 attrib_list
[0].type
= VAConfigAttribRTFormat
;
158 attrib_list
[0].value
= VA_RT_FORMAT_YUV420
;
160 return VA_STATUS_SUCCESS
;