opengl: set EGL_CONTEXT_RELEASE_BEHAVIOR_KHR if supported (#13114)

EGL_CONTEXT_RELEASE_BEHAVIOR_KHR determines what happends with implicit
flushes when context changes, on multigpu scenario we change context
frequently when blitting content. while we still rely on explicit sync
fences, the flush is destroying driver optimisations.

setting it to EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR essentially mean
just swap context and continue processing on the next context.
This commit is contained in:
Tom Englund 2026-01-30 20:42:01 +01:00 committed by GitHub
parent fe6c213024
commit ec120d5732
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View file

@ -160,6 +160,7 @@ void CHyprOpenGLImpl::initEGL(bool gbm) {
m_exts.EXT_create_context_robustness = EGLEXTENSIONS.contains("EXT_create_context_robustness");
m_exts.EXT_image_dma_buf_import = EGLEXTENSIONS.contains("EXT_image_dma_buf_import");
m_exts.EXT_image_dma_buf_import_modifiers = EGLEXTENSIONS.contains("EXT_image_dma_buf_import_modifiers");
m_exts.KHR_context_flush_control = EGLEXTENSIONS.contains("EGL_KHR_context_flush_control");
if (m_exts.IMG_context_priority) {
Log::logger->log(Log::DEBUG, "EGL: IMG_context_priority supported, requesting high");
@ -173,6 +174,12 @@ void CHyprOpenGLImpl::initEGL(bool gbm) {
attrs.push_back(EGL_LOSE_CONTEXT_ON_RESET_EXT);
}
if (m_exts.KHR_context_flush_control) {
Log::logger->log(Log::DEBUG, "EGL: Using KHR_context_flush_control");
attrs.push_back(EGL_CONTEXT_RELEASE_BEHAVIOR_KHR);
attrs.push_back(EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR); // or _FLUSH_KHR
}
auto attrsNoVer = attrs;
attrs.push_back(EGL_CONTEXT_MAJOR_VERSION);

View file

@ -361,6 +361,7 @@ class CHyprOpenGLImpl {
bool EXT_read_format_bgra = false;
bool EXT_image_dma_buf_import = false;
bool EXT_image_dma_buf_import_modifiers = false;
bool KHR_context_flush_control = false;
bool KHR_display_reference = false;
bool IMG_context_priority = false;
bool EXT_create_context_robustness = false;