summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Englund <tomenglund26@gmail.com>2026-01-30 20:42:01 +0100
committerGitHub <noreply@github.com>2026-01-30 19:42:01 +0000
commitec120d57328e5ae4bfc93a7e809ace47d98f2dc3 (patch)
tree431cb6fbd6e97e8386930a4c164a37a58a31fd20 /src
parentfe6c213024a1b0d8583a1c4cd256f0a27928f259 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/render/OpenGL.cpp7
-rw-r--r--src/render/OpenGL.hpp1
2 files changed, 8 insertions, 0 deletions
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp
index 715ca4f7..b00728ed 100644
--- a/src/render/OpenGL.cpp
+++ b/src/render/OpenGL.cpp
@@ -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);
diff --git a/src/render/OpenGL.hpp b/src/render/OpenGL.hpp
index a538aa4b..3df8322b 100644
--- a/src/render/OpenGL.hpp
+++ b/src/render/OpenGL.hpp
@@ -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;