summaryrefslogtreecommitdiff
path: root/src/egl/main/eglscreen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/egl/main/eglscreen.c')
-rw-r--r--src/egl/main/eglscreen.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/egl/main/eglscreen.c b/src/egl/main/eglscreen.c
index 8f96fd935c..8b8966f3ff 100644
--- a/src/egl/main/eglscreen.c
+++ b/src/egl/main/eglscreen.c
@@ -16,7 +16,6 @@
#include <string.h>
#include "egldisplay.h"
-#include "eglglobals.h"
#include "eglcurrent.h"
#include "eglmode.h"
#include "eglconfig.h"
@@ -25,6 +24,14 @@
#include "eglmutex.h"
+#ifdef EGL_MESA_screen_surface
+
+
+/* ugh, no atomic op? */
+static _EGL_DECLARE_MUTEX(_eglNextScreenHandleMutex);
+static EGLScreenMESA _eglNextScreenHandle = 1;
+
+
/**
* Return a new screen handle/ID.
* NOTE: we never reuse these!
@@ -33,10 +40,10 @@ static EGLScreenMESA
_eglAllocScreenHandle(void)
{
EGLScreenMESA s;
-
- _eglLockMutex(_eglGlobal.Mutex);
- s = _eglGlobal.FreeScreenHandle++;
- _eglUnlockMutex(_eglGlobal.Mutex);
+
+ _eglLockMutex(&_eglNextScreenHandleMutex);
+ s = _eglNextScreenHandle++;
+ _eglUnlockMutex(&_eglNextScreenHandleMutex);
return s;
}
@@ -263,3 +270,5 @@ _eglDestroyScreen(_EGLScreen *scrn)
free(scrn);
}
+
+#endif /* EGL_MESA_screen_surface */