summaryrefslogtreecommitdiff
path: root/src/vdpau_gate.c
blob: db6140be8fccbae436c51c8f057333c1a41fdc0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
/*
 *  vdpau_gate.c - VDPAU hooks
 *
 *  libva-driver-vdpau (C) 2009-2011 Splitted-Desktop Systems
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */

#include "sysdeps.h"
#include "vdpau_gate.h"
#include "vdpau_video.h"

#define DEBUG 1
#include "debug.h"


// Initialize VDPAU hooks
int vdpau_gate_init(vdpau_driver_data_t *driver_data)
{
    VdpStatus vdp_status;

#define VDP_INIT_PROC(FUNC_ID, FUNC) do {                       \
        vdp_status = driver_data->vdp_get_proc_address          \
            (driver_data->vdp_device,                           \
             VDP_FUNC_ID_##FUNC_ID,                             \
             (void *)&driver_data->vdp_vtable.vdp_##FUNC);      \
        if (vdp_status != VDP_STATUS_OK)                        \
            return -1;                                          \
    } while (0)

    VDP_INIT_PROC(DEVICE_DESTROY,
                  device_destroy);
    VDP_INIT_PROC(GENERATE_CSC_MATRIX,
                  generate_csc_matrix);
    VDP_INIT_PROC(VIDEO_SURFACE_CREATE,
                  video_surface_create);
    VDP_INIT_PROC(VIDEO_SURFACE_DESTROY,
                  video_surface_destroy);
    VDP_INIT_PROC(VIDEO_SURFACE_GET_BITS_Y_CB_CR,
                  video_surface_get_bits_ycbcr);
    VDP_INIT_PROC(VIDEO_SURFACE_PUT_BITS_Y_CB_CR,
                  video_surface_put_bits_ycbcr);
    VDP_INIT_PROC(OUTPUT_SURFACE_CREATE,
                  output_surface_create);
    VDP_INIT_PROC(OUTPUT_SURFACE_DESTROY,
                  output_surface_destroy);
    VDP_INIT_PROC(OUTPUT_SURFACE_GET_BITS_NATIVE,
                  output_surface_get_bits_native);
    VDP_INIT_PROC(OUTPUT_SURFACE_PUT_BITS_NATIVE,
                  output_surface_put_bits_native);
    VDP_INIT_PROC(OUTPUT_SURFACE_RENDER_BITMAP_SURFACE,
                  output_surface_render_bitmap_surface);
    VDP_INIT_PROC(OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE,
                  output_surface_render_output_surface);
    VDP_INIT_PROC(OUTPUT_SURFACE_QUERY_PUT_BITS_INDEXED_CAPABILITIES,
                  output_surface_query_put_bits_indexed_capabilities);
    VDP_INIT_PROC(OUTPUT_SURFACE_PUT_BITS_INDEXED,
                  output_surface_put_bits_indexed);
    VDP_INIT_PROC(BITMAP_SURFACE_QUERY_CAPABILITIES,
                  bitmap_surface_query_capabilities);
    VDP_INIT_PROC(BITMAP_SURFACE_CREATE,
                  bitmap_surface_create);
    VDP_INIT_PROC(BITMAP_SURFACE_DESTROY,
                  bitmap_surface_destroy);
    VDP_INIT_PROC(BITMAP_SURFACE_PUT_BITS_NATIVE,
                  bitmap_surface_put_bits_native);
    VDP_INIT_PROC(VIDEO_MIXER_CREATE,
                  video_mixer_create);
    VDP_INIT_PROC(VIDEO_MIXER_DESTROY,
                  video_mixer_destroy);
    VDP_INIT_PROC(VIDEO_MIXER_RENDER,
                  video_mixer_render);
    VDP_INIT_PROC(VIDEO_MIXER_QUERY_FEATURE_SUPPORT,
                  video_mixer_query_feature_support);
    VDP_INIT_PROC(VIDEO_MIXER_GET_FEATURE_ENABLES,
                  video_mixer_get_feature_enables);
    VDP_INIT_PROC(VIDEO_MIXER_SET_FEATURE_ENABLES,
                  video_mixer_set_feature_enables);
    VDP_INIT_PROC(VIDEO_MIXER_QUERY_ATTRIBUTE_SUPPORT,
                  video_mixer_query_attribute_support);
    VDP_INIT_PROC(VIDEO_MIXER_GET_ATTRIBUTE_VALUES,
                  video_mixer_get_attribute_values);
    VDP_INIT_PROC(VIDEO_MIXER_SET_ATTRIBUTE_VALUES,
                  video_mixer_set_attribute_values);
    VDP_INIT_PROC(PRESENTATION_QUEUE_CREATE,
                  presentation_queue_create);
    VDP_INIT_PROC(PRESENTATION_QUEUE_DESTROY,
                  presentation_queue_destroy);
    VDP_INIT_PROC(PRESENTATION_QUEUE_SET_BACKGROUND_COLOR,
                  presentation_queue_set_background_color);
    VDP_INIT_PROC(PRESENTATION_QUEUE_GET_BACKGROUND_COLOR,
                  presentation_queue_get_background_color);
    VDP_INIT_PROC(PRESENTATION_QUEUE_DISPLAY,
                  presentation_queue_display);
    VDP_INIT_PROC(PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE,
                  presentation_queue_block_until_surface_idle);
    VDP_INIT_PROC(PRESENTATION_QUEUE_QUERY_SURFACE_STATUS,
                  presentation_queue_query_surface_status);
    VDP_INIT_PROC(PRESENTATION_QUEUE_TARGET_CREATE_X11,
                  presentation_queue_target_create_x11);
    VDP_INIT_PROC(PRESENTATION_QUEUE_TARGET_DESTROY,
                  presentation_queue_target_destroy);
    VDP_INIT_PROC(DECODER_CREATE,
                  decoder_create);
    VDP_INIT_PROC(DECODER_DESTROY,
                  decoder_destroy);
    VDP_INIT_PROC(DECODER_RENDER,
                  decoder_render);
    VDP_INIT_PROC(DECODER_QUERY_CAPABILITIES,
                  decoder_query_capabilities);
    VDP_INIT_PROC(VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES,
                  video_surface_query_ycbcr_caps);
    VDP_INIT_PROC(OUTPUT_SURFACE_QUERY_GET_PUT_BITS_NATIVE_CAPABILITIES,
                  output_surface_query_rgba_caps);
    VDP_INIT_PROC(GET_API_VERSION,
                  get_api_version);
    VDP_INIT_PROC(GET_INFORMATION_STRING,
                  get_information_string);
    VDP_INIT_PROC(GET_ERROR_STRING,
                  get_error_string);

#undef VDP_INIT_PROC
    return 0;
}

