Merge remote branch 'origin/master' into pipe-video
[mesa.git] / src / gallium / state_trackers / vdpau / presentation.c
1 /**************************************************************************
2 *
3 * Copyright 2010 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 TUNGSTEN GRAPHICS 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 #include "vdpau_private.h"
29 #include <vdpau/vdpau.h>
30 #include <util/u_debug.h>
31 #include <util/u_memory.h>
32
33 VdpStatus
34 vlVdpPresentationQueueTargetDestroy (VdpPresentationQueueTarget presentation_queue_target)
35 {
36
37 return VDP_STATUS_NO_IMPLEMENTATION;
38 }
39
40 VdpStatus
41 vlVdpPresentationQueueCreate ( VdpDevice device,
42 VdpPresentationQueueTarget presentation_queue_target,
43 VdpPresentationQueue *presentation_queue)
44 {
45 debug_printf("[VDPAU] Creating PresentationQueue\n");
46 VdpStatus ret;
47 vlVdpPresentationQueue *pq = NULL;
48
49 if (!presentation_queue)
50 return VDP_STATUS_INVALID_POINTER;
51
52 vlVdpDevice *dev = vlGetDataHTAB(device);
53 if (!dev)
54 return VDP_STATUS_INVALID_HANDLE;
55
56 vlVdpPresentationQueueTarget *pqt = vlGetDataHTAB(presentation_queue_target);
57 if (!pqt)
58 return VDP_STATUS_INVALID_HANDLE;
59
60 if (dev != pqt->device)
61 return VDP_STATUS_HANDLE_DEVICE_MISMATCH;
62
63 pq = CALLOC(1, sizeof(vlVdpPresentationQueue));
64 if (!pq)
65 return VDP_STATUS_RESOURCES;
66
67 *presentation_queue = vlAddDataHTAB(pq);
68 if (*presentation_queue == 0) {
69 ret = VDP_STATUS_ERROR;
70 goto no_handle;
71 }
72
73
74 return VDP_STATUS_OK;
75 no_handle:
76 FREE(pq);
77 return ret;
78 }
79
80 VdpStatus
81 vlVdpPresentationQueueDestroy (VdpPresentationQueue presentation_queue)
82 {
83
84 return VDP_STATUS_NO_IMPLEMENTATION;
85 }
86
87 VdpStatus
88 vlVdpPresentationQueueSetBackgroundColor ( VdpPresentationQueue presentation_queue,
89 VdpColor *const background_color)
90 {
91 if (!background_color)
92 return VDP_STATUS_INVALID_POINTER;
93
94 return VDP_STATUS_NO_IMPLEMENTATION;
95 }
96
97 VdpStatus
98 vlVdpPresentationQueueGetBackgroundColor ( VdpPresentationQueue presentation_queue,
99 VdpColor *const background_color)
100 {
101 if (!background_color)
102 return VDP_STATUS_INVALID_POINTER;
103
104 return VDP_STATUS_NO_IMPLEMENTATION;
105 }
106
107 VdpStatus
108 vlVdpPresentationQueueGetTime ( VdpPresentationQueue presentation_queue,
109 VdpTime *current_time)
110 {
111 if (!current_time)
112 return VDP_STATUS_INVALID_POINTER;
113
114 return VDP_STATUS_NO_IMPLEMENTATION;
115 }
116
117 VdpStatus
118 vlVdpPresentationQueueDisplay ( VdpPresentationQueue presentation_queue,
119 VdpOutputSurface surface,
120 uint32_t clip_width,
121 uint32_t clip_height,
122 VdpTime earliest_presentation_time)
123 {
124
125 return VDP_STATUS_NO_IMPLEMENTATION;
126 }
127
128 VdpStatus
129 vlVdpPresentationQueueBlockUntilSurfaceIdle ( VdpPresentationQueue presentation_queue,
130 VdpOutputSurface surface,
131 VdpTime *first_presentation_time)
132 {
133 if (!first_presentation_time)
134 return VDP_STATUS_INVALID_POINTER;
135
136 return VDP_STATUS_NO_IMPLEMENTATION;
137 }
138
139 VdpStatus
140 vlVdpPresentationQueueQuerySurfaceStatus ( VdpPresentationQueue presentation_queue,
141 VdpOutputSurface surface,
142 VdpPresentationQueueStatus *status,
143 VdpTime *first_presentation_time)
144 {
145 if (!(status && first_presentation_time))
146 return VDP_STATUS_INVALID_POINTER;
147
148 return VDP_STATUS_NO_IMPLEMENTATION;
149 }