e79223657dc093cd55c8ae4891685c04b28c8a63
1 /**************************************************************************
3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
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:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
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.
26 **************************************************************************/
30 * Small/misc EGL functions
36 #include "eglglobals.h"
41 * Examine the individual extension enable/disable flags and recompute
42 * the driver's Extensions string.
45 _eglUpdateExtensionsString(_EGLDriver
*drv
)
47 drv
->Extensions
.String
[0] = 0;
49 if (drv
->Extensions
.MESA_screen_surface
)
50 strcat(drv
->Extensions
.String
, "EGL_MESA_screen_surface ");
51 if (drv
->Extensions
.MESA_copy_context
)
52 strcat(drv
->Extensions
.String
, "EGL_MESA_copy_context ");
53 assert(strlen(drv
->Extensions
.String
) < _EGL_MAX_EXTENSIONS_LEN
);
57 #if 0 /* prototype code */
62 _eglFindAPIs_by_sym(void)
66 if (dlsym(NULL
, "glBegin"))
67 mask
|= EGL_OPENGL_BIT
;
68 if (dlsym(NULL
, "glGetFixedv"))
69 mask
|= EGL_OPENGL_ES_BIT
;
70 if (dlsym(NULL
, "vgSetf"))
71 mask
|= EGL_OPENVG_BIT
;
77 _eglFindAPIs_by_lib(void)
83 if ((h
= dlopen("libGLESv1_CM.so", flag
))) {
85 mask
|= EGL_OPENGL_ES_BIT
;
88 if ((h
= dlopen("libGLESv2.so", flag
))) {
90 mask
|= EGL_OPENGL_ES2_BIT
;
93 if ((h
= dlopen("libGL.so", flag
))) {
95 mask
|= EGL_OPENGL_BIT
;
98 if ((h
= dlopen("libOpenVG.so", flag
))) {
100 mask
|= EGL_OPENVG_BIT
;
110 _eglUpdateAPIsString(_EGLDriver
*drv
)
112 _eglGlobal
.ClientAPIs
[0] = 0;
114 if (_eglGlobal
.ClientAPIsMask
& EGL_OPENGL_BIT
)
115 strcat(_eglGlobal
.ClientAPIs
, "OpenGL ");
117 if (_eglGlobal
.ClientAPIsMask
& EGL_OPENGL_ES_BIT
)
118 strcat(_eglGlobal
.ClientAPIs
, "OpenGL_ES ");
120 if (_eglGlobal
.ClientAPIsMask
& EGL_OPENGL_ES2_BIT
)
121 strcat(_eglGlobal
.ClientAPIs
, "OpenGL_ES2 ");
123 if (_eglGlobal
.ClientAPIsMask
& EGL_OPENVG_BIT
)
124 strcat(_eglGlobal
.ClientAPIs
, "OpenVG ");
126 assert(strlen(_eglGlobal
.ClientAPIs
) < sizeof(_eglGlobal
.ClientAPIs
));
132 _eglQueryString(_EGLDriver
*drv
, EGLDisplay dpy
, EGLint name
)
138 return _EGL_VENDOR_STRING
;
142 _eglUpdateExtensionsString(drv
);
143 return drv
->Extensions
.String
;
144 #ifdef EGL_VERSION_1_2
145 case EGL_CLIENT_APIS
:
146 _eglUpdateAPIsString(drv
);
147 return _eglGlobal
.ClientAPIs
;
150 _eglError(EGL_BAD_PARAMETER
, "eglQueryString");
157 _eglWaitGL(_EGLDriver
*drv
, EGLDisplay dpy
)
159 /* just a placeholder */
167 _eglWaitNative(_EGLDriver
*drv
, EGLDisplay dpy
, EGLint engine
)
169 /* just a placeholder */
173 case EGL_CORE_NATIVE_ENGINE
:
176 _eglError(EGL_BAD_PARAMETER
, "eglWaitNative(engine)");