1 /*
2  *  vdpau_gate.c - VDPAU hooks
3  *
4  *  libva-vdpau-driver (C) 2009-2011 Splitted-Desktop Systems
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
19  */
20 
21 #include "sysdeps.h"
22 #include "vdpau_gate.h"
23 #include "vdpau_video.h"
24 
25 #define DEBUG 1
26 #include "debug.h"
27 
28 
29 // Initialize VDPAU hooks
vdpau_gate_init(vdpau_driver_data_t * driver_data)30 int vdpau_gate_init(vdpau_driver_data_t *driver_data)
31 {
32     VdpStatus vdp_status;
33 
34 #define VDP_INIT_PROC(FUNC_ID, FUNC) do {                       \
35         vdp_status = driver_data->vdp_get_proc_address          \
36             (driver_data->vdp_device,                           \
37              VDP_FUNC_ID_##FUNC_ID,                             \
38              (void *)&driver_data->vdp_vtable.vdp_##FUNC);      \
39         if (vdp_status != VDP_STATUS_OK)                        \
40             return -1;                                          \
41     } while (0)
42 
43     VDP_INIT_PROC(DEVICE_DESTROY,
44                   device_destroy);
45     VDP_INIT_PROC(GENERATE_CSC_MATRIX,
46                   generate_csc_matrix);
47     VDP_INIT_PROC(VIDEO_SURFACE_CREATE,
48                   video_surface_create);
49     VDP_INIT_PROC(VIDEO_SURFACE_DESTROY,
50                   video_surface_destroy);
51     VDP_INIT_PROC(VIDEO_SURFACE_GET_BITS_Y_CB_CR,
52                   video_surface_get_bits_ycbcr);
53     VDP_INIT_PROC(VIDEO_SURFACE_PUT_BITS_Y_CB_CR,
54                   video_surface_put_bits_ycbcr);
55     VDP_INIT_PROC(OUTPUT_SURFACE_CREATE,
56                   output_surface_create);
57     VDP_INIT_PROC(OUTPUT_SURFACE_DESTROY,
58                   output_surface_destroy);
59     VDP_INIT_PROC(OUTPUT_SURFACE_GET_BITS_NATIVE,
60                   output_surface_get_bits_native);
61     VDP_INIT_PROC(OUTPUT_SURFACE_PUT_BITS_NATIVE,
62                   output_surface_put_bits_native);
63     VDP_INIT_PROC(OUTPUT_SURFACE_RENDER_BITMAP_SURFACE,
64                   output_surface_render_bitmap_surface);
65     VDP_INIT_PROC(OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE,
66                   output_surface_render_output_surface);
67     VDP_INIT_PROC(OUTPUT_SURFACE_QUERY_PUT_BITS_INDEXED_CAPABILITIES,
68                   output_surface_query_put_bits_indexed_capabilities);
69     VDP_INIT_PROC(OUTPUT_SURFACE_PUT_BITS_INDEXED,
70                   output_surface_put_bits_indexed);
71     VDP_INIT_PROC(BITMAP_SURFACE_QUERY_CAPABILITIES,
72                   bitmap_surface_query_capabilities);
73     VDP_INIT_PROC(BITMAP_SURFACE_CREATE,
74                   bitmap_surface_create);
75     VDP_INIT_PROC(BITMAP_SURFACE_DESTROY,
76                   bitmap_surface_destroy);
77     VDP_INIT_PROC(BITMAP_SURFACE_PUT_BITS_NATIVE,
78                   bitmap_surface_put_bits_native);
79     VDP_INIT_PROC(VIDEO_MIXER_CREATE,
80                   video_mixer_create);
81     VDP_INIT_PROC(VIDEO_MIXER_DESTROY,
82                   video_mixer_destroy);
83     VDP_INIT_PROC(VIDEO_MIXER_RENDER,
84                   video_mixer_render);
85     VDP_INIT_PROC(VIDEO_MIXER_QUERY_FEATURE_SUPPORT,
86                   video_mixer_query_feature_support);
87     VDP_INIT_PROC(VIDEO_MIXER_GET_FEATURE_ENABLES,
88                   video_mixer_get_feature_enables);
89     VDP_INIT_PROC(VIDEO_MIXER_SET_FEATURE_ENABLES,
90                   video_mixer_set_feature_enables);
91     VDP_INIT_PROC(VIDEO_MIXER_QUERY_ATTRIBUTE_SUPPORT,
92                   video_mixer_query_attribute_support);
93     VDP_INIT_PROC(VIDEO_MIXER_GET_ATTRIBUTE_VALUES,
94                   video_mixer_get_attribute_values);
95     VDP_INIT_PROC(VIDEO_MIXER_SET_ATTRIBUTE_VALUES,
96                   video_mixer_set_attribute_values);
97     VDP_INIT_PROC(PRESENTATION_QUEUE_CREATE,
98                   presentation_queue_create);
99     VDP_INIT_PROC(PRESENTATION_QUEUE_DESTROY,
100                   presentation_queue_destroy);
101     VDP_INIT_PROC(PRESENTATION_QUEUE_SET_BACKGROUND_COLOR,
102                   presentation_queue_set_background_color);
103     VDP_INIT_PROC(PRESENTATION_QUEUE_GET_BACKGROUND_COLOR,
104                   presentation_queue_get_background_color);
105     VDP_INIT_PROC(PRESENTATION_QUEUE_DISPLAY,
106                   presentation_queue_display);
107     VDP_INIT_PROC(PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE,
108                   presentation_queue_block_until_surface_idle);
109     VDP_INIT_PROC(PRESENTATION_QUEUE_QUERY_SURFACE_STATUS,
110                   presentation_queue_query_surface_status);
111     VDP_INIT_PROC(PRESENTATION_QUEUE_TARGET_CREATE_X11,
112                   presentation_queue_target_create_x11);
113     VDP_INIT_PROC(PRESENTATION_QUEUE_TARGET_DESTROY,
114                   presentation_queue_target_destroy);
115     VDP_INIT_PROC(DECODER_CREATE,
116                   decoder_create);
117     VDP_INIT_PROC(DECODER_DESTROY,
118                   decoder_destroy);
119     VDP_INIT_PROC(DECODER_RENDER,
120                   decoder_render);
121     VDP_INIT_PROC(DECODER_QUERY_CAPABILITIES,
122                   decoder_query_capabilities);
123     VDP_INIT_PROC(VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES,
124                   video_surface_query_ycbcr_caps);
125     VDP_INIT_PROC(OUTPUT_SURFACE_QUERY_GET_PUT_BITS_NATIVE_CAPABILITIES,
126                   output_surface_query_rgba_caps);
127     VDP_INIT_PROC(GET_API_VERSION,
128                   get_api_version);
129     VDP_INIT_PROC(GET_INFORMATION_STRING,
130                   get_information_string);
131     VDP_INIT_PROC(GET_ERROR_STRING,
132                   get_error_string);
133 
134 #undef VDP_INIT_PROC
135     return 0;
136 }
137 
138 // Deinitialize VDPAU hooks
vdpau_gate_exit(vdpau_driver_data_t * driver_data)139 void vdpau_gate_exit(vdpau_driver_data_t *driver_data)
140 {
141 }
142 
143 // Check VdpStatus
vdpau_check_status(vdpau_driver_data_p driver_data,VdpStatus vdp_status,const char * msg)144 int vdpau_check_status(
145     vdpau_driver_data_p driver_data,
146     VdpStatus           vdp_status,
147     const char         *msg
148 )
149 {
150     if (vdp_status != VDP_STATUS_OK) {
151         const char *vdp_status_string;
152         vdp_status_string = vdpau_get_error_string(driver_data, vdp_status);
153         vdpau_information_message("%s: status %d: %s\n", msg, vdp_status,
154             vdp_status_string ? vdp_status_string : "<unknown error>");
155         return 0;
156     }
157     return 1;
158 }
159 
160 #define VDPAU_INVOKE_(retval, func, ...)               \
161     (driver_data && driver_data->vdp_vtable.vdp_##func \
162      ? driver_data->vdp_vtable.vdp_##func(__VA_ARGS__) \
163      : (retval))
164 
165 #define VDPAU_INVOKE(func, ...)                        \
166     VDPAU_INVOKE_(VDP_STATUS_INVALID_POINTER,          \
167                   func, __VA_ARGS__)
168 
169 // VdpGenerateCSCMatrix
170 VdpStatus
vdpau_generate_csc_matrix(vdpau_driver_data_p driver_data,VdpProcamp * procamp,VdpColorStandard standard,VdpCSCMatrix * csc_matrix)171 vdpau_generate_csc_matrix(
172     vdpau_driver_data_p driver_data,
173     VdpProcamp         *procamp,
174     VdpColorStandard    standard,
175     VdpCSCMatrix       *csc_matrix
176 )
177 {
178     return VDPAU_INVOKE(generate_csc_matrix,
179                         procamp,
180                         standard,
181                         csc_matrix);
182 }
183 
184 // VdpDeviceDestroy
185 VdpStatus
vdpau_device_destroy(vdpau_driver_data_t * driver_data,VdpDevice device)186 vdpau_device_destroy(
187     vdpau_driver_data_t *driver_data,
188     VdpDevice            device
189 )
190 {
191     return VDPAU_INVOKE(device_destroy, device);
192 }
193 
194 // VdpVideoSurfaceCreate
195 VdpStatus
vdpau_video_surface_create(vdpau_driver_data_t * driver_data,VdpDevice device,VdpChromaType chroma_type,uint32_t width,uint32_t height,VdpVideoSurface * surface)196 vdpau_video_surface_create(
197     vdpau_driver_data_t *driver_data,
198     VdpDevice            device,
199     VdpChromaType        chroma_type,
200     uint32_t             width,
201     uint32_t             height,
202     VdpVideoSurface     *surface
203 )
204 {
205     return VDPAU_INVOKE(video_surface_create,
206                         device,
207                         chroma_type,
208                         width,
209                         height,
210                         surface);
211 }
212 
213 // VdpVideoSurfaceDestroy
214 VdpStatus
vdpau_video_surface_destroy(vdpau_driver_data_t * driver_data,VdpVideoSurface surface)215 vdpau_video_surface_destroy(
216     vdpau_driver_data_t *driver_data,
217     VdpVideoSurface      surface
218 )
219 {
220     return VDPAU_INVOKE(video_surface_destroy, surface);
221 }
222 
223 // VdpVideoSurfaceGetBitsYCbCr
224 VdpStatus
vdpau_video_surface_get_bits_ycbcr(vdpau_driver_data_t * driver_data,VdpVideoSurface surface,VdpYCbCrFormat format,uint8_t ** dest,uint32_t * stride)225 vdpau_video_surface_get_bits_ycbcr(
226     vdpau_driver_data_t *driver_data,
227     VdpVideoSurface      surface,
228     VdpYCbCrFormat       format,
229     uint8_t            **dest,
230     uint32_t            *stride
231 )
232 {
233     return VDPAU_INVOKE(video_surface_get_bits_ycbcr,
234                         surface,
235                         format,
236                         (void * const *)dest,
237                         stride);
238 }
239 
240 // VdpVideoSurfacePutBitsYCbCr
241 VdpStatus
vdpau_video_surface_put_bits_ycbcr(vdpau_driver_data_t * driver_data,VdpVideoSurface surface,VdpYCbCrFormat format,uint8_t ** src,uint32_t * stride)242 vdpau_video_surface_put_bits_ycbcr(
243     vdpau_driver_data_t *driver_data,
244     VdpVideoSurface      surface,
245     VdpYCbCrFormat       format,
246     uint8_t            **src,
247     uint32_t            *stride
248 )
249 {
250     return VDPAU_INVOKE(video_surface_put_bits_ycbcr,
251                         surface,
252                         format,
253                         (const void * const *)src,
254                         stride);
255 }
256 
257 // VdpOutputSurfaceCreate
258 VdpStatus
vdpau_output_surface_create(vdpau_driver_data_t * driver_data,VdpDevice device,VdpRGBAFormat rgba_format,uint32_t width,uint32_t height,VdpOutputSurface * surface)259 vdpau_output_surface_create(
260     vdpau_driver_data_t *driver_data,
261     VdpDevice            device,
262     VdpRGBAFormat        rgba_format,
263     uint32_t             width,
264     uint32_t             height,
265     VdpOutputSurface    *surface
266 )
267 {
268     return VDPAU_INVOKE(output_surface_create,
269                         device,
270                         rgba_format,
271                         width,
272                         height,
273                         surface);
274 }
275 
276 // VdpOutputSurfaceDestroy
277 VdpStatus
vdpau_output_surface_destroy(vdpau_driver_data_t * driver_data,VdpOutputSurface surface)278 vdpau_output_surface_destroy(
279     vdpau_driver_data_t *driver_data,
280     VdpOutputSurface     surface
281 )
282 {
283     return VDPAU_INVOKE(output_surface_destroy, surface);
284 }
285 
286 // VdpOutputSurfaceGetBitsNative
287 VdpStatus
vdpau_output_surface_get_bits_native(vdpau_driver_data_t * driver_data,VdpOutputSurface surface,const VdpRect * source_rect,uint8_t ** dst,uint32_t * stride)288 vdpau_output_surface_get_bits_native(
289     vdpau_driver_data_t *driver_data,
290     VdpOutputSurface     surface,
291     const VdpRect       *source_rect,
292     uint8_t            **dst,
293     uint32_t            *stride
294 )
295 {
296     return VDPAU_INVOKE(output_surface_get_bits_native,
297                         surface,
298                         source_rect,
299                         (void * const *)dst,
300                         stride);
301 }
302 
303 // VdpOutputSurfacePutBitsNative
304 VdpStatus
vdpau_output_surface_put_bits_native(vdpau_driver_data_t * driver_data,VdpOutputSurface surface,const uint8_t ** src,uint32_t * stride,const VdpRect * dest_rect)305 vdpau_output_surface_put_bits_native(
306     vdpau_driver_data_t *driver_data,
307     VdpOutputSurface     surface,
308     const uint8_t      **src,
309     uint32_t            *stride,
310     const VdpRect       *dest_rect
311 )
312 {
313     return VDPAU_INVOKE(output_surface_put_bits_native,
314                         surface,
315                         (const void * const *)src,
316                         stride,
317                         dest_rect);
318 }
319 
320 // VdpOutputSurfaceRenderBitmapSurface
321 VdpStatus
vdpau_output_surface_render_bitmap_surface(vdpau_driver_data_t * driver_data,VdpOutputSurface destination_surface,const VdpRect * destination_rect,VdpBitmapSurface source_surface,const VdpRect * source_rect,const VdpColor * colors,const VdpOutputSurfaceRenderBlendState * blend_state,uint32_t flags)322 vdpau_output_surface_render_bitmap_surface(
323     vdpau_driver_data_t *driver_data,
324     VdpOutputSurface     destination_surface,
325     const VdpRect       *destination_rect,
326     VdpBitmapSurface     source_surface,
327     const VdpRect       *source_rect,
328     const VdpColor      *colors,
329     const VdpOutputSurfaceRenderBlendState *blend_state,
330     uint32_t             flags
331 )
332 {
333     return VDPAU_INVOKE(output_surface_render_bitmap_surface,
334                         destination_surface,
335                         destination_rect,
336                         source_surface,
337                         source_rect,
338                         colors,
339                         blend_state,
340                         flags);
341 }
342 
343 // VdpOutputSurfaceRenderOutputSurface
344 VdpStatus
vdpau_output_surface_render_output_surface(vdpau_driver_data_p driver_data,VdpOutputSurface destination_surface,const VdpRect * destination_rect,VdpOutputSurface source_surface,const VdpRect * source_rect,const VdpColor * colors,const VdpOutputSurfaceRenderBlendState * blend_state,uint32_t flags)345 vdpau_output_surface_render_output_surface(
346     vdpau_driver_data_p driver_data,
347     VdpOutputSurface    destination_surface,
348     const VdpRect      *destination_rect,
349     VdpOutputSurface    source_surface,
350     const VdpRect      *source_rect,
351     const VdpColor     *colors,
352     const VdpOutputSurfaceRenderBlendState *blend_state,
353     uint32_t            flags
354 )
355 {
356     return VDPAU_INVOKE(output_surface_render_output_surface,
357                         destination_surface,
358                         destination_rect,
359                         source_surface,
360                         source_rect,
361                         colors,
362                         blend_state,
363                         flags);
364 }
365 
366 // VdpOutputSurfaceQueryPutBitsIndexedCapabilities
367 VdpStatus
vdpau_output_surface_query_put_bits_indexed_capabilities(vdpau_driver_data_p driver_data,VdpDevice device,VdpRGBAFormat rgba_format,VdpIndexedFormat bits_indexed_format,VdpColorTableFormat color_table_format,VdpBool * is_supported)368 vdpau_output_surface_query_put_bits_indexed_capabilities(
369     vdpau_driver_data_p  driver_data,
370     VdpDevice            device,
371     VdpRGBAFormat        rgba_format,
372     VdpIndexedFormat     bits_indexed_format,
373     VdpColorTableFormat  color_table_format,
374     VdpBool             *is_supported
375 )
376 {
377     return VDPAU_INVOKE(output_surface_query_put_bits_indexed_capabilities,
378                         device,
379                         rgba_format,
380                         bits_indexed_format,
381                         color_table_format,
382                         is_supported);
383 }
384 
385 // VdpOutputSurfacePutBitsIndexed
386 VdpStatus
vdpau_output_surface_put_bits_indexed(vdpau_driver_data_p driver_data,VdpOutputSurface surface,VdpIndexedFormat source_indexed_format,const uint8_t ** source_data,const uint32_t * source_pitch,const VdpRect * destination_rect,VdpColorTableFormat color_table_format,const void * color_table)387 vdpau_output_surface_put_bits_indexed(
388     vdpau_driver_data_p  driver_data,
389     VdpOutputSurface     surface,
390     VdpIndexedFormat     source_indexed_format,
391     const uint8_t      **source_data,
392     const uint32_t      *source_pitch,
393     const VdpRect       *destination_rect,
394     VdpColorTableFormat  color_table_format,
395     const void          *color_table
396 )
397 {
398     return VDPAU_INVOKE(output_surface_put_bits_indexed,
399                         surface,
400                         source_indexed_format,
401                         (const void **)source_data,
402                         source_pitch,
403                         destination_rect,
404                         color_table_format,
405                         color_table);
406 }
407 
408 // VdpBitmapSurfaceQueryCapabilities
409 VdpStatus
vdpau_bitmap_surface_query_capabilities(vdpau_driver_data_t * driver_data,VdpDevice device,VdpRGBAFormat rgba_format,VdpBool * is_supported,uint32_t * max_width,uint32_t * max_height)410 vdpau_bitmap_surface_query_capabilities(
411     vdpau_driver_data_t *driver_data,
412     VdpDevice            device,
413     VdpRGBAFormat        rgba_format,
414     VdpBool             *is_supported,
415     uint32_t            *max_width,
416     uint32_t            *max_height
417 )
418 {
419     return VDPAU_INVOKE(bitmap_surface_query_capabilities,
420                         device,
421                         rgba_format,
422                         is_supported,
423                         max_width,
424                         max_height);
425 }
426 
427 // VdpBitmapSurfaceCreate
428 VdpStatus
vdpau_bitmap_surface_create(vdpau_driver_data_t * driver_data,VdpDevice device,VdpRGBAFormat rgba_format,uint32_t width,uint32_t height,VdpBool frequently_accessed,VdpBitmapSurface * surface)429 vdpau_bitmap_surface_create(
430     vdpau_driver_data_t *driver_data,
431     VdpDevice            device,
432     VdpRGBAFormat        rgba_format,
433     uint32_t             width,
434     uint32_t             height,
435     VdpBool              frequently_accessed,
436     VdpBitmapSurface    *surface
437 )
438 {
439     return VDPAU_INVOKE(bitmap_surface_create,
440                         device,
441                         rgba_format,
442                         width,
443                         height,
444                         frequently_accessed,
445                         surface);
446 }
447 
448 // VdpBitmapSurfaceDestroy
449 VdpStatus
vdpau_bitmap_surface_destroy(vdpau_driver_data_t * driver_data,VdpBitmapSurface surface)450 vdpau_bitmap_surface_destroy(
451     vdpau_driver_data_t *driver_data,
452     VdpBitmapSurface     surface
453 )
454 {
455     return VDPAU_INVOKE(bitmap_surface_destroy, surface);
456 }
457 
458 // VdpBitmapSurfacePutBitsNative
459 VdpStatus
vdpau_bitmap_surface_put_bits_native(vdpau_driver_data_t * driver_data,VdpBitmapSurface surface,const uint8_t ** src,const uint32_t * stride,const VdpRect * dest_rect)460 vdpau_bitmap_surface_put_bits_native(
461     vdpau_driver_data_t *driver_data,
462     VdpBitmapSurface     surface,
463     const uint8_t      **src,
464     const uint32_t      *stride,
465     const VdpRect       *dest_rect
466 )
467 {
468     return VDPAU_INVOKE(bitmap_surface_put_bits_native,
469                         surface,
470                         (const void * const *)src,
471                         stride,
472                         dest_rect);
473 }
474 
475 // VdpVideoMixerCreate
476 VdpStatus
vdpau_video_mixer_create(vdpau_driver_data_t * driver_data,VdpDevice device,uint32_t feature_count,VdpVideoMixerFeature const * features,uint32_t parameter_count,VdpVideoMixerParameter const * parameters,const void * parameter_values,VdpVideoMixer * mixer)477 vdpau_video_mixer_create(
478     vdpau_driver_data_t          *driver_data,
479     VdpDevice                     device,
480     uint32_t                      feature_count,
481     VdpVideoMixerFeature const   *features,
482     uint32_t                      parameter_count,
483     VdpVideoMixerParameter const *parameters,
484     const void                   *parameter_values,
485     VdpVideoMixer                *mixer
486 )
487 {
488     return VDPAU_INVOKE(video_mixer_create,
489                         device,
490                         feature_count,
491                         features,
492                         parameter_count,
493                         parameters,
494                         parameter_values,
495                         mixer);
496 }
497 
498 // VdpVideoMixerDestroy
499 VdpStatus
vdpau_video_mixer_destroy(vdpau_driver_data_t * driver_data,VdpVideoMixer mixer)500 vdpau_video_mixer_destroy(
501     vdpau_driver_data_t *driver_data,
502     VdpVideoMixer        mixer
503 )
504 {
505     return VDPAU_INVOKE(video_mixer_destroy, mixer);
506 }
507 
508 // VdpVideoMixerRender
509 VdpStatus
vdpau_video_mixer_render(vdpau_driver_data_t * driver_data,VdpVideoMixer mixer,VdpOutputSurface background_surface,const VdpRect * background_source_rect,VdpVideoMixerPictureStructure current_picture_structure,uint32_t video_surface_past_count,const VdpVideoSurface * video_surface_past,VdpVideoSurface video_surface_current,uint32_t video_surface_future_count,const VdpVideoSurface * video_surface_future,const VdpRect * video_source_rect,VdpOutputSurface destination_surface,const VdpRect * destination_rect,const VdpRect * destination_video_rect,uint32_t layer_count,const VdpLayer * layers)510 vdpau_video_mixer_render(
511     vdpau_driver_data_t          *driver_data,
512     VdpVideoMixer                 mixer,
513     VdpOutputSurface              background_surface,
514     const VdpRect                *background_source_rect,
515     VdpVideoMixerPictureStructure current_picture_structure,
516     uint32_t                      video_surface_past_count,
517     const VdpVideoSurface        *video_surface_past,
518     VdpVideoSurface               video_surface_current,
519     uint32_t                      video_surface_future_count,
520     const VdpVideoSurface        *video_surface_future,
521     const VdpRect                *video_source_rect,
522     VdpOutputSurface              destination_surface,
523     const VdpRect                *destination_rect,
524     const VdpRect                *destination_video_rect,
525     uint32_t                      layer_count,
526     const VdpLayer               *layers
527 )
528 {
529     return VDPAU_INVOKE(video_mixer_render,
530                         mixer,
531                         background_surface,
532                         background_source_rect,
533                         current_picture_structure,
534                         video_surface_past_count,
535                         video_surface_past,
536                         video_surface_current,
537                         video_surface_future_count,
538                         video_surface_future,
539                         video_source_rect,
540                         destination_surface,
541                         destination_rect,
542                         destination_video_rect,
543                         layer_count,
544                         layers);
545 }
546 
547 // VdpVideoMixerQueryFeatureSupport
548 VdpStatus
vdpau_video_mixer_query_feature_support(vdpau_driver_data_p driver_data,VdpDevice device,VdpVideoMixerFeature feature,VdpBool * is_supported)549 vdpau_video_mixer_query_feature_support(
550     vdpau_driver_data_p         driver_data,
551     VdpDevice                   device,
552     VdpVideoMixerFeature        feature,
553     VdpBool                    *is_supported
554 )
555 {
556     return VDPAU_INVOKE(video_mixer_query_feature_support,
557                         device,
558                         feature,
559                         is_supported);
560 }
561 
562 // VdpVideoMixerGetFeatureEnables
563 VdpStatus
vdpau_video_mixer_get_feature_enables(vdpau_driver_data_p driver_data,VdpVideoMixer mixer,uint32_t feature_count,const VdpVideoMixerFeature * features,VdpBool * feature_enables)564 vdpau_video_mixer_get_feature_enables(
565     vdpau_driver_data_p         driver_data,
566     VdpVideoMixer               mixer,
567     uint32_t                    feature_count,
568     const VdpVideoMixerFeature *features,
569     VdpBool                    *feature_enables
570 )
571 {
572     return VDPAU_INVOKE(video_mixer_get_feature_enables,
573                         mixer,
574                         feature_count,
575                         features,
576                         feature_enables);
577 }
578 
579 // VdpVideoMixerSetFeatureEnables
580 VdpStatus
vdpau_video_mixer_set_feature_enables(vdpau_driver_data_p driver_data,VdpVideoMixer mixer,uint32_t feature_count,const VdpVideoMixerFeature * features,const VdpBool * feature_enables)581 vdpau_video_mixer_set_feature_enables(
582     vdpau_driver_data_p         driver_data,
583     VdpVideoMixer               mixer,
584     uint32_t                    feature_count,
585     const VdpVideoMixerFeature *features,
586     const VdpBool              *feature_enables
587 )
588 {
589     return VDPAU_INVOKE(video_mixer_set_feature_enables,
590                         mixer,
591                         feature_count,
592                         features,
593                         feature_enables);
594 }
595 
596 // VdpVideoMixerQueryAttributeSupport
597 VdpStatus
vdpau_video_mixer_query_attribute_support(vdpau_driver_data_p driver_data,VdpDevice device,VdpVideoMixerAttribute attribute,VdpBool * is_supported)598 vdpau_video_mixer_query_attribute_support(
599     vdpau_driver_data_p         driver_data,
600     VdpDevice                   device,
601     VdpVideoMixerAttribute      attribute,
602     VdpBool                    *is_supported
603 )
604 {
605     return VDPAU_INVOKE(video_mixer_query_attribute_support,
606                         device,
607                         attribute,
608                         is_supported);
609 }
610 
611 // VdpVideoMixerGetAttributeValues
612 VdpStatus
vdpau_video_mixer_get_attribute_values(vdpau_driver_data_p driver_data,VdpVideoMixer mixer,uint32_t attribute_count,const VdpVideoMixerAttribute * attributes,void ** attribute_values)613 vdpau_video_mixer_get_attribute_values(
614     vdpau_driver_data_p           driver_data,
615     VdpVideoMixer                 mixer,
616     uint32_t                      attribute_count,
617     const VdpVideoMixerAttribute *attributes,
618     void                        **attribute_values
619 )
620 {
621     return VDPAU_INVOKE(video_mixer_get_attribute_values,
622                         mixer,
623                         attribute_count,
624                         attributes,
625                         attribute_values);
626 }
627 
628 // VdpVideoMixerSetAttributeValues
629 VdpStatus
vdpau_video_mixer_set_attribute_values(vdpau_driver_data_p driver_data,VdpVideoMixer mixer,uint32_t attribute_count,const VdpVideoMixerAttribute * attributes,const void ** attribute_values)630 vdpau_video_mixer_set_attribute_values(
631     vdpau_driver_data_p           driver_data,
632     VdpVideoMixer                 mixer,
633     uint32_t                      attribute_count,
634     const VdpVideoMixerAttribute *attributes,
635     const void                  **attribute_values
636 )
637 {
638     return VDPAU_INVOKE(video_mixer_set_attribute_values,
639                         mixer,
640                         attribute_count,
641                         attributes,
642                         attribute_values);
643 }
644 
645 // VdpPresentationQueueCreate
646 VdpStatus
vdpau_presentation_queue_create(vdpau_driver_data_t * driver_data,VdpDevice device,VdpPresentationQueueTarget presentation_queue_target,VdpPresentationQueue * presentation_queue)647 vdpau_presentation_queue_create(
648     vdpau_driver_data_t       *driver_data,
649     VdpDevice                  device,
650     VdpPresentationQueueTarget presentation_queue_target,
651     VdpPresentationQueue      *presentation_queue
652 )
653 {
654     return VDPAU_INVOKE(presentation_queue_create,
655                         device,
656                         presentation_queue_target,
657                         presentation_queue);
658 }
659 
660 // VdpPresentationQueueDestroy
661 VdpStatus
vdpau_presentation_queue_destroy(vdpau_driver_data_t * driver_data,VdpPresentationQueue presentation_queue)662 vdpau_presentation_queue_destroy(
663     vdpau_driver_data_t *driver_data,
664     VdpPresentationQueue presentation_queue
665 )
666 {
667 
668     return VDPAU_INVOKE(presentation_queue_destroy, presentation_queue);
669 }
670 
671 // VdpPresentationQueueSetBackgroundColor
672 VdpStatus
vdpau_presentation_queue_set_background_color(vdpau_driver_data_p driver_data,VdpPresentationQueue presentation_queue,const VdpColor * background_color)673 vdpau_presentation_queue_set_background_color(
674     vdpau_driver_data_p  driver_data,
675     VdpPresentationQueue presentation_queue,
676     const VdpColor      *background_color
677 )
678 {
679     return VDPAU_INVOKE(presentation_queue_set_background_color,
680                         presentation_queue,
681                         (VdpColor *)background_color);
682 }
683 
684 //VdpPresentationQueueGetBackgroundColor
685 VdpStatus
vdpau_presentation_queue_get_background_color(vdpau_driver_data_p driver_data,VdpPresentationQueue presentation_queue,VdpColor * background_color)686 vdpau_presentation_queue_get_background_color(
687     vdpau_driver_data_p  driver_data,
688     VdpPresentationQueue presentation_queue,
689     VdpColor            *background_color
690 )
691 {
692     return VDPAU_INVOKE(presentation_queue_get_background_color,
693                         presentation_queue,
694                         background_color);
695 }
696 
697 // VdpPresentationQueueDisplay
698 VdpStatus
vdpau_presentation_queue_display(vdpau_driver_data_t * driver_data,VdpPresentationQueue presentation_queue,VdpOutputSurface surface,uint32_t clip_width,uint32_t clip_height,VdpTime earliest_presentation_time)699 vdpau_presentation_queue_display(
700     vdpau_driver_data_t *driver_data,
701     VdpPresentationQueue presentation_queue,
702     VdpOutputSurface     surface,
703     uint32_t             clip_width,
704     uint32_t             clip_height,
705     VdpTime              earliest_presentation_time
706 )
707 {
708     return VDPAU_INVOKE(presentation_queue_display,
709                         presentation_queue,
710                         surface,
711                         clip_width,
712                         clip_height,
713                         earliest_presentation_time);
714 }
715 
716 // VdpPresentationQueueBlockUntilSurfaceIdle
717 VdpStatus
vdpau_presentation_queue_block_until_surface_idle(vdpau_driver_data_t * driver_data,VdpPresentationQueue presentation_queue,VdpOutputSurface surface,VdpTime * first_presentation_time)718 vdpau_presentation_queue_block_until_surface_idle(
719     vdpau_driver_data_t *driver_data,
720     VdpPresentationQueue presentation_queue,
721     VdpOutputSurface     surface,
722     VdpTime             *first_presentation_time
723 )
724 {
725     return VDPAU_INVOKE(presentation_queue_block_until_surface_idle,
726                         presentation_queue,
727                         surface,
728                         first_presentation_time);
729 }
730 
731 // VdpPresentationQueueQuerySurfaceStatus
732 VdpStatus
vdpau_presentation_queue_query_surface_status(vdpau_driver_data_t * driver_data,VdpPresentationQueue presentation_queue,VdpOutputSurface surface,VdpPresentationQueueStatus * status,VdpTime * first_presentation_time)733 vdpau_presentation_queue_query_surface_status(
734     vdpau_driver_data_t        *driver_data,
735     VdpPresentationQueue        presentation_queue,
736     VdpOutputSurface            surface,
737     VdpPresentationQueueStatus *status,
738     VdpTime                    *first_presentation_time
739 )
740 {
741     return VDPAU_INVOKE(presentation_queue_query_surface_status,
742                         presentation_queue,
743                         surface,
744                         status,
745                         first_presentation_time);
746 }
747 
748 // VdpPresentationQueueTargetCreateX11
749 VdpStatus
vdpau_presentation_queue_target_create_x11(vdpau_driver_data_t * driver_data,VdpDevice device,Drawable drawable,VdpPresentationQueueTarget * target)750 vdpau_presentation_queue_target_create_x11(
751     vdpau_driver_data_t        *driver_data,
752     VdpDevice                   device,
753     Drawable                    drawable,
754     VdpPresentationQueueTarget *target
755 )
756 {
757     return VDPAU_INVOKE(presentation_queue_target_create_x11,
758                         device,
759                         drawable,
760                         target);
761 }
762 
763 // VdpPresentationQueueTargetDestroy
764 VdpStatus
vdpau_presentation_queue_target_destroy(vdpau_driver_data_t * driver_data,VdpPresentationQueueTarget presentation_queue_target)765 vdpau_presentation_queue_target_destroy(
766     vdpau_driver_data_t       *driver_data,
767     VdpPresentationQueueTarget presentation_queue_target
768 )
769 {
770     return VDPAU_INVOKE(presentation_queue_target_destroy,
771                         presentation_queue_target);
772 }
773 
774 // VdpDecoderCreate
775 VdpStatus
vdpau_decoder_create(vdpau_driver_data_t * driver_data,VdpDevice device,VdpDecoderProfile profile,uint32_t width,uint32_t height,uint32_t max_references,VdpDecoder * decoder)776 vdpau_decoder_create(
777     vdpau_driver_data_t *driver_data,
778     VdpDevice            device,
779     VdpDecoderProfile    profile,
780     uint32_t             width,
781     uint32_t             height,
782     uint32_t             max_references,
783     VdpDecoder          *decoder
784 )
785 {
786     return VDPAU_INVOKE(decoder_create,
787                         device,
788                         profile,
789                         width,
790                         height,
791                         max_references,
792                         decoder);
793 }
794 
795 // VdpDecoderDestroy
796 VdpStatus
vdpau_decoder_destroy(vdpau_driver_data_t * driver_data,VdpDecoder decoder)797 vdpau_decoder_destroy(
798     vdpau_driver_data_t *driver_data,
799     VdpDecoder           decoder
800 )
801 {
802     return VDPAU_INVOKE(decoder_destroy, decoder);
803 }
804 
805 // VdpDecoderRender
806 VdpStatus
vdpau_decoder_render(vdpau_driver_data_t * driver_data,VdpDecoder decoder,VdpVideoSurface target,VdpPictureInfo const * picture_info,uint32_t bitstream_buffers_count,VdpBitstreamBuffer const * bitstream_buffers)807 vdpau_decoder_render(
808     vdpau_driver_data_t      *driver_data,
809     VdpDecoder                decoder,
810     VdpVideoSurface           target,
811     VdpPictureInfo const     *picture_info,
812     uint32_t                  bitstream_buffers_count,
813     VdpBitstreamBuffer const *bitstream_buffers
814 )
815 {
816     return VDPAU_INVOKE(decoder_render,
817                         decoder,
818                         target,
819                         picture_info,
820                         bitstream_buffers_count,
821                         bitstream_buffers);
822 }
823 
824 // VdpDecoderQueryCapabilities
825 VdpStatus
vdpau_decoder_query_capabilities(vdpau_driver_data_t * driver_data,VdpDevice device,VdpDecoderProfile profile,VdpBool * is_supported,uint32_t * max_level,uint32_t * max_references,uint32_t * max_width,uint32_t * max_height)826 vdpau_decoder_query_capabilities(
827     vdpau_driver_data_t *driver_data,
828     VdpDevice            device,
829     VdpDecoderProfile    profile,
830     VdpBool             *is_supported,
831     uint32_t            *max_level,
832     uint32_t            *max_references,
833     uint32_t            *max_width,
834     uint32_t            *max_height
835 )
836 {
837     return VDPAU_INVOKE(decoder_query_capabilities,
838                         device,
839                         profile,
840                         is_supported,
841                         max_level,
842                         max_references,
843                         max_width,
844                         max_height);
845 }
846 
847 // VdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities
848 VdpStatus
vdpau_video_surface_query_ycbcr_caps(vdpau_driver_data_t * driver_data,VdpDevice device,VdpChromaType surface_chroma_type,VdpYCbCrFormat bits_ycbcr_format,VdpBool * is_supported)849 vdpau_video_surface_query_ycbcr_caps(
850     vdpau_driver_data_t *driver_data,
851     VdpDevice            device,
852     VdpChromaType        surface_chroma_type,
853     VdpYCbCrFormat       bits_ycbcr_format,
854     VdpBool             *is_supported
855 )
856 {
857     return VDPAU_INVOKE(video_surface_query_ycbcr_caps,
858                         device,
859                         surface_chroma_type,
860                         bits_ycbcr_format,
861                         is_supported);
862 }
863 
864 // VdpOutputSurfaceQueryGetPutBitsNativeCapabilities
865 VdpStatus
vdpau_output_surface_query_rgba_caps(vdpau_driver_data_t * driver_data,VdpDevice device,VdpRGBAFormat surface_rgba_format,VdpBool * is_supported)866 vdpau_output_surface_query_rgba_caps(
867     vdpau_driver_data_t *driver_data,
868     VdpDevice            device,
869     VdpRGBAFormat        surface_rgba_format,
870     VdpBool             *is_supported
871 )
872 {
873     return VDPAU_INVOKE(output_surface_query_rgba_caps,
874                         device,
875                         surface_rgba_format,
876                         is_supported);
877 }
878 
879 // VdpGetApiVersion
880 VdpStatus
vdpau_get_api_version(vdpau_driver_data_t * driver_data,uint32_t * api_version)881 vdpau_get_api_version(vdpau_driver_data_t *driver_data, uint32_t *api_version)
882 {
883     return VDPAU_INVOKE(get_api_version, api_version);
884 }
885 
886 // VdpGetInformationString
887 VdpStatus
vdpau_get_information_string(vdpau_driver_data_t * driver_data,const char ** info_string)888 vdpau_get_information_string(
889     vdpau_driver_data_t *driver_data,
890     const char         **info_string
891 )
892 {
893     return VDPAU_INVOKE(get_information_string, info_string);
894 }
895 
896 // VdpGetErrorString
897 const char *
vdpau_get_error_string(vdpau_driver_data_t * driver_data,VdpStatus vdp_status)898 vdpau_get_error_string(vdpau_driver_data_t *driver_data, VdpStatus vdp_status)
899 {
900     return VDPAU_INVOKE_(NULL, get_error_string, vdp_status);
901 }
902