Linux – Where would I start looking for documentation on the graphical mode of the Linux console

documentationframebufferlinux-kernel

I'm writing my own display server as an educational exercise. Where in the Linux kernel tree would I look for documentation on the console's graphical mode?

Basically, as I understand it, Xorg takes over the tty device and also takes over the raw hardware. How can I find documentation on duplicating that action?

Best Answer

Sorry for repeating but take a look to Nano-X sources.

git clone git://microwindows.org/microwin

In particular take a look to the files:

drivers/kbd_tty.c
drivers/scr_fb.c

What is done in the tty driver is very similar to what Xorg does, and The devfb driver is a very simple and clean implementation.

Linux's devfb frame buffers mostly rely on ioctl (eg: to set/get resolution) and mmap (to raw write/read pixels).

devfb is just one (easy and a bit more portable on linux) way to access the graphic hardware.

Xorg drivers instead are composed by a kernel driver and a Xorg user space interface between the driver and Xorg itself, and what happen between kernel and user side is really implementation-dependant (there isn't a standard).

You can also take a look to SDL or Directfb but Nano-X is the cleanest/easy and a display server itself, so probably could help you on other question that you'll surely meet.

Related Question