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