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);
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;
}
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;
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;
}
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;
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;
* 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)
{
switch (disp->Platform) {
case _EGL_PLATFORM_X11:
- return dri2_initialize_x11(drv, disp, major, minor);
+ return dri2_initialize_x11(drv, disp);
#ifdef HAVE_LIBUDEV
case _EGL_PLATFORM_DRM:
- return dri2_initialize_drm(drv, disp, major, minor);
+ return dri2_initialize_drm(drv, disp);
#endif
default:
* 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;
}
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));
}
/* we're supporting EGL 1.4 */
- *major = 1;
- *minor = 4;
+ disp->VersionMajor = 1;
+ disp->VersionMinor = 4;
return EGL_TRUE;
}
#include <stdlib.h>
#include <string.h>
-#include "eglstring.h"
#include "eglcontext.h"
#include "egldisplay.h"
#include "egltypedefs.h"
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);
*/
/* 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 */
EGLBoolean NOK_swap_region;
EGLBoolean NOK_texture_from_pixmap;
-
- char String[_EGL_MAX_EXTENSIONS_LEN];
};
_EGLMutex Mutex;
- _EGLPlatformType Platform;
- void *PlatformDisplay;
-
- EGLBoolean Initialized; /**< True if the display is initialized */
- _EGLDriver *Driver;
- void *DriverData; /* private to driver */
+ _EGLPlatformType Platform; /**< The type of the platform display */
+ void *PlatformDisplay; /**< A pointer to the platform display */
- int APImajor, APIminor; /**< as returned by eglInitialize() */
- char Version[1000]; /**< initialized from APImajor/minor, DriverName */
+ _EGLDriver *Driver; /**< Matched driver of the display */
+ EGLBoolean Initialized; /**< True if the display is initialized */
- /** Bitmask of supported APIs (EGL_xx_BIT) set by the driver during init */
- EGLint ClientAPIsMask;
- char ClientAPIs[1000]; /**< updated by eglQueryString */
+ /* 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 */
- _EGLExtensions Extensions;
+ /* 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;
_EGLModule *mod;
_EGLDriver *best_drv = NULL;
EGLint best_score = 0;
- EGLint major, minor, i;
+ EGLint i;
_eglLockMutex(&_eglModuleMutex);
}
}
else {
- if (mod->Driver->API.Initialize(mod->Driver, dpy, &major, &minor)) {
+ if (mod->Driver->API.Initialize(mod->Driver, dpy)) {
best_drv = mod->Driver;
best_score = 100;
}
mod->Driver->Probe(mod->Driver, dpy) : 1;
}
else {
- if (mod->Driver->API.Initialize(mod->Driver, dpy, &major, &minor))
+ if (mod->Driver->API.Initialize(mod->Driver, dpy))
best_score = 100;
}
if (!use_probe) {
dpy->Driver = best_drv;
dpy->Initialized = EGL_TRUE;
- dpy->APImajor = major;
- dpy->APIminor = minor;
}
}
#include "eglcurrent.h"
#include "eglmisc.h"
#include "egldisplay.h"
+#include "egldriver.h"
+#include "eglstring.h"
/**
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;
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));
_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->VersionMajor,
+ 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;
#include <string.h>
#ifdef _EGL_OS_WINDOWS
+#include <stdio.h>
#define _eglstrcasecmp _stricmp
#define _eglsnprintf _snprintf
#else
ST_ATTACHMENT_BACK_LEFT : ST_ATTACHMENT_FRONT_LEFT;
valid = init_config_attributes(&gconf->base,
- nconf, dpy->ClientAPIsMask, depth_stencil_format,
+ nconf, dpy->ClientAPIs, depth_stencil_format,
preserve_buffer, max_swap_interval);
if (!valid) {
_eglLog(_EGL_DEBUG, "skip invalid config 0x%x", nconf->native_visual_id);
}
static EGLBoolean
-egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy,
- EGLint *major, EGLint *minor)
+egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy)
{
struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
struct egl_g3d_display *gdpy;
}
if (gdpy->loader->profile_masks[ST_API_OPENGL] & ST_PROFILE_DEFAULT_MASK)
- dpy->ClientAPIsMask |= EGL_OPENGL_BIT;
+ dpy->ClientAPIs |= EGL_OPENGL_BIT;
if (gdpy->loader->profile_masks[ST_API_OPENGL] & ST_PROFILE_OPENGL_ES1_MASK)
- dpy->ClientAPIsMask |= EGL_OPENGL_ES_BIT;
+ dpy->ClientAPIs |= EGL_OPENGL_ES_BIT;
if (gdpy->loader->profile_masks[ST_API_OPENGL] & ST_PROFILE_OPENGL_ES2_MASK)
- dpy->ClientAPIsMask |= EGL_OPENGL_ES2_BIT;
+ dpy->ClientAPIs |= EGL_OPENGL_ES2_BIT;
if (gdpy->loader->profile_masks[ST_API_OPENVG] & ST_PROFILE_DEFAULT_MASK)
- dpy->ClientAPIsMask |= EGL_OPENVG_BIT;
+ dpy->ClientAPIs |= EGL_OPENVG_BIT;
gdpy->smapi = egl_g3d_create_st_manager(dpy);
if (!gdpy->smapi) {
goto fail;
}
- *major = 1;
- *minor = 4;
+ dpy->VersionMajor = 1;
+ dpy->VersionMinor = 4;
return EGL_TRUE;