From afd678803632096b9e5ce68d6518684de88e9a85 Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Thu, 29 May 2025 20:28:50 +0200 Subject: [PATCH] egl: Fixes for eglQueryContext and RESET_NOTIFICATION_STRATEGY MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Streamline the conditions for when `RESET_NOTIFICATION_STRATEGY_EXT` can be queried to match the conditions when it can be set - notably only with GLES. While on it, add support to query the KHR and suffix-less versions. Cc: mesa-stable Signed-off-by: Robert Mader Reviewed-by: Tapani Pälli Part-of: --- src/egl/main/eglcontext.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c index 77204347e57..49b4633b734 100644 --- a/src/egl/main/eglcontext.c +++ b/src/egl/main/eglcontext.c @@ -765,6 +765,7 @@ EGLBoolean _eglQueryContext(_EGLContext *c, EGLint attribute, EGLint *value) { _EGLDisplay *disp = c->Resource.Display; + EGLenum api = c->ClientAPI; if (!value) return _eglError(EGL_BAD_PARAMETER, "eglQueryContext"); @@ -798,7 +799,14 @@ _eglQueryContext(_EGLContext *c, EGLint attribute, EGLint *value) *value = c->Protected; break; case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT: - if (!disp->Extensions.EXT_query_reset_notification_strategy) + if (!disp->Extensions.EXT_create_context_robustness || + api != EGL_OPENGL_ES_API) + return _eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext"); + *value = c->ResetNotificationStrategy; + break; + case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR: + if (!(disp->Extensions.KHR_create_context && api == EGL_OPENGL_API) && + disp->Version < 15) return _eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext"); *value = c->ResetNotificationStrategy; break;