Matthew Garrett (mjg59) wrote,

Nvidia resume

As I've mentioned before, one of the major problems facing reliable suspend/resume is graphics reinitialisation. Modern AMD and Nvidia chipsets contain a set of bytecode scripts making up information on how to program a specific card. At boot time the BIOS executes a small native interpreter that runs these. After boot, the driver can execute the scripts itself. This removes the need to have the driver make BIOS calls, and also means that the driver can filter out commands that it feels are undesirable at the time.

The nouveau project have reverse engineered the majority of the BIOS script format for older nvidia hardware. I've stolenmade use of their code by wedging it into a kernel module. On suspend various bits of register state are saved - on resume, they're poked back into the card and the init scripts are run. This is enough to get me some semblance of graphics back on my nvidia laptop, which previously didn't support this at all.

There's a few caveats. First, it doesn't support nv50 based hardware (8000 series and above). There's a hacky alternative method that basically works there for now. Secondly, it doesn't restore text mode correctly. Your consoles won't work again. Thirdly, it doesn't reinitialise the 3D core at all. If you're using nouveau then this means that it'll wedge itself unless you disable acceleration (option "NoAccel" "true" in xorg.conf). If you do use it with nouveau, you need to load the nv_bios module before the nouveau module is probed, since otherwise it'll grab the PCI device. And fourthly, this obviously won't work at all with the binary nvidia drivers. They ought to be doing much the same thing anyway.

The code's here, and I'm interested in finding out how well it works. Especially on desktops, which I can't test myself.

Thanks go to Stuart Bennett, who not only took a painfully bad laptop off my hands but also helped me hugely in working out why the existing code didn't quite work on my hardware (the ptimer values need saving and restoring, for those who have an excessive degree of interest)
Tags: advogato, fedora
  • 6 comments
  • 6 comments

Comments for this post were locked by the author