summaryrefslogtreecommitdiffstats
path: root/src/egl/main/eglscreen.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2010-07-31 00:00:49 +0800
committerChia-I Wu <[email protected]>2010-07-31 17:49:32 +0800
commit6c7e0b95a4a16d268aa3ca74c5c8407779533314 (patch)
tree533bf5ee540c5bc55518d39c424db8f0ed28a0a4 /src/egl/main/eglscreen.c
parent3cc471e429675e82fcc37c6efa2c5e880d811b84 (diff)
egl: Add checks for EGL_MESA_screen_surface.
This allows Mesa EGL to be compiled with eglext.h that does not define EGL_MESA_screen_surface.
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 8f96fd935c7..8b8966f3ffd 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 */