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