From 7680b7862185897624728b38486c45635db03fa6 Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Thu, 24 Sep 2026 14:03:47 +0000 Subject: [PATCH] [MG_Backend] (P12 review): an ended server session's swap interval is forgotten, so the next session in the in-process display server starts at the driver's default DirectGLES keeps the requested eglSwapInterval in a process global on purpose (a surface re-created mid-session re-applies it), and every server process used to serve one session. The in-process display server serves the next session in the same process, which then silently inherited the previous client's interval. The server backend's destruction under a transport now calls DirectGLES::ForgetRequestedSwapInterval() beside DropEveryTwinForEndedServerSession (split build only; the pull build is unchanged, G1). --- .../MG_Backend/DirectGLES/BackendObject_DirectGLES.cpp | 6 +++++- MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp | 4 ++++ MobileGL/MG_Backend/DirectGLES/DirectGLES.h | 7 +++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/MobileGL/MG_Backend/DirectGLES/BackendObject_DirectGLES.cpp b/MobileGL/MG_Backend/DirectGLES/BackendObject_DirectGLES.cpp index e1841903..a980ed35 100644 --- a/MobileGL/MG_Backend/DirectGLES/BackendObject_DirectGLES.cpp +++ b/MobileGL/MG_Backend/DirectGLES/BackendObject_DirectGLES.cpp @@ -898,7 +898,11 @@ namespace MobileGL::MG_Backend::DirectGLES { // display server runs the next session in this same process, so the twins this one built // - naming ids of the context just destroyed - must not answer for the next client's // handles (Managers.h, DropEveryTwinForEndedServerSession). Monolith keeps its twins. - if (MG_Config::Transport != MG_Config::TransportMode::Monolith) DropEveryTwinForEndedServerSession(); + if (MG_Config::Transport != MG_Config::TransportMode::Monolith) { + DropEveryTwinForEndedServerSession(); + // Review fix: and the swap interval it asked for (DirectGLES.h). + ForgetRequestedSwapInterval(); + } #endif } diff --git a/MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp b/MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp index 8b5133d0..4c780454 100644 --- a/MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp +++ b/MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp @@ -16246,6 +16246,10 @@ namespace MobileGL::MG_Backend::DirectGLES { ApplyRequestedSwapInterval(); } +#if MOBILEGL_BUILD_DISAGGREGATED + void ForgetRequestedSwapInterval() { g_requestedSwapInterval = -1; } +#endif + Bool InitWindowSurface(NativeWindowType window) { if (!window) return false; diff --git a/MobileGL/MG_Backend/DirectGLES/DirectGLES.h b/MobileGL/MG_Backend/DirectGLES/DirectGLES.h index 9f67cb79..94d72f68 100644 --- a/MobileGL/MG_Backend/DirectGLES/DirectGLES.h +++ b/MobileGL/MG_Backend/DirectGLES/DirectGLES.h @@ -188,6 +188,13 @@ namespace MobileGL::MG_Backend::DirectGLES { // Applies (or defers until the window surface exists) the app-requested // eglSwapInterval on the native EGL surface. void SetSwapInterval(Int interval); +#if MOBILEGL_BUILD_DISAGGREGATED + // P12 review fix: the swap interval an ended server session asked for is not the next one's. + // The request outlives the context on purpose (a surface re-created mid-session re-applies it), + // so the in-process display server's session end forgets it: the next session starts at the + // driver's default until it asks (BackendObject_DirectGLES's destructor under a transport). + void ForgetRequestedSwapInterval(); +#endif void SetEGLFuncsTable(const MG_External::EGLFunctionsTable& eglFuncs); void SetGLESFuncsTable(const MG_External::GLESFunctionsTable& glesFuncs); void SetGLESCapabilities(const MG_External::GLESCapabilities& capabilities);