summaryrefslogtreecommitdiff
path: root/src/egl/main
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2006-01-30 00:10:55 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2006-01-30 00:10:55 +0000
commitb2006a40eb22899d38cd31691640555228e36975 (patch)
tree4a54cd2f8b638936f7f24d842ab34106a6094a80 /src/egl/main
parentdaf3093f28353b27d277da4406324fbc41676a5b (diff)
some initial EGL 1.2 work
Diffstat (limited to 'src/egl/main')
-rw-r--r--src/egl/main/eglapi.c89
-rw-r--r--src/egl/main/eglapi.h15
-rw-r--r--src/egl/main/eglconfig.c36
-rw-r--r--src/egl/main/eglcontext.c5
-rw-r--r--src/egl/main/eglcontext.h3
-rw-r--r--src/egl/main/egldriver.c21
-rw-r--r--src/egl/main/egldriver.h1
-rw-r--r--src/egl/main/eglglobals.c39
-rw-r--r--src/egl/main/eglglobals.h17
-rw-r--r--src/egl/main/eglsurface.c116
-rw-r--r--src/egl/main/eglsurface.h20
11 files changed, 349 insertions, 13 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index f898ba59fb..bfa580e6c3 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -31,6 +31,7 @@
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include "eglcontext.h"
#include "egldisplay.h"
@@ -346,6 +347,7 @@ void (* APIENTRY eglGetProcAddress(const char *procname))()
{ "eglWaitGL", (_EGLProc) eglWaitGL },
{ "eglWaitNative", (_EGLProc) eglWaitNative },
/* Extensions */
+#ifdef EGL_MESA_screen_surface
{ "eglChooseModeMESA", (_EGLProc) eglChooseModeMESA },
{ "eglGetModesMESA", (_EGLProc) eglGetModesMESA },
{ "eglGetModeAttribMESA", (_EGLProc) eglGetModeAttribMESA },
@@ -358,6 +360,14 @@ void (* APIENTRY eglGetProcAddress(const char *procname))()
{ "eglQueryScreenSurfaceMESA", (_EGLProc) eglQueryScreenSurfaceMESA },
{ "eglQueryScreenModeMESA", (_EGLProc) eglQueryScreenModeMESA },
{ "eglQueryModeStringMESA", (_EGLProc) eglQueryModeStringMESA },
+#endif /* EGL_MESA_screen_surface */
+#ifdef EGL_VERSION_1_2
+ { "eglBindAPI", (_EGLProc) eglBindAPI },
+ { "eglCreatePbufferFromClientBuffer", (_EGLProc) eglCreatePbufferFromClientBuffer },
+ { "eglQueryAPI", (_EGLProc) eglQueryAPI },
+ { "eglReleaseThread", (_EGLProc) eglReleaseThread },
+ { "eglWaitClient", (_EGLProc) eglWaitClient },
+#endif /* EGL_VERSION_1_2 */
{ NULL, NULL }
};
EGLint i;
@@ -492,6 +502,85 @@ eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode)
}
+/**
+ ** EGL 1.2
+ **/
+
+#ifdef EGL_VERSION_1_2
+
+EGLBoolean
+eglBindAPI(EGLenum api)
+{
+ _EGLThreadInfo *t = _eglGetCurrentThread();
+
+ switch (api) {
+ case EGL_OPENGL_ES_API:
+ if (_eglGlobal.OpenGLESAPISupported) {
+ t->CurrentAPI = api;
+ return EGL_TRUE;
+ }
+ _eglError(EGL_BAD_PARAMETER, "eglBindAPI");
+ return EGL_FALSE;
+ case EGL_OPENVG_API:
+ if (_eglGlobal.OpenVGAPISupported) {
+ t->CurrentAPI = api;
+ return EGL_TRUE;
+ }
+ _eglError(EGL_BAD_PARAMETER, "eglBindAPI");
+ return EGL_FALSE;
+ default:
+ return EGL_FALSE;
+ }
+ return EGL_TRUE;
+}
+
+
+EGLSurface
+eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype,
+ EGLClientBuffer buffer, EGLConfig config,
+ const EGLint *attrib_list)
+{
+ _EGLDriver *drv = _eglLookupDriver(dpy);
+ return drv->API.CreatePbufferFromClientBuffer(drv, dpy, buftype, buffer,
+ config, attrib_list);
+}
+
+
+EGLenum
+eglQueryAPI(void)
+{
+ /* returns one of EGL_OPENGL_ES_API or EGL_OPENVG_API */
+ _EGLThreadInfo *t = _eglGetCurrentThread();
+ return t->CurrentAPI;
+}
+
+
+EGLBoolean
+eglReleaseThread(void)
+{
+ _EGLThreadInfo *t = _eglGetCurrentThread();
+ EGLDisplay dpy = eglGetCurrentDisplay();
+ if (dpy) {
+ _EGLDriver *drv = _eglLookupDriver(dpy);
+ /* unbind context */
+ (void) drv->API.MakeCurrent(drv, dpy, EGL_NO_SURFACE,
+ EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ }
+ _eglDeleteThreadData(t);
+ return EGL_TRUE;
+}
+EGLBoolean
+eglWaitClient(void)
+{
+ EGLDisplay dpy = eglGetCurrentDisplay();
+ if (dpy != EGL_NO_DISPLAY) {
+ _EGLDriver *drv = _eglLookupDriver(dpy);
+ return drv->API.WaitClient(drv, dpy);
+ }
+ else
+ return EGL_FALSE;
+}
+#endif /* EGL_VERSION_1_2 */
diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h
index f11080be1c..555aa5dd9e 100644
--- a/src/egl/main/eglapi.h
+++ b/src/egl/main/eglapi.h
@@ -40,7 +40,7 @@ typedef EGLBoolean (*WaitGL_t)(_EGLDriver *drv, EGLDisplay dpy);
typedef EGLBoolean (*WaitNative_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint engine);
-/* EGL_MESA_screen extension */
+#ifdef EGL_MESA_screen_surface
typedef EGLBoolean (*ChooseModeMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
typedef EGLBoolean (*GetModesMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint mode_size, EGLint *num_mode);
typedef EGLBoolean (*GetModeAttribMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value);
@@ -53,6 +53,14 @@ typedef EGLBoolean (*QueryScreenMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScre
typedef EGLBoolean (*QueryScreenSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
typedef EGLBoolean (*QueryScreenModeMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
typedef const char * (*QueryModeStringMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode);
+#endif /* EGL_MESA_screen_surface */
+
+
+#ifdef EGL_VERSION_1_2
+typedef EGLBoolean (*WaitClient_t)(_EGLDriver *drv, EGLDisplay dpy);
+typedef EGLSurface (*CreatePbufferFromClientBuffer_t)(_EGLDriver *drv, EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
+#endif /* EGL_VERSION_1_2 */
+
/**
@@ -101,6 +109,11 @@ struct _egl_api
QueryScreenSurfaceMESA_t QueryScreenSurfaceMESA;
QueryScreenModeMESA_t QueryScreenModeMESA;
QueryModeStringMESA_t QueryModeStringMESA;
+
+#ifdef EGL_VERSION_1_2
+ WaitClient_t WaitClient;
+ CreatePbufferFromClientBuffer_t CreatePbufferFromClientBuffer;
+#endif
};
#endif /* EGLAPI_INCLUDED */
diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c
index 96f47d98b6..c180e30d7f 100644
--- a/src/egl/main/eglconfig.c
+++ b/src/egl/main/eglconfig.c
@@ -92,6 +92,10 @@ _eglInitConfig(_EGLConfig *config, EGLint id)
_eglSetConfigAttrib(config, EGL_TRANSPARENT_RED_VALUE, EGL_DONT_CARE);
_eglSetConfigAttrib(config, EGL_TRANSPARENT_GREEN_VALUE, EGL_DONT_CARE);
_eglSetConfigAttrib(config, EGL_TRANSPARENT_BLUE_VALUE, EGL_DONT_CARE);
+#ifdef EGL_VERSION_1_2
+ _eglSetConfigAttrib(config, EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER);
+ _eglSetConfigAttrib(config, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT);
+#endif /* EGL_VERSION_1_2 */
}
@@ -153,13 +157,37 @@ _eglParseConfigAttribs(_EGLConfig *config, const EGLint *attrib_list)
}
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
- if (attrib_list[i] >= EGL_BUFFER_SIZE &&
- attrib_list[i] <= EGL_MAX_SWAP_INTERVAL) {
- EGLint k = attrib_list[i] - FIRST_ATTRIB;
+ const EGLint attr = attrib_list[i];
+ if (attr >= EGL_BUFFER_SIZE &&
+ attr <= EGL_MAX_SWAP_INTERVAL) {
+ EGLint k = attr - FIRST_ATTRIB;
assert(k >= 0);
assert(k < MAX_ATTRIBS);
config->Attrib[k] = attrib_list[++i];
}
+#ifdef EGL_VERSION_1_2
+ else if (attr == EGL_COLOR_BUFFER_TYPE) {
+ EGLint bufType = attrib_list[++i];
+ if (bufType != EGL_RGB_BUFFER && bufType != EGL_LUMINANCE_BUFFER) {
+ _eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
+ return EGL_FALSE;
+ }
+ _eglSetConfigAttrib(config, EGL_COLOR_BUFFER_TYPE, bufType);
+ }
+ else if (attr == EGL_RENDERABLE_TYPE) {
+ EGLint renType = attrib_list[++i];
+ if (renType & ~(EGL_OPENGL_ES_BIT | EGL_OPENVG_BIT)) {
+ _eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
+ return EGL_FALSE;
+ }
+ _eglSetConfigAttrib(config, EGL_RENDERABLE_TYPE, renType);
+ }
+ else if (attr == EGL_ALPHA_MASK_SIZE ||
+ attr == EGL_LUMINANCE_SIZE) {
+ EGLint value = attrib_list[++i];
+ _eglSetConfigAttrib(config, attr, value);
+ }
+#endif /* EGL_VERSION_1_2 */
else {
_eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
return EGL_FALSE;
@@ -184,6 +212,8 @@ struct sort_info {
/* This encodes the info from Table 3.5 of the EGL spec, ordered by
* Sort Priority.
+ *
+ * XXX To do: EGL 1.2 attribs
*/
static struct sort_info SortInfo[] = {
{ EGL_CONFIG_CAVEAT, EXACT, SPECIAL },
diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
index 07b63e9b11..374c006dae 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -160,6 +160,11 @@ _eglQueryContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx,
case EGL_CONFIG_ID:
*value = GET_CONFIG_ATTRIB(c->Config, EGL_CONFIG_ID);
return EGL_TRUE;
+#ifdef EGL_VERSION_1_2
+ case EGL_CONTEXT_CLIENT_TYPE:
+ *value = c->ClientAPI;
+ return EGL_FALSE;
+#endif /* EGL_VERSION_1_2 */
default:
_eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext");
return EGL_FALSE;
diff --git a/src/egl/main/eglcontext.h b/src/egl/main/eglcontext.h
index 4b0eaf3107..82bfde151f 100644
--- a/src/egl/main/eglcontext.h
+++ b/src/egl/main/eglcontext.h
@@ -22,6 +22,9 @@ struct _egl_context
EGLBoolean IsBound;
EGLBoolean DeletePending;
+#ifdef EGL_VERSION_1_2
+ EGLint ClientAPI; /* Either EGL_OPENGL_ES_API or EGL_OPENVG_API */
+#endif /* EGL_VERSION_1_2 */
};
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index fd7e00778e..bda06dd827 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -181,7 +181,7 @@ _eglInitDriverFallbacks(_EGLDriver *drv)
drv->API.WaitGL = _eglWaitGL;
drv->API.WaitNative = _eglWaitNative;
- /* EGL_MESA_screen */
+#ifdef EGL_MESA_screen_surface
drv->API.ChooseModeMESA = _eglChooseModeMESA;
drv->API.GetModesMESA = _eglGetModesMESA;
drv->API.GetModeAttribMESA = _eglGetModeAttribMESA;
@@ -193,6 +193,11 @@ _eglInitDriverFallbacks(_EGLDriver *drv)
drv->API.QueryScreenSurfaceMESA = _eglQueryScreenSurfaceMESA;
drv->API.QueryScreenModeMESA = _eglQueryScreenModeMESA;
drv->API.QueryModeStringMESA = _eglQueryModeStringMESA;
+#endif /* EGL_MESA_screen_surface */
+
+#ifdef EGL_VERSION_1_2
+ drv->API.CreatePbufferFromClientBuffer = _eglCreatePbufferFromClientBuffer;
+#endif /* EGL_VERSION_1_2 */
}
@@ -227,6 +232,11 @@ _eglQueryString(_EGLDriver *drv, EGLDisplay dpy, EGLint name)
case EGL_EXTENSIONS:
_eglUpdateExtensionsString(drv);
return drv->Extensions.String;
+#ifdef EGL_VERSION_1_2
+ case EGL_CLIENT_APIS:
+ /* XXX need to initialize somewhere */
+ return drv->ClientAPIs;
+#endif
default:
_eglError(EGL_BAD_PARAMETER, "eglQueryString");
return NULL;
@@ -250,6 +260,13 @@ _eglWaitNative(_EGLDriver *drv, EGLDisplay dpy, EGLint engine)
/* just a placeholder */
(void) drv;
(void) dpy;
- (void) engine;
+ switch (engine) {
+ case EGL_CORE_NATIVE_ENGINE:
+ break;
+ default:
+ _eglError(EGL_BAD_PARAMETER, "eglWaitNative(engine)");
+ return EGL_FALSE;
+ }
+
return EGL_TRUE;
}
diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h
index 51ec27c06f..88526e973d 100644
--- a/src/egl/main/egldriver.h
+++ b/src/egl/main/egldriver.h
@@ -34,6 +34,7 @@ struct _egl_driver
int ABIversion;
int APImajor, APIminor; /* returned through eglInitialize */
+ const char *ClientAPIs;
_EGLAPI API;
diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c
index 83abd0a370..608311d749 100644
--- a/src/egl/main/eglglobals.c
+++ b/src/egl/main/eglglobals.c
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <stdlib.h>
#include "eglglobals.h"
@@ -18,9 +19,12 @@ _eglInitGlobals(void)
_eglGlobal.Surfaces = _eglNewHashTable();
_eglGlobal.FreeScreenHandle = 1;
_eglGlobal.Initialized = EGL_TRUE;
+
+ _eglGlobal.OpenGLESAPISupported = EGL_TRUE;
+ _eglGlobal.OpenVGAPISupported = EGL_FALSE;
+
/* XXX temporary */
- _eglGlobal.ThreadInfo.CurrentContext = EGL_NO_CONTEXT;
- _eglGlobal.ThreadInfo.LastError = EGL_SUCCESS;
+ _eglGlobal.ThreadInfo = _eglNewThreadInfo();
}
}
@@ -39,6 +43,33 @@ _eglDestroyGlobals(void)
/**
+ * Allocate and init a new _EGLThreadInfo object.
+ */
+_EGLThreadInfo *
+_eglNewThreadInfo(void)
+{
+ _EGLThreadInfo *t = (_EGLThreadInfo *) calloc(1, sizeof(_EGLThreadInfo));
+ if (t) {
+ t->CurrentContext = EGL_NO_CONTEXT;
+ t->LastError = EGL_SUCCESS;
+ t->CurrentAPI = EGL_NONE;
+ }
+ return t;
+}
+
+
+/**
+ * Delete/free a _EGLThreadInfo object.
+ */
+void
+_eglDeleteThreadData(_EGLThreadInfo *t)
+{
+ free(t);
+}
+
+
+
+/**
* Return pointer to calling thread's _EGLThreadInfo object.
* Create a new one if needed.
* Should never return NULL.
@@ -46,8 +77,10 @@ _eglDestroyGlobals(void)
_EGLThreadInfo *
_eglGetCurrentThread(void)
{
+ _eglInitGlobals();
+
/* XXX temporary */
- return &_eglGlobal.ThreadInfo;
+ return _eglGlobal.ThreadInfo;
}
diff --git a/src/egl/main/eglglobals.h b/src/egl/main/eglglobals.h
index c25ab3e35b..c16baa2d6b 100644
--- a/src/egl/main/eglglobals.h
+++ b/src/egl/main/eglglobals.h
@@ -12,6 +12,7 @@ struct _egl_thread_info
{
EGLint LastError;
_EGLContext *CurrentContext;
+ EGLenum CurrentAPI;
};
@@ -28,8 +29,12 @@ struct _egl_global
EGLScreenMESA FreeScreenHandle;
- /* XXX temporary */
- _EGLThreadInfo ThreadInfo;
+ /* XXX these may be temporary */
+ EGLBoolean OpenGLESAPISupported;
+ EGLBoolean OpenVGAPISupported;
+
+ /* XXX temporary - should be thread-specific data (TSD) */
+ _EGLThreadInfo *ThreadInfo;
};
@@ -45,6 +50,14 @@ _eglDestroyGlobals(void);
extern _EGLThreadInfo *
+_eglNewThreadInfo(void);
+
+
+extern void
+_eglDeleteThreadData(_EGLThreadInfo *t);
+
+
+extern _EGLThreadInfo *
_eglGetCurrentThread(void);
diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c
index 4606168cf3..4d71594273 100644
--- a/src/egl/main/eglsurface.c
+++ b/src/egl/main/eglsurface.c
@@ -27,6 +27,11 @@ _eglInitSurface(_EGLDriver *drv, EGLDisplay dpy,
_EGLConfig *conf;
EGLint width = 0, height = 0, largest = 0;
EGLint texFormat = 0, texTarget = 0, mipmapTex = 0;
+ EGLint renderBuffer = EGL_BACK_BUFFER;
+#ifdef EGL_VERSION_1_2
+ EGLint colorspace = EGL_COLORSPACE_sRGB;
+ EGLint alphaFormat = EGL_ALPHA_FORMAT_NONPRE;
+#endif
EGLint i;
switch (type) {
@@ -35,12 +40,14 @@ _eglInitSurface(_EGLDriver *drv, EGLDisplay dpy,
break;
case EGL_PIXMAP_BIT:
func = "eglCreatePixmapSurface";
+ renderBuffer = EGL_SINGLE_BUFFER;
break;
case EGL_PBUFFER_BIT:
func = "eglCreatePBufferSurface";
break;
case EGL_SCREEN_BIT_MESA:
func = "eglCreateScreenSurface";
+ renderBuffer = EGL_SINGLE_BUFFER; /* XXX correct? */
break;
default:
_eglLog(_EGL_WARNING, "Bad type in _eglInitSurface");
@@ -113,6 +120,55 @@ _eglInitSurface(_EGLDriver *drv, EGLDisplay dpy,
return EGL_FALSE;
}
break;
+#ifdef EGL_VERSION_1_2
+ case EGL_RENDER_BUFFER:
+ if (type == EGL_WINDOW_BIT) {
+ renderBuffer = attrib_list[++i];
+ if (renderBuffer != EGL_BACK_BUFFER &&
+ renderBuffer != EGL_SINGLE_BUFFER) {
+ _eglError(EGL_BAD_ATTRIBUTE, func);
+ return EGL_FALSE;
+ }
+ }
+ else {
+ _eglError(EGL_BAD_ATTRIBUTE, func);
+ return EGL_FALSE;
+ }
+ break;
+ case EGL_COLORSPACE:
+ if (type == EGL_WINDOW_BIT ||
+ type == EGL_PBUFFER_BIT ||
+ type == EGL_PIXMAP_BIT) {
+ colorspace = attrib_list[++i];
+ if (colorspace != EGL_COLORSPACE_sRGB &&
+ colorspace != EGL_COLORSPACE_LINEAR) {
+ _eglError(EGL_BAD_ATTRIBUTE, func);
+ return EGL_FALSE;
+ }
+ }
+ else {
+ _eglError(EGL_BAD_ATTRIBUTE, func);
+ return EGL_FALSE;
+ }
+ break;
+ case EGL_ALPHA_FORMAT:
+ if (type == EGL_WINDOW_BIT ||
+ type == EGL_PBUFFER_BIT ||
+ type == EGL_PIXMAP_BIT) {
+ alphaFormat = attrib_list[++i];
+ if (alphaFormat != EGL_ALPHA_FORMAT_NONPRE &&
+ alphaFormat != EGL_ALPHA_FORMAT_PRE) {
+ _eglError(EGL_BAD_ATTRIBUTE, func);
+ return EGL_FALSE;
+ }
+ }
+ else {
+ _eglError(EGL_BAD_ATTRIBUTE, func);
+ return EGL_FALSE;
+ }
+ break;
+
+#endif /* EGL_VERSION_1_2 */
default:
_eglError(EGL_BAD_ATTRIBUTE, func);
return EGL_FALSE;
@@ -134,6 +190,15 @@ _eglInitSurface(_EGLDriver *drv, EGLDisplay dpy,
surf->MipmapTexture = mipmapTex;
surf->MipmapLevel = 0;
surf->SwapInterval = 0;
+#ifdef EGL_VERSION_1_2
+ surf->SwapBehavior = EGL_BUFFER_DESTROYED; /* XXX ok? */
+ surf->HorizontalResolution = EGL_UNKNOWN; /* set by caller */
+ surf->VerticalResolution = EGL_UNKNOWN; /* set by caller */
+ surf->AspectRatio = EGL_UNKNOWN; /* set by caller */
+ surf->RenderBuffer = renderBuffer;
+ surf->AlphaFormat = alphaFormat;
+ surf->Colorspace = colorspace;
+#endif
return EGL_TRUE;
}
@@ -232,6 +297,11 @@ _eglQuerySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surf,
case EGL_CONFIG_ID:
*value = GET_CONFIG_ATTRIB(surface->Config, EGL_CONFIG_ID);
return EGL_TRUE;
+ /*XXX case EGL_LARGEST_PBUFFER:*/
+ case EGL_SURFACE_TYPE:
+ *value = surface->Type;
+ return EGL_TRUE;
+#ifdef EGL_VERSION_1_1
case EGL_TEXTURE_FORMAT:
/* texture attributes: only for pbuffers, no error otherwise */
if (surface->Type == EGL_PBUFFER_BIT)
@@ -249,9 +319,30 @@ _eglQuerySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surf,
if (surface->Type == EGL_PBUFFER_BIT)
*value = surface->MipmapLevel;
return EGL_TRUE;
- case EGL_SURFACE_TYPE:
- *value = surface->Type;
+#endif /* EGL_VERSION_1_1 */
+#ifdef EGL_VERSION_1_2
+ case EGL_SWAP_BEHAVIOR:
+ *value = surface->SwapBehavior;
+ return EGL_TRUE;
+ case EGL_RENDER_BUFFER:
+ *value = surface->RenderBuffer;
+ return EGL_TRUE;
+ case EGL_PIXEL_ASPECT_RATIO:
+ *value = surface->AspectRatio;
+ return EGL_TRUE;
+ case EGL_HORIZONTAL_RESOLUTION:
+ *value = surface->HorizontalResolution;
return EGL_TRUE;
+ case EGL_VERTICAL_RESOLUTION:
+ *value = surface->VerticalResolution;
+ return EGL_TRUE;
+ case EGL_ALPHA_FORMAT:
+ *value = surface->AlphaFormat;
+ return EGL_TRUE;
+ case EGL_COLORSPACE:
+ *value = surface->Colorspace;
+ return EGL_TRUE;
+#endif /* EGL_VERSION_1_2 */
default:
_eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
return EGL_FALSE;
@@ -416,3 +507,24 @@ _eglSwapInterval(_EGLDriver *drv, EGLDisplay dpy, EGLint interval)
surf->SwapInterval = interval;
return EGL_TRUE;
}
+
+
+#ifdef EGL_VERSION_1_2
+
+/**
+ * Example function - drivers should do a proper implementation.
+ */
+EGLSurface
+_eglCreatePbufferFromClientBuffer(_EGLDriver *drv, EGLDisplay dpy,
+ EGLenum buftype, EGLClientBuffer buffer,
+ EGLConfig config, const EGLint *attrib_list)
+{
+ if (buftype != EGL_OPENVG_IMAGE) {
+ _eglError(EGL_BAD_PARAMETER, "eglCreatePbufferFromClientBuffer");
+ return ELG_NO_SURFACE;
+ }
+
+ return EGL_NO_SURFACE;
+}
+
+#endif /* EGL_VERSION_1_2 */
diff --git a/src/egl/main/eglsurface.h b/src/egl/main/eglsurface.h
index bbe399211f..79abeca0b2 100644
--- a/src/egl/main/eglsurface.h
+++ b/src/egl/main/eglsurface.h
@@ -25,6 +25,15 @@ struct _egl_surface
/* If type == EGL_SCREEN_BIT: */
EGLint VisibleRefCount; /* number of screens I'm displayed on */
+
+#ifdef EGL_VERSION_1_2
+ EGLint SwapBehavior; /* one of EGL_BUFFER_PRESERVED/DESTROYED */
+ EGLint HorizontalResolution, VerticalResolution;
+ EGLint AspectRatio;
+ EGLint RenderBuffer; /* EGL_BACK_BUFFER or EGL_SINGLE_BUFFER */
+ EGLint AlphaFormat; /* EGL_ALPHA_FORMAT_NONPRE or EGL_ALPHA_FORMAT_PRE */
+ EGLint Colorspace; /* EGL_COLORSPACE_sRGB or EGL_COLORSPACE_LINEAR */
+#endif /* EGL_VERSION_1_2 */
};
@@ -94,4 +103,15 @@ extern EGLBoolean
_eglSwapInterval(_EGLDriver *drv, EGLDisplay dpy, EGLint interval);
+#ifdef EGL_VERSION_1_2
+
+extern EGLSurface
+_eglCreatePbufferFromClientBuffer(_EGLDriver *drv, EGLDisplay dpy,
+ EGLenum buftype, EGLClientBuffer buffer,
+ EGLConfig config, const EGLint *attrib_list);
+
+#endif /* EGL_VERSION_1_2 */
+
+
+
#endif /* EGLSURFACE_INCLUDED */