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