Rename eglShowSurfaceMESA to eglShowScreenSurfaceMESA.
EGLint APIENTRY
eglGetError(void)
{
- EGLint e = _eglGlobal.LastError;
- _eglGlobal.LastError = EGL_SUCCESS;
+ _EGLThreadInfo *t = _eglGetCurrentThread();
+ EGLint e = t->LastError;
+ t->LastError = EGL_SUCCESS;
return e;
}
{ "eglCopyContextMESA", (_EGLProc) eglCopyContextMESA },
{ "eglGetScreensMESA", (_EGLProc) eglGetScreensMESA },
{ "eglCreateScreenSurfaceMESA", (_EGLProc) eglCreateScreenSurfaceMESA },
- { "eglShowSurfaceMESA", (_EGLProc) eglShowSurfaceMESA },
+ { "eglShowScreenSurfaceMESA", (_EGLProc) eglShowScreenSurfaceMESA },
{ "eglScreenPositionMESA", (_EGLProc) eglScreenPositionMESA },
{ "eglQueryScreenMESA", (_EGLProc) eglQueryScreenMESA },
{ "eglQueryScreenSurfaceMESA", (_EGLProc) eglQueryScreenSurfaceMESA },
EGLBoolean
-eglShowSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode)
+eglShowScreenSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.ShowSurfaceMESA(drv, dpy, screen, surface, mode);
+ return drv->API.ShowScreenSurfaceMESA(drv, dpy, screen, surface, mode);
}
typedef EGLBoolean (*CopyContextMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask);
typedef EGLBoolean (*GetScreensMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
typedef EGLSurface (*CreateScreenSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
-typedef EGLBoolean (*ShowSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface surface, EGLModeMESA mode);
+typedef EGLBoolean (*ShowScreenSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface surface, EGLModeMESA mode);
typedef EGLBoolean (*ScreenPositionMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y);
typedef EGLBoolean (*QueryScreenMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value);
typedef EGLBoolean (*QueryScreenSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
CopyContextMESA_t CopyContextMESA;
GetScreensMESA_t GetScreensMESA;
CreateScreenSurfaceMESA_t CreateScreenSurfaceMESA;
- ShowSurfaceMESA_t ShowSurfaceMESA;
+ ShowScreenSurfaceMESA_t ShowScreenSurfaceMESA;
ScreenPositionMESA_t ScreenPositionMESA;
QueryScreenMESA_t QueryScreenMESA;
QueryScreenSurfaceMESA_t QueryScreenSurfaceMESA;
_EGLContext *
_eglGetCurrentContext(void)
{
- /* XXX this should be per-thread someday */
- return _eglGlobal.CurrentContext;
+ _EGLThreadInfo *t = _eglGetCurrentThread();
+ return t->CurrentContext;
}
_eglMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface d,
EGLSurface r, EGLContext context)
{
+ _EGLThreadInfo *t = _eglGetCurrentThread();
_EGLContext *ctx = _eglLookupContext(context);
_EGLSurface *draw = _eglLookupSurface(d);
_EGLSurface *read = _eglLookupSurface(r);
read->IsBound = EGL_TRUE;
}
- _eglGlobal.CurrentContext = ctx;
+ t->CurrentContext = ctx;
return EGL_TRUE;
}
drv->API.GetModeAttribMESA = _eglGetModeAttribMESA;
drv->API.GetScreensMESA = _eglGetScreensMESA;
drv->API.CreateScreenSurfaceMESA = _eglCreateScreenSurfaceMESA;
- drv->API.ShowSurfaceMESA = _eglShowSurfaceMESA;
+ drv->API.ShowScreenSurfaceMESA = _eglShowScreenSurfaceMESA;
drv->API.ScreenPositionMESA = _eglScreenPositionMESA;
drv->API.QueryScreenMESA = _eglQueryScreenMESA;
drv->API.QueryScreenSurfaceMESA = _eglQueryScreenSurfaceMESA;
#include "eglglobals.h"
-struct _egl_global _eglGlobal = { EGL_FALSE };
+struct _egl_global _eglGlobal = { .Initialized = EGL_FALSE };
/**
_eglGlobal.Contexts = _eglNewHashTable();
_eglGlobal.Surfaces = _eglNewHashTable();
_eglGlobal.FreeScreenHandle = 1;
- _eglGlobal.CurrentContext = EGL_NO_CONTEXT;
- _eglGlobal.LastError = EGL_SUCCESS;
_eglGlobal.Initialized = EGL_TRUE;
+ /* XXX temporary */
+ _eglGlobal.ThreadInfo.CurrentContext = EGL_NO_CONTEXT;
+ _eglGlobal.ThreadInfo.LastError = EGL_SUCCESS;
}
}
}
+/**
+ * Return pointer to calling thread's _EGLThreadInfo object.
+ * Create a new one if needed.
+ * Should never return NULL.
+ */
+_EGLThreadInfo *
+_eglGetCurrentThread(void)
+{
+ /* XXX temporary */
+ return &_eglGlobal.ThreadInfo;
+}
+
/**
* Record EGL error code.
void
_eglError(EGLint errCode, const char *msg)
{
+ _EGLThreadInfo *t = _eglGetCurrentThread();
const char *s;
- if (_eglGlobal.LastError == EGL_SUCCESS) {
- _eglGlobal.LastError = errCode;
+ if (t->LastError == EGL_SUCCESS) {
+ t->LastError = errCode;
switch (errCode) {
case EGL_BAD_ACCESS:
#include "eglhash.h"
+/**
+ * Per-thread info
+ */
+struct _egl_thread_info
+{
+ EGLint LastError;
+ _EGLContext *CurrentContext;
+};
+
+
+/**
+ * Global library data
+ */
struct _egl_global
{
EGLBoolean Initialized;
EGLScreenMESA FreeScreenHandle;
- EGLint LastError;
-
- /* XXX this should be per-thread someday */
- _EGLContext *CurrentContext;
+ /* XXX temporary */
+ _EGLThreadInfo ThreadInfo;
};
_eglDestroyGlobals(void);
+extern _EGLThreadInfo *
+_eglGetCurrentThread(void);
+
+
extern void
_eglError(EGLint errCode, const char *msg);
/**
* Surface-related functions.
- *
- * See the eglcontext.c file for comments that also apply here.
*/
typedef struct _egl_surface _EGLSurface;
+typedef struct _egl_thread_info _EGLThreadInfo;
+
typedef void (*_EGLProc)();