summaryrefslogtreecommitdiffstats
path: root/src/egl
diff options
context:
space:
mode:
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c44
-rw-r--r--src/egl/drivers/glx/egl_glx.c16
-rw-r--r--src/egl/main/Makefile2
-rw-r--r--src/egl/main/SConscript30
-rw-r--r--src/egl/main/eglapi.c9
-rw-r--r--src/egl/main/eglapi.h2
-rw-r--r--src/egl/main/egldisplay.h40
-rw-r--r--src/egl/main/egldriver.c166
-rw-r--r--src/egl/main/egldriver.h16
-rw-r--r--src/egl/main/eglmisc.c33
-rw-r--r--src/egl/main/eglstring.h1
11 files changed, 187 insertions, 172 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 8967969c924..6fc1e49e773 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -260,8 +260,8 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
base.BindToTextureRGBA = bind_to_texture_rgba;
}
- base.RenderableType = disp->ClientAPIsMask;
- base.Conformant = disp->ClientAPIsMask;
+ base.RenderableType = disp->ClientAPIs;
+ base.Conformant = disp->ClientAPIs;
if (!_eglValidateConfig(&base, EGL_FALSE)) {
_eglLog(_EGL_DEBUG, "DRI2: failed to validate config %d", id);
@@ -752,13 +752,13 @@ dri2_create_screen(_EGLDisplay *disp)
else
api_mask = 1 << __DRI_API_OPENGL;
- disp->ClientAPIsMask = 0;
+ disp->ClientAPIs = 0;
if (api_mask & (1 <<__DRI_API_OPENGL))
- disp->ClientAPIsMask |= EGL_OPENGL_BIT;
+ disp->ClientAPIs |= EGL_OPENGL_BIT;
if (api_mask & (1 <<__DRI_API_GLES))
- disp->ClientAPIsMask |= EGL_OPENGL_ES_BIT;
+ disp->ClientAPIs |= EGL_OPENGL_ES_BIT;
if (api_mask & (1 << __DRI_API_GLES2))
- disp->ClientAPIsMask |= EGL_OPENGL_ES2_BIT;
+ disp->ClientAPIs |= EGL_OPENGL_ES2_BIT;
if (dri2_dpy->dri2->base.version >= 2) {
disp->Extensions.KHR_surfaceless_gles1 = EGL_TRUE;
@@ -775,8 +775,7 @@ dri2_create_screen(_EGLDisplay *disp)
}
static EGLBoolean
-dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp,
- EGLint *major, EGLint *minor)
+dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp)
{
struct dri2_egl_display *dri2_dpy;
@@ -855,8 +854,8 @@ dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp,
disp->Extensions.NOK_texture_from_pixmap = EGL_TRUE;
/* we're supporting EGL 1.4 */
- *major = 1;
- *minor = 4;
+ disp->VersionMajor = 1;
+ disp->VersionMinor = 4;
return EGL_TRUE;
@@ -1415,8 +1414,7 @@ dri2_get_driver_for_fd(int fd)
}
static EGLBoolean
-dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp,
- EGLint *major, EGLint *minor)
+dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
{
struct dri2_egl_display *dri2_dpy;
int i;
@@ -1451,8 +1449,8 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp,
disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE;
/* we're supporting EGL 1.4 */
- *major = 1;
- *minor = 4;
+ disp->VersionMajor = 1;
+ disp->VersionMinor = 4;
return EGL_TRUE;
@@ -1470,16 +1468,23 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp,
* Called via eglInitialize(), GLX_drv->API.Initialize().
*/
static EGLBoolean
-dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp,
- EGLint *major, EGLint *minor)
+dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp)
{
+ /* not until swrast_dri is supported */
+ if (disp->Options.UseFallback)
+ return EGL_FALSE;
+
switch (disp->Platform) {
case _EGL_PLATFORM_X11:
- return dri2_initialize_x11(drv, disp, major, minor);
+ if (disp->Options.TestOnly)
+ return EGL_TRUE;
+ return dri2_initialize_x11(drv, disp);
#ifdef HAVE_LIBUDEV
case _EGL_PLATFORM_DRM:
- return dri2_initialize_drm(drv, disp, major, minor);
+ if (disp->Options.TestOnly)
+ return EGL_TRUE;
+ return dri2_initialize_drm(drv, disp);
#endif
default:
@@ -2382,10 +2387,11 @@ _EGL_MAIN(const char *args)
if (!dri2_drv)
return NULL;
+ memset(dri2_drv, 0, sizeof *dri2_drv);
+
if (!dri2_load(&dri2_drv->base))
return NULL;
- memset(dri2_drv, 0, sizeof *dri2_drv);
_eglInitDriverFallbacks(&dri2_drv->base);
dri2_drv->base.API.Initialize = dri2_initialize;
dri2_drv->base.API.Terminate = dri2_terminate;
diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c
index 5fce06d66df..c3c11c7b6eb 100644
--- a/src/egl/drivers/glx/egl_glx.c
+++ b/src/egl/drivers/glx/egl_glx.c
@@ -581,8 +581,7 @@ check_quirks(struct GLX_egl_driver *GLX_drv,
* Called via eglInitialize(), GLX_drv->API.Initialize().
*/
static EGLBoolean
-GLX_eglInitialize(_EGLDriver *drv, _EGLDisplay *disp,
- EGLint *major, EGLint *minor)
+GLX_eglInitialize(_EGLDriver *drv, _EGLDisplay *disp)
{
struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
struct GLX_egl_display *GLX_dpy;
@@ -590,6 +589,13 @@ GLX_eglInitialize(_EGLDriver *drv, _EGLDisplay *disp,
if (disp->Platform != _EGL_PLATFORM_X11)
return EGL_FALSE;
+ /* this is a fallback driver */
+ if (!disp->Options.UseFallback)
+ return EGL_FALSE;
+
+ if (disp->Options.TestOnly)
+ return EGL_TRUE;
+
GLX_dpy = CALLOC_STRUCT(GLX_egl_display);
if (!GLX_dpy)
return _eglError(EGL_BAD_ALLOC, "eglInitialize");
@@ -614,7 +620,7 @@ GLX_eglInitialize(_EGLDriver *drv, _EGLDisplay *disp,
}
disp->DriverData = (void *) GLX_dpy;
- disp->ClientAPIsMask = EGL_OPENGL_BIT;
+ disp->ClientAPIs = EGL_OPENGL_BIT;
check_extensions(GLX_drv, GLX_dpy, DefaultScreen(GLX_dpy->dpy));
check_quirks(GLX_drv, GLX_dpy, DefaultScreen(GLX_dpy->dpy));
@@ -629,8 +635,8 @@ GLX_eglInitialize(_EGLDriver *drv, _EGLDisplay *disp,
}
/* we're supporting EGL 1.4 */
- *major = 1;
- *minor = 4;
+ disp->VersionMajor = 1;
+ disp->VersionMinor = 4;
return EGL_TRUE;
}
diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile
index 0eb309c1969..c710631688c 100644
--- a/src/egl/main/Makefile
+++ b/src/egl/main/Makefile
@@ -93,7 +93,7 @@ default: depend library
# EGL Library
library: $(TOP)/$(LIB_DIR)/$(EGL_LIB_NAME)
-$(TOP)/$(LIB_DIR)/$(EGL_LIB_NAME): $(OBJECTS)
+$(TOP)/$(LIB_DIR)/$(EGL_LIB_NAME): $(OBJECTS) $(LOCAL_LIBS)
$(MKLIB) -o $(EGL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major $(EGL_MAJOR) -minor $(EGL_MINOR) \
-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
diff --git a/src/egl/main/SConscript b/src/egl/main/SConscript
index f001b81600f..8c57ceaf20f 100644
--- a/src/egl/main/SConscript
+++ b/src/egl/main/SConscript
@@ -7,13 +7,23 @@ Import('*')
env = env.Clone()
env.Append(CPPDEFINES = [
- '_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_WINDOWS',
+ '_EGL_BUILT_IN_DRIVER_GALLIUM',
'_EGL_DRIVER_SEARCH_DIR=\\"\\"',
- '_EGL_OS_WINDOWS',
- '_EGL_GET_CORE_ADDRESSES',
- 'KHRONOS_DLL_EXPORTS',
])
+if env['platform'] == 'windows':
+ env.Append(CPPDEFINES = [
+ '_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_WINDOWS',
+ '_EGL_OS_WINDOWS',
+ '_EGL_GET_CORE_ADDRESSES',
+ 'KHRONOS_DLL_EXPORTS',
+ ])
+else:
+ env.Append(CPPDEFINES = [
+ '_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_X11',
+ '_EGL_OS_UNIX',
+ ])
+
env.Append(CPPPATH = [
'#/include',
])
@@ -38,15 +48,9 @@ egl_sources = [
'eglsync.c',
]
-egl = env.SharedLibrary(
- target = 'libEGL',
- source = egl_sources + ['egl.def'],
+egl = env.ConvenienceLibrary(
+ target = 'egl',
+ source = egl_sources,
)
-installed_egl = env.InstallSharedLibrary(egl, version=(1, 4, 0))
-
-env.Alias('egl', installed_egl)
-
-egl = [env.FindIxes(egl, 'LIBPREFIX', 'LIBSUFFIX')]
-
Export('egl')
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index efa9e97346b..4e64ce6f718 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -57,7 +57,6 @@
#include <stdlib.h>
#include <string.h>
-#include "eglstring.h"
#include "eglcontext.h"
#include "egldisplay.h"
#include "egltypedefs.h"
@@ -294,16 +293,14 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
if (!_eglMatchDriver(disp, EGL_FALSE))
RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
- _eglsnprintf(disp->Version, sizeof(disp->Version), "%d.%d (%s)",
- disp->APImajor, disp->APIminor, disp->Driver->Name);
/* limit to APIs supported by core */
- disp->ClientAPIsMask &= _EGL_API_ALL_BITS;
+ disp->ClientAPIs &= _EGL_API_ALL_BITS;
}
/* Update applications version of major and minor if not NULL */
if ((major != NULL) && (minor != NULL)) {
- *major = disp->APImajor;
- *minor = disp->APIminor;
+ *major = disp->VersionMajor;
+ *minor = disp->VersionMinor;
}
RETURN_EGL_SUCCESS(disp, EGL_TRUE);
diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h
index 127becc9acd..01492082f66 100644
--- a/src/egl/main/eglapi.h
+++ b/src/egl/main/eglapi.h
@@ -12,7 +12,7 @@ typedef void (*_EGLProc)(void);
*/
/* driver funcs */
-typedef EGLBoolean (*Initialize_t)(_EGLDriver *, _EGLDisplay *dpy, EGLint *major, EGLint *minor);
+typedef EGLBoolean (*Initialize_t)(_EGLDriver *, _EGLDisplay *dpy);
typedef EGLBoolean (*Terminate_t)(_EGLDriver *, _EGLDisplay *dpy);
/* config funcs */
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index bcba05480a8..dbc5d32d910 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -74,8 +74,6 @@ struct _egl_extensions
EGLBoolean NOK_swap_region;
EGLBoolean NOK_texture_from_pixmap;
-
- char String[_EGL_MAX_EXTENSIONS_LEN];
};
@@ -86,21 +84,29 @@ struct _egl_display
_EGLMutex Mutex;
- _EGLPlatformType Platform;
- void *PlatformDisplay;
-
- EGLBoolean Initialized; /**< True if the display is initialized */
- _EGLDriver *Driver;
- void *DriverData; /* private to driver */
-
- int APImajor, APIminor; /**< as returned by eglInitialize() */
- char Version[1000]; /**< initialized from APImajor/minor, DriverName */
-
- /** Bitmask of supported APIs (EGL_xx_BIT) set by the driver during init */
- EGLint ClientAPIsMask;
- char ClientAPIs[1000]; /**< updated by eglQueryString */
-
- _EGLExtensions Extensions;
+ _EGLPlatformType Platform; /**< The type of the platform display */
+ void *PlatformDisplay; /**< A pointer to the platform display */
+
+ _EGLDriver *Driver; /**< Matched driver of the display */
+ EGLBoolean Initialized; /**< True if the display is initialized */
+
+ /* options that affect how the driver initializes the display */
+ struct {
+ EGLBoolean TestOnly; /**< Driver should not set fields when true */
+ EGLBoolean UseFallback; /**< Use fallback driver (sw or less features) */
+ } Options;
+
+ /* these fields are set by the driver during init */
+ void *DriverData; /**< Driver private data */
+ EGLint VersionMajor; /**< EGL major version */
+ EGLint VersionMinor; /**< EGL minor version */
+ EGLint ClientAPIs; /**< Bitmask of APIs supported (EGL_xxx_BIT) */
+ _EGLExtensions Extensions; /**< Extensions supported */
+
+ /* these fields are derived from above */
+ char VersionString[1000]; /**< EGL_VERSION */
+ char ClientAPIsString[1000]; /**< EGL_CLIENT_APIS */
+ char ExtensionsString[_EGL_MAX_EXTENSIONS_LEN]; /**< EGL_EXTENSIONS */
_EGLArray *Screens;
_EGLArray *Configs;
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index 62c56955134..e133c220f5c 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -37,6 +37,9 @@ const struct {
const char *name;
_EGLMain_t main;
} _eglBuiltInDrivers[] = {
+#ifdef _EGL_BUILT_IN_DRIVER_GALLIUM
+ { "egl_gallium", _eglBuiltInDriverGALLIUM },
+#endif
#ifdef _EGL_BUILT_IN_DRIVER_DRI2
{ "egl_dri2", _eglBuiltInDriverDRI2 },
#endif
@@ -141,9 +144,6 @@ _eglOpenLibrary(const char *driverPath, lib_handle *handle)
if (!lib) {
_eglLog(_EGL_WARNING, "Could not open driver %s (%s)",
driverPath, error);
- if (!getenv("EGL_DRIVER"))
- _eglLog(_EGL_WARNING,
- "The driver can be overridden by setting EGL_DRIVER");
return NULL;
}
@@ -432,7 +432,7 @@ _eglGetSearchPath(void)
*
* The user driver is specified by EGL_DRIVER.
*/
-static void
+static EGLBoolean
_eglAddUserDriver(void)
{
const char *search_path = _eglGetSearchPath();
@@ -463,7 +463,24 @@ _eglAddUserDriver(void)
mod->BuiltIn = _eglBuiltInDrivers[i].main;
}
}
+
+ return EGL_TRUE;
}
+
+ return EGL_FALSE;
+}
+
+
+/**
+ * Add egl_gallium to the module array.
+ */
+static void
+_eglAddGalliumDriver(void)
+{
+#ifndef _EGL_BUILT_IN_DRIVER_GALLIUM
+ void *external = (void *) "egl_gallium";
+ _eglPreloadForEach(_eglGetSearchPath(), _eglLoaderFile, external);
+#endif
}
@@ -491,118 +508,99 @@ _eglAddBuiltInDrivers(void)
static EGLBoolean
_eglAddDrivers(void)
{
- void *external = (void *) "egl_gallium";
-
if (_eglModules)
return EGL_TRUE;
- /* the order here decides the priorities of the drivers */
- _eglAddUserDriver();
- _eglPreloadForEach(_eglGetSearchPath(), _eglLoaderFile, external);
- _eglAddBuiltInDrivers();
+ if (!_eglAddUserDriver()) {
+ /*
+ * Add other drivers only when EGL_DRIVER is not set. The order here
+ * decides the priorities.
+ */
+ _eglAddGalliumDriver();
+ _eglAddBuiltInDrivers();
+ }
return (_eglModules != NULL);
}
/**
- * Match a display to a driver. The display is initialized unless use_probe is
- * true.
- *
- * The matching is done by finding the first driver that can initialize the
- * display, or when use_probe is true, the driver with highest score.
+ * A helper function for _eglMatchDriver. It finds the first driver that can
+ * initialize the display and return.
*/
-_EGLDriver *
-_eglMatchDriver(_EGLDisplay *dpy, EGLBoolean use_probe)
+static _EGLDriver *
+_eglMatchAndInitialize(_EGLDisplay *dpy)
{
- _EGLModule *mod;
- _EGLDriver *best_drv = NULL;
- EGLint best_score = 0;
- EGLint major, minor, i;
-
- _eglLockMutex(&_eglModuleMutex);
+ _EGLDriver *drv = NULL;
+ EGLint i = 0;
if (!_eglAddDrivers()) {
- _eglUnlockMutex(&_eglModuleMutex);
- return EGL_FALSE;
+ _eglLog(_EGL_WARNING, "failed to find any driver");
+ return NULL;
}
- /* match the loaded modules */
- for (i = 0; i < _eglModules->Size; i++) {
- mod = (_EGLModule *) _eglModules->Elements[i];
- if (!mod->Driver)
- break;
+ if (dpy->Driver) {
+ drv = dpy->Driver;
+ /* no re-matching? */
+ if (!drv->API.Initialize(drv, dpy))
+ drv = NULL;
+ return drv;
+ }
- if (use_probe) {
- EGLint score = (mod->Driver->Probe) ?
- mod->Driver->Probe(mod->Driver, dpy) : 1;
- if (score > best_score) {
- best_drv = mod->Driver;
- best_score = score;
- }
+ while (i < _eglModules->Size) {
+ _EGLModule *mod = (_EGLModule *) _eglModules->Elements[i];
+
+ if (!_eglLoadModule(mod)) {
+ /* remove invalid modules */
+ _eglEraseArray(_eglModules, i, _eglFreeModule);
+ continue;
+ }
+
+ if (mod->Driver->API.Initialize(mod->Driver, dpy)) {
+ drv = mod->Driver;
+ break;
}
else {
- if (mod->Driver->API.Initialize(mod->Driver, dpy, &major, &minor)) {
- best_drv = mod->Driver;
- best_score = 100;
- }
+ i++;
}
- /* perfect match */
- if (best_score >= 100)
- break;
}
- /* load more modules */
- if (!best_drv) {
- EGLint first_unloaded = i;
+ return drv;
+}
- while (i < _eglModules->Size) {
- mod = (_EGLModule *) _eglModules->Elements[i];
- assert(!mod->Driver);
- if (!_eglLoadModule(mod)) {
- /* remove invalid modules */
- _eglEraseArray(_eglModules, i, _eglFreeModule);
- continue;
- }
+/**
+ * Match a display to a driver. The display is initialized unless test_only is
+ * true. The matching is done by finding the first driver that can initialize
+ * the display.
+ */
+_EGLDriver *
+_eglMatchDriver(_EGLDisplay *dpy, EGLBoolean test_only)
+{
+ _EGLDriver *best_drv;
- if (use_probe) {
- best_score = (mod->Driver->Probe) ?
- mod->Driver->Probe(mod->Driver, dpy) : 1;
- }
- else {
- if (mod->Driver->API.Initialize(mod->Driver, dpy, &major, &minor))
- best_score = 100;
- }
+ assert(!dpy->Initialized);
- if (best_score > 0) {
- best_drv = mod->Driver;
- /* loaded modules come before unloaded ones */
- if (first_unloaded != i) {
- void *tmp = _eglModules->Elements[i];
- _eglModules->Elements[i] =
- _eglModules->Elements[first_unloaded];
- _eglModules->Elements[first_unloaded] = tmp;
- }
- break;
- }
- else {
- _eglUnloadModule(mod);
- i++;
- }
- }
+ _eglLockMutex(&_eglModuleMutex);
+
+ /* set options */
+ dpy->Options.TestOnly = test_only;
+ dpy->Options.UseFallback = EGL_FALSE;
+
+ best_drv = _eglMatchAndInitialize(dpy);
+ if (!best_drv) {
+ dpy->Options.UseFallback = EGL_TRUE;
+ best_drv = _eglMatchAndInitialize(dpy);
}
_eglUnlockMutex(&_eglModuleMutex);
if (best_drv) {
- _eglLog(_EGL_DEBUG, "the best driver is %s (score %d)",
- best_drv->Name, best_score);
- if (!use_probe) {
+ _eglLog(_EGL_DEBUG, "the best driver is %s%s",
+ best_drv->Name, (test_only) ? " (test only) " : "");
+ if (!test_only) {
dpy->Driver = best_drv;
dpy->Initialized = EGL_TRUE;
- dpy->APImajor = major;
- dpy->APIminor = minor;
}
}
diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h
index 651788cb7ae..3cde102d12d 100644
--- a/src/egl/main/egldriver.h
+++ b/src/egl/main/egldriver.h
@@ -44,16 +44,6 @@ struct _egl_driver
const char *Name; /**< name of this driver */
/**
- * Probe a display and return a score.
- *
- * Roughly,
- * 50 means the driver supports the display;
- * 90 means the driver can accelerate the display;
- * 100 means a perfect match.
- */
- EGLint (*Probe)(_EGLDriver *drv, _EGLDisplay *dpy);
-
- /**
* Release the driver resource.
*
* It is called before dlclose().
@@ -65,6 +55,10 @@ struct _egl_driver
extern _EGLDriver *
+_eglBuiltInDriverGALLIUM(const char *args);
+
+
+extern _EGLDriver *
_eglBuiltInDriverDRI2(const char *args);
@@ -77,7 +71,7 @@ _eglMain(const char *args);
extern _EGLDriver *
-_eglMatchDriver(_EGLDisplay *dpy, EGLBoolean probe_only);
+_eglMatchDriver(_EGLDisplay *dpy, EGLBoolean test_only);
extern __eglMustCastToProperFunctionPointerType
diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c
index bbb96a908e4..f8ba5f33eb9 100644
--- a/src/egl/main/eglmisc.c
+++ b/src/egl/main/eglmisc.c
@@ -36,6 +36,8 @@
#include "eglcurrent.h"
#include "eglmisc.h"
#include "egldisplay.h"
+#include "egldriver.h"
+#include "eglstring.h"
/**
@@ -73,11 +75,11 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy)
do { \
if (dpy->Extensions.ext) { \
_eglAppendExtension(&exts, "EGL_" #ext); \
- assert(exts <= dpy->Extensions.String + _EGL_MAX_EXTENSIONS_LEN); \
+ assert(exts <= dpy->ExtensionsString + _EGL_MAX_EXTENSIONS_LEN); \
} \
} while (0)
- char *exts = dpy->Extensions.String;
+ char *exts = dpy->ExtensionsString;
if (exts[0])
return;
@@ -114,24 +116,24 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy)
static void
_eglUpdateAPIsString(_EGLDisplay *dpy)
{
- char *apis = dpy->ClientAPIs;
+ char *apis = dpy->ClientAPIsString;
- if (apis[0] || !dpy->ClientAPIsMask)
+ if (apis[0] || !dpy->ClientAPIs)
return;
- if (dpy->ClientAPIsMask & EGL_OPENGL_BIT)
+ if (dpy->ClientAPIs & EGL_OPENGL_BIT)
strcat(apis, "OpenGL ");
- if (dpy->ClientAPIsMask & EGL_OPENGL_ES_BIT)
+ if (dpy->ClientAPIs & EGL_OPENGL_ES_BIT)
strcat(apis, "OpenGL_ES ");
- if (dpy->ClientAPIsMask & EGL_OPENGL_ES2_BIT)
+ if (dpy->ClientAPIs & EGL_OPENGL_ES2_BIT)
strcat(apis, "OpenGL_ES2 ");
- if (dpy->ClientAPIsMask & EGL_OPENVG_BIT)
+ if (dpy->ClientAPIs & EGL_OPENVG_BIT)
strcat(apis, "OpenVG ");
- assert(strlen(apis) < sizeof(dpy->ClientAPIs));
+ assert(strlen(apis) < sizeof(dpy->ClientAPIsString));
}
@@ -139,20 +141,21 @@ const char *
_eglQueryString(_EGLDriver *drv, _EGLDisplay *dpy, EGLint name)
{
(void) drv;
- (void) dpy;
+
switch (name) {
case EGL_VENDOR:
return _EGL_VENDOR_STRING;
case EGL_VERSION:
- return dpy->Version;
+ _eglsnprintf(dpy->VersionString, sizeof(dpy->VersionString),
+ "%d.%d (%s)", dpy->VersionMajor, dpy->VersionMinor,
+ dpy->Driver->Name);
+ return dpy->VersionString;
case EGL_EXTENSIONS:
_eglUpdateExtensionsString(dpy);
- return dpy->Extensions.String;
-#ifdef EGL_VERSION_1_2
+ return dpy->ExtensionsString;
case EGL_CLIENT_APIS:
_eglUpdateAPIsString(dpy);
- return dpy->ClientAPIs;
-#endif
+ return dpy->ClientAPIsString;
default:
_eglError(EGL_BAD_PARAMETER, "eglQueryString");
return NULL;
diff --git a/src/egl/main/eglstring.h b/src/egl/main/eglstring.h
index f1d559b24a2..d4c89541362 100644
--- a/src/egl/main/eglstring.h
+++ b/src/egl/main/eglstring.h
@@ -2,6 +2,7 @@
#define EGLSTRING_INCLUDED
#include <string.h>
+#include <stdio.h>
#ifdef _EGL_OS_WINDOWS
#define _eglstrcasecmp _stricmp