forked from mosterta/libvdpau-sunxi
-
Notifications
You must be signed in to change notification settings - Fork 1
/
surface_output.c
230 lines (175 loc) · 6.95 KB
/
surface_output.c
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
/*
* Copyright (c) 2013 Jens Kuske <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "vdpau_private.h"
#include "string.h"
#include "vdpau_private.h"
VdpStatus vdp_output_surface_create(VdpDevice device, VdpRGBAFormat rgba_format, uint32_t width, uint32_t height, VdpOutputSurface *surface)
{
int status = VDP_STATUS_OK;
if (!surface)
return VDP_STATUS_INVALID_POINTER;
if (!width || !height)
return VDP_STATUS_INVALID_SIZE;
device_ctx_t *dev = handle_get(device);
if (!dev)
return VDP_STATUS_INVALID_HANDLE;
output_surface_ctx_t *out = handle_create(sizeof(*out), surface, htype_output);
if (out)
{
memset(out, 0, sizeof(*out));
out->width = width;
out->height = height;
out->rgba_format = rgba_format;
out->contrast = 1.0;
out->saturation = 1.0;
out->device = dev;
}
else{
status = VDP_STATUS_RESOURCES;
}
handle_release(device);
return status;
}
VdpStatus vdp_output_surface_destroy(VdpOutputSurface surface)
{
output_surface_ctx_t *out = handle_get(surface);
if (!out)
return VDP_STATUS_INVALID_HANDLE;
memset(out, 0, sizeof(*out));
handle_release(surface);
handle_destroy(surface);
return VDP_STATUS_OK;
}
VdpStatus vdp_output_surface_get_parameters(VdpOutputSurface surface, VdpRGBAFormat *rgba_format, uint32_t *width, uint32_t *height)
{
output_surface_ctx_t *out = handle_get(surface);
if (!out)
return VDP_STATUS_INVALID_HANDLE;
if (rgba_format)
*rgba_format = out->rgba_format;
if (width)
*width = out->width;
if (height)
*height = out->height;
handle_release(surface);
return VDP_STATUS_OK;
}
VdpStatus vdp_output_surface_get_bits_native(VdpOutputSurface surface, VdpRect const *source_rect, void *const *destination_data, uint32_t const *destination_pitches)
{
output_surface_ctx_t *out = handle_get(surface);
if (!out)
return VDP_STATUS_INVALID_HANDLE;
handle_release(surface);
return VDP_STATUS_ERROR;
}
VdpStatus vdp_output_surface_put_bits_native(VdpOutputSurface surface, void const *const *source_data, uint32_t const *source_pitches, VdpRect const *destination_rect)
{
output_surface_ctx_t *out = handle_get(surface);
if (!out)
return VDP_STATUS_INVALID_HANDLE;
VDPAU_DBG_ONCE("%s called but unimplemented!", __func__);
handle_release(surface);
return VDP_STATUS_OK;
}
VdpStatus vdp_output_surface_put_bits_indexed(VdpOutputSurface surface, VdpIndexedFormat source_indexed_format, void const *const *source_data, uint32_t const *source_pitch, VdpRect const *destination_rect, VdpColorTableFormat color_table_format, void const *color_table)
{
output_surface_ctx_t *out = handle_get(surface);
if (!out)
return VDP_STATUS_INVALID_HANDLE;
VDPAU_DBG_ONCE("%s called but unimplemented!", __func__);
handle_release(surface);
return VDP_STATUS_OK;
}
VdpStatus vdp_output_surface_put_bits_y_cb_cr(VdpOutputSurface surface, VdpYCbCrFormat source_ycbcr_format, void const *const *source_data, uint32_t const *source_pitches, VdpRect const *destination_rect, VdpCSCMatrix const *csc_matrix)
{
output_surface_ctx_t *out = handle_get(surface);
if (!out)
return VDP_STATUS_INVALID_HANDLE;
VDPAU_DBG_ONCE("%s called but unimplemented!", __func__);
handle_release(surface);
return VDP_STATUS_OK;
}
VdpStatus vdp_output_surface_render_output_surface(VdpOutputSurface destination_surface, VdpRect const *destination_rect, VdpOutputSurface source_surface, VdpRect const *source_rect, VdpColor const *colors, VdpOutputSurfaceRenderBlendState const *blend_state, uint32_t flags)
{
output_surface_ctx_t *out = handle_get(destination_surface);
if (!out)
return VDP_STATUS_INVALID_HANDLE;
output_surface_ctx_t *in = handle_get(source_surface);
if (!in)
return VDP_STATUS_INVALID_HANDLE;
VDPAU_DBG_ONCE("%s called but unimplemented!", __func__);
handle_release(destination_surface);
handle_release(source_surface);
return VDP_STATUS_OK;
}
VdpStatus vdp_output_surface_render_bitmap_surface(VdpOutputSurface destination_surface, VdpRect const *destination_rect, VdpBitmapSurface source_surface, VdpRect const *source_rect, VdpColor const *colors, VdpOutputSurfaceRenderBlendState const *blend_state, uint32_t flags)
{
output_surface_ctx_t *out = handle_get(destination_surface);
if (!out)
return VDP_STATUS_INVALID_HANDLE;
VDPAU_DBG_ONCE("%s called but unimplemented!", __func__);
handle_release(destination_surface);
return VDP_STATUS_OK;
}
VdpStatus vdp_output_surface_query_capabilities(VdpDevice device, VdpRGBAFormat surface_rgba_format, VdpBool *is_supported, uint32_t *max_width, uint32_t *max_height)
{
if (!is_supported || !max_width || !max_height)
return VDP_STATUS_INVALID_POINTER;
device_ctx_t *dev = handle_get(device);
if (!dev)
return VDP_STATUS_INVALID_HANDLE;
*is_supported = (surface_rgba_format == VDP_RGBA_FORMAT_R8G8B8A8 || surface_rgba_format == VDP_RGBA_FORMAT_B8G8R8A8);
*max_width = 8192;
*max_height = 8192;
handle_release(device);
return VDP_STATUS_OK;
}
VdpStatus vdp_output_surface_query_get_put_bits_native_capabilities(VdpDevice device, VdpRGBAFormat surface_rgba_format, VdpBool *is_supported)
{
if (!is_supported)
return VDP_STATUS_INVALID_POINTER;
device_ctx_t *dev = handle_get(device);
if (!dev)
return VDP_STATUS_INVALID_HANDLE;
*is_supported = VDP_FALSE;
handle_release(device);
return VDP_STATUS_OK;
}
VdpStatus vdp_output_surface_query_put_bits_indexed_capabilities(VdpDevice device, VdpRGBAFormat surface_rgba_format, VdpIndexedFormat bits_indexed_format, VdpColorTableFormat color_table_format, VdpBool *is_supported)
{
if (!is_supported)
return VDP_STATUS_INVALID_POINTER;
device_ctx_t *dev = handle_get(device);
if (!dev)
return VDP_STATUS_INVALID_HANDLE;
*is_supported = VDP_FALSE;
handle_release(device);
return VDP_STATUS_OK;
}
VdpStatus vdp_output_surface_query_put_bits_y_cb_cr_capabilities(VdpDevice device, VdpRGBAFormat surface_rgba_format, VdpYCbCrFormat bits_ycbcr_format, VdpBool *is_supported)
{
if (!is_supported)
return VDP_STATUS_INVALID_POINTER;
device_ctx_t *dev = handle_get(device);
if (!dev)
return VDP_STATUS_INVALID_HANDLE;
*is_supported = VDP_FALSE;
handle_release(device);
return VDP_STATUS_OK;
}