1 /**************************************************************************
3 * Copyright 2010 Younes Manton & Thomas Balling Sørensen.
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 #ifndef VDPAU_PRIVATE_H
29 #define VDPAU_PRIVATE_H
33 #include <vdpau/vdpau.h>
34 #include <vdpau/vdpau_x11.h>
36 #include <pipe/p_compiler.h>
37 #include <pipe/p_video_context.h>
39 #include <util/u_debug.h>
41 #include <vl_winsys.h>
43 #define INFORMATION G3DVL VDPAU Driver Shared Library version VER_MAJOR.VER_MINOR
45 #define TOSTRING(x) QUOTEME(x)
46 #define INFORMATION_STRING TOSTRING(INFORMATION)
49 static inline enum pipe_video_chroma_format
50 ChromaToPipe(VdpChromaType vdpau_type
)
53 case VDP_CHROMA_TYPE_420
:
54 return PIPE_VIDEO_CHROMA_FORMAT_420
;
55 case VDP_CHROMA_TYPE_422
:
56 return PIPE_VIDEO_CHROMA_FORMAT_422
;
57 case VDP_CHROMA_TYPE_444
:
58 return PIPE_VIDEO_CHROMA_FORMAT_444
;
66 static inline VdpChromaType
67 PipeToChroma(enum pipe_video_chroma_format pipe_type
)
70 case PIPE_VIDEO_CHROMA_FORMAT_420
:
71 return VDP_CHROMA_TYPE_420
;
72 case PIPE_VIDEO_CHROMA_FORMAT_422
:
73 return VDP_CHROMA_TYPE_422
;
74 case PIPE_VIDEO_CHROMA_FORMAT_444
:
75 return VDP_CHROMA_TYPE_444
;
84 static inline enum pipe_format
85 FormatToPipe(VdpYCbCrFormat vdpau_format
)
87 switch (vdpau_format
) {
88 case VDP_YCBCR_FORMAT_NV12
:
89 return PIPE_FORMAT_NV12
;
90 case VDP_YCBCR_FORMAT_YV12
:
91 return PIPE_FORMAT_YV12
;
92 case VDP_YCBCR_FORMAT_UYVY
:
93 return PIPE_FORMAT_UYVY
;
94 case VDP_YCBCR_FORMAT_YUYV
:
95 return PIPE_FORMAT_YUYV
;
96 case VDP_YCBCR_FORMAT_Y8U8V8A8
: /* Not defined in p_format.h */
98 case VDP_YCBCR_FORMAT_V8U8Y8A8
:
99 return PIPE_FORMAT_VUYA
;
107 static inline enum pipe_format
108 FormatRGBAToPipe(VdpRGBAFormat vdpau_format
)
110 switch (vdpau_format
) {
111 case VDP_RGBA_FORMAT_A8
:
112 return PIPE_FORMAT_A8_UNORM
;
113 case VDP_RGBA_FORMAT_B10G10R10A2
:
114 return PIPE_FORMAT_B10G10R10A2_UNORM
;
115 case VDP_RGBA_FORMAT_B8G8R8A8
:
116 return PIPE_FORMAT_B8G8R8A8_UNORM
;
117 case VDP_RGBA_FORMAT_R10G10B10A2
:
118 return PIPE_FORMAT_R10G10B10A2_UNORM
;
119 case VDP_RGBA_FORMAT_R8G8B8A8
:
120 return PIPE_FORMAT_R8G8B8A8_UNORM
;
128 static inline VdpYCbCrFormat
129 PipeToFormat(enum pipe_format p_format
)
132 case PIPE_FORMAT_NV12
:
133 return VDP_YCBCR_FORMAT_NV12
;
134 case PIPE_FORMAT_YV12
:
135 return VDP_YCBCR_FORMAT_YV12
;
136 case PIPE_FORMAT_UYVY
:
137 return VDP_YCBCR_FORMAT_UYVY
;
138 case PIPE_FORMAT_YUYV
:
139 return VDP_YCBCR_FORMAT_YUYV
;
140 //case PIPE_FORMAT_YUVA:
141 // return VDP_YCBCR_FORMAT_Y8U8V8A8;
142 case PIPE_FORMAT_VUYA
:
143 return VDP_YCBCR_FORMAT_V8U8Y8A8
;
151 static inline enum pipe_video_profile
152 ProfileToPipe(VdpDecoderProfile vdpau_profile
)
154 switch (vdpau_profile
) {
155 case VDP_DECODER_PROFILE_MPEG1
:
156 return PIPE_VIDEO_PROFILE_MPEG1
;
157 case VDP_DECODER_PROFILE_MPEG2_SIMPLE
:
158 return PIPE_VIDEO_PROFILE_MPEG2_SIMPLE
;
159 case VDP_DECODER_PROFILE_MPEG2_MAIN
:
160 return PIPE_VIDEO_PROFILE_MPEG2_MAIN
;
161 case VDP_DECODER_PROFILE_H264_BASELINE
:
162 return PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE
;
163 case VDP_DECODER_PROFILE_H264_MAIN
: /* Not defined in p_format.h */
164 return PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN
;
165 case VDP_DECODER_PROFILE_H264_HIGH
:
166 return PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH
;
168 return PIPE_VIDEO_PROFILE_UNKNOWN
;
176 struct vl_screen
*vscreen
;
177 struct vl_context
*context
;
184 } vlVdpPresentationQueueTarget
;
190 struct pipe_video_compositor
*compositor
;
191 } vlVdpPresentationQueue
;
196 struct pipe_video_compositor
*compositor
;
202 struct pipe_video_buffer
*video_buffer
;
208 struct pipe_surface
*surface
;
209 struct pipe_sampler_view
*sampler_view
;
210 } vlVdpOutputSurface
;
215 struct pipe_video_decoder
*decoder
;
216 struct pipe_video_decode_buffer
*buffer
;
219 typedef uint32_t vlHandle
;
221 boolean
vlCreateHTAB(void);
222 void vlDestroyHTAB(void);
223 vlHandle
vlAddDataHTAB(void *data
);
224 void* vlGetDataHTAB(vlHandle handle
);
225 void vlRemoveDataHTAB(vlHandle handle
);
227 boolean
vlGetFuncFTAB(VdpFuncId function_id
, void **func
);
229 /* Public functions */
230 VdpDeviceCreateX11 vdp_imp_device_create_x11
;
231 VdpPresentationQueueTargetCreateX11 vlVdpPresentationQueueTargetCreateX11
;
233 /* Internal function pointers */
234 VdpGetErrorString vlVdpGetErrorString
;
235 VdpDeviceDestroy vlVdpDeviceDestroy
;
236 VdpGetProcAddress vlVdpGetProcAddress
;
237 VdpGetApiVersion vlVdpGetApiVersion
;
238 VdpGetInformationString vlVdpGetInformationString
;
239 VdpVideoSurfaceQueryCapabilities vlVdpVideoSurfaceQueryCapabilities
;
240 VdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities
;
241 VdpDecoderQueryCapabilities vlVdpDecoderQueryCapabilities
;
242 VdpOutputSurfaceQueryCapabilities vlVdpOutputSurfaceQueryCapabilities
;
243 VdpOutputSurfaceQueryGetPutBitsNativeCapabilities vlVdpOutputSurfaceQueryGetPutBitsNativeCapabilities
;
244 VdpOutputSurfaceQueryPutBitsIndexedCapabilities vlVdpOutputSurfaceQueryPutBitsIndexedCapabilities
;
245 VdpOutputSurfaceQueryPutBitsYCbCrCapabilities vlVdpOutputSurfaceQueryPutBitsYCbCrCapabilities
;
246 VdpBitmapSurfaceQueryCapabilities vlVdpBitmapSurfaceQueryCapabilities
;
247 VdpVideoMixerQueryFeatureSupport vlVdpVideoMixerQueryFeatureSupport
;
248 VdpVideoMixerQueryParameterSupport vlVdpVideoMixerQueryParameterSupport
;
249 VdpVideoMixerQueryParameterValueRange vlVdpVideoMixerQueryParameterValueRange
;
250 VdpVideoMixerQueryAttributeSupport vlVdpVideoMixerQueryAttributeSupport
;
251 VdpVideoMixerQueryAttributeValueRange vlVdpVideoMixerQueryAttributeValueRange
;
252 VdpVideoSurfaceCreate vlVdpVideoSurfaceCreate
;
253 VdpVideoSurfaceDestroy vlVdpVideoSurfaceDestroy
;
254 VdpVideoSurfaceGetParameters vlVdpVideoSurfaceGetParameters
;
255 VdpVideoSurfaceGetBitsYCbCr vlVdpVideoSurfaceGetBitsYCbCr
;
256 VdpVideoSurfacePutBitsYCbCr vlVdpVideoSurfacePutBitsYCbCr
;
257 VdpDecoderCreate vlVdpDecoderCreate
;
258 VdpDecoderDestroy vlVdpDecoderDestroy
;
259 VdpDecoderGetParameters vlVdpDecoderGetParameters
;
260 VdpDecoderRender vlVdpDecoderRender
;
261 VdpOutputSurfaceCreate vlVdpOutputSurfaceCreate
;
262 VdpOutputSurfaceDestroy vlVdpOutputSurfaceDestroy
;
263 VdpOutputSurfaceGetParameters vlVdpOutputSurfaceGetParameters
;
264 VdpOutputSurfaceGetBitsNative vlVdpOutputSurfaceGetBitsNative
;
265 VdpOutputSurfacePutBitsNative vlVdpOutputSurfacePutBitsNative
;
266 VdpOutputSurfacePutBitsIndexed vlVdpOutputSurfacePutBitsIndexed
;
267 VdpOutputSurfacePutBitsYCbCr vlVdpOutputSurfacePutBitsYCbCr
;
268 VdpOutputSurfaceRenderOutputSurface vlVdpOutputSurfaceRenderOutputSurface
;
269 VdpOutputSurfaceRenderBitmapSurface vlVdpOutputSurfaceRenderBitmapSurface
;
270 VdpBitmapSurfaceCreate vlVdpBitmapSurfaceCreate
;
271 VdpBitmapSurfaceDestroy vlVdpBitmapSurfaceDestroy
;
272 VdpBitmapSurfaceGetParameters vlVdpBitmapSurfaceGetParameters
;
273 VdpBitmapSurfacePutBitsNative vlVdpBitmapSurfacePutBitsNative
;
274 VdpPresentationQueueTargetDestroy vlVdpPresentationQueueTargetDestroy
;
275 VdpPresentationQueueCreate vlVdpPresentationQueueCreate
;
276 VdpPresentationQueueDestroy vlVdpPresentationQueueDestroy
;
277 VdpPresentationQueueSetBackgroundColor vlVdpPresentationQueueSetBackgroundColor
;
278 VdpPresentationQueueGetBackgroundColor vlVdpPresentationQueueGetBackgroundColor
;
279 VdpPresentationQueueGetTime vlVdpPresentationQueueGetTime
;
280 VdpPresentationQueueDisplay vlVdpPresentationQueueDisplay
;
281 VdpPresentationQueueBlockUntilSurfaceIdle vlVdpPresentationQueueBlockUntilSurfaceIdle
;
282 VdpPresentationQueueQuerySurfaceStatus vlVdpPresentationQueueQuerySurfaceStatus
;
283 VdpPreemptionCallback vlVdpPreemptionCallback
;
284 VdpPreemptionCallbackRegister vlVdpPreemptionCallbackRegister
;
285 VdpVideoMixerSetFeatureEnables vlVdpVideoMixerSetFeatureEnables
;
286 VdpVideoMixerCreate vlVdpVideoMixerCreate
;
287 VdpVideoMixerRender vlVdpVideoMixerRender
;
288 VdpVideoMixerSetAttributeValues vlVdpVideoMixerSetAttributeValues
;
289 VdpVideoMixerGetFeatureSupport vlVdpVideoMixerGetFeatureSupport
;
290 VdpVideoMixerGetFeatureEnables vlVdpVideoMixerGetFeatureEnables
;
291 VdpVideoMixerGetParameterValues vlVdpVideoMixerGetParameterValues
;
292 VdpVideoMixerGetAttributeValues vlVdpVideoMixerGetAttributeValues
;
293 VdpVideoMixerDestroy vlVdpVideoMixerDestroy
;
294 VdpGenerateCSCMatrix vlVdpGenerateCSCMatrix
;
299 #define VDPAU_TRACE 3
301 static inline void VDPAU_MSG(unsigned int level
, const char *fmt
, ...)
303 static int debug_level
= -1;
305 if (debug_level
== -1) {
306 debug_level
= MAX2(debug_get_num_option("VDPAU_DEBUG", 0), 0);
309 if (level
<= debug_level
) {
312 _debug_vprintf(fmt
, ap
);
317 #endif // VDPAU_PRIVATE_H