From 28c2ce71053e33ba23d0d0da3b26f7c4cf27af12 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 16 May 2019 22:05:51 -0700 Subject: [PATCH] egl: Allow EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY in ES and GL MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit EGL annoyingly defines a few variants of this token: EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT - 0x3138 EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR - 0x31BD EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY - 0x31BD The EGL_EXT_create_context_robustness extension specifies that the EXT token is only valid for ES contexts, not GL. The EGL_KHR_create_context extension defines the KHR version, and says it is only allowed for GL contexts, and specifically calls out that it's an error for ES contexts. But EGL 1.5 includes the new suffixless token, which has the same value as the KHR version, and specifically calls out that it's now valid to use with both GL and ES contexts. So we should allow this. Fixes KHR-NoContext.es32.robustness.no_reset_notification and KHR-NoContext.es32.robustness.lose_context_on_reset on iris, which apparently is exposing EGL 1.5. Reviewed-by: Tapani Pälli --- src/egl/main/eglcontext.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c index ae90e4e2bd4..bb11b8f9104 100644 --- a/src/egl/main/eglcontext.c +++ b/src/egl/main/eglcontext.c @@ -250,9 +250,17 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *disp, * meaningful for OpenGL contexts, and specifying it for other * types of contexts, including OpenGL ES contexts, will generate * an error." + * + * EGL 1.5 defines EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY + * (without a suffix) which has the same value as the KHR token, + * and specifies that it now works with both GL and ES contexts: + * + * "This attribute is supported only for OpenGL and OpenGL ES + * contexts." */ - if (!disp->Extensions.KHR_create_context - || api != EGL_OPENGL_API) { + if (!(disp->Extensions.KHR_create_context && api == EGL_OPENGL_API) + && !(disp->Version >= 15 && (api == EGL_OPENGL_API || + api == EGL_OPENGL_ES_API))) { err = EGL_BAD_ATTRIBUTE; break; } -- 2.30.2