Start a session on every Play, not only on the compositor's first start

The compositor lives for the whole process, so the second Play after a session
had ended re-attached the Surface, started nothing, and left the loading panel
counting up over a dead session — it looked like a login that never came. The
service now starts whenever no session is running; the compositor's one-shot
first-frame notice is re-armed for the new session, or the panel would never
leave; and whatever the previous session left behind (gamescopereaper, the
session script, a dead client's helpers, the audio server) is killed first,
since it is our uid and still holds the socket the new one needs.
This commit is contained in:
The412Banner committed 2026-09-19 14:59:12 -04:00
1 parent ebae834e36
commit d46bd4a0c3
6 files changed
+63 -4

No files matched your search

@@ -108,14 +108,19 @@ class SessionActivity : Activity(), SurfaceHolder.Callback {
val size = outputSize()
SessionState.outputSize = size
SessionState.refreshHz = refreshHz()
val first = CompositorHost.startOrAttach(
CompositorHost.startOrAttach(
holder.surface, runtimeDir.path,
driverId?.let { turnip.driverPath(it) }, driverId?.let { turnip.libraryName(it) },
applicationInfo.nativeLibraryDir, size.first, size.second, refreshHz(),
)
// The service owns everything below the compositor, and starting it is idempotent: coming
// back to a running session just re-attaches the Surface above.
if (first) SessionService.start(this)
// The service owns everything below the compositor. It is started whenever no session is
// running — NOT only when the compositor was just started: the compositor lives for the
// whole process, so the second Play after a session ended used to re-attach the Surface,
// start nothing, and leave the loading panel counting up over a dead session.
if (!SessionState.running) {
CompositorHost.newSession()
SessionService.start(this)
}
}
override fun surfaceChanged(holder: SurfaceHolder, format: Int, width: Int, height: Int) {}