• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "state_tracker/vdpau_interop.h"
40 #include "state_tracker/vdpau_dmabuf.h"
41 #include "state_tracker/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_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       default:
138          assert(0);
139    }
140 
141    return PIPE_FORMAT_NONE;
142 }
143 
144 static inline VdpYCbCrFormat
PipeToFormatYCBCR(enum pipe_format p_format)145 PipeToFormatYCBCR(enum pipe_format p_format)
146 {
147    switch (p_format) {
148       case PIPE_FORMAT_NV12:
149          return VDP_YCBCR_FORMAT_NV12;
150       case PIPE_FORMAT_YV12:
151          return VDP_YCBCR_FORMAT_YV12;
152       case PIPE_FORMAT_UYVY:
153          return VDP_YCBCR_FORMAT_UYVY;
154       case PIPE_FORMAT_YUYV:
155          return VDP_YCBCR_FORMAT_YUYV;
156       case PIPE_FORMAT_R8G8B8A8_UNORM:
157         return VDP_YCBCR_FORMAT_Y8U8V8A8;
158       case PIPE_FORMAT_B8G8R8A8_UNORM:
159          return VDP_YCBCR_FORMAT_V8U8Y8A8;
160       default:
161          assert(0);
162    }
163 
164    return -1;
165 }
166 
167 static inline VdpRGBAFormat
PipeToFormatRGBA(enum pipe_format p_format)168 PipeToFormatRGBA(enum pipe_format p_format)
169 {
170    switch (p_format) {
171       case PIPE_FORMAT_A8_UNORM:
172          return VDP_RGBA_FORMAT_A8;
173       case PIPE_FORMAT_B10G10R10A2_UNORM:
174          return VDP_RGBA_FORMAT_B10G10R10A2;
175       case PIPE_FORMAT_B8G8R8A8_UNORM:
176          return VDP_RGBA_FORMAT_B8G8R8A8;
177       case PIPE_FORMAT_R10G10B10A2_UNORM:
178          return VDP_RGBA_FORMAT_R10G10B10A2;
179       case PIPE_FORMAT_R8G8B8A8_UNORM:
180          return VDP_RGBA_FORMAT_R8G8B8A8;
181       default:
182          assert(0);
183    }
184 
185    return -1;
186 }
187 
188 static inline enum pipe_format
FormatIndexedToPipe(VdpRGBAFormat vdpau_format)189 FormatIndexedToPipe(VdpRGBAFormat vdpau_format)
190 {
191    switch (vdpau_format) {
192       case VDP_INDEXED_FORMAT_A4I4:
193          return PIPE_FORMAT_R4A4_UNORM;
194       case VDP_INDEXED_FORMAT_I4A4:
195          return PIPE_FORMAT_A4R4_UNORM;
196       case VDP_INDEXED_FORMAT_A8I8:
197          return PIPE_FORMAT_A8R8_UNORM;
198       case VDP_INDEXED_FORMAT_I8A8:
199          return PIPE_FORMAT_R8A8_UNORM;
200       default:
201          assert(0);
202    }
203 
204    return PIPE_FORMAT_NONE;
205 }
206 
207 static inline enum pipe_format
FormatColorTableToPipe(VdpColorTableFormat vdpau_format)208 FormatColorTableToPipe(VdpColorTableFormat vdpau_format)
209 {
210    switch(vdpau_format) {
211       case VDP_COLOR_TABLE_FORMAT_B8G8R8X8:
212          return PIPE_FORMAT_B8G8R8X8_UNORM;
213       default:
214          assert(0);
215    }
216 
217    return PIPE_FORMAT_NONE;
218 }
219 
220 static inline enum pipe_video_profile
ProfileToPipe(VdpDecoderProfile vdpau_profile)221 ProfileToPipe(VdpDecoderProfile vdpau_profile)
222 {
223    switch (vdpau_profile) {
224       case VDP_DECODER_PROFILE_MPEG1:
225          return PIPE_VIDEO_PROFILE_MPEG1;
226       case VDP_DECODER_PROFILE_MPEG2_SIMPLE:
227          return PIPE_VIDEO_PROFILE_MPEG2_SIMPLE;
228       case VDP_DECODER_PROFILE_MPEG2_MAIN:
229          return PIPE_VIDEO_PROFILE_MPEG2_MAIN;
230       case VDP_DECODER_PROFILE_H264_BASELINE:
231          return PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE;
232       case VDP_DECODER_PROFILE_H264_MAIN:
233          return PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN;
234       case VDP_DECODER_PROFILE_H264_HIGH:
235          return PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH;
236       case VDP_DECODER_PROFILE_MPEG4_PART2_SP:
237          return PIPE_VIDEO_PROFILE_MPEG4_SIMPLE;
238       case VDP_DECODER_PROFILE_MPEG4_PART2_ASP:
239          return PIPE_VIDEO_PROFILE_MPEG4_ADVANCED_SIMPLE;
240       case VDP_DECODER_PROFILE_VC1_SIMPLE:
241          return PIPE_VIDEO_PROFILE_VC1_SIMPLE;
242       case VDP_DECODER_PROFILE_VC1_MAIN:
243          return PIPE_VIDEO_PROFILE_VC1_MAIN;
244       case VDP_DECODER_PROFILE_VC1_ADVANCED:
245          return PIPE_VIDEO_PROFILE_VC1_ADVANCED;
246       case VDP_DECODER_PROFILE_HEVC_MAIN:
247          return PIPE_VIDEO_PROFILE_HEVC_MAIN;
248       case VDP_DECODER_PROFILE_HEVC_MAIN_10:
249          return PIPE_VIDEO_PROFILE_HEVC_MAIN_10;
250       case VDP_DECODER_PROFILE_HEVC_MAIN_STILL:
251          return PIPE_VIDEO_PROFILE_HEVC_MAIN_STILL;
252       case VDP_DECODER_PROFILE_HEVC_MAIN_12:
253          return PIPE_VIDEO_PROFILE_HEVC_MAIN_12;
254       case VDP_DECODER_PROFILE_HEVC_MAIN_444:
255          return PIPE_VIDEO_PROFILE_HEVC_MAIN_444;
256       default:
257          return PIPE_VIDEO_PROFILE_UNKNOWN;
258    }
259 }
260 
261 static inline VdpDecoderProfile
PipeToProfile(enum pipe_video_profile p_profile)262 PipeToProfile(enum pipe_video_profile p_profile)
263 {
264    switch (p_profile) {
265       case PIPE_VIDEO_PROFILE_MPEG1:
266          return VDP_DECODER_PROFILE_MPEG1;
267       case PIPE_VIDEO_PROFILE_MPEG2_SIMPLE:
268          return VDP_DECODER_PROFILE_MPEG2_SIMPLE;
269       case PIPE_VIDEO_PROFILE_MPEG2_MAIN:
270          return VDP_DECODER_PROFILE_MPEG2_MAIN;
271       case PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE:
272          return VDP_DECODER_PROFILE_H264_BASELINE;
273       case PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN:
274          return VDP_DECODER_PROFILE_H264_MAIN;
275       case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH:
276          return VDP_DECODER_PROFILE_H264_HIGH;
277       case PIPE_VIDEO_PROFILE_MPEG4_SIMPLE:
278          return VDP_DECODER_PROFILE_MPEG4_PART2_SP;
279       case PIPE_VIDEO_PROFILE_MPEG4_ADVANCED_SIMPLE:
280          return VDP_DECODER_PROFILE_MPEG4_PART2_ASP;
281       case PIPE_VIDEO_PROFILE_VC1_SIMPLE:
282          return VDP_DECODER_PROFILE_VC1_SIMPLE;
283       case PIPE_VIDEO_PROFILE_VC1_MAIN:
284          return VDP_DECODER_PROFILE_VC1_MAIN;
285       case PIPE_VIDEO_PROFILE_VC1_ADVANCED:
286          return VDP_DECODER_PROFILE_VC1_ADVANCED;
287       case PIPE_VIDEO_PROFILE_HEVC_MAIN:
288          return VDP_DECODER_PROFILE_HEVC_MAIN;
289       case PIPE_VIDEO_PROFILE_HEVC_MAIN_10:
290          return VDP_DECODER_PROFILE_HEVC_MAIN_10;
291       case PIPE_VIDEO_PROFILE_HEVC_MAIN_STILL:
292          return VDP_DECODER_PROFILE_HEVC_MAIN_STILL;
293       case PIPE_VIDEO_PROFILE_HEVC_MAIN_12:
294          return VDP_DECODER_PROFILE_HEVC_MAIN_12;
295       case PIPE_VIDEO_PROFILE_HEVC_MAIN_444:
296          return VDP_DECODER_PROFILE_HEVC_MAIN_444;
297       default:
298          assert(0);
299          return -1;
300    }
301 }
302 
303 static inline struct u_rect *
RectToPipe(const VdpRect * src,struct u_rect * dst)304 RectToPipe(const VdpRect *src, struct u_rect *dst)
305 {
306    if (src) {
307       dst->x0 = src->x0;
308       dst->y0 = src->y0;
309       dst->x1 = src->x1;
310       dst->y1 = src->y1;
311       return dst;
312    }
313    return NULL;
314 }
315 
316 static inline struct pipe_box
RectToPipeBox(const VdpRect * rect,struct pipe_resource * res)317 RectToPipeBox(const VdpRect *rect, struct pipe_resource *res)
318 {
319    struct pipe_box box;
320 
321    box.x = 0;
322    box.y = 0;
323    box.z = 0;
324    box.width = res->width0;
325    box.height = res->height0;
326    box.depth = 1;
327 
328    if (rect) {
329       box.x = MIN2(rect->x0, rect->x1);
330       box.y = MIN2(rect->y0, rect->y1);
331       box.width = abs(rect->x1 - rect->x0);
332       box.height = abs(rect->y1 - rect->y0);
333    }
334 
335    return box;
336 }
337 
338 static inline bool
CheckSurfaceParams(struct pipe_screen * screen,const struct pipe_resource * templ)339 CheckSurfaceParams(struct pipe_screen *screen,
340                    const struct pipe_resource *templ)
341 {
342    return screen->is_format_supported(
343          screen, templ->format, templ->target, templ->nr_samples, templ->bind);
344 }
345 
346 typedef struct
347 {
348    struct pipe_reference reference;
349    struct vl_screen *vscreen;
350    struct pipe_context *context;
351    struct vl_compositor compositor;
352    struct pipe_sampler_view *dummy_sv;
353    pipe_mutex mutex;
354 } vlVdpDevice;
355 
356 typedef struct
357 {
358    vlVdpDevice *device;
359    struct vl_compositor_state cstate;
360 
361    struct {
362        bool supported, enabled;
363        float luma_min, luma_max;
364    } luma_key;
365 
366    struct {
367 	  bool supported, enabled, spatial;
368 	  struct vl_deint_filter *filter;
369    } deint;
370 
371    struct {
372 	  bool supported, enabled;
373 	  struct vl_bicubic_filter *filter;
374    } bicubic;
375 
376    struct {
377       bool supported, enabled;
378       unsigned level;
379       struct vl_median_filter *filter;
380    } noise_reduction;
381 
382    struct {
383       bool supported, enabled;
384       float value;
385       struct vl_matrix_filter *filter;
386    } sharpness;
387 
388    unsigned video_width, video_height;
389    enum pipe_video_chroma_format chroma_format;
390    unsigned max_layers, skip_chroma_deint;
391 
392    bool custom_csc;
393    vl_csc_matrix csc;
394 } vlVdpVideoMixer;
395 
396 typedef struct
397 {
398    vlVdpDevice *device;
399    struct pipe_video_buffer templat, *video_buffer;
400 } vlVdpSurface;
401 
402 typedef struct
403 {
404    vlVdpDevice *device;
405    struct pipe_sampler_view *sampler_view;
406 } vlVdpBitmapSurface;
407 
408 typedef uint64_t vlVdpTime;
409 
410 typedef struct
411 {
412    vlVdpDevice *device;
413    struct pipe_surface *surface;
414    struct pipe_sampler_view *sampler_view;
415    struct pipe_fence_handle *fence;
416    struct vl_compositor_state cstate;
417    struct u_rect dirty_area;
418    bool send_to_X;
419 } vlVdpOutputSurface;
420 
421 typedef struct
422 {
423    vlVdpDevice *device;
424    Drawable drawable;
425 } vlVdpPresentationQueueTarget;
426 
427 typedef struct
428 {
429    vlVdpDevice *device;
430    Drawable drawable;
431    struct vl_compositor_state cstate;
432    vlVdpOutputSurface *last_surf;
433 } vlVdpPresentationQueue;
434 
435 typedef struct
436 {
437    vlVdpDevice *device;
438    pipe_mutex mutex;
439    struct pipe_video_codec *decoder;
440 } vlVdpDecoder;
441 
442 typedef uint32_t vlHandle;
443 
444 boolean vlCreateHTAB(void);
445 void vlDestroyHTAB(void);
446 vlHandle vlAddDataHTAB(void *data);
447 void* vlGetDataHTAB(vlHandle handle);
448 void vlRemoveDataHTAB(vlHandle handle);
449 
450 boolean vlGetFuncFTAB(VdpFuncId function_id, void **func);
451 
452 /* Public functions */
453 VdpDeviceCreateX11 vdp_imp_device_create_x11;
454 
455 void vlVdpDefaultSamplerViewTemplate(struct pipe_sampler_view *templ, struct pipe_resource *res);
456 
457 /* Internal function pointers */
458 VdpGetErrorString vlVdpGetErrorString;
459 VdpDeviceDestroy vlVdpDeviceDestroy;
460 void vlVdpDeviceFree(vlVdpDevice *dev);
461 VdpGetProcAddress vlVdpGetProcAddress;
462 VdpGetApiVersion vlVdpGetApiVersion;
463 VdpGetInformationString vlVdpGetInformationString;
464 VdpVideoSurfaceQueryCapabilities vlVdpVideoSurfaceQueryCapabilities;
465 VdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities;
466 VdpDecoderQueryCapabilities vlVdpDecoderQueryCapabilities;
467 VdpOutputSurfaceQueryCapabilities vlVdpOutputSurfaceQueryCapabilities;
468 VdpOutputSurfaceQueryGetPutBitsNativeCapabilities vlVdpOutputSurfaceQueryGetPutBitsNativeCapabilities;
469 VdpOutputSurfaceQueryPutBitsIndexedCapabilities vlVdpOutputSurfaceQueryPutBitsIndexedCapabilities;
470 VdpOutputSurfaceQueryPutBitsYCbCrCapabilities vlVdpOutputSurfaceQueryPutBitsYCbCrCapabilities;
471 VdpBitmapSurfaceQueryCapabilities vlVdpBitmapSurfaceQueryCapabilities;
472 VdpVideoMixerQueryFeatureSupport vlVdpVideoMixerQueryFeatureSupport;
473 VdpVideoMixerQueryParameterSupport vlVdpVideoMixerQueryParameterSupport;
474 VdpVideoMixerQueryParameterValueRange vlVdpVideoMixerQueryParameterValueRange;
475 VdpVideoMixerQueryAttributeSupport vlVdpVideoMixerQueryAttributeSupport;
476 VdpVideoMixerQueryAttributeValueRange vlVdpVideoMixerQueryAttributeValueRange;
477 VdpVideoSurfaceCreate vlVdpVideoSurfaceCreate;
478 VdpVideoSurfaceDestroy vlVdpVideoSurfaceDestroy;
479 VdpVideoSurfaceGetParameters vlVdpVideoSurfaceGetParameters;
480 VdpVideoSurfaceGetBitsYCbCr vlVdpVideoSurfaceGetBitsYCbCr;
481 VdpVideoSurfacePutBitsYCbCr vlVdpVideoSurfacePutBitsYCbCr;
482 void vlVdpVideoSurfaceClear(vlVdpSurface *vlsurf);
483 VdpDecoderCreate vlVdpDecoderCreate;
484 VdpDecoderDestroy vlVdpDecoderDestroy;
485 VdpDecoderGetParameters vlVdpDecoderGetParameters;
486 VdpDecoderRender vlVdpDecoderRender;
487 VdpOutputSurfaceCreate vlVdpOutputSurfaceCreate;
488 VdpOutputSurfaceDestroy vlVdpOutputSurfaceDestroy;
489 VdpOutputSurfaceGetParameters vlVdpOutputSurfaceGetParameters;
490 VdpOutputSurfaceGetBitsNative vlVdpOutputSurfaceGetBitsNative;
491 VdpOutputSurfacePutBitsNative vlVdpOutputSurfacePutBitsNative;
492 VdpOutputSurfacePutBitsIndexed vlVdpOutputSurfacePutBitsIndexed;
493 VdpOutputSurfacePutBitsYCbCr vlVdpOutputSurfacePutBitsYCbCr;
494 VdpOutputSurfaceRenderOutputSurface vlVdpOutputSurfaceRenderOutputSurface;
495 VdpOutputSurfaceRenderBitmapSurface vlVdpOutputSurfaceRenderBitmapSurface;
496 VdpBitmapSurfaceCreate vlVdpBitmapSurfaceCreate;
497 VdpBitmapSurfaceDestroy vlVdpBitmapSurfaceDestroy;
498 VdpBitmapSurfaceGetParameters vlVdpBitmapSurfaceGetParameters;
499 VdpBitmapSurfacePutBitsNative vlVdpBitmapSurfacePutBitsNative;
500 VdpPresentationQueueTargetDestroy vlVdpPresentationQueueTargetDestroy;
501 VdpPresentationQueueCreate vlVdpPresentationQueueCreate;
502 VdpPresentationQueueDestroy vlVdpPresentationQueueDestroy;
503 VdpPresentationQueueSetBackgroundColor vlVdpPresentationQueueSetBackgroundColor;
504 VdpPresentationQueueGetBackgroundColor vlVdpPresentationQueueGetBackgroundColor;
505 VdpPresentationQueueGetTime vlVdpPresentationQueueGetTime;
506 VdpPresentationQueueDisplay vlVdpPresentationQueueDisplay;
507 VdpPresentationQueueBlockUntilSurfaceIdle vlVdpPresentationQueueBlockUntilSurfaceIdle;
508 VdpPresentationQueueQuerySurfaceStatus vlVdpPresentationQueueQuerySurfaceStatus;
509 VdpPreemptionCallback vlVdpPreemptionCallback;
510 VdpPreemptionCallbackRegister vlVdpPreemptionCallbackRegister;
511 VdpVideoMixerSetFeatureEnables vlVdpVideoMixerSetFeatureEnables;
512 VdpVideoMixerCreate vlVdpVideoMixerCreate;
513 VdpVideoMixerRender vlVdpVideoMixerRender;
514 VdpVideoMixerSetAttributeValues vlVdpVideoMixerSetAttributeValues;
515 VdpVideoMixerGetFeatureSupport vlVdpVideoMixerGetFeatureSupport;
516 VdpVideoMixerGetFeatureEnables vlVdpVideoMixerGetFeatureEnables;
517 VdpVideoMixerGetParameterValues vlVdpVideoMixerGetParameterValues;
518 VdpVideoMixerGetAttributeValues vlVdpVideoMixerGetAttributeValues;
519 VdpVideoMixerDestroy vlVdpVideoMixerDestroy;
520 VdpGenerateCSCMatrix vlVdpGenerateCSCMatrix;
521 /* Winsys specific internal function pointers */
522 VdpPresentationQueueTargetCreateX11 vlVdpPresentationQueueTargetCreateX11;
523 
524 
525 /* interop to mesa state tracker */
526 VdpVideoSurfaceGallium vlVdpVideoSurfaceGallium;
527 VdpOutputSurfaceGallium vlVdpOutputSurfaceGallium;
528 VdpVideoSurfaceDMABuf vlVdpVideoSurfaceDMABuf;
529 VdpOutputSurfaceDMABuf vlVdpOutputSurfaceDMABuf;
530 
531 #define VDPAU_OUT   0
532 #define VDPAU_ERR   1
533 #define VDPAU_WARN  2
534 #define VDPAU_TRACE 3
535 
VDPAU_MSG(unsigned int level,const char * fmt,...)536 static inline void VDPAU_MSG(unsigned int level, const char *fmt, ...)
537 {
538    static int debug_level = -1;
539 
540    if (debug_level == -1) {
541       debug_level = MAX2(debug_get_num_option("VDPAU_DEBUG", 0), 0);
542    }
543 
544    if (level <= debug_level) {
545       va_list ap;
546       va_start(ap, fmt);
547       _debug_vprintf(fmt, ap);
548       va_end(ap);
549    }
550 }
551 
552 static inline void
DeviceReference(vlVdpDevice ** ptr,vlVdpDevice * dev)553 DeviceReference(vlVdpDevice **ptr, vlVdpDevice *dev)
554 {
555    vlVdpDevice *old_dev = *ptr;
556 
557    if (pipe_reference(&(*ptr)->reference, &dev->reference))
558       vlVdpDeviceFree(old_dev);
559    *ptr = dev;
560 }
561 
562 #endif /* VDPAU_PRIVATE_H */
563