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
31 #include <vdpau/vdpau.h>
32 #include <vdpau/vdpau_x11.h>
33 #include <pipe/p_compiler.h>
34 #include <pipe/p_video_context.h>
35 #include <vl_winsys.h>
38 #define INFORMATION G3DVL VDPAU Driver Shared Library version VER_MAJOR.VER_MINOR
40 #define TOSTRING(x) QUOTEME(x)
41 #define INFORMATION_STRING TOSTRING(INFORMATION)
44 static inline enum pipe_video_chroma_format
45 ChromaToPipe(VdpChromaType vdpau_type
)
48 case VDP_CHROMA_TYPE_420
:
49 return PIPE_VIDEO_CHROMA_FORMAT_420
;
50 case VDP_CHROMA_TYPE_422
:
51 return PIPE_VIDEO_CHROMA_FORMAT_422
;
52 case VDP_CHROMA_TYPE_444
:
53 return PIPE_VIDEO_CHROMA_FORMAT_444
;
61 static inline VdpChromaType
62 PipeToChroma(enum pipe_video_chroma_format pipe_type
)
65 case PIPE_VIDEO_CHROMA_FORMAT_420
:
66 return VDP_CHROMA_TYPE_420
;
67 case PIPE_VIDEO_CHROMA_FORMAT_422
:
68 return VDP_CHROMA_TYPE_422
;
69 case PIPE_VIDEO_CHROMA_FORMAT_444
:
70 return VDP_CHROMA_TYPE_444
;
79 static inline enum pipe_format
80 FormatToPipe(VdpYCbCrFormat vdpau_format
)
82 switch (vdpau_format
) {
83 case VDP_YCBCR_FORMAT_NV12
:
84 return PIPE_FORMAT_NV12
;
85 case VDP_YCBCR_FORMAT_YV12
:
86 return PIPE_FORMAT_YV12
;
87 case VDP_YCBCR_FORMAT_UYVY
:
88 return PIPE_FORMAT_UYVY
;
89 case VDP_YCBCR_FORMAT_YUYV
:
90 return PIPE_FORMAT_YUYV
;
91 case VDP_YCBCR_FORMAT_Y8U8V8A8
: /* Not defined in p_format.h */
93 case VDP_YCBCR_FORMAT_V8U8Y8A8
:
94 return PIPE_FORMAT_VUYA
;
102 static inline enum pipe_format
103 FormatRGBAToPipe(VdpRGBAFormat vdpau_format
)
105 switch (vdpau_format
) {
106 case VDP_RGBA_FORMAT_A8
:
107 return PIPE_FORMAT_A8_UNORM
;
108 case VDP_RGBA_FORMAT_B10G10R10A2
:
109 return PIPE_FORMAT_B10G10R10A2_UNORM
;
110 case VDP_RGBA_FORMAT_B8G8R8A8
:
111 return PIPE_FORMAT_B8G8R8A8_UNORM
;
112 case VDP_RGBA_FORMAT_R10G10B10A2
:
113 return PIPE_FORMAT_R10G10B10A2_UNORM
;
114 case VDP_RGBA_FORMAT_R8G8B8A8
:
115 return PIPE_FORMAT_R8G8B8A8_UNORM
;
123 static inline VdpYCbCrFormat
124 PipeToFormat(enum pipe_format p_format
)
127 case PIPE_FORMAT_NV12
:
128 return VDP_YCBCR_FORMAT_NV12
;
129 case PIPE_FORMAT_YV12
:
130 return VDP_YCBCR_FORMAT_YV12
;
131 case PIPE_FORMAT_UYVY
:
132 return VDP_YCBCR_FORMAT_UYVY
;
133 case PIPE_FORMAT_YUYV
:
134 return VDP_YCBCR_FORMAT_YUYV
;
135 //case PIPE_FORMAT_YUVA:
136 // return VDP_YCBCR_FORMAT_Y8U8V8A8;
137 case PIPE_FORMAT_VUYA
:
138 return VDP_YCBCR_FORMAT_V8U8Y8A8
;
146 static inline enum pipe_video_profile
147 ProfileToPipe(VdpDecoderProfile vdpau_profile
)
149 switch (vdpau_profile
) {
150 case VDP_DECODER_PROFILE_MPEG1
:
151 return PIPE_VIDEO_PROFILE_MPEG1
;
152 case VDP_DECODER_PROFILE_MPEG2_SIMPLE
:
153 return PIPE_VIDEO_PROFILE_MPEG2_SIMPLE
;
154 case VDP_DECODER_PROFILE_MPEG2_MAIN
:
155 return PIPE_VIDEO_PROFILE_MPEG2_MAIN
;
156 case VDP_DECODER_PROFILE_H264_BASELINE
:
157 return PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE
;
158 case VDP_DECODER_PROFILE_H264_MAIN
: /* Not defined in p_format.h */
159 return PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN
;
160 case VDP_DECODER_PROFILE_H264_HIGH
:
161 return PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH
;
163 PIPE_VIDEO_PROFILE_UNKNOWN
;
173 struct vl_screen
*vscreen
;
174 struct vl_context
*context
;
181 } vlVdpPresentationQueueTarget
;
187 } vlVdpPresentationQueue
;
197 struct pipe_video_buffer
*video_buffer
;
205 enum pipe_format format
;
206 } vlVdpOutputSurface
;
211 struct vl_context
*vctx
;
212 enum pipe_video_chroma_format chroma_format
;
213 enum pipe_video_profile profile
;
218 typedef uint32_t vlHandle
;
220 boolean
vlCreateHTAB(void);
221 void vlDestroyHTAB(void);
222 vlHandle
vlAddDataHTAB(void *data
);
223 void* vlGetDataHTAB(vlHandle handle
);
224 boolean
vlGetFuncFTAB(VdpFuncId function_id
, void **func
);
226 /* Public functions */
227 VdpDeviceCreateX11 vdp_imp_device_create_x11
;
228 VdpPresentationQueueTargetCreateX11 vlVdpPresentationQueueTargetCreateX11
;
230 /* Internal function pointers */
231 VdpGetErrorString vlVdpGetErrorString
;
232 VdpDeviceDestroy vlVdpDeviceDestroy
;
233 VdpGetProcAddress vlVdpGetProcAddress
;
234 VdpGetApiVersion vlVdpGetApiVersion
;
235 VdpGetInformationString vlVdpGetInformationString
;
236 VdpVideoSurfaceQueryCapabilities vlVdpVideoSurfaceQueryCapabilities
;
237 VdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities
;
238 VdpDecoderQueryCapabilities vlVdpDecoderQueryCapabilities
;
239 VdpOutputSurfaceQueryCapabilities vlVdpOutputSurfaceQueryCapabilities
;
240 VdpOutputSurfaceQueryGetPutBitsNativeCapabilities vlVdpOutputSurfaceQueryGetPutBitsNativeCapabilities
;
241 VdpOutputSurfaceQueryPutBitsYCbCrCapabilities vlVdpOutputSurfaceQueryPutBitsYCbCrCapabilities
;
242 VdpBitmapSurfaceQueryCapabilities vlVdpBitmapSurfaceQueryCapabilities
;
243 VdpVideoMixerQueryFeatureSupport vlVdpVideoMixerQueryFeatureSupport
;
244 VdpVideoMixerQueryParameterSupport vlVdpVideoMixerQueryParameterSupport
;
245 VdpVideoMixerQueryParameterValueRange vlVdpVideoMixerQueryParameterValueRange
;
246 VdpVideoMixerQueryAttributeSupport vlVdpVideoMixerQueryAttributeSupport
;
247 VdpVideoMixerQueryAttributeValueRange vlVdpVideoMixerQueryAttributeValueRange
;
248 VdpVideoSurfaceCreate vlVdpVideoSurfaceCreate
;
249 VdpVideoSurfaceDestroy vlVdpVideoSurfaceDestroy
;
250 VdpVideoSurfaceGetParameters vlVdpVideoSurfaceGetParameters
;
251 VdpVideoSurfaceGetBitsYCbCr vlVdpVideoSurfaceGetBitsYCbCr
;
252 VdpVideoSurfacePutBitsYCbCr vlVdpVideoSurfacePutBitsYCbCr
;
253 VdpDecoderCreate vlVdpDecoderCreate
;
254 VdpDecoderDestroy vlVdpDecoderDestroy
;
255 VdpDecoderRender vlVdpDecoderRender
;
256 VdpOutputSurfaceCreate vlVdpOutputSurfaceCreate
;
257 VdpBitmapSurfaceCreate vlVdpBitmapSurfaceCreate
;
258 VdpBitmapSurfaceDestroy vlVdpBitmapSurfaceDestroy
;
259 VdpBitmapSurfaceGetParameters vlVdpBitmapSurfaceGetParameters
;
260 VdpBitmapSurfacePutBitsNative vlVdpBitmapSurfacePutBitsNative
;
261 VdpPresentationQueueTargetDestroy vlVdpPresentationQueueTargetDestroy
;
262 VdpPresentationQueueCreate vlVdpPresentationQueueCreate
;
263 VdpPresentationQueueDestroy vlVdpPresentationQueueDestroy
;
264 VdpPresentationQueueSetBackgroundColor vlVdpPresentationQueueSetBackgroundColor
;
265 VdpPresentationQueueGetBackgroundColor vlVdpPresentationQueueGetBackgroundColor
;
266 VdpPresentationQueueGetTime vlVdpPresentationQueueGetTime
;
267 VdpPresentationQueueDisplay vlVdpPresentationQueueDisplay
;
268 VdpPresentationQueueBlockUntilSurfaceIdle vlVdpPresentationQueueBlockUntilSurfaceIdle
;
269 VdpPresentationQueueQuerySurfaceStatus vlVdpPresentationQueueQuerySurfaceStatus
;
270 VdpPreemptionCallback vlVdpPreemptionCallback
;
271 VdpPreemptionCallbackRegister vlVdpPreemptionCallbackRegister
;
272 VdpVideoMixerSetFeatureEnables vlVdpVideoMixerSetFeatureEnables
;
273 VdpVideoMixerCreate vlVdpVideoMixerCreate
;
274 VdpVideoMixerRender vlVdpVideoMixerRender
;
275 VdpVideoMixerSetAttributeValues vlVdpVideoMixerSetAttributeValues
;
276 VdpGenerateCSCMatrix vlVdpGenerateCSCMatrix
;
278 #endif // VDPAU_PRIVATE_H