// Deinitialize VDPAU hooks
void vdpau_gate_exit(vdpau_driver_data_t *driver_data)
{
}

// Check VdpStatus
int vdpau_check_status(
    vdpau_driver_data_p driver_data,
    VdpStatus           vdp_status,
    const char         *msg
)
{
    if (vdp_status != VDP_STATUS_OK) {
        const char *vdp_status_string;
        vdp_status_string = vdpau_get_error_string(driver_data, vdp_status);
        vdpau_information_message("%s: status %d: %s\n", msg, vdp_status,
            vdp_status_string ? vdp_status_string : "<unknown error>");
        return 0;
    }
    return 1;
}

#define VDPAU_INVOKE_(retval, func, ...)               \
    (driver_data && driver_data->vdp_vtable.vdp_##func \
     ? driver_data->vdp_vtable.vdp_##func(__VA_ARGS__) \
     : (retval))

#define VDPAU_INVOKE(func, ...)                        \
    VDPAU_INVOKE_(VDP_STATUS_INVALID_POINTER,          \
                  func, __VA_ARGS__)

// VdpGenerateCSCMatrix
VdpStatus
vdpau_generate_csc_matrix(
    vdpau_driver_data_p driver_data,
    VdpProcamp         *procamp,
    VdpColorStandard    standard,
    VdpCSCMatrix       *csc_matrix
)
{
    return VDPAU_INVOKE(generate_csc_matrix,
                        procamp,
                        standard,
                        csc_matrix);
}

// VdpDeviceDestroy
VdpStatus
vdpau_device_destroy(
    vdpau_driver_data_t *driver_data,
    VdpDevice            device
)
{
    return VDPAU_INVOKE(device_destroy, device);
}

// VdpVideoSurfaceCreate
VdpStatus
vdpau_video_surface_create(
    vdpau_driver_data_t *driver_data,
    VdpDevice            device,
    VdpChromaType        chroma_type,
    uint32_t             width,
    uint32_t             height,
    VdpVideoSurface     *surface
)
{
    return VDPAU_INVOKE(video_surface_create,
                        device,
                        chroma_type,
                        width,
                        height,
                        surface);
}

