renderer: set EGL_CONTEXT_RELEASE_BEHAVIOR_KHR if supported (#234)

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:14 +01:00 committed by GitHub
parent def5e74c97
commit af4c6fedbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View file

@ -453,6 +453,7 @@ void CDRMRenderer::initContext() {
exts.EXT_create_context_robustness = EGLEXTENSIONS.contains("EXT_create_context_robustness");
exts.EXT_image_dma_buf_import = EGLEXTENSIONS.contains("EXT_image_dma_buf_import");
exts.EXT_image_dma_buf_import_modifiers = EGLEXTENSIONS.contains("EXT_image_dma_buf_import_modifiers");
exts.KHR_context_flush_control = EGLEXTENSIONS.contains("EGL_KHR_context_flush_control");
std::vector<EGLint> attrs;
@ -468,6 +469,12 @@ void CDRMRenderer::initContext() {
attrs.push_back(EGL_LOSE_CONTEXT_ON_RESET_EXT);
}
if (exts.KHR_context_flush_control) {
backend->log(AQ_LOG_DEBUG, "CDRMRenderer: 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
}
attrs.push_back(EGL_CONTEXT_OPENGL_DEBUG);
attrs.push_back(Aquamarine::isTrace() ? EGL_TRUE : EGL_FALSE);

View file

@ -137,6 +137,7 @@ namespace Aquamarine {
bool KHR_platform_gbm = 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;