aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-01-12 19:14:32 +0100
committerSimon Zeni <simon@bl4ckb0ne.ca>2022-11-15 15:50:19 +0000
commit165352e32fb8bddb64f26dd4f4994db80a30901b (patch)
tree3a4bcdef7745e8cfe25fdc91dfdd79ba188cbb92
parent261d6998fb7461fcdf6cf66a57863b8ed505a67c (diff)
render/egl: enable EGL_LOSE_CONTEXT_ON_RESET
This allows the GLES2 renderer to figure out when a GPU reset happens.
-rw-r--r--include/render/egl.h1
-rw-r--r--render/egl.c10
2 files changed, 10 insertions, 1 deletions
diff --git a/include/render/egl.h b/include/render/egl.h
index b690877d..e8b85964 100644
--- a/include/render/egl.h
+++ b/include/render/egl.h
@@ -15,6 +15,7 @@ struct wlr_egl {
bool EXT_image_dma_buf_import;
bool EXT_image_dma_buf_import_modifiers;
bool IMG_context_priority;
+ bool EXT_create_context_robustness;
// Device extensions
bool EXT_device_drm;
diff --git a/render/egl.c b/render/egl.c
index 0c25e036..19ed6918 100644
--- a/render/egl.c
+++ b/render/egl.c
@@ -288,6 +288,9 @@ static bool egl_init_display(struct wlr_egl *egl, EGLDisplay display) {
"eglQueryDmaBufModifiersEXT");
}
+ egl->exts.EXT_create_context_robustness =
+ check_egl_ext(display_exts_str, "EGL_EXT_create_context_robustness");
+
const char *device_exts_str = NULL, *driver_name = NULL;
if (egl->exts.EXT_device_query) {
EGLAttrib device_attrib;
@@ -385,7 +388,7 @@ static bool egl_init(struct wlr_egl *egl, EGLenum platform,
}
size_t atti = 0;
- EGLint attribs[5];
+ EGLint attribs[7];
attribs[atti++] = EGL_CONTEXT_CLIENT_VERSION;
attribs[atti++] = 2;
@@ -400,6 +403,11 @@ static bool egl_init(struct wlr_egl *egl, EGLenum platform,
attribs[atti++] = EGL_CONTEXT_PRIORITY_HIGH_IMG;
}
+ if (egl->exts.EXT_create_context_robustness) {
+ attribs[atti++] = EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT;
+ attribs[atti++] = EGL_LOSE_CONTEXT_ON_RESET_EXT;
+ }
+
attribs[atti++] = EGL_NONE;
assert(atti <= sizeof(attribs)/sizeof(attribs[0]));