// VdpVideoSurfaceDestroy
VdpStatus
vdpau_video_surface_destroy(
    vdpau_driver_data_t *driver_data,
    VdpVideoSurface      surface
)
{
    return VDPAU_INVOKE(video_surface_destroy, surface);
}

// VdpVideoSurfaceGetBitsYCbCr
VdpStatus
vdpau_video_surface_get_bits_ycbcr(
    vdpau_driver_data_t *driver_data,
    VdpVideoSurface      surface,
    VdpYCbCrFormat       format,
    uint8_t            **dest,
    uint32_t            *stride
)
{
    return VDPAU_INVOKE(video_surface_get_bits_ycbcr,
                        surface,
                        format,
                        (void * const *)dest,
                        stride);
}

// VdpVideoSurfacePutBitsYCbCr
VdpStatus
vdpau_video_surface_put_bits_ycbcr(
    vdpau_driver_data_t *driver_data,
    VdpVideoSurface      surface,
    VdpYCbCrFormat       format,
    uint8_t            **src,
    uint32_t            *stride
)
{
    return VDPAU_INVOKE(video_surface_put_bits_ycbcr,
                        surface,
                        format,
                        (const void * const *)src,
                        stride);
}

// VdpOutputSurfaceCreate
VdpStatus
vdpau_output_surface_create(
    vdpau_driver_data_t *driver_data,
    VdpDevice            device,
    VdpRGBAFormat        rgba_format,
    uint32_t             width,
    uint32_t             height,
    VdpOutputSurface    *surface
)
{
    return VDPAU_INVOKE(output_surface_create,
                        device,
                        rgba_format,
                        width,
                        height,
                        surface);
}

// VdpOutputSurfaceDestroy
VdpStatus
vdpau_output_surface_destroy(
    vdpau_driver_data_t *driver_data,
    VdpOutputSurface     surface
)
{
    return VDPAU_INVOKE(output_surface_destroy, surface);
}

// VdpOutputSurfaceGetBitsNative
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
)
{
    return VDPAU_INVOKE(output_surface_get_bits_native,
                        surface,
                        source_rect,
                        (void * const *)dst,
                        stride);
}

// VdpOutputSurfacePutBitsNative
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
)
{
    return VDPAU_INVOKE(output_surface_put_bits_native,
                        surface,
                        (const void * const *)src,
                        stride,
                        dest_rect);
}

// VdpOutputSurfaceRenderBitmapSurface
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
)
{
    return VDPAU_INVOKE(output_surface_render_bitmap_surface,
                        destination_surface,
                        destination_rect,
                        source_surface,
                        source_rect,
                        colors,
                        blend_state,
                        flags);
}

// VdpOutputSurfaceRenderOutputSurface
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
)
{
    return VDPAU_INVOKE(output_surface_render_output_surface,
                        destination_surface,
                        destination_rect,
                        source_surface,
                        source_rect,
                        colors,
                        blend_state,
                        flags);
}

// VdpOutputSurfaceQueryPutBitsIndexedCapabilities
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
)
{
    return VDPAU_INVOKE(output_surface_query_put_bits_indexed_capabilities,
                        device,
                        rgba_format,
                        bits_indexed_format,
                        color_table_format,
                        is_supported);
}

// VdpOutputSurfacePutBitsIndexed
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
)
{
    return VDPAU_INVOKE(output_surface_put_bits_indexed,
                        surface,
                        source_indexed_format,
                        (const void **)source_data,
                        source_pitch,
                        destination_rect,
                        color_table_format,
                        color_table);
}

// VdpBitmapSurfaceQueryCapabilities
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
)
{
    return VDPAU_INVOKE(bitmap_surface_query_capabilities,
                        device,
                        rgba_format,
                        is_supported,
                        max_width,
                        max_height);
}

// VdpBitmapSurfaceCreate
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
)
{
    return VDPAU_INVOKE(bitmap_surface_create,
                        device,
                        rgba_format,
                        width,
                        height,
                        frequently_accessed,
                        surface);
}

// VdpBitmapSurfaceDestroy
VdpStatus
vdpau_bitmap_surface_destroy(
    vdpau_driver_data_t *driver_data,
    VdpBitmapSurface     surface
)
{
    return VDPAU_INVOKE(bitmap_surface_destroy, surface);
}

