Is it possible to save the game's current state using hibernation without it crashing after booting from the hibernation file? Or does it depened on the game and/or DRM? Also what about emulators/Virtual machines? I tried it with Euro Truck Simulator 2 just now and it crashed after maximizing it.
-
Probably depends on the game. Have you tried it? – Máté Juhász Oct 09 '18 at 15:52
-
I tried it with Euro Truck Simulator 2 just now and it crashed after maximizing it. Thats why the question came to my head – Bluscream Oct 09 '18 at 15:53
-
1Games *could* be written to safely deal with this eventuality, after all pretty much every "standard" windows program can do this natively without any extra work... the problem is that games make direct use of graphics card features and can set up or otherwise have programs (shaders) or textures that they expect to leave set up on graphics card until the program closes. They would have to be written to respond appropriately to hibernate events and store relevant state information ready to be restored. Whether any game considers this worthwhile is questionable. On laptops it might be. – Mokubai Oct 09 '18 at 17:02
1 Answers
Hibernation (S4) removes power, thus the GPU and it's RAM also get turned off. There is no mention of video RAM on this page.
Hibernate state (S4)
Windows uses hibernation to provide a fast startup experience. When available, it's also used on mobile devices to extend the usable battery life of a system by giving a mechanism to save all of the user s state prior to shutting down the system. In a Hibernate transition, all the contents of memory are written to a file on the primary system drive, the hibernation file. This preserves the state of the operating system, applications, and devices. In the case where the combined memory footprint consumes all of physical memory, the hibernation file must be large enough to ensure there will be space to save all the contents of physical memory. Since data is written to non-volatile storage, DRAM does not need to maintain self-refresh and can be powered off, which means power consumption of hibernation is very low, almost the same as power off.
Entering hibernation
When a hibernate request is made, the following steps occur as the system enters hibernation:
- Apps and services are notified
- Drivers are notified
- User and system state is saved to disk in a compressed format
- Firmware is notified
Resuming from hibernation
When a system is powered on, the following steps occur as the system resumes from hibernation.
- System POST
- System memory is decompressed and restored from the hibernation file
- Device initialization
- Drivers are restored to the state they were in prior to hibernation
- Services are restored to the state they were in prior to hibernation
- System becomes available for login
Given that (AFAIK) Windows doesn't dump/restore video RAM, I would not be surprised at all if games crashed when the system resumes.
If it's correct that Windows doesn't deal with video RAM, then the GPU will likely be re-initialized by the drivers in the same way as a fresh boot - i.e: all textures and game engine code running on the GPU will appear to "suddenly" not be there (from before hibernation to after resume).
This will leave the game engine / application running on the CPU (which is restored) talking to "nothing" - or at least a thing which isn't there any more.
The game application would have to handle this very carefully, and there is no good reason for it to do so.
To further compound the issue, it's possible that the PCIe device will enumerate and get a different address space allocated, meaning that A) the GPU isn't doing what we thought it was doing, and B) the GPU isn't where we thought it was any more, giving us a bus error or worse (i.e: talking to something that isn't a GPU).
It might be possible for the video driver to deal with this... but I don't think they do.
See this question for more discussion: "Do VRAM/Registers get saved when hibernating?"
- 19,974