1 /**************************************************************************
2 *
3 * Copyright 2010 Younes Manton & Thomas Balling Sørensen.
4 * All Rights Reserved.
5 *
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:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
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 VMWARE 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.
25 *
26 **************************************************************************/
27
28 #ifndef VDPAU_PRIVATE_H
29 #define VDPAU_PRIVATE_H
30
31 #include <assert.h>
32
33 #include <vdpau/vdpau.h>
34 #include <vdpau/vdpau_x11.h>
35
36 #include "pipe/p_compiler.h"
37 #include "pipe/p_video_codec.h"
38
39 #include "frontend/vdpau_interop.h"
40 #include "frontend/vdpau_dmabuf.h"
41 #include "frontend/vdpau_funcs.h"
42
43 #include "util/u_debug.h"
44 #include "util/u_rect.h"
45 #include "os/os_thread.h"
46
47 #include "vl/vl_video_buffer.h"
48 #include "vl/vl_bicubic_filter.h"
49 #include "vl/vl_compositor.h"
50 #include "vl/vl_csc.h"
51 #include "vl/vl_deint_filter.h"
52 #include "vl/vl_matrix_filter.h"
53 #include "vl/vl_median_filter.h"
54 #include "vl/vl_winsys.h"
55
56 /* Full VDPAU API documentation available at :
57 * ftp://download.nvidia.com/XFree86/vdpau/doxygen/html/index.html */
58
59 #define INFORMATION G3DVL VDPAU Driver Shared Library version VER_MAJOR.VER_MINOR
60 #define QUOTEME(x) #x
61 #define TOSTRING(x) QUOTEME(x)
62 #define INFORMATION_STRING TOSTRING(INFORMATION)
63
64 static inline enum pipe_video_chroma_format
ChromaToPipe(VdpChromaType vdpau_type)65 ChromaToPipe(VdpChromaType vdpau_type)
66 {
67 switch (vdpau_type) {
68 case VDP_CHROMA_TYPE_420:
69 return PIPE_VIDEO_CHROMA_FORMAT_420;
70 case VDP_CHROMA_TYPE_422:
71 return PIPE_VIDEO_CHROMA_FORMAT_422;
72 case VDP_CHROMA_TYPE_444:
73 return PIPE_VIDEO_CHROMA_FORMAT_444;
74 default:
75 assert(0);
76 }
77
78 return -1;
79 }
80
81 static inline VdpChromaType
PipeToChroma(enum pipe_video_chroma_format pipe_type)82 PipeToChroma(enum pipe_video_chroma_format pipe_type)
83 {
84 switch (pipe_type) {
85 case PIPE_VIDEO_CHROMA_FORMAT_420:
86 return VDP_CHROMA_TYPE_420;
87 case PIPE_VIDEO_CHROMA_FORMAT_422:
88 return VDP_CHROMA_TYPE_422;
89 case PIPE_VIDEO_CHROMA_FORMAT_444:
90 return VDP_CHROMA_TYPE_444;
91 default:
92 assert(0);
93 }
94
95 return -1;
96 }
97
98 static inline enum pipe_video_chroma_format
FormatYCBCRToPipeChroma(VdpYCbCrFormat vdpau_format)99 FormatYCBCRToPipeChroma(VdpYCbCrFormat vdpau_format)
100 {
101 switch (vdpau_format) {
102 case VDP_YCBCR_FORMAT_NV12:
103 return PIPE_VIDEO_CHROMA_FORMAT_420;
104 case VDP_YCBCR_FORMAT_YV12:
105 return PIPE_VIDEO_CHROMA_FORMAT_420;
106 case VDP_YCBCR_FORMAT_UYVY:
107 return PIPE_VIDEO_CHROMA_FORMAT_422;
108 case VDP_YCBCR_FORMAT_YUYV:
109 return PIPE_VIDEO_CHROMA_FORMAT_422;
110 case VDP_YCBCR_FORMAT_Y8U8V8A8:
111 return PIPE_VIDEO_CHROMA_FORMAT_444;
112 case VDP_YCBCR_FORMAT_V8U8Y8A8:
113 return PIPE_VIDEO_CHROMA_FORMAT_444;
114 default:
115 assert(0);
116 }
117
118 return PIPE_VIDEO_CHROMA_FORMAT_NONE;
119 }
120
121 static inline enum pipe_format
FormatYCBCRToPipe(VdpYCbCrFormat vdpau_format)122 FormatYCBCRToPipe(VdpYCbCrFormat vdpau_format)
123 {
124 switch (vdpau_format) {
125 case VDP_YCBCR_FORMAT_NV12:
126 return PIPE_FORMAT_NV12;
127 case VDP_YCBCR_FORMAT_YV12:
128 return PIPE_FORMAT_YV12;
129 case VDP_YCBCR_FORMAT_UYVY:
130 return PIPE_FORMAT_UYVY;
131 case VDP_YCBCR_FORMAT_YUYV:
132 return PIPE_FORMAT_YUYV;
133 case VDP_YCBCR_FORMAT_Y8U8V8A8:
134 return PIPE_FORMAT_R8G8B8A8_UNORM;
135 case VDP_YCBCR_FORMAT_V8U8Y8A8:
136 return PIPE_FORMAT_B8G8R8A8_UNORM;
137 #ifdef VDP_YCBCR_FORMAT_P010
138 case VDP_YCBCR_FORMAT_P010:
139 return PIPE_FORMAT_P010;
140 #endif
141 #ifdef VDP_YCBCR_FORMAT_P016
142 case VDP_YCBCR_FORMAT_P016:
143 return PIPE_FORMAT_P016;
144 #endif
145 default:
146 /* NOTE: Can't be "unreachable", as it's quite reachable. */
147 assert(!"unexpected VdpYCbCrFormat");
148 #ifdef VDP_YCBCR_FORMAT_Y_UV_444
149 case VDP_YCBCR_FORMAT_Y_UV_444:
150 #endif
151 #ifdef VDP_YCBCR_FORMAT_Y_U_V_444
152 case VDP_YCBCR_FORMAT_Y_U_V_444:
153 #endif
154 #ifdef VDP_YCBCR_FORMAT_Y_U_V_444_16
155 case VDP_YCBCR_FORMAT_Y_U_V_444_16:
156 #endif
157 return PIPE_FORMAT_NONE;
158 }
159
160 }
161
162 static inline VdpYCbCrFormat
PipeToFormatYCBCR(enum pipe_format p_format)163 PipeToFormatYCBCR(enum pipe_format p_format)
164 {
165 switch (p_format) {
166 case PIPE_FORMAT_NV12:
167 return VDP_YCBCR_FORMAT_NV12;
168 case PIPE_FORMAT_YV12:
169 return VDP_YCBCR_FORMAT_YV12;
170 case PIPE_FORMAT_UYVY:
171 return VDP_YCBCR_FORMAT_UYVY;
172 case PIPE_FORMAT_YUYV:
173 return VDP_YCBCR_FORMAT_YUYV;
174 case PIPE_FORMAT_R8G8B8A8_UNORM:
175 return VDP_YCBCR_FORMAT_Y8U8V8A8;
176 case PIPE_FORMAT_B8G8R8A8_UNORM:
177 return VDP_YCBCR_FORMAT_V8U8Y8A8;
178 default:
179 assert(0);
180 }
181
182 return -1;
183 }
184
185 static inline VdpRGBAFormat
PipeToFormatRGBA(enum pipe_format p_format)186 PipeToFormatRGBA(enum pipe_format p_format)
187 {
188 switch (p_format) {
189 case PIPE_FORMAT_A8_UNORM:
190 return VDP_RGBA_FORMAT_A8;
191 case PIPE_FORMAT_B10G10R10A2_UNORM:
192 return VDP_RGBA_FORMAT_B10G10R10A2;
193 case PIPE_FORMAT_B8G8R8A8_UNORM:
194 return VDP_RGBA_FORMAT_B8G8R8A8;
195 case PIPE_FORMAT_R10G10B10A2_UNORM:
196 return VDP_RGBA_FORMAT_R10G10B10A2;
197 case PIPE_FORMAT_R8G8B8A8_UNORM:
198 return VDP_RGBA_FORMAT_R8G8B8A8;
199 default:
200 assert(0);
201 }
202
203 return -1;
204 }
205
206 static inline enum pipe_format
FormatIndexedToPipe(VdpRGBAFormat vdpau_format)207 FormatIndexedToPipe(VdpRGBAFormat vdpau_format)
208 {
209 switch (vdpau_format) {
210 case VDP_INDEXED_FORMAT_A4I4:
211 return PIPE_FORMAT_R4A4_UNORM;
212 case VDP_INDEXED_FORMAT_I4A4:
213 return PIPE_FORMAT_A4R4_UNORM;
214 case VDP_INDEXED_FORMAT_A8I8:
215 return PIPE_FORMAT_A8R8_UNORM;
216 case VDP_INDEXED_FORMAT_I8A8:
217 return PIPE_FORMAT_R8A8_UNORM;
218 default:
219 assert(0);
220 }
221
222 return PIPE_FORMAT_NONE;
223 }
224
225 static inline enum pipe_format
FormatColorTableToPipe(VdpColorTableFormat vdpau_format)226 FormatColorTableToPipe(VdpColorTableFormat vdpau_format)
227 {
228 switch(vdpau_format) {
229 case VDP_COLOR_TABLE_FORMAT_B8G8R8X8:
230 return PIPE_FORMAT_B8G8R8X8_UNORM;
231 default:
232 assert(0);
233 }
234
235 return PIPE_FORMAT_NONE;
236 }
237
238 static inline enum pipe_video_profile
ProfileToPipe(VdpDecoderProfile vdpau_profile)239 ProfileToPipe(VdpDecoderProfile vdpau_profile)
240 {
241 switch (vdpau_profile) {
242 case VDP_DECODER_PROFILE_MPEG1:
243 return PIPE_VIDEO_PROFILE_MPEG1;
244 case VDP_DECODER_PROFILE_MPEG2_SIMPLE:
245 return PIPE_VIDEO_PROFILE_MPEG2_SIMPLE;
246 case VDP_DECODER_PROFILE_MPEG2_MAIN:
247 return PIPE_VIDEO_PROFILE_MPEG2_MAIN;
248 case VDP_DECODER_PROFILE_H264_BASELINE:
249 return PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE;
250 case VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE:
251 return PIPE_VIDEO_PROFILE_MPEG4_AVC_CONSTRAINED_BASELINE;
252 case VDP_DECODER_PROFILE_H264_MAIN:
253 return PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN;
254 case VDP_DECODER_PROFILE_H264_HIGH:
255 return PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH;
256 case VDP_DECODER_PROFILE_MPEG4_PART2_SP:
257 return PIPE_VIDEO_PROFILE_MPEG4_SIMPLE;
258 case VDP_DECODER_PROFILE_MPEG4_PART2_ASP:
259 return PIPE_VIDEO_PROFILE_MPEG4_ADVANCED_SIMPLE;
260 case VDP_DECODER_PROFILE_VC1_SIMPLE:
261 return PIPE_VIDEO_PROFILE_VC1_SIMPLE;
262 case VDP_DECODER_PROFILE_VC1_MAIN:
263 return PIPE_VIDEO_PROFILE_VC1_MAIN;
264 case VDP_DECODER_PROFILE_VC1_ADVANCED:
265 return PIPE_VIDEO_PROFILE_VC1_ADVANCED;
266 case VDP_DECODER_PROFILE_HEVC_MAIN:
267 return PIPE_VIDEO_PROFILE_HEVC_MAIN;
268 case VDP_DECODER_PROFILE_HEVC_MAIN_10:
269 return PIPE_VIDEO_PROFILE_HEVC_MAIN_10;
270 case VDP_DECODER_PROFILE_HEVC_MAIN_STILL:
271 return PIPE_VIDEO_PROFILE_HEVC_MAIN_STILL;
272 case VDP_DECODER_PROFILE_HEVC_MAIN_12:
273 return PIPE_VIDEO_PROFILE_HEVC_MAIN_12;
274 case VDP_DECODER_PROFILE_HEVC_MAIN_444:
275 return PIPE_VIDEO_PROFILE_HEVC_MAIN_444;
276 default:
277 return PIPE_VIDEO_PROFILE_UNKNOWN;
278 }
279 }
280
281 static inline VdpDecoderProfile
PipeToProfile(enum pipe_video_profile p_profile)282 PipeToProfile(enum pipe_video_profile p_profile)
283 {
284 switch (p_profile) {
285 case PIPE_VIDEO_PROFILE_MPEG1:
286 return VDP_DECODER_PROFILE_MPEG1;
287 case PIPE_VIDEO_PROFILE_MPEG2_SIMPLE:
288 return VDP_DECODER_PROFILE_MPEG2_SIMPLE;
289 case PIPE_VIDEO_PROFILE_MPEG2_MAIN:
290 return VDP_DECODER_PROFILE_MPEG2_MAIN;
291 case PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE:
292 return VDP_DECODER_PROFILE_H264_BASELINE;
293 case PIPE_VIDEO_PROFILE_MPEG4_AVC_CONSTRAINED_BASELINE:
294 return VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE;
295 case PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN:
296 return VDP_DECODER_PROFILE_H264_MAIN;
297 case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH:
298 return VDP_DECODER_PROFILE_H264_HIGH;
299 case PIPE_VIDEO_PROFILE_MPEG4_SIMPLE:
300 return VDP_DECODER_PROFILE_MPEG4_PART2_SP;
301 case PIPE_VIDEO_PROFILE_MPEG4_ADVANCED_SIMPLE:
302 return VDP_DECODER_PROFILE_MPEG4_PART2_ASP;
303 case PIPE_VIDEO_PROFILE_VC1_SIMPLE:
304 return VDP_DECODER_PROFILE_VC1_SIMPLE;
305 case PIPE_VIDEO_PROFILE_VC1_MAIN:
306 return VDP_DECODER_PROFILE_VC1_MAIN;
307 case PIPE_VIDEO_PROFILE_VC1_ADVANCED:
308 return VDP_DECODER_PROFILE_VC1_ADVANCED;
309 case PIPE_VIDEO_PROFILE_HEVC_MAIN:
310 return VDP_DECODER_PROFILE_HEVC_MAIN;
311 case PIPE_VIDEO_PROFILE_HEVC_MAIN_10:
312 return VDP_DECODER_PROFILE_HEVC_MAIN_10;
313 case PIPE_VIDEO_PROFILE_HEVC_MAIN_STILL:
314 return VDP_DECODER_PROFILE_HEVC_MAIN_STILL;
315 case PIPE_VIDEO_PROFILE_HEVC_MAIN_12:
316 return VDP_DECODER_PROFILE_HEVC_MAIN_12;
317 case PIPE_VIDEO_PROFILE_HEVC_MAIN_444:
318 return VDP_DECODER_PROFILE_HEVC_MAIN_444;
319 default:
320 assert(0);
321 return -1;
322 }
323 }
324
325 static inline struct u_rect *
RectToPipe(const VdpRect * src,struct u_rect * dst)326 RectToPipe(const VdpRect *src, struct u_rect *dst)
327 {
328 if (src) {
329 dst->x0 = src->x0;
330 dst->y0 = src->y0;
331 dst->x1 = src->x1;
332 dst->y1 = src->y1;
333 return dst;
334 }
335 return NULL;
336 }
337
338 static inline struct pipe_box
RectToPipeBox(const VdpRect * rect,struct pipe_resource * res)339 RectToPipeBox(const VdpRect *rect, struct pipe_resource *res)
340 {
341 struct pipe_box box;
342
343 box.x = 0;
344 box.y = 0;
345 box.z = 0;
346 box.width = res->width0;
347 box.height = res->height0;
348 box.depth = 1;
349
350 if (rect) {
351 if (rect->x1 > rect->x0 &&
352 rect->y1 > rect->y0) {
353 box.x = rect->x0;
354 box.y = rect->y0;
355 box.width = rect->x1 - box.x;
356 box.height = rect->y1 - box.y;
357 } else {
358 box.width = 0;
359 box.height = 0;
360 }
361 }
362
363 return box;
364 }
365
366 static inline bool
CheckSurfaceParams(struct pipe_screen * screen,const struct pipe_resource * templ)367 CheckSurfaceParams(struct pipe_screen *screen,
368 const struct pipe_resource *templ)
369 {
370 return screen->is_format_supported(screen, templ->format, templ->target,
371 templ->nr_samples,
372 templ->nr_storage_samples, templ->bind);
373 }
374
375 typedef struct
376 {
377 struct pipe_reference reference;
378 struct vl_screen *vscreen;
379 struct pipe_context *context;
380 struct vl_compositor compositor;
381 struct pipe_sampler_view *dummy_sv;
382 mtx_t mutex;
383 } vlVdpDevice;
384
385 typedef struct
386 {
387 vlVdpDevice *device;
388 struct vl_compositor_state cstate;
389
390 struct {
391 bool supported, enabled;
392 float luma_min, luma_max;
393 } luma_key;
394
395 struct {
396 bool supported, enabled, spatial;
397 struct vl_deint_filter *filter;
398 } deint;
399
400 struct {
401 bool supported, enabled;
402 struct vl_bicubic_filter *filter;
403 } bicubic;
404
405 struct {
406 bool supported, enabled;
407 unsigned level;
408 struct vl_median_filter *filter;
409 } noise_reduction;
410
411 struct {
412 bool supported, enabled;
413 float value;
414 struct vl_matrix_filter *filter;
415 } sharpness;
416
417 unsigned video_width, video_height;
418 enum pipe_video_chroma_format chroma_format;
419 unsigned max_layers, skip_chroma_deint;
420
421 bool custom_csc;
422 vl_csc_matrix csc;
423 } vlVdpVideoMixer;
424
425 typedef struct
426 {
427 vlVdpDevice *device;
428 struct pipe_video_buffer templat, *video_buffer;
429 } vlVdpSurface;
430
431 typedef struct
432 {
433 vlVdpDevice *device;
434 struct pipe_sampler_view *sampler_view;
435 } vlVdpBitmapSurface;
436
437 typedef uint64_t vlVdpTime;
438
439 typedef struct
440 {
441 vlVdpDevice *device;
442 struct pipe_surface *surface;
443 struct pipe_sampler_view *sampler_view;
444 struct pipe_fence_handle *fence;
445 struct vl_compositor_state cstate;
446 struct u_rect dirty_area;
447 bool send_to_X;
448 } vlVdpOutputSurface;
449
450 typedef struct
451 {
452 vlVdpDevice *device;
453 Drawable drawable;
454 } vlVdpPresentationQueueTarget;
455
456 typedef struct
457 {
458 vlVdpDevice *device;
459 Drawable drawable;
460 struct vl_compositor_state cstate;
461 vlVdpOutputSurface *last_surf;
462 } vlVdpPresentationQueue;
463
464 typedef struct
465 {
466 vlVdpDevice *device;
467 mtx_t mutex;
468 struct pipe_video_codec *decoder;
469 } vlVdpDecoder;
470
471 typedef uint32_t vlHandle;
472
473 boolean vlCreateHTAB(void);
474 void vlDestroyHTAB(void);
475 vlHandle vlAddDataHTAB(void *data);
476 void* vlGetDataHTAB(vlHandle handle);
477 void vlRemoveDataHTAB(vlHandle handle);
478
479 boolean vlGetFuncFTAB(VdpFuncId function_id, void **func);
480
481 /* Public functions */
482 VdpDeviceCreateX11 vdp_imp_device_create_x11;
483
484 void vlVdpDefaultSamplerViewTemplate(struct pipe_sampler_view *templ, struct pipe_resource *res);
485
486 /* Internal function pointers */
487 VdpGetErrorString vlVdpGetErrorString;
488 VdpDeviceDestroy vlVdpDeviceDestroy;
489 void vlVdpDeviceFree(vlVdpDevice *dev);
490 VdpGetProcAddress vlVdpGetProcAddress;
491 VdpGetApiVersion vlVdpGetApiVersion;
492 VdpGetInformationString vlVdpGetInformationString;
493 VdpVideoSurfaceQueryCapabilities vlVdpVideoSurfaceQueryCapabilities;
494 VdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities;
495 VdpDecoderQueryCapabilities vlVdpDecoderQueryCapabilities;
496 VdpOutputSurfaceQueryCapabilities vlVdpOutputSurfaceQueryCapabilities;
497 VdpOutputSurfaceQueryGetPutBitsNativeCapabilities vlVdpOutputSurfaceQueryGetPutBitsNativeCapabilities;
498 VdpOutputSurfaceQueryPutBitsIndexedCapabilities vlVdpOutputSurfaceQueryPutBitsIndexedCapabilities;
499 VdpOutputSurfaceQueryPutBitsYCbCrCapabilities vlVdpOutputSurfaceQueryPutBitsYCbCrCapabilities;
500 VdpBitmapSurfaceQueryCapabilities vlVdpBitmapSurfaceQueryCapabilities;
501 VdpVideoMixerQueryFeatureSupport vlVdpVideoMixerQueryFeatureSupport;
502 VdpVideoMixerQueryParameterSupport vlVdpVideoMixerQueryParameterSupport;
503 VdpVideoMixerQueryParameterValueRange vlVdpVideoMixerQueryParameterValueRange;
504 VdpVideoMixerQueryAttributeSupport vlVdpVideoMixerQueryAttributeSupport;
505 VdpVideoMixerQueryAttributeValueRange vlVdpVideoMixerQueryAttributeValueRange;
506 VdpVideoSurfaceCreate vlVdpVideoSurfaceCreate;
507 VdpVideoSurfaceDestroy vlVdpVideoSurfaceDestroy;
508 VdpVideoSurfaceGetParameters vlVdpVideoSurfaceGetParameters;
509 VdpVideoSurfaceGetBitsYCbCr vlVdpVideoSurfaceGetBitsYCbCr;
510 VdpVideoSurfacePutBitsYCbCr vlVdpVideoSurfacePutBitsYCbCr;
511 void vlVdpVideoSurfaceClear(vlVdpSurface *vlsurf);
512 VdpDecoderCreate vlVdpDecoderCreate;
513 VdpDecoderDestroy vlVdpDecoderDestroy;
514 VdpDecoderGetParameters vlVdpDecoderGetParameters;
515 VdpDecoderRender vlVdpDecoderRender;
516 VdpOutputSurfaceCreate vlVdpOutputSurfaceCreate;
517 VdpOutputSurfaceDestroy vlVdpOutputSurfaceDestroy;
518 VdpOutputSurfaceGetParameters vlVdpOutputSurfaceGetParameters;
519 VdpOutputSurfaceGetBitsNative vlVdpOutputSurfaceGetBitsNative;
520 VdpOutputSurfacePutBitsNative vlVdpOutputSurfacePutBitsNative;
521 VdpOutputSurfacePutBitsIndexed vlVdpOutputSurfacePutBitsIndexed;
522 VdpOutputSurfacePutBitsYCbCr vlVdpOutputSurfacePutBitsYCbCr;
523 VdpOutputSurfaceRenderOutputSurface vlVdpOutputSurfaceRenderOutputSurface;
524 VdpOutputSurfaceRenderBitmapSurface vlVdpOutputSurfaceRenderBitmapSurface;
525 VdpBitmapSurfaceCreate vlVdpBitmapSurfaceCreate;
526 VdpBitmapSurfaceDestroy vlVdpBitmapSurfaceDestroy;
527 VdpBitmapSurfaceGetParameters vlVdpBitmapSurfaceGetParameters;
528 VdpBitmapSurfacePutBitsNative vlVdpBitmapSurfacePutBitsNative;
529 VdpPresentationQueueTargetDestroy vlVdpPresentationQueueTargetDestroy;
530 VdpPresentationQueueCreate vlVdpPresentationQueueCreate;
531 VdpPresentationQueueDestroy vlVdpPresentationQueueDestroy;
532 VdpPresentationQueueSetBackgroundColor vlVdpPresentationQueueSetBackgroundColor;
533 VdpPresentationQueueGetBackgroundColor vlVdpPresentationQueueGetBackgroundColor;
534 VdpPresentationQueueGetTime vlVdpPresentationQueueGetTime;
535 VdpPresentationQueueDisplay vlVdpPresentationQueueDisplay;
536 VdpPresentationQueueBlockUntilSurfaceIdle vlVdpPresentationQueueBlockUntilSurfaceIdle;
537 VdpPresentationQueueQuerySurfaceStatus vlVdpPresentationQueueQuerySurfaceStatus;
538 VdpPreemptionCallback vlVdpPreemptionCallback;
539 VdpPreemptionCallbackRegister vlVdpPreemptionCallbackRegister;
540 VdpVideoMixerSetFeatureEnables vlVdpVideoMixerSetFeatureEnables;
541 VdpVideoMixerCreate vlVdpVideoMixerCreate;
542 VdpVideoMixerRender vlVdpVideoMixerRender;
543 VdpVideoMixerSetAttributeValues vlVdpVideoMixerSetAttributeValues;
544 VdpVideoMixerGetFeatureSupport vlVdpVideoMixerGetFeatureSupport;
545 VdpVideoMixerGetFeatureEnables vlVdpVideoMixerGetFeatureEnables;
546 VdpVideoMixerGetParameterValues vlVdpVideoMixerGetParameterValues;
547 VdpVideoMixerGetAttributeValues vlVdpVideoMixerGetAttributeValues;
548 VdpVideoMixerDestroy vlVdpVideoMixerDestroy;
549 VdpGenerateCSCMatrix vlVdpGenerateCSCMatrix;
550 /* Winsys specific internal function pointers */
551 VdpPresentationQueueTargetCreateX11 vlVdpPresentationQueueTargetCreateX11;
552
553
554 /* interop for GL gallium frontend */
555 VdpVideoSurfaceGallium vlVdpVideoSurfaceGallium;
556 VdpOutputSurfaceGallium vlVdpOutputSurfaceGallium;
557 VdpVideoSurfaceDMABuf vlVdpVideoSurfaceDMABuf;
558 VdpOutputSurfaceDMABuf vlVdpOutputSurfaceDMABuf;
559
560 #define VDPAU_OUT 0
561 #define VDPAU_ERR 1
562 #define VDPAU_WARN 2
563 #define VDPAU_TRACE 3
564
VDPAU_MSG(unsigned int level,const char * fmt,...)565 static inline void VDPAU_MSG(unsigned int level, const char *fmt, ...)
566 {
567 static int debug_level = -1;
568
569 if (debug_level == -1) {
570 debug_level = MAX2(debug_get_num_option("VDPAU_DEBUG", 0), 0);
571 }
572
573 if (level <= debug_level) {
574 va_list ap;
575 va_start(ap, fmt);
576 _debug_vprintf(fmt, ap);
577 va_end(ap);
578 }
579 }
580
581 static inline void
DeviceReference(vlVdpDevice ** ptr,vlVdpDevice * dev)582 DeviceReference(vlVdpDevice **ptr, vlVdpDevice *dev)
583 {
584 vlVdpDevice *old_dev = *ptr;
585
586 if (pipe_reference(&(*ptr)->reference, &dev->reference))
587 vlVdpDeviceFree(old_dev);
588 *ptr = dev;
589 }
590
591 #endif /* VDPAU_PRIVATE_H */
592