// VdpBitmapSurfacePutBitsNative
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
)
{
    return VDPAU_INVOKE(bitmap_surface_put_bits_native,
                        surface,
                        (const void * const *)src,
                        stride,
                        dest_rect);
}

// VdpVideoMixerCreate
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
)
{
    return VDPAU_INVOKE(video_mixer_create,
                        device,
                        feature_count,
                        features,
                        parameter_count,
                        parameters,
                        parameter_values,
                        mixer);
}

// VdpVideoMixerDestroy
VdpStatus
vdpau_video_mixer_destroy(
    vdpau_driver_data_t *driver_data,
    VdpVideoMixer        mixer
)
{
    return VDPAU_INVOKE(video_mixer_destroy, mixer);
}

// VdpVideoMixerRender
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
)
{
    return VDPAU_INVOKE(video_mixer_render,
                        mixer,
                        background_surface,
                        background_source_rect,
                        current_picture_structure,
                        video_surface_past_count,
                        video_surface_past,
                        video_surface_current,
                        video_surface_future_count,
                        video_surface_future,
                        video_source_rect,
                        destination_surface,
                        destination_rect,
                        destination_video_rect,
                        layer_count,
                        layers);
}

// VdpVideoMixerQueryFeatureSupport
VdpStatus
vdpau_video_mixer_query_feature_support(
    vdpau_driver_data_p         driver_data,
    VdpDevice                   device,
    VdpVideoMixerFeature        feature,
    VdpBool                    *is_supported
)
{
    return VDPAU_INVOKE(video_mixer_query_feature_support,
                        device,
                        feature,
                        is_supported);
}

// VdpVideoMixerGetFeatureEnables
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
)
{
    return VDPAU_INVOKE(video_mixer_get_feature_enables,
                        mixer,
                        feature_count,
                        features,
                        feature_enables);
}

// VdpVideoMixerSetFeatureEnables
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
)
{
    return VDPAU_INVOKE(video_mixer_set_feature_enables,
                        mixer,
                        feature_count,
                        features,
                        feature_enables);
}

// VdpVideoMixerQueryAttributeSupport
VdpStatus
vdpau_video_mixer_query_attribute_support(
    vdpau_driver_data_p         driver_data,
    VdpDevice                   device,
    VdpVideoMixerAttribute      attribute,
    VdpBool                    *is_supported
)
{
    return VDPAU_INVOKE(video_mixer_query_attribute_support,
                        device,
                        attribute,
                        is_supported);
}

// VdpVideoMixerGetAttributeValues
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
)
{
    return VDPAU_INVOKE(video_mixer_get_attribute_values,
                        mixer,
                        attribute_count,
                        attributes,
                        attribute_values);
}

// VdpVideoMixerSetAttributeValues
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
)
{
    return VDPAU_INVOKE(video_mixer_set_attribute_values,
                        mixer,
                        attribute_count,
                        attributes,
                        attribute_values);
}

// VdpPresentationQueueCreate
VdpStatus
vdpau_presentation_queue_create(
    vdpau_driver_data_t       *driver_data,
    VdpDevice                  device,
    VdpPresentationQueueTarget presentation_queue_target,
    VdpPresentationQueue      *presentation_queue
)
{
    return VDPAU_INVOKE(presentation_queue_create,
                        device,
                        presentation_queue_target,
                        presentation_queue);
}

// VdpPresentationQueueDestroy
VdpStatus
vdpau_presentation_queue_destroy(
    vdpau_driver_data_t *driver_data,
    VdpPresentationQueue presentation_queue
)
{

    return VDPAU_INVOKE(presentation_queue_destroy, presentation_queue);
}

// VdpPresentationQueueSetBackgroundColor
VdpStatus
vdpau_presentation_queue_set_background_color(
    vdpau_driver_data_p  driver_data,
    VdpPresentationQueue presentation_queue,
    const VdpColor      *background_color
)
{
    return VDPAU_INVOKE(presentation_queue_set_background_color,
                        presentation_queue,
                        (VdpColor *)background_color);
}

//VdpPresentationQueueGetBackgroundColor
VdpStatus
vdpau_presentation_queue_get_background_color(
    vdpau_driver_data_p  driver_data,
    VdpPresentationQueue presentation_queue,
    VdpColor            *background_color
)
{
    return VDPAU_INVOKE(presentation_queue_get_background_color,
                        presentation_queue,
                        background_color);
}

