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
|
/**********************************************************************
*
* Copyright(c) Imagination Technologies Ltd.
*
* The contents of this file are subject to the MIT license as set out below.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* This License is also included in this distribution in the file called
* "COPYING".
*
******************************************************************************/
#if !defined(__WSEGL_H__)
#define __WSEGL_H__
#ifdef __cplusplus
extern "C" {
#endif
/*
// WSEGL Platform-specific definitions
*/
#if defined(__linux__)
#define WSEGL_EXPORT __attribute__((visibility("default")))
#define WSEGL_IMPORT
#else
#define WSEGL_EXPORT
#define WSEGL_IMPORT
#endif
/*
// WSEGL API Version Number
*/
#define WSEGL_VERSION 2
#define WSEGL_DEFAULT_DISPLAY 0
#define WSEGL_DEFAULT_NATIVE_ENGINE 0
#define WSEGL_FALSE 0
#define WSEGL_TRUE 1
#define WSEGL_NULL 0
#define WSEGL_UNREFERENCED_PARAMETER(param) (param) = (param)
/*
// WSEGL handles
*/
typedef void *WSEGLDisplayHandle;
typedef void *WSEGLDrawableHandle;
/*
// Display capability type
*/
typedef enum WSEGLCapsType_TAG
{
WSEGL_NO_CAPS = 0,
WSEGL_CAP_MIN_SWAP_INTERVAL = 1, /* System default value = 1 */
WSEGL_CAP_MAX_SWAP_INTERVAL = 2, /* System default value = 1 */
WSEGL_CAP_WINDOWS_USE_HW_SYNC = 3, /* System default value = 0 (FALSE) */
WSEGL_CAP_PIXMAPS_USE_HW_SYNC = 4, /* System default value = 0 (FALSE) */
} WSEGLCapsType;
/*
// Display capability
*/
typedef struct WSEGLCaps_TAG
{
WSEGLCapsType eCapsType;
unsigned long ui32CapsValue;
} WSEGLCaps;
/*
// Drawable type
*/
#define WSEGL_NO_DRAWABLE 0x0
#define WSEGL_DRAWABLE_WINDOW 0x1
#define WSEGL_DRAWABLE_PIXMAP 0x2
/*
// Pixel format of display/drawable
*/
typedef enum WSEGLPixelFormat_TAG
{
/* These must not be re-ordered */
WSEGL_PIXELFORMAT_RGB565 = 0,
WSEGL_PIXELFORMAT_ARGB4444 = 1,
WSEGL_PIXELFORMAT_ARGB8888 = 2,
WSEGL_PIXELFORMAT_ARGB1555 = 3,
WSEGL_PIXELFORMAT_ABGR8888 = 4,
WSEGL_PIXELFORMAT_XBGR8888 = 5,
/* These are compatibility names only; new WSEGL
* modules should not use them.
*/
WSEGL_PIXELFORMAT_565 = WSEGL_PIXELFORMAT_RGB565,
WSEGL_PIXELFORMAT_4444 = WSEGL_PIXELFORMAT_ARGB4444,
WSEGL_PIXELFORMAT_8888 = WSEGL_PIXELFORMAT_ARGB8888,
WSEGL_PIXELFORMAT_1555 = WSEGL_PIXELFORMAT_ARGB1555,
} WSEGLPixelFormat;
/*
// Transparent of display/drawable
*/
typedef enum WSEGLTransparentType_TAG
{
WSEGL_OPAQUE = 0,
WSEGL_COLOR_KEY = 1,
} WSEGLTransparentType;
/*
// Display/drawable configuration
*/
typedef struct WSEGLConfig_TAG
{
/*
// Type of drawables this configuration applies to -
// OR'd values of drawable types.
*/
unsigned long ui32DrawableType;
/* Pixel format */
WSEGLPixelFormat ePixelFormat;
/* Native Renderable - set to WSEGL_TRUE if native renderable */
unsigned long ulNativeRenderable;
/* FrameBuffer Level Parameter */
unsigned long ulFrameBufferLevel;
/* Native Visual ID */
unsigned long ulNativeVisualID;
/* Native Visual */
void *hNativeVisual;
/* Transparent Type */
WSEGLTransparentType eTransparentType;
/* Transparent Color - only used if transparent type is COLOR_KEY */
unsigned long ulTransparentColor; /* packed as 0x00RRGGBB */
} WSEGLConfig;
/*
// WSEGL errors
*/
typedef enum WSEGLError_TAG
{
WSEGL_SUCCESS = 0,
WSEGL_CANNOT_INITIALISE = 1,
WSEGL_BAD_NATIVE_DISPLAY = 2,
WSEGL_BAD_NATIVE_WINDOW = 3,
WSEGL_BAD_NATIVE_PIXMAP = 4,
WSEGL_BAD_NATIVE_ENGINE = 5,
WSEGL_BAD_DRAWABLE = 6,
WSEGL_BAD_MATCH = 7,
WSEGL_OUT_OF_MEMORY = 8,
/* These are compatibility names only; new WSEGL
* modules should not use them.
*/
WSEGL_BAD_CONFIG = WSEGL_BAD_MATCH,
} WSEGLError;
/*
// Drawable orientation (in degrees anti-clockwise)
*/
typedef enum WSEGLRotationAngle_TAG
{
WSEGL_ROTATE_0 = 0,
WSEGL_ROTATE_90 = 1,
WSEGL_ROTATE_180 = 2,
WSEGL_ROTATE_270 = 3
} WSEGLRotationAngle;
/*
// Drawable information required by OpenGL-ES driver
*/
typedef struct WSEGLDrawableParams_TAG
{
/* Width in pixels of the drawable */
unsigned long ui32Width;
/* Height in pixels of the drawable */
unsigned long ui32Height;
/* Stride in pixels of the drawable */
unsigned long ui32Stride;
/* Pixel format of the drawable */
WSEGLPixelFormat ePixelFormat;
/* User space cpu virtual address of the drawable */
void *pvLinearAddress;
/* HW address of the drawable */
unsigned long ui32HWAddress;
/* Private data for the drawable */
void *hPrivateData;
} WSEGLDrawableParams;
/*
// Table of function pointers that is returned by WSEGL_GetFunctionTablePointer()
//
// The first entry in the table is the version number of the wsegl.h header file that
// the module has been written against, and should therefore be set to WSEGL_VERSION
*/
typedef struct WSEGL_FunctionTable_TAG
{
unsigned long ui32WSEGLVersion;
WSEGLError (*pfnWSEGL_IsDisplayValid)(NativeDisplayType);
WSEGLError (*pfnWSEGL_InitialiseDisplay)(NativeDisplayType, WSEGLDisplayHandle *, const WSEGLCaps **, WSEGLConfig **);
WSEGLError (*pfnWSEGL_CloseDisplay)(WSEGLDisplayHandle);
WSEGLError (*pfnWSEGL_CreateWindowDrawable)(WSEGLDisplayHandle, WSEGLConfig *, WSEGLDrawableHandle *, NativeWindowType, WSEGLRotationAngle *);
WSEGLError (*pfnWSEGL_CreatePixmapDrawable)(WSEGLDisplayHandle, WSEGLConfig *, WSEGLDrawableHandle *, NativePixmapType, WSEGLRotationAngle *);
WSEGLError (*pfnWSEGL_DeleteDrawable)(WSEGLDrawableHandle);
WSEGLError (*pfnWSEGL_SwapDrawable)(WSEGLDrawableHandle, unsigned long);
WSEGLError (*pfnWSEGL_SwapControlInterval)(WSEGLDrawableHandle, unsigned long);
WSEGLError (*pfnWSEGL_WaitNative)(WSEGLDrawableHandle, unsigned long);
WSEGLError (*pfnWSEGL_CopyFromDrawable)(WSEGLDrawableHandle, NativePixmapType);
WSEGLError (*pfnWSEGL_CopyFromPBuffer)(void *, unsigned long, unsigned long, unsigned long, WSEGLPixelFormat, NativePixmapType);
WSEGLError (*pfnWSEGL_GetDrawableParameters)(WSEGLDrawableHandle, WSEGLDrawableParams *, WSEGLDrawableParams *);
WSEGLError (*pfnWSEGL_ConnectDrawable)(WSEGLDrawableHandle);
WSEGLError (*pfnWSEGL_DisconnectDrawable)(WSEGLDrawableHandle);
} WSEGL_FunctionTable;
WSEGL_IMPORT const WSEGL_FunctionTable *WSEGL_GetFunctionTablePointer(void);
#ifdef __cplusplus
}
#endif
#endif /* __WSEGL_H__ */
/******************************************************************************
End of file (wsegl.h)
******************************************************************************/
|