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