mirror of
https://github.com/lemonade-sdk/mac_linuxgpu.git
synced 2026-11-23 08:59:28 -10:00
Since the device stays up across clients (248), a previous instance whose last client left keeps its session, and with it the GPU, open. It can leave only once that session is closed, and Retire, the installer's way to close it, needs the session-release authorization the signed app does not have (kIOReturnNotPrivileged). So every upgrade stayed "terminating for upgrade via delegate" until someone killed the old driver, which panics the Mac, or power-cycled the GPU. The installer now hands over without Retire when Retire is refused. It opens a session client of its own on each previous instance and asks ShutdownGPU, which any session client may ask and which closes the session when no other client uses it. The display agents are already stopped for the upgrade. The installer keeps asking until the instance is gone, and says which programs still hold it. When other clients still use the GPU, the driver now remembers the request (s_closeWhenIdle, session state flag CLOSE_WHEN_IDLE): the last client's leaving closes the session, even after the installer has given up. The request goes with the session. Nothing about Retire's authorization changes. Disconnect GPU uses the same path when its Retire DISCONNECT is refused. Tests: test-session-shutdown runs the production code for the upgrade with no client left (ShutdownGPU closes the session at once, IOKit's Stop then finishes) and with a client that leaves afterwards (refused, remembered, closed by that client's leaving, then Stop). test-display-agent covers reading ShutdownGPU's answers. A previous instance from before build 263 does not remember the request: the installer then asks again after the clients leave.