// VdpPresentationQueueDisplay
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
)
{
    return VDPAU_INVOKE(presentation_queue_display,
                        presentation_queue,
                        surface,
                        clip_width,
                        clip_height,
                        earliest_presentation_time);
}

// VdpPresentationQueueBlockUntilSurfaceIdle
VdpStatus
vdpau_presentation_queue_block_until_surface_idle(
    vdpau_driver_data_t *driver_data,
    VdpPresentationQueue presentation_queue,
    VdpOutputSurface     surface,
    VdpTime             *first_presentation_time
)
{
    return VDPAU_INVOKE(presentation_queue_block_until_surface_idle,
                        presentation_queue,
                        surface,
                        first_presentation_time);
}

// VdpPresentationQueueQuerySurfaceStatus
VdpStatus
vdpau_presentation_queue_query_surface_status(
    vdpau_driver_data_t        *driver_data,
    VdpPresentationQueue        presentation_queue,
    VdpOutputSurface            surface,
    VdpPresentationQueueStatus *status,
    VdpTime                    *first_presentation_time
)
{
    return VDPAU_INVOKE(presentation_queue_query_surface_status,
                        presentation_queue,
                        surface,
                        status,
                        first_presentation_time);
}

// VdpPresentationQueueTargetCreateX11
VdpStatus
vdpau_presentation_queue_target_create_x11(
    vdpau_driver_data_t        *driver_data,
    VdpDevice                   device,
    Drawable                    drawable,
    VdpPresentationQueueTarget *target
)
{
    return VDPAU_INVOKE(presentation_queue_target_create_x11,
                        device,
                        drawable,
                        target);
}

// VdpPresentationQueueTargetDestroy
VdpStatus
vdpau_presentation_queue_target_destroy(
    vdpau_driver_data_t       *driver_data,
    VdpPresentationQueueTarget presentation_queue_target
)
{
    return VDPAU_INVOKE(presentation_queue_target_destroy,
                        presentation_queue_target);
}

// VdpDecoderCreate
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
)
{
    return VDPAU_INVOKE(decoder_create,
                        device,
                        profile,
                        width,
                        height,
                        max_references,
                        decoder);
}

// VdpDecoderDestroy
VdpStatus
vdpau_decoder_destroy(
    vdpau_driver_data_t *driver_data,
    VdpDecoder           decoder
)
{
    return VDPAU_INVOKE(decoder_destroy, decoder);
}

// VdpDecoderRender
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
)
{
    return VDPAU_INVOKE(decoder_render,
                        decoder,
                        target,
                        picture_info,
                        bitstream_buffers_count,
                        bitstream_buffers);
}

// VdpDecoderQueryCapabilities
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
)
{
    return VDPAU_INVOKE(decoder_query_capabilities,
                        device,
                        profile,
                        is_supported,
                        max_level,
                        max_references,
                        max_width,
                        max_height);
}

// VdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities
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
)
{
    return VDPAU_INVOKE(video_surface_query_ycbcr_caps,
                        device,
                        surface_chroma_type,
                        bits_ycbcr_format,
                        is_supported);
}

// VdpOutputSurfaceQueryGetPutBitsNativeCapabilities
VdpStatus
vdpau_output_surface_query_rgba_caps(
    vdpau_driver_data_t *driver_data,
    VdpDevice            device,
    VdpRGBAFormat        surface_rgba_format,
    VdpBool             *is_supported
)
{
    return VDPAU_INVOKE(output_surface_query_rgba_caps,
                        device,
                        surface_rgba_format,
                        is_supported);
}

// VdpGetApiVersion
VdpStatus
vdpau_get_api_version(vdpau_driver_data_t *driver_data, uint32_t *api_version)
{
    return VDPAU_INVOKE(get_api_version, api_version);
}

// VdpGetInformationString
VdpStatus
vdpau_get_information_string(
    vdpau_driver_data_t *driver_data,
    const char         **info_string
)
{
    return VDPAU_INVOKE(get_information_string, info_string);
}

// VdpGetErrorString
const char *
vdpau_get_error_string(vdpau_driver_data_t *driver_data, VdpStatus vdp_status)
{
    return VDPAU_INVOKE_(NULL, get_error_string, vdp_status);
}