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