EGL_VG_ALPHA_FORMAT_PRE_BIT |
EGL_MULTISAMPLE_RESOLVE_BOX_BIT |
EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
+#ifdef EGL_MESA_screen_surface
if (conf->Display->Extensions.MESA_screen_surface)
mask |= EGL_SCREEN_BIT_MESA;
+#endif
break;
case EGL_RENDERABLE_TYPE:
case EGL_CONFORMANT:
#include <stdlib.h>
#include <string.h>
-#include "eglglobals.h"
#include "egllog.h"
#include "eglmutex.h"
#include "eglcurrent.h"
case EGL_BAD_SURFACE:
s = "EGL_BAD_SURFACE";
break;
+#ifdef EGL_MESA_screen_surface
case EGL_BAD_SCREEN_MESA:
s = "EGL_BAD_SCREEN_MESA";
break;
case EGL_BAD_MODE_MESA:
s = "EGL_BAD_MODE_MESA";
break;
+#endif
default:
s = "other";
}
#include "egldefines.h"
#include "egldisplay.h"
#include "egldriver.h"
-#include "eglglobals.h"
#include "egllog.h"
#include "eglmisc.h"
#include "eglmode.h"
{
&_eglGlobalMutex, /* Mutex */
NULL, /* DisplayList */
- 1, /* FreeScreenHandle */
2, /* NumAtExitCalls */
{
/* default AtExitCalls, called in reverse order */
/* the list of all displays */
_EGLDisplay *DisplayList;
- EGLScreenMESA FreeScreenHandle;
-
EGLint NumAtExitCalls;
void (*AtExitCalls[10])(void);
};
#include "eglstring.h"
+#ifdef EGL_MESA_screen_surface
+
+
#define MIN2(A, B) (((A) < (B)) ? (A) : (B))
{
return m->Name;
}
+
+
+#endif /* EGL_MESA_screen_surface */
#include "egltypedefs.h"
+#ifdef EGL_MESA_screen_surface
+
+
#define EGL_NO_MODE_MESA 0
_eglQueryModeStringMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLMode *m);
+#endif /* EGL_MESA_screen_surface */
+
+
#endif /* EGLMODE_INCLUDED */
#include <string.h>
#include "egldisplay.h"
-#include "eglglobals.h"
#include "eglcurrent.h"
#include "eglmode.h"
#include "eglconfig.h"
#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!
_eglAllocScreenHandle(void)
{
EGLScreenMESA s;
-
- _eglLockMutex(_eglGlobal.Mutex);
- s = _eglGlobal.FreeScreenHandle++;
- _eglUnlockMutex(_eglGlobal.Mutex);
+
+ _eglLockMutex(&_eglNextScreenHandleMutex);
+ s = _eglNextScreenHandle++;
+ _eglUnlockMutex(&_eglNextScreenHandleMutex);
return s;
}
free(scrn);
}
+
+#endif /* EGL_MESA_screen_surface */
#include "egltypedefs.h"
+#ifdef EGL_MESA_screen_surface
+
+
/**
* Per-screen information.
* Note that an EGL screen doesn't have a size. A screen may be set to
_eglDestroyScreen(_EGLScreen *scrn);
+#endif /* EGL_MESA_screen_surface */
+
+
#endif /* EGLSCREEN_INCLUDED */
}
+#ifdef EGL_MESA_screen_surface
+static EGLint
+_eglParseScreenSurfaceAttribList(_EGLSurface *surf, const EGLint *attrib_list)
+{
+ EGLint i, err = EGL_SUCCESS;
+
+ if (!attrib_list)
+ return EGL_SUCCESS;
+
+ for (i = 0; attrib_list[i] != EGL_NONE; i++) {
+ EGLint attr = attrib_list[i++];
+ EGLint val = attrib_list[i];
+
+ switch (attr) {
+ case EGL_WIDTH:
+ if (val < 0) {
+ err = EGL_BAD_PARAMETER;
+ break;
+ }
+ surf->Width = val;
+ break;
+ case EGL_HEIGHT:
+ if (val < 0) {
+ err = EGL_BAD_PARAMETER;
+ break;
+ }
+ surf->Height = val;
+ break;
+ default:
+ err = EGL_BAD_ATTRIBUTE;
+ break;
+ }
+
+ if (err != EGL_SUCCESS) {
+ _eglLog(_EGL_WARNING, "bad surface attribute 0x%04x", attr);
+ break;
+ }
+ }
+
+ return err;
+}
+#endif /* EGL_MESA_screen_surface */
+
+
/**
* Parse the list of surface attributes and return the proper error code.
*/
if (!attrib_list)
return EGL_SUCCESS;
+#ifdef EGL_MESA_screen_surface
+ if (type == EGL_SCREEN_BIT_MESA)
+ return _eglParseScreenSurfaceAttribList(surf, attrib_list);
+#endif
+
if (dpy->Extensions.NOK_texture_from_pixmap)
texture_type |= EGL_PIXMAP_BIT;
EGLint val = attrib_list[i];
switch (attr) {
- /* common (except for screen surfaces) attributes */
+ /* common attributes */
case EGL_VG_COLORSPACE:
- if (type == EGL_SCREEN_BIT_MESA) {
- err = EGL_BAD_ATTRIBUTE;
- break;
- }
switch (val) {
case EGL_VG_COLORSPACE_sRGB:
case EGL_VG_COLORSPACE_LINEAR:
surf->VGColorspace = val;
break;
case EGL_VG_ALPHA_FORMAT:
- if (type == EGL_SCREEN_BIT_MESA) {
- err = EGL_BAD_ATTRIBUTE;
- break;
- }
switch (val) {
case EGL_VG_ALPHA_FORMAT_NONPRE:
case EGL_VG_ALPHA_FORMAT_PRE:
break;
/* pbuffer surface attributes */
case EGL_WIDTH:
- if (type != EGL_PBUFFER_BIT && type != EGL_SCREEN_BIT_MESA) {
+ if (type != EGL_PBUFFER_BIT) {
err = EGL_BAD_ATTRIBUTE;
break;
}
surf->Width = val;
break;
case EGL_HEIGHT:
- if (type != EGL_PBUFFER_BIT && type != EGL_SCREEN_BIT_MESA) {
+ if (type != EGL_PBUFFER_BIT) {
err = EGL_BAD_ATTRIBUTE;
break;
}
}
surf->LargestPbuffer = !!val;
break;
+ /* for eglBindTexImage */
case EGL_TEXTURE_FORMAT:
if (!(type & texture_type)) {
err = EGL_BAD_ATTRIBUTE;
case EGL_PBUFFER_BIT:
func = "eglCreatePBufferSurface";
break;
+#ifdef EGL_MESA_screen_surface
case EGL_SCREEN_BIT_MESA:
func = "eglCreateScreenSurface";
renderBuffer = EGL_SINGLE_BUFFER; /* XXX correct? */
break;
+#endif
default:
_eglLog(_EGL_WARNING, "Bad type in _eglInitSurface");
return EGL_FALSE;
static void
egl_g3d_free_screen(void *scr)
{
+#ifdef EGL_MESA_screen_surface
struct egl_g3d_screen *gscr = egl_g3d_screen((_EGLScreen *) scr);
FREE(gscr->native_modes);
FREE(gscr);
+#endif
}
static EGLBoolean
unsigned zslice;
};
+/* standard typecasts */
+_EGL_DRIVER_STANDARD_TYPECASTS(egl_g3d)
+_EGL_DRIVER_TYPECAST(egl_g3d_image, _EGLImage, obj)
+
+#ifdef EGL_MESA_screen_surface
+
struct egl_g3d_screen {
_EGLScreen base;
const struct native_connector *native;
const struct native_mode **native_modes;
};
-
-/* standard typecasts */
-_EGL_DRIVER_STANDARD_TYPECASTS(egl_g3d)
_EGL_DRIVER_TYPECAST(egl_g3d_screen, _EGLScreen, obj)
-_EGL_DRIVER_TYPECAST(egl_g3d_image, _EGLImage, obj)
+
+#endif /* EGL_MESA_screen_surface */
#endif /* _EGL_G3D_H_ */