Originally posted by hgfelger
Who is responsible for restaurating the right graphics-mode when X terminates, or when there is a switch form X to a virual console?
Umm, the kernel. Specifically, the console driver.
If you're running a hi-res console (framebuffer console is what the kernel config calls it, I think), check into the fbcon.c file, specifically the fbcon_switch() function. It's in linux/drivers/video/fbcon.c.
Or, if you use the default RH virtual console setup, then before you start X up, hit Ctrl-Alt-F7 (actually, I'm pretty sure Ctrl-F7 would work, but I'm in the habit of using Ctrl-Alt because that's the only thing that works when you're currently looking at an X screen) once. You'll see a blank screen, as long as X is configured to start on that VC. Hit Ctrl-F1 and startx. The VC switch that you just saw happened somewhere in the fbcon driver.
The thing is, X runs entirely on top of the VC layer, AFAIK.