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 enum pipe_video_chroma_format
TypeToPipe(VdpChromaType vdpau_type
)
47 case VDP_CHROMA_TYPE_420
:
48 return PIPE_VIDEO_CHROMA_FORMAT_420
;
49 case VDP_CHROMA_TYPE_422
:
50 return PIPE_VIDEO_CHROMA_FORMAT_422
;
51 case VDP_CHROMA_TYPE_444
:
52 return PIPE_VIDEO_CHROMA_FORMAT_444
;
60 static VdpChromaType
PipeToType(enum pipe_video_chroma_format pipe_type
)
63 case PIPE_VIDEO_CHROMA_FORMAT_420
:
64 return VDP_CHROMA_TYPE_420
;
65 case PIPE_VIDEO_CHROMA_FORMAT_422
:
66 return VDP_CHROMA_TYPE_422
;
67 case PIPE_VIDEO_CHROMA_FORMAT_444
:
68 return VDP_CHROMA_TYPE_444
;
77 static enum pipe_format
FormatToPipe(VdpYCbCrFormat vdpau_format
)
79 switch (vdpau_format
) {
80 case VDP_YCBCR_FORMAT_NV12
:
81 return PIPE_FORMAT_NV12
;
82 case VDP_YCBCR_FORMAT_YV12
:
83 return PIPE_FORMAT_YV12
;
84 case VDP_YCBCR_FORMAT_UYVY
:
85 return PIPE_FORMAT_UYVY
;
86 case VDP_YCBCR_FORMAT_YUYV
:
87 return PIPE_FORMAT_YUYV
;
88 case VDP_YCBCR_FORMAT_Y8U8V8A8
: /* Not defined in p_format.h */
90 case VDP_YCBCR_FORMAT_V8U8Y8A8
:
91 return PIPE_FORMAT_VUYA
;
99 static enum pipe_format
FormatRGBAToPipe(VdpRGBAFormat vdpau_format
)
101 switch (vdpau_format
) {
102 case VDP_RGBA_FORMAT_A8
:
103 return PIPE_FORMAT_A8_UNORM
;
104 case VDP_RGBA_FORMAT_B10G10R10A2
:
105 return PIPE_FORMAT_B10G10R10A2_UNORM
;
106 case VDP_RGBA_FORMAT_B8G8R8A8
:
107 return PIPE_FORMAT_B8G8R8A8_UNORM
;
108 case VDP_RGBA_FORMAT_R10G10B10A2
:
109 return PIPE_FORMAT_R10G10B10A2_UNORM
;
110 case VDP_RGBA_FORMAT_R8G8B8A8
:
111 return PIPE_FORMAT_R8G8B8A8_UNORM
;
119 static VdpYCbCrFormat
PipeToFormat(enum pipe_format p_format
)
122 case PIPE_FORMAT_NV12
:
123 return VDP_YCBCR_FORMAT_NV12
;
124 case PIPE_FORMAT_YV12
:
125 return VDP_YCBCR_FORMAT_YV12
;
126 case PIPE_FORMAT_UYVY
:
127 return VDP_YCBCR_FORMAT_UYVY
;
128 case PIPE_FORMAT_YUYV
:
129 return VDP_YCBCR_FORMAT_YUYV
;
130 //case PIPE_FORMAT_YUVA:
131 // return VDP_YCBCR_FORMAT_Y8U8V8A8;
132 case PIPE_FORMAT_VUYA
:
133 return VDP_YCBCR_FORMAT_V8U8Y8A8
;
141 static enum pipe_video_profile
ProfileToPipe(VdpDecoderProfile vdpau_profile
)
143 switch (vdpau_profile
) {
144 case VDP_DECODER_PROFILE_MPEG1
:
145 return PIPE_VIDEO_PROFILE_MPEG1
;
146 case VDP_DECODER_PROFILE_MPEG2_SIMPLE
:
147 return PIPE_VIDEO_PROFILE_MPEG2_SIMPLE
;
148 case VDP_DECODER_PROFILE_MPEG2_MAIN
:
149 return PIPE_VIDEO_PROFILE_MPEG2_MAIN
;
150 case VDP_DECODER_PROFILE_H264_BASELINE
:
151 return PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE
;
152 case VDP_DECODER_PROFILE_H264_MAIN
: /* Not defined in p_format.h */
153 return PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN
;
154 case VDP_DECODER_PROFILE_H264_HIGH
:
155 return PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH
;
157 PIPE_VIDEO_PROFILE_UNKNOWN
;
167 struct vl_screen
*vscreen
;
174 } vlVdpPresentationQueueTarget
;
180 } vlVdpPresentationQueue
;
190 enum pipe_video_chroma_format chroma_format
;
195 //struct pipe_surface *psurface;
204 enum pipe_format format
;
205 } vlVdpOutputSurface
;
210 struct vl_context
*vctx
;
211 enum pipe_video_chroma_format chroma_format
;
212 enum pipe_video_profile profile
;
217 typedef uint32_t vlHandle
;
219 boolean
vlCreateHTAB(void);
220 void vlDestroyHTAB(void);
221 vlHandle
vlAddDataHTAB(void *data
);
222 void* vlGetDataHTAB(vlHandle handle
);
223 boolean
vlGetFuncFTAB(VdpFuncId function_id
, void **func
);
225 /* Public functions */
226 VdpDeviceCreateX11 vdp_imp_device_create_x11
;
227 VdpPresentationQueueTargetCreateX11 vlVdpPresentationQueueTargetCreateX11
;
229 /* Internal function pointers */
230 VdpGetErrorString vlVdpGetErrorString
;
231 VdpDeviceDestroy vlVdpDeviceDestroy
;
232 VdpGetProcAddress vlVdpGetProcAddress
;
233 VdpGetApiVersion vlVdpGetApiVersion
;
234 VdpGetInformationString vlVdpGetInformationString
;
235 VdpVideoSurfaceQueryCapabilities vlVdpVideoSurfaceQueryCapabilities
;
236 VdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities
;
237 VdpDecoderQueryCapabilities vlVdpDecoderQueryCapabilities
;
238 VdpOutputSurfaceQueryCapabilities vlVdpOutputSurfaceQueryCapabilities
;
239 VdpOutputSurfaceQueryGetPutBitsNativeCapabilities vlVdpOutputSurfaceQueryGetPutBitsNativeCapabilities
;
240 VdpOutputSurfaceQueryPutBitsYCbCrCapabilities vlVdpOutputSurfaceQueryPutBitsYCbCrCapabilities
;
241 VdpBitmapSurfaceQueryCapabilities vlVdpBitmapSurfaceQueryCapabilities
;
242 VdpVideoMixerQueryFeatureSupport vlVdpVideoMixerQueryFeatureSupport
;
243 VdpVideoMixerQueryParameterSupport vlVdpVideoMixerQueryParameterSupport
;
244 VdpVideoMixerQueryParameterValueRange vlVdpVideoMixerQueryParameterValueRange
;
245 VdpVideoMixerQueryAttributeSupport vlVdpVideoMixerQueryAttributeSupport
;
246 VdpVideoMixerQueryAttributeValueRange vlVdpVideoMixerQueryAttributeValueRange
;
247 VdpVideoSurfaceCreate vlVdpVideoSurfaceCreate
;
248 VdpVideoSurfaceDestroy vlVdpVideoSurfaceDestroy
;
249 VdpVideoSurfaceGetParameters vlVdpVideoSurfaceGetParameters
;
250 VdpVideoSurfaceGetBitsYCbCr vlVdpVideoSurfaceGetBitsYCbCr
;
251 VdpVideoSurfacePutBitsYCbCr vlVdpVideoSurfacePutBitsYCbCr
;
252 VdpDecoderCreate vlVdpDecoderCreate
;
253 VdpDecoderDestroy vlVdpDecoderDestroy
;
254 VdpDecoderRender vlVdpDecoderRender
;
255 VdpOutputSurfaceCreate vlVdpOutputSurfaceCreate
;
256 VdpBitmapSurfaceCreate vlVdpBitmapSurfaceCreate
;
257 VdpBitmapSurfaceDestroy vlVdpBitmapSurfaceDestroy
;
258 VdpBitmapSurfaceGetParameters vlVdpBitmapSurfaceGetParameters
;
259 VdpBitmapSurfacePutBitsNative vlVdpBitmapSurfacePutBitsNative
;
260 VdpPresentationQueueTargetDestroy vlVdpPresentationQueueTargetDestroy
;
261 VdpPresentationQueueCreate vlVdpPresentationQueueCreate
;
262 VdpPresentationQueueDestroy vlVdpPresentationQueueDestroy
;
263 VdpPresentationQueueSetBackgroundColor vlVdpPresentationQueueSetBackgroundColor
;
264 VdpPresentationQueueGetBackgroundColor vlVdpPresentationQueueGetBackgroundColor
;
265 VdpPresentationQueueGetTime vlVdpPresentationQueueGetTime
;
266 VdpPresentationQueueDisplay vlVdpPresentationQueueDisplay
;
267 VdpPresentationQueueBlockUntilSurfaceIdle vlVdpPresentationQueueBlockUntilSurfaceIdle
;
268 VdpPresentationQueueQuerySurfaceStatus vlVdpPresentationQueueQuerySurfaceStatus
;
269 VdpPreemptionCallback vlVdpPreemptionCallback
;
270 VdpPreemptionCallbackRegister vlVdpPreemptionCallbackRegister
;
271 VdpVideoMixerSetFeatureEnables vlVdpVideoMixerSetFeatureEnables
;
272 VdpVideoMixerCreate vlVdpVideoMixerCreate
;
273 VdpVideoMixerRender vlVdpVideoMixerRender
;
274 VdpVideoMixerSetAttributeValues vlVdpVideoMixerSetAttributeValues
;
275 VdpGenerateCSCMatrix vlVdpGenerateCSCMatrix
;
277 #endif // VDPAU_PRIVATE_H