From 565987edae68b77a60fc104004c3fe8f75b66c3d Mon Sep 17 00:00:00 2001 From: The412Banner Date: Sat, 19 Sep 2026 17:03:14 -0400 Subject: [PATCH] Disarm frame generation across a Surface resize, re-arm after MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the session activity resizable the fold works — with frame generation off. With an engine on the picture still came back stretched: its ring, effects chain and multi-present pacing were built against the old extent. The engine is now disarmed before the window is rebound and re-armed once the new swapchain has settled, so everything on its side is built again for the new size. --- .../java/com/steamdeck/launcher/SessionActivity.kt | 2 +- .../com/steamdeck/launcher/wayland/CompositorHost.kt | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/steamdeck/launcher/SessionActivity.kt b/app/src/main/java/com/steamdeck/launcher/SessionActivity.kt index 368858f3b9..37a33ad8ed 100644 --- a/app/src/main/java/com/steamdeck/launcher/SessionActivity.kt +++ b/app/src/main/java/com/steamdeck/launcher/SessionActivity.kt @@ -235,7 +235,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { surfaceH = height if (resized) { Log.i(TAG, "surface resized to ${width}x$height — rebinding the compositor") - CompositorHost.resize(holder.surface) + CompositorHost.resize(holder.surface) { applyFrameGen() } } } diff --git a/app/src/main/java/com/steamdeck/launcher/wayland/CompositorHost.kt b/app/src/main/java/com/steamdeck/launcher/wayland/CompositorHost.kt index 95fbae4738..e5c73c1e6b 100644 --- a/app/src/main/java/com/steamdeck/launcher/wayland/CompositorHost.kt +++ b/app/src/main/java/com/steamdeck/launcher/wayland/CompositorHost.kt @@ -56,10 +56,18 @@ object CompositorHost { * the new size, and the scale mode letterboxes as it should. */ @Synchronized - fun resize(surface: Surface) { + fun resize(surface: Surface, rearm: () -> Unit) { if (!started) return + // Frame generation does not live through a resize: its ring, its effects chain and its + // multi-present pacing were all built against the old extent, and on a Fold the picture + // came back stretched with an engine on and right with it off. Disarmed, the window is + // rebound and the swapchain rebuilt; the caller re-arms once that has settled, and every + // engine-side object is made again for the new size. + WaylandCompositor.nativeSetFrameGenArmed(false, 0) + WaylandCompositor.nativeLog("screen", "surface resized: rebinding the window, frame generation re-armed after") WaylandCompositor.nativeSetSurface(null) WaylandCompositor.nativeSetSurface(surface) + android.os.Handler(android.os.Looper.getMainLooper()).postDelayed(rearm, 600) } /**