1 /**************************************************************************
3 * Copyright 2010 Younes Manton.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
28 #include "vdpau_private.h"
29 #include <vl_winsys.h>
31 #include <pipe/p_screen.h>
32 #include <pipe/p_defines.h>
34 #include <util/u_debug.h>
38 vlVdpGetApiVersion(uint32_t *api_version
)
41 return VDP_STATUS_INVALID_POINTER
;
48 vlVdpGetInformationString(char const **information_string
)
50 if (!information_string
)
51 return VDP_STATUS_INVALID_POINTER
;
53 *information_string
= INFORMATION_STRING
;
58 vlVdpVideoSurfaceQueryCapabilities(VdpDevice device
, VdpChromaType surface_chroma_type
,
59 VdpBool
*is_supported
, uint32_t *max_width
, uint32_t *max_height
)
62 struct pipe_screen
*pscreen
;
63 uint32_t max_2d_texture_level
;
65 VDPAU_MSG(VDPAU_TRACE
, "[VDPAU] Querying video surfaces\n");
67 if (!(is_supported
&& max_width
&& max_height
))
68 return VDP_STATUS_INVALID_POINTER
;
70 dev
= vlGetDataHTAB(device
);
72 return VDP_STATUS_INVALID_HANDLE
;
74 pscreen
= dev
->vscreen
->pscreen
;
76 return VDP_STATUS_RESOURCES
;
78 /* XXX: Current limits */
80 if (surface_chroma_type
!= VDP_CHROMA_TYPE_420
)
81 *is_supported
= false;
83 max_2d_texture_level
= pscreen
->get_param(pscreen
, PIPE_CAP_MAX_TEXTURE_2D_LEVELS
);
84 if (!max_2d_texture_level
)
85 return VDP_STATUS_RESOURCES
;
87 /* I am not quite sure if it is max_2d_texture_level-1 or just max_2d_texture_level */
88 *max_width
= *max_height
= pow(2,max_2d_texture_level
-1);
94 vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities(VdpDevice device
, VdpChromaType surface_chroma_type
,
95 VdpYCbCrFormat bits_ycbcr_format
,
96 VdpBool
*is_supported
)
99 struct pipe_screen
*pscreen
;
101 VDPAU_MSG(VDPAU_TRACE
, "[VDPAU] Querying get put video surfaces\n");
104 return VDP_STATUS_INVALID_POINTER
;
106 dev
= vlGetDataHTAB(device
);
108 return VDP_STATUS_INVALID_HANDLE
;
110 pscreen
= dev
->vscreen
->pscreen
;
112 return VDP_STATUS_RESOURCES
;
114 *is_supported
= pscreen
->is_video_format_supported
117 FormatYCBCRToPipe(bits_ycbcr_format
),
118 PIPE_VIDEO_PROFILE_UNKNOWN
121 return VDP_STATUS_OK
;
125 vlVdpDecoderQueryCapabilities(VdpDevice device
, VdpDecoderProfile profile
,
126 VdpBool
*is_supported
, uint32_t *max_level
, uint32_t *max_macroblocks
,
127 uint32_t *max_width
, uint32_t *max_height
)
130 struct pipe_screen
*pscreen
;
131 enum pipe_video_profile p_profile
;
133 VDPAU_MSG(VDPAU_TRACE
, "[VDPAU] Querying decoder\n");
135 if (!(is_supported
&& max_level
&& max_macroblocks
&& max_width
&& max_height
))
136 return VDP_STATUS_INVALID_POINTER
;
138 dev
= vlGetDataHTAB(device
);
140 return VDP_STATUS_INVALID_HANDLE
;
142 pscreen
= dev
->vscreen
->pscreen
;
144 return VDP_STATUS_RESOURCES
;
146 p_profile
= ProfileToPipe(profile
);
147 if (p_profile
== PIPE_VIDEO_PROFILE_UNKNOWN
) {
148 *is_supported
= false;
149 return VDP_STATUS_OK
;
152 *is_supported
= pscreen
->get_video_param(pscreen
, p_profile
, PIPE_VIDEO_CAP_SUPPORTED
);
154 *max_width
= pscreen
->get_video_param(pscreen
, p_profile
, PIPE_VIDEO_CAP_MAX_WIDTH
);
155 *max_height
= pscreen
->get_video_param(pscreen
, p_profile
, PIPE_VIDEO_CAP_MAX_HEIGHT
);
157 *max_macroblocks
= (*max_width
/16)*(*max_height
/16);
162 *max_macroblocks
= 0;
165 return VDP_STATUS_OK
;
169 vlVdpOutputSurfaceQueryCapabilities(VdpDevice device
, VdpRGBAFormat surface_rgba_format
,
170 VdpBool
*is_supported
, uint32_t *max_width
, uint32_t *max_height
)
172 if (!(is_supported
&& max_width
&& max_height
))
173 return VDP_STATUS_INVALID_POINTER
;
175 VDPAU_MSG(VDPAU_TRACE
, "[VDPAU] Querying ouput surfaces\n");
177 return VDP_STATUS_NO_IMPLEMENTATION
;
181 vlVdpOutputSurfaceQueryGetPutBitsNativeCapabilities(VdpDevice device
, VdpRGBAFormat surface_rgba_format
,
182 VdpBool
*is_supported
)
184 VDPAU_MSG(VDPAU_TRACE
, "[VDPAU] Querying output surfaces get put native cap\n");
187 return VDP_STATUS_INVALID_POINTER
;
189 return VDP_STATUS_NO_IMPLEMENTATION
;
193 vlVdpOutputSurfaceQueryPutBitsIndexedCapabilities(VdpDevice device
,
194 VdpRGBAFormat surface_rgba_format
,
195 VdpIndexedFormat bits_indexed_format
,
196 VdpColorTableFormat color_table_format
,
197 VdpBool
*is_supported
)
199 VDPAU_MSG(VDPAU_TRACE
, "[VDPAU] Querying output surfaces get put indexed cap\n");
202 return VDP_STATUS_INVALID_POINTER
;
204 return VDP_STATUS_NO_IMPLEMENTATION
;
208 vlVdpOutputSurfaceQueryPutBitsYCbCrCapabilities(VdpDevice device
, VdpRGBAFormat surface_rgba_format
,
209 VdpYCbCrFormat bits_ycbcr_format
,
210 VdpBool
*is_supported
)
212 VDPAU_MSG(VDPAU_TRACE
, "[VDPAU] Querying output surfaces put ycrcb cap\n");
214 return VDP_STATUS_INVALID_POINTER
;
216 return VDP_STATUS_NO_IMPLEMENTATION
;
220 vlVdpBitmapSurfaceQueryCapabilities(VdpDevice device
, VdpRGBAFormat surface_rgba_format
,
221 VdpBool
*is_supported
, uint32_t *max_width
, uint32_t *max_height
)
223 VDPAU_MSG(VDPAU_TRACE
, "[VDPAU] Querying bitmap surfaces\n");
224 if (!(is_supported
&& max_width
&& max_height
))
225 return VDP_STATUS_INVALID_POINTER
;
227 return VDP_STATUS_NO_IMPLEMENTATION
;
231 vlVdpVideoMixerQueryFeatureSupport(VdpDevice device
, VdpVideoMixerFeature feature
,
232 VdpBool
*is_supported
)
234 VDPAU_MSG(VDPAU_TRACE
, "[VDPAU] Querying mixer feature support\n");
236 return VDP_STATUS_INVALID_POINTER
;
238 return VDP_STATUS_NO_IMPLEMENTATION
;
242 vlVdpVideoMixerQueryParameterSupport(VdpDevice device
, VdpVideoMixerParameter parameter
,
243 VdpBool
*is_supported
)
246 return VDP_STATUS_INVALID_POINTER
;
248 return VDP_STATUS_NO_IMPLEMENTATION
;
252 vlVdpVideoMixerQueryParameterValueRange(VdpDevice device
, VdpVideoMixerParameter parameter
,
253 void *min_value
, void *max_value
)
255 if (!(min_value
&& max_value
))
256 return VDP_STATUS_INVALID_POINTER
;
258 return VDP_STATUS_NO_IMPLEMENTATION
;
262 vlVdpVideoMixerQueryAttributeSupport(VdpDevice device
, VdpVideoMixerAttribute attribute
,
263 VdpBool
*is_supported
)
266 return VDP_STATUS_INVALID_POINTER
;
268 return VDP_STATUS_NO_IMPLEMENTATION
;
272 vlVdpVideoMixerQueryAttributeValueRange(VdpDevice device
, VdpVideoMixerAttribute attribute
,
273 void *min_value
, void *max_value
)
275 if (!(min_value
&& max_value
))
276 return VDP_STATUS_INVALID_POINTER
;
278 return VDP_STATUS_NO_IMPLEMENTATION
;