diff --git a/include/render/egl.h b/include/render/egl.h index 103ab57df..208362858 100644 --- a/include/render/egl.h +++ b/include/render/egl.h @@ -16,6 +16,7 @@ struct wlr_egl { bool EXT_image_dma_buf_import_modifiers; bool IMG_context_priority; bool EXT_create_context_robustness; + bool KHR_context_flush_control; // Device extensions bool EXT_device_drm; diff --git a/render/egl.c b/render/egl.c index 8673acabf..9e02cb6df 100644 --- a/render/egl.c +++ b/render/egl.c @@ -295,6 +295,8 @@ static bool egl_init_display(struct wlr_egl *egl, EGLDisplay display, egl->exts.EXT_create_context_robustness = check_egl_ext(display_exts_str, "EGL_EXT_create_context_robustness"); + egl->exts.KHR_context_flush_control = + check_egl_ext(display_exts_str, "EGL_KHR_context_flush_control"); const char *device_exts_str = NULL, *driver_name = NULL; if (egl->exts.EXT_device_query) { @@ -409,7 +411,7 @@ static bool egl_init(struct wlr_egl *egl, EGLenum platform, } size_t atti = 0; - EGLint attribs[7]; + EGLint attribs[32]; attribs[atti++] = EGL_CONTEXT_CLIENT_VERSION; attribs[atti++] = 2; @@ -429,6 +431,11 @@ static bool egl_init(struct wlr_egl *egl, EGLenum platform, attribs[atti++] = EGL_LOSE_CONTEXT_ON_RESET_EXT; } + if (egl->exts.KHR_context_flush_control) { + attribs[atti++] = EGL_CONTEXT_RELEASE_BEHAVIOR_KHR; + attribs[atti++] = EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR; + } + attribs[atti++] = EGL_NONE; assert(atti <= sizeof(attribs)/sizeof(attribs[0]));