How does Linux handle multiple monitors?

If you have problems with wine and games with wrong a resolution like 640x480 when you think, you have e.g. 1920x1200 available, you need to check your setup.

First of all, check if you have more than one monitor connected to your computer. If you have (like me) you maybe have the reason for your problem because you are not on 1920x1200 if you thought, it's much bigger and non-standard. You can use your eyes, manuals or xrandr:


xrandr: Failed to get size of gamma for output default
Screen 0: minimum 1920 x 1200, current 3360 x 1200, maximum 3360 x 1200
default connected 3360x1200+0+0 (normal left inverted right) 0mm x 0mm
 3360x1200 50.0*```
Multi monitor setups just don't work well with xorg / wine / crossover (yet?), they also don't work well with native linux applications and games. The reason is chaos in the graphical environment world called Xorg and the different drivers... It's not a fault of codeweavers! :)
**WARNING: HISTORY AND DESCRIPTION OF RESOLUTIONS:**
-----
Each graphical desktop session (server) on Xorg contains visible "screens". The server can contain one or more screens.
Due to historical reasons, it was easy to use multiple monitors with X, but not combined together. That means, if you had two monitors connected, you couldn't move a window from one monitor to the other. Each monitor was available with it's own screen.
Then, some years ago, the big change came, called Xinerama. With Xinerama, these single screens were combined available to one usable desktop.
When the next change called Xgl/AIGLX and composite extensions came around 2007 (compiz, beryl, wobbling windows, cube desktops, expose and more graphical sugar), it turns out that in most Xinerama setups, the composize extensions / compiz were not working.
Also due to the fact that the whole Xinerama / multiple X screen situation was (and is still) a hell to configure, the graphic card vendors (e.g. nvidia in my case) made extensions to their drivers for a workaround.
Nvidia calls it's hack "Twinview". You will see that in most setups currently. Twinview combines its several monitors attached to the graphic card to 1 (one) screen visible to X. The whole 3D acceleration, compiz extensions and so on are working. Great, now what's the problem?
There are some standard resolutions out there, like 640x480,800x600,1024x768,1280x1024,... for 4:3 or 1280x768,1440x900,1650x1050, 1920x1200 for the 16:10 "widescreen" resolutions and also things like 1920x1080 for the 16:9 widescreen resolutions for new monitors.
Games are programmed for these standard resolutions. That fits well if you just have one monitor. That also fits well (for games) if you have two screens which are reported seperate with standard resolutions, but then you can't move your windows from one screen to the other and that's annoying.
On Twinview, two monitors are combined to a resolution of e.g. 3840x1200, which means, two 1920x1200 monitors next to each other, combined to one big screen. More fun will come if you combine two monitors with different resolution, like 1440x900+1920x1200 (in my case), you get a "combined" resolution of 3360x1200. Well, sort of. On the smaller monitor, you get a small area of a blind not displayed resolution, because the monitors can't display the full area of 3360x1200, the height is missing on the smaller 1440x900 monitor ;)
That's the main point of the problem.
I think the Xrandr Extension was invented to fix all that problems and to replace Xinerama. You can set the resolution, position and most of the things in realtime without restarting your X session. And that's where the tipps begin.
**To summarize:**
-----
- Xinerama isn't working anymore with composite extensions - your desktop get's more ugly then before (and other problems may happen)
- Seperate X screens will work, but aren't nice to work with. You can move your mouse but not the windows between...
- Twinview (and other driver specific hacks) report the "wrong" non-standard resolution to the system but you can use all features, but games will fail due to these wrong resolution
**Easiest solution:**
------
Create several resolution setups for work and games where e.g. one monitor can be easily deactivated. They can be easily switched with graphical tools or with console commands. With twinview you can set several so called meta modes which describe your setup.
An example for twinview with 2 monitors and seperate resolutions on nvidia grapic cards
Take a look at your /etc/X11/xorg.conf, you should find something like
```Section "Screen"
 Identifier "Screen0"
 Device "Device0"
 Monitor "Monitor0"
 DefaultDepth 24
 Option "TwinView" "1"
 Option "TwinViewXineramaInfoOrder" "DFP-1"
 Option "metamodes" "DFP-0: 1440x900 +0+0, DFP-1: 1920x1200 +1440+0"
 SubSection "Display"
 Depth 24
 EndSubSection
EndSection```
You may find something with the metamodes there, maybe something with "auto-select"
```Option "metamodes" "DFP-0: nvidia-auto-select +0+0, DFP-1: nvidia-auto-select +1440+0"```
You can enter several different meta modes. This metamodes line contains a setup for my 1440x900+1920x1200 AND (seperated with ;) another with just the big monitor, the second monitor is deactivated.
```Option "metamodes" "DFP-0: 1440x900 +0+0, DFP-1: 1920x1200 +1440+0; DFP-0: NULL, DFP-1: 1920x1200 +0+0"```
Restart your X session.
You should now be able to switch between two setups with tools like
 - grandr (gui), gnome randr applet
 - arandr (gui)
 - console based xrandr
Example to switch to setup1, in my case dual monitor:
```$ xrandr -s 0```
Example to switch to setup1, in my case single big second monitor:
```$ xrandr -s 1```
You can also make two separate starters on your desktop with the arguments -s 1 and -s 0.
__Written by Björn__

Next Step: Manually set VideoMemorySize

Last modified on 2023-09-29 12:50:14 UTC by Andrew Balfour

Knowledge Base Software powered by Helpjuice