Module: Mesa
Branch: main
Commit: f6d2df5a7542025022e69b81dbe3af3e51ea5cd3
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f6d2df5a7542025022e69b81dbe3af3e51ea5cd3

Author: Simon Zeni <simon.z...@collabora.com>
Date:   Wed Nov  1 16:26:35 2023 -0400

egl: implement EGL_EXT_query_reset_notification_strategy

`EGL_EXT_query_reset_notification_strategy` complements
`EXT_create_context_robustness` and enables an application or framework to
retrieve an existing context's reset notification strategy in order to create
a compatible shared context.

Signed-off-by: Simon Zeni <simon.z...@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-pra...@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25996>

---

 docs/relnotes/new_features.txt  | 1 +
 src/egl/drivers/dri2/egl_dri2.c | 5 +++++
 src/egl/main/eglapi.c           | 3 ++-
 src/egl/main/eglcontext.c       | 5 +++++
 src/egl/main/egldisplay.h       | 3 ++-
 5 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt
index 44d7822f0f6..4b45b5e4d8d 100644
--- a/docs/relnotes/new_features.txt
+++ b/docs/relnotes/new_features.txt
@@ -20,3 +20,4 @@ VK_KHR_calibrated_timestamps on RADV
 VK_KHR_vertex_attribute_divisor on RADV
 VK_KHR_maintenance6 on RADV
 VK_KHR_ray_tracing_position_fetch on RADV
+EGL_EXT_query_reset_notification_strategy
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index bb75273ead9..2f4583f1a3a 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -893,6 +893,11 @@ dri2_setup_screen(_EGLDisplay *disp)
    disp->Extensions.EXT_create_context_robustness =
       get_screen_param(disp, PIPE_CAP_DEVICE_RESET_STATUS_QUERY);
 
+   /* EXT_query_reset_notification_strategy complements and requires
+    * EXT_create_context_robustness. */
+   disp->Extensions.EXT_query_reset_notification_strategy =
+      disp->Extensions.EXT_create_context_robustness;
+
    if (dri2_dpy->fence) {
       disp->Extensions.KHR_fence_sync = EGL_TRUE;
       disp->Extensions.KHR_wait_sync = EGL_TRUE;
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index d37d61d6246..3ee3f1b598c 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -549,9 +549,10 @@ _eglCreateExtensionsString(_EGLDisplay *disp)
    _EGL_CHECK_EXTENSION(EXT_create_context_robustness);
    _EGL_CHECK_EXTENSION(EXT_image_dma_buf_import);
    _EGL_CHECK_EXTENSION(EXT_image_dma_buf_import_modifiers);
+   _EGL_CHECK_EXTENSION(EXT_present_opaque);
    _EGL_CHECK_EXTENSION(EXT_protected_content);
    _EGL_CHECK_EXTENSION(EXT_protected_surface);
-   _EGL_CHECK_EXTENSION(EXT_present_opaque);
+   _EGL_CHECK_EXTENSION(EXT_query_reset_notification_strategy);
    _EGL_CHECK_EXTENSION(EXT_surface_CTA861_3_metadata);
    _EGL_CHECK_EXTENSION(EXT_surface_SMPTE2086_metadata);
    _EGL_CHECK_EXTENSION(EXT_swap_buffers_with_damage);
diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
index 5f6f9ada708..fa14bdf3943 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -737,6 +737,11 @@ _eglQueryContext(_EGLContext *c, EGLint attribute, EGLint 
*value)
          return _eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext");
       *value = c->Protected;
       break;
+   case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT:
+      if (!disp->Extensions.EXT_query_reset_notification_strategy)
+         return _eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext");
+      *value = c->ResetNotificationStrategy;
+      break;
    default:
       return _eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext");
    }
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 330eb198ecb..b3510ae7a1d 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -106,9 +106,10 @@ struct _egl_extensions {
    EGLBoolean EXT_image_dma_buf_import;
    EGLBoolean EXT_image_dma_buf_import_modifiers;
    EGLBoolean EXT_pixel_format_float;
+   EGLBoolean EXT_present_opaque;
    EGLBoolean EXT_protected_content;
    EGLBoolean EXT_protected_surface;
-   EGLBoolean EXT_present_opaque;
+   EGLBoolean EXT_query_reset_notification_strategy;
    EGLBoolean EXT_surface_CTA861_3_metadata;
    EGLBoolean EXT_surface_SMPTE2086_metadata;
    EGLBoolean EXT_swap_buffers_with_damage;

Reply via email to