3
\$\begingroup\$

In D3D9 there was the concept of a "device reset". When a device reset occurred textures created with D3DPOOL_DEFAULT had to be recreated, but textures created with D3DPOOL_MANAGED didn't, because, according to MSDN, a duplicate copy is kept in system memory.

In D3D11, the concept of a device reset has much less prominence. But since the video card loses power during hibernation, textures must be stored somewhere else beforehand.

So how does Windows 7 preserve video card resources during hibernation?

  • Is it like D3DPOOL_MANAGED where a duplicate copy is wastefully kept in system memory,
  • or does it only copy resources back from video memory immediately before hibernating, then returns them to video memory after resuming?
  • Or do such resources need to be manually recreated and I'm missing something in the API?

It looks like graphics drivers implement DxgkDdiSubmitCommand to allow data to be copied to and from video memory, but it's unclear whether Windows actually does this when hibernating.

\$\endgroup\$

1 Answer 1

6
\$\begingroup\$

System memory also loses power during hibernation, as the system is completely powered off during hibernate. Windows deals with both system memory and video memory the same way: it dumps them to disk. Hence, it is only copying out video memory when necessary, when hibernation is invoked.

If you meant stand-by mode, where the system is put into low-power mode but not shut down, then the system memory retains its contents. The GPU can either also be put into a low-power state similar to the CPU (if the GPU supports it), allowing it to keep its video memory contents (which of course happens "for free" for shared-memory integrated GPUs), or the GPU memory can be transparently saved out to system memory when the system goes into stand-by with absolutely no need for any work on the part of applications. When the system comes out of stand-by and the app starts accessing its GPU data again, the OS will stream those resources back into video memory automatically.

For "Hybrid Sleep," which is a combination of the two, Windows will dump the video memory to disk along with system memory, while otherwise putting the system into normal stand-by mode. That simply allows the system to deal with power-loss during stand-by mode by simply booting up as if you had hibernated.

This is all possible because WDDM completely virtualizes video memory. Your application does not and need not care whether any particular texture or buffer is actually in video memory. WDDM will move your resources out of and into video memory as it sees fit, and it all happens transparently to the application.

This allows a large number of applications to share the GPU. It allows the OS to stream out data from background apps that have D3D11 contexts but which aren't being actively used (e.g., the desktop when you're playing a full-screen game). It also of course allows transparent support for hibernation/sleep.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .