1/*
2Copyright (c) 2012, Broadcom Europe Ltd
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are met:
7 * Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.
9 * Redistributions in binary form must reproduce the above copyright
10 notice, this list of conditions and the following disclaimer in the
11 documentation and/or other materials provided with the distribution.
12 * Neither the name of the copyright holder nor the
13 names of its contributors may be used to endorse or promote products
14 derived from this software without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*/
27
28#ifndef _WFC_H_
29#define _WFC_H_
30
31#include "wfcplatform.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37#define OPENWFC_VERSION_1_0 (1)
38
39#define WFC_NONE (0)
40
41#define WFC_INVALID_HANDLE ((WFCHandle)0)
42
43#define WFC_DEFAULT_DEVICE_ID (0)
44
45#define WFC_MAX_INT ((WFCint)16777216)
46#define WFC_MAX_FLOAT ((WFCfloat)16777216)
47
48typedef WFCHandle WFCDevice;
49typedef WFCHandle WFCContext;
50typedef WFCHandle WFCSource;
51typedef WFCHandle WFCMask;
52typedef WFCHandle WFCElement;
53
54typedef enum {
55 WFC_ERROR_NONE = 0,
56 WFC_ERROR_OUT_OF_MEMORY = 0x7001,
57 WFC_ERROR_ILLEGAL_ARGUMENT = 0x7002,
58 WFC_ERROR_UNSUPPORTED = 0x7003,
59 WFC_ERROR_BAD_ATTRIBUTE = 0x7004,
60 WFC_ERROR_IN_USE = 0x7005,
61 WFC_ERROR_BUSY = 0x7006,
62 WFC_ERROR_BAD_DEVICE = 0x7007,
63 WFC_ERROR_BAD_HANDLE = 0x7008,
64 WFC_ERROR_INCONSISTENCY = 0x7009,
65 WFC_ERROR_FORCE_32BIT = 0x7FFFFFFF
66} WFCErrorCode;
67
68typedef enum {
69 WFC_DEVICE_FILTER_SCREEN_NUMBER = 0x7020,
70 WFC_DEVICE_FILTER_FORCE_32BIT = 0x7FFFFFFF
71} WFCDeviceFilter;
72
73typedef enum {
74 /* Read-only */
75 WFC_DEVICE_CLASS = 0x7030,
76 WFC_DEVICE_ID = 0x7031,
77 WFC_DEVICE_FORCE_32BIT = 0x7FFFFFFF
78} WFCDeviceAttrib;
79
80typedef enum {
81 WFC_DEVICE_CLASS_FULLY_CAPABLE = 0x7040,
82 WFC_DEVICE_CLASS_OFF_SCREEN_ONLY = 0x7041,
83 WFC_DEVICE_CLASS_FORCE_32BIT = 0x7FFFFFFF
84} WFCDeviceClass;
85
86typedef enum {
87 /* Read-only */
88 WFC_CONTEXT_TYPE = 0x7051,
89 WFC_CONTEXT_TARGET_HEIGHT = 0x7052,
90 WFC_CONTEXT_TARGET_WIDTH = 0x7053,
91 WFC_CONTEXT_LOWEST_ELEMENT = 0x7054,
92
93 /* Read-write */
94 WFC_CONTEXT_ROTATION = 0x7061,
95 WFC_CONTEXT_BG_COLOR = 0x7062,
96 WFC_CONTEXT_FORCE_32BIT = 0x7FFFFFFF
97} WFCContextAttrib;
98
99typedef enum {
100 WFC_CONTEXT_TYPE_ON_SCREEN = 0x7071,
101 WFC_CONTEXT_TYPE_OFF_SCREEN = 0x7072,
102 WFC_CONTEXT_TYPE_FORCE_32BIT = 0x7FFFFFFF
103} WFCContextType;
104
105typedef enum {
106 /* Clockwise rotation */
107 WFC_ROTATION_0 = 0x7081, /* default */
108 WFC_ROTATION_90 = 0x7082,
109 WFC_ROTATION_180 = 0x7083,
110 WFC_ROTATION_270 = 0x7084,
111 WFC_ROTATION_FORCE_32BIT = 0x7FFFFFFF
112} WFCRotation;
113
114typedef enum {
115 WFC_ELEMENT_DESTINATION_RECTANGLE = 0x7101,
116 WFC_ELEMENT_SOURCE = 0x7102,
117 WFC_ELEMENT_SOURCE_RECTANGLE = 0x7103,
118 WFC_ELEMENT_SOURCE_FLIP = 0x7104,
119 WFC_ELEMENT_SOURCE_ROTATION = 0x7105,
120 WFC_ELEMENT_SOURCE_SCALE_FILTER = 0x7106,
121 WFC_ELEMENT_TRANSPARENCY_TYPES = 0x7107,
122 WFC_ELEMENT_GLOBAL_ALPHA = 0x7108,
123 WFC_ELEMENT_MASK = 0x7109,
124 WFC_ELEMENT_FORCE_32BIT = 0x7FFFFFFF
125} WFCElementAttrib;
126
127typedef enum {
128 WFC_SCALE_FILTER_NONE = 0x7151, /* default */
129 WFC_SCALE_FILTER_FASTER = 0x7152,
130 WFC_SCALE_FILTER_BETTER = 0x7153,
131 WFC_SCALE_FILTER_FORCE_32BIT = 0x7FFFFFFF
132} WFCScaleFilter;
133
134typedef enum {
135 WFC_TRANSPARENCY_NONE = 0, /* default */
136 WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA = (1 << 0),
137 WFC_TRANSPARENCY_SOURCE = (1 << 1),
138 WFC_TRANSPARENCY_MASK = (1 << 2),
139 WFC_TRANSPARENCY_FORCE_32BIT = 0x7FFFFFFF
140} WFCTransparencyType;
141
142typedef enum {
143 WFC_VENDOR = 0x7200,
144 WFC_RENDERER = 0x7201,
145 WFC_VERSION = 0x7202,
146 WFC_EXTENSIONS = 0x7203,
147 WFC_STRINGID_FORCE_32BIT = 0x7FFFFFFF
148} WFCStringID;
149
150
151/* Function Prototypes */
152
153/* Device */
154WFC_API_CALL WFCint WFC_APIENTRY
155 wfcEnumerateDevices(WFCint *deviceIds, WFCint deviceIdsCount,
156 const WFCint *filterList) WFC_APIEXIT;
157WFC_API_CALL WFCDevice WFC_APIENTRY
158 wfcCreateDevice(WFCint deviceId, const WFCint *attribList) WFC_APIEXIT;
159WFC_API_CALL WFCErrorCode WFC_APIENTRY
160 wfcGetError(WFCDevice dev) WFC_APIEXIT;
161WFC_API_CALL WFCint WFC_APIENTRY
162 wfcGetDeviceAttribi(WFCDevice dev, WFCDeviceAttrib attrib) WFC_APIEXIT;
163WFC_API_CALL WFCErrorCode WFC_APIENTRY
164 wfcDestroyDevice(WFCDevice dev) WFC_APIEXIT;
165
166/* Context */
167WFC_API_CALL WFCContext WFC_APIENTRY
168 wfcCreateOnScreenContext(WFCDevice dev,
169 WFCint screenNumber,
170 const WFCint *attribList) WFC_APIEXIT;
171WFC_API_CALL WFCContext WFC_APIENTRY
172 wfcCreateOffScreenContext(WFCDevice dev,
173 WFCNativeStreamType stream,
174 const WFCint *attribList) WFC_APIEXIT;
175WFC_API_CALL void WFC_APIENTRY
176 wfcCommit(WFCDevice dev, WFCContext ctx, WFCboolean wait) WFC_APIEXIT;
177WFC_API_CALL WFCint WFC_APIENTRY
178 wfcGetContextAttribi(WFCDevice dev, WFCContext ctx,
179 WFCContextAttrib attrib) WFC_APIEXIT;
180WFC_API_CALL void WFC_APIENTRY
181 wfcGetContextAttribfv(WFCDevice dev, WFCContext ctx,
182 WFCContextAttrib attrib, WFCint count, WFCfloat *values) WFC_APIEXIT;
183WFC_API_CALL void WFC_APIENTRY
184 wfcSetContextAttribi(WFCDevice dev, WFCContext ctx,
185 WFCContextAttrib attrib, WFCint value) WFC_APIEXIT;
186WFC_API_CALL void WFC_APIENTRY
187 wfcSetContextAttribfv(WFCDevice dev, WFCContext ctx,
188 WFCContextAttrib attrib,
189 WFCint count, const WFCfloat *values) WFC_APIEXIT;
190WFC_API_CALL void WFC_APIENTRY
191 wfcDestroyContext(WFCDevice dev, WFCContext ctx) WFC_APIEXIT;
192
193/* Source */
194WFC_API_CALL WFCSource WFC_APIENTRY
195 wfcCreateSourceFromStream(WFCDevice dev, WFCContext ctx,
196 WFCNativeStreamType stream,
197 const WFCint *attribList) WFC_APIEXIT;
198WFC_API_CALL void WFC_APIENTRY
199 wfcDestroySource(WFCDevice dev, WFCSource src) WFC_APIEXIT;
200
201/* Mask */
202WFC_API_CALL WFCMask WFC_APIENTRY
203 wfcCreateMaskFromStream(WFCDevice dev, WFCContext ctx,
204 WFCNativeStreamType stream,
205 const WFCint *attribList) WFC_APIEXIT;
206WFC_API_CALL void WFC_APIENTRY
207 wfcDestroyMask(WFCDevice dev, WFCMask mask) WFC_APIEXIT;
208
209/* Element */
210WFC_API_CALL WFCElement WFC_APIENTRY
211 wfcCreateElement(WFCDevice dev, WFCContext ctx,
212 const WFCint *attribList) WFC_APIEXIT;
213WFC_API_CALL WFCint WFC_APIENTRY
214 wfcGetElementAttribi(WFCDevice dev, WFCElement element,
215 WFCElementAttrib attrib) WFC_APIEXIT;
216WFC_API_CALL WFCfloat WFC_APIENTRY
217 wfcGetElementAttribf(WFCDevice dev, WFCElement element,
218 WFCElementAttrib attrib) WFC_APIEXIT;
219WFC_API_CALL void WFC_APIENTRY
220 wfcGetElementAttribiv(WFCDevice dev, WFCElement element,
221 WFCElementAttrib attrib, WFCint count, WFCint *values) WFC_APIEXIT;
222WFC_API_CALL void WFC_APIENTRY
223 wfcGetElementAttribfv(WFCDevice dev, WFCElement element,
224 WFCElementAttrib attrib, WFCint count, WFCfloat *values) WFC_APIEXIT;
225WFC_API_CALL void WFC_APIENTRY
226 wfcSetElementAttribi(WFCDevice dev, WFCElement element,
227 WFCElementAttrib attrib, WFCint value) WFC_APIEXIT;
228WFC_API_CALL void WFC_APIENTRY
229 wfcSetElementAttribf(WFCDevice dev, WFCElement element,
230 WFCElementAttrib attrib, WFCfloat value) WFC_APIEXIT;
231WFC_API_CALL void WFC_APIENTRY
232 wfcSetElementAttribiv(WFCDevice dev, WFCElement element,
233 WFCElementAttrib attrib,
234 WFCint count, const WFCint *values) WFC_APIEXIT;
235WFC_API_CALL void WFC_APIENTRY
236 wfcSetElementAttribfv(WFCDevice dev, WFCElement element,
237 WFCElementAttrib attrib,
238 WFCint count, const WFCfloat *values) WFC_APIEXIT;
239WFC_API_CALL void WFC_APIENTRY
240 wfcInsertElement(WFCDevice dev, WFCElement element,
241 WFCElement subordinate) WFC_APIEXIT;
242WFC_API_CALL void WFC_APIENTRY
243 wfcRemoveElement(WFCDevice dev, WFCElement element) WFC_APIEXIT;
244WFC_API_CALL WFCElement WFC_APIENTRY
245 wfcGetElementAbove(WFCDevice dev, WFCElement element) WFC_APIEXIT;
246WFC_API_CALL WFCElement WFC_APIENTRY
247 wfcGetElementBelow(WFCDevice dev, WFCElement element) WFC_APIEXIT;
248WFC_API_CALL void WFC_APIENTRY
249 wfcDestroyElement(WFCDevice dev, WFCElement element) WFC_APIEXIT;
250
251/* Rendering */
252WFC_API_CALL void WFC_APIENTRY
253 wfcActivate(WFCDevice dev, WFCContext ctx) WFC_APIEXIT;
254WFC_API_CALL void WFC_APIENTRY
255 wfcDeactivate(WFCDevice dev, WFCContext ctx) WFC_APIEXIT;
256WFC_API_CALL void WFC_APIENTRY
257 wfcCompose(WFCDevice dev, WFCContext ctx, WFCboolean wait) WFC_APIEXIT;
258WFC_API_CALL void WFC_APIENTRY
259 wfcFence(WFCDevice dev, WFCContext ctx, WFCEGLDisplay dpy,
260 WFCEGLSync sync) WFC_APIEXIT;
261
262/* Renderer and extension information */
263WFC_API_CALL WFCint WFC_APIENTRY
264 wfcGetStrings(WFCDevice dev,
265 WFCStringID name,
266 const char **strings,
267 WFCint stringsCount) WFC_APIEXIT;
268WFC_API_CALL WFCboolean WFC_APIENTRY
269 wfcIsExtensionSupported(WFCDevice dev, const char *string) WFC_APIEXIT;
270
271#ifdef __cplusplus
272}
273#endif
274
275#endif /* _WFC_H_ */
276