Running Headless W/ OpenGL under X11

I use a number of machines during the day including four, a windows workstation, a linux workstation, a mac mini, and a mac MacBook Pro. I know, in this day and age, there are a number of ways to eliminate boxes. I can dual boot or run VMs, but there are often times that I want or need access to both the workstations, and VMs still don’t have the full support for OpenGL that I want…or, to be honest, I haven’t driven deep into trying very hard. Besides, the workstations have different NVIDIA cards with different characteristics. Bottom line is I like having access to both physical machines.

I also don’t like having a wall of monitors on my desk, so, typically, I’d use the  different inputs on one set of monitors (dual screen on all my systems) to switch between systems and then use a piece of software like Synergy. 

This worked fairly well but I started getting tired of flipping back and forth between inputs so I installed HP RGS on my system and started accessing my linux box through RGS. RGS isn’t perfect, but for 90% of what I’m doing, including all the new shader technology on the NVIDIA Kepler Quadro cards, it works pretty well….but if I’m going to access it through RGS, I don’t need it connected to my monitors (until something goes wrong), and I don’t even need it in my office any more. I could move this load, hot early access box out!

So how do I fire up X11 on the linux workstation if I put it in the corner of a machine room and don’t connect any monitors to it? When it comes to xorg.conf, I’m a bit of a cut-n-paste kind of guy so this was a bit of an issue for me, but it turns out, if you read the man pages, it’s pretty straightforward. There’s an option for the “Display” SubSection which is ‘Virtual’. The other key is you need to manually set the “DPI” in the “Monitor” section.

Assuming you have a working xorg.conf for your graphics card, here are the changes I made to go headless with X11 & OpenGL running.

In original xorg.conf

Section “Monitor”
Identifier     “Monitor0”
VendorName     “Unknown”
ModelName      “HP ZR22w”
HorizSync       24.0 – 94.0
VertRefresh     50.0 – 76.0
Option         “DPMS”
EndSection

change to

Section “Monitor”
Identifier     “Monitor0”
VendorName     “Unknown”
ModelName      “Unknown”
HorizSync       28.0 – 33.0
VertRefresh     43.0 – 72.0
Option         “DPI” “96 x 96”
Option         “DPMS”
EndSection

Notice the “DPI” option

In original xorg.conf

Section “Screen”
Identifier     “Screen0”
Device         “Device0”
Monitor        “Monitor0”
DefaultDepth    24
Option         “TwinView” “1”
Option         “TwinViewXineramaInfoOrder” “DFP-0”
Option         “metamodes” “DFP-0: nvidia-auto-select +0+0, DFP-1: nvidia-auto-select +1920+0”
SubSection     “Display”
Depth       24
EndSubSection
EndSection

change to

Section “Screen”
Identifier     “Screen0”
Device         “Device0”
Monitor        “Monitor0”
DefaultDepth    24
Option         “UseDisplayDevice” “none”
SubSection     “Display”
Virtual     3840 1080
Depth       24
EndSubSection
EndSection

Notice the the change to “UseDisplayDevice” AND the addition of “Virtual” to the “Display” subsection

That’s it.

Advertisements