Fixes error EGL_BAD_ATTRIBUTE in the tests below on Intel Sandybridge: * piglit egl-create-context-verify-gl-flavor, testcase OpenGL ES 3.0 * gles3conform, revision 19700, when runnning GL3Tests with -fbo
This plumbing is added in order to comply with the EGL_KHR_create_context spec. According to the EGL_KHR_create_context spec, it is illegal to call eglCreateContext(EGL_CONTEXT_MAJOR_VERSION_KHR=3) with a config whose EGL_RENDERABLE_TYPE does not contain the EGL_OPENGL_ES3_BIT_KHR. The pertinent portion of the spec is quoted below; the key word is "respectively". * If <config> is not a valid EGLConfig, or does not support the requested client API, then an EGL_BAD_CONFIG error is generated (this includes requesting creation of an OpenGL ES 1.x, 2.0, or 3.0 context when the EGL_RENDERABLE_TYPE attribute of <config> does not contain EGL_OPENGL_ES_BIT, EGL_OPENGL_ES2_BIT, or EGL_OPENGL_ES3_BIT_KHR respectively). To create this patch, I searched for all the ES2 bit plumbing by calling `git grep "ES2_BIT\|DRI_API_GLES2" src/egl`, and then at each location added a case for ES3. Signed-off-by: Chad Versace <chad.vers...@linux.intel.com> --- src/egl/drivers/dri2/egl_dri2.c | 11 +++++++++-- src/egl/main/eglconfig.c | 1 + src/egl/main/eglcontext.c | 4 +++- src/egl/main/eglcurrent.h | 1 + src/egl/main/eglmisc.c | 3 +++ src/egl/main/eglsurface.c | 5 ++++- 6 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 1f13d79..0965959 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -465,7 +465,10 @@ dri2_setup_screen(_EGLDisplay *disp) api_mask = dri2_dpy->dri2->getAPIMask(dri2_dpy->dri_screen); } else { assert(dri2_dpy->swrast); - api_mask = 1 << __DRI_API_OPENGL | 1 << __DRI_API_GLES | 1 << __DRI_API_GLES2; + api_mask = 1 << __DRI_API_OPENGL | + 1 << __DRI_API_GLES | + 1 << __DRI_API_GLES2 | + 1 << __DRI_API_GLES3; } disp->ClientAPIs = 0; @@ -475,6 +478,8 @@ dri2_setup_screen(_EGLDisplay *disp) disp->ClientAPIs |= EGL_OPENGL_ES_BIT; if (api_mask & (1 << __DRI_API_GLES2)) disp->ClientAPIs |= EGL_OPENGL_ES2_BIT; + if (api_mask & (1 << __DRI_API_GLES3)) + disp->ClientAPIs |= EGL_OPENGL_ES3_BIT_KHR; assert(dri2_dpy->dri2 || dri2_dpy->swrast); disp->Extensions.KHR_surfaceless_context = EGL_TRUE; @@ -737,8 +742,10 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf, api = __DRI_API_GLES; break; case 2: + api = __DRI_API_GLES3; + break; case 3: - api = __DRI_API_GLES2; + api = __DRI_API_GLES3; break; default: _eglError(EGL_BAD_PARAMETER, "eglCreateContext"); diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c index e1d53da..b18f301 100644 --- a/src/egl/main/eglconfig.c +++ b/src/egl/main/eglconfig.c @@ -331,6 +331,7 @@ _eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching) mask = EGL_OPENGL_ES_BIT | EGL_OPENVG_BIT | EGL_OPENGL_ES2_BIT | + EGL_OPENGL_ES3_BIT_KHR | EGL_OPENGL_BIT; break; default: diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c index 4efb76b..86af91d 100644 --- a/src/egl/main/eglcontext.c +++ b/src/egl/main/eglcontext.c @@ -54,9 +54,11 @@ _eglGetContextAPIBit(_EGLContext *ctx) bit = EGL_OPENGL_ES_BIT; break; case 2: - case 3: bit = EGL_OPENGL_ES2_BIT; break; + case 3: + bit = EGL_OPENGL_ES3_BIT_KHR; + break; default: break; } diff --git a/src/egl/main/eglcurrent.h b/src/egl/main/eglcurrent.h index a64821e..45fcc64 100644 --- a/src/egl/main/eglcurrent.h +++ b/src/egl/main/eglcurrent.h @@ -37,6 +37,7 @@ (EGL_OPENGL_ES_BIT | \ EGL_OPENVG_BIT | \ EGL_OPENGL_ES2_BIT | \ + EGL_OPENGL_ES3_BIT_KHR | \ EGL_OPENGL_BIT) diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c index b7599d0..0733b9d 100644 --- a/src/egl/main/eglmisc.c +++ b/src/egl/main/eglmisc.c @@ -139,6 +139,9 @@ _eglUpdateAPIsString(_EGLDisplay *dpy) if (dpy->ClientAPIs & EGL_OPENGL_ES2_BIT) strcat(apis, "OpenGL_ES2 "); + if (dpy->ClientAPIs & EGL_OPENGL_ES3_BIT_KHR) + strcat(apis, "OpenGL_ES3 "); + if (dpy->ClientAPIs & EGL_OPENVG_BIT) strcat(apis, "OpenVG "); diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c index 52d85ef..56d68a4 100644 --- a/src/egl/main/eglsurface.c +++ b/src/egl/main/eglsurface.c @@ -427,11 +427,14 @@ _eglSurfaceAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, { EGLint confval; EGLint err = EGL_SUCCESS; + EGLint all_es_bits = EGL_OPENGL_ES_BIT | + EGL_OPENGL_ES2_BIT | + EGL_OPENGL_ES3_BIT_KHR; switch (attribute) { case EGL_MIPMAP_LEVEL: confval = surface->Config->RenderableType; - if (!(confval & (EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT))) { + if (!(confval & all_es_bits)) { err = EGL_BAD_PARAMETER; break; } -- 1.7.11.7 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev