Display layout configuration in Linux
The general approach to rendering to multiple displays in Linux is as follows:
- enable-gpus-linux
- identify-display-names-linux
- export-edid-linux
- configure-display-layout-linux
- finalize-xorg-conf-linux
We do not want a single large desktop that spans all GPUs because of performance reasons. Under the X11 Window System in Linux, we set up each GPU as having its own X Screen. You can think of each X Screen as basically a separate desktop. They all have their own coordinate system with origin (0, 0) at the top-left corner. You can not move individual windows between X Screens and you can not have a single window visible on more than one X Screen. Canvus is designed to run on large video walls, so that a single Canvus instance can render itself to multiple windows and utilize multiple X Screens at once. This will be configured later in configure-graphics-coordinates.
bezel-compensation is done using both X Screens and graphics coordinates. We compensate for bezels between displays connected to the same GPU (inside each X Screen) by creating a slightly larger X Screen than necessary and adjusting each display's location inside the X Screen to compensate for the bezels. To compensate for bezels between two X Screens (different GPUs), we offset the graphics coordinates in Canvus.
Most of the operating system configuration can be done using the graphical nvidia-settings tool. However, using a text editor to verify and modify the generated xorg.conf file by hand is recommended.
Prerequisites
The following sections assume that you are using MultiTaction Base Linux Image.
Before continuing, ensure all GPUs and other PCIe devices have been connected. If you change the GPUs or other PCIe devices afterwards, it may cause the PCIe bus IDs to change which will break your configuration.
During the setup, you will likely be restarting the GUI provided by X11 Windows System several times. Because of this, we strongly recommend enabling SSH access and running the command-line commands remotely from a different computer to make it easier. It also makes it easier to recover from errors if mistakes in the configuration that cause the GUI to not start.
Hint
To enable SSH password authentication on the MultiTaction Base Linux Image, you must edit the file /etc/ssh/sshd_config as root.
Then, change the line
PasswordAuthentication no
to
PasswordAuthentication yes
After making the change, restart the SSH service by running the following command:
sudo service ssh restart
Tip
While working on the following sections, consider looking at included examples of certain common configurations. See video-wall-examples for details.
Enable all GPUs in xorg.conf
To start from scratch, run the following command to generate a skeleton xorg.conf file with all connected GPUs enabled:
sudo nvidia-xconfig -a
Warning
This step will erase any existing xorg.conf configuration you may have.
After this, restart the the X display manager (lightdm) to apply the new configuration by running the following commands:
sudo service lightdm stop
sudo service lightdm start
Note
Any changes you make to the xorg.conf file will not have any effect until you restart the display manager in Linux.
You could also use sudo service lightdm restart instead of separate stop and start commands, but sometimes it might not start the display manager reliably so it is safer to use stop and start separately.
After restarting lightdm, you should be able to see all of your connected GPUs in the nvidia-settings tool. Next, we use this tool to identify our displays and export their EDID information.
Identify display device names
A "display device" refers to a hardware device capable of displaying an image. Most of the time, each GPU will drive multiple display devices simultaneously. We need the display device names of our connected displays to refer to them later in the configuration. We can see the display device names by using the nvidia-settings tool. To start it, run the following command:
sudo nvidia-settings
You should see something like the picture below. The names and number of your displays will vary depending on how many GPUs you have, how many displays are connected to which outputs, etc.
In the picture above, the display device names under GPU 0 are DP-0, DP-4 and DP-6. The display device names under GPU 1 are DP-4 and DP-6. Note that display device names are only unique to each GPU.
Under each GPU on the left panel, see the display device names for your connected displays. Make a note of these as we need them later.
Export display EDIDs
Tip
You can download a pre-exported EDID for MT557D in video-wall-examples.
In order to create a stable display configuration, we need to acquire the EDID information of our displays and force the GPUs to think the displays are always connected. There are many possible reasons for unstable display layout such as poor quality cables, too long cables or misbehaving video extenders. With the exported EDID information, we can force the GPU driver to think the physical connections to the displays are always present, even when they are not or there is a problem automatically detecting them.
To export the EDID information, select the display device name from the left panel in nvidia-settings and click Acquire EDID... on the right.
Save the EDID in ASCII format under /etc/X11/ folder. For example, if using MultiTaction Decca displays, you could save the EDID to /etc/X11/mt557d-edid.txt.
After you have made note of the display device names and exported the EDID information of your displays to a file, it's time to configure the actual display layout.
Tip
If you are using multiple identical displays, you can export EDID information from only one of them and re-use the same exported EDID for each identical display to save some effort.
However, if you have multiple different displays, make sure you don't mix the EDID from one display model to another. If in doubt, you can always export the EDID separately for each display.
Configure display layout inside each X Screen
To configure the display layout, you need to edit the /etc/X11/xorg.conf file manually. While it is possible to do basic layout graphically using nvidia-settings tool, certain operations are not possible with it, such as forcing the EDIDs and disabling the screen saver. In this section, we describe how to manually edit the file.
To begin, open /etc/X11/xorg.conf in a text editor as sudo. You can use any editor, like nano, vim or leafpad.
sudo leafpad /etc/X11/xorg.conf
There will be several sections in the file. You should see one "Screen" section for each of your GPUs. Each one represents a different X Screen described earlier:
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
EndSubSection
EndSection
Section "Screen"
Identifier "Screen1"
Device "Device1"
Monitor "Monitor1"
DefaultDepth 24
SubSection "Display"
Depth 24
EndSubSection
EndSection
To specify the display layout, we add four new Option lines inside each Screen section:
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "metamodes" "DP-6: 1920x1080 +0+0 {rotation=right}, DP-4: 1920x1080 +1088+0 {rotation=right}, DP-0: 1920x1080 +2176+0 {rotation=right}"
Option "CustomEDID" "DP-6:/etc/X11/mt557d-edid.txt; DP-4:/etc/X11/mt557d-edid.txt; DP-0:/etc/X11/mt557d-edid.txt"
Option "ConnectedMonitor" "DP-6, DP-4, DP-0"
Option "DPI" "96 x 96"
EndSection
Section "Screen"
Identifier "Screen1"
Device "Device1"
Monitor "Monitor1"
DefaultDepth 24
Option "metamodes" "DP-6: 1920x1080 +0+0 {rotation=right}, DP-4: 1920x1080 +1088+0 {rotation=right}"
Option "CustomEDID" "DP-6:/etc/X11/mt557d-edid.txt; DP-4:/etc/X11/mt557d-edid.txt"
Option "ConnectedMonitor" "DP-6, DP-4"
Option "DPI" "96 x 96"
EndSection
The line starting with Option "metamodes" is used to specify the layout of the displays connected to this GPU (X Screen). It specifies for each display (identified by its display device name we obtained earlier) the resolution of the display, its location and rotation. In the example above, we have three displays (DP-6, DP-4, DP-0) each with 1920x1080 resolution at locations +0+0, +1088+0 and +2176+0. We have used 8 pixels as a bezel compensation value between the displays which affects the location of the second and third display.
The line starting with Option \"CustomEDID\" is used to force EDIDs for each display. On this line, we specify which previously exported EDID file to apply for each display identified by their display device name. You should always specify this option to ensure more stable display configuration. Note that different entries are separated by a semicolon on this line.
The line starting with Option "ConnectedMonitor" is used to force the Nvidia driver to think these displays are always physically connected. You should always specify this option. This line is just a comma-separated list of display device names.
The line starting with Option "DPI" can be used to force a DPI setting regardless of what is stated in the EDID information. Very often changing DPI from the default 96 to something else just breaks applications by making things too big or small, or just breaking text and GUI layouts.
The steps above should be repeated for each Screen section in the config file.
After the display layout has been configured for each Screen section, we need to finalize the configuration by defining the relative locations of the X Screens.
Finalize xorg.conf configuration
Once all X Screens have been configured, we need to finalize the configuration to ensure each X Screen is correctly positioned relative to others. We do this by modifying the ServerLayout section:
Section "ServerLayout"
Identifier "nVidia Layout"
Screen 0 "Screen0"
Screen 1 "Screen1" RightOf "Screen0"
Option "BlankTime" "0"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "0"
EndSection
Screens can be positioned with keywords RightOf, LeftOf, Above, Below or you can just write absolute coordinates like this:
Screen 0 "Screen0"
Screen 1 "Screen1" 3260 0
We recommend using the keywords instead of absolute coordinates to make it easier to make adjustments later.
Warning
We do not recommend trying to do bezel compensation by adding gaps between X Screens. This can lead to instability and may also prevent moving your mouse cursor across different X Screens.
The last four rows in the ServerLayout section are used to disable the screen saver. You must specify all of these to avoid the displays going to sleep:
Option "BlankTime" "0"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "0"
After all these changes are done, save the file and restart lightdm for the settings to have an effect:
sudo service lightdm stop
sudo service lightdm start
You can verify your layout is correct by moving the mouse cursor across each display. If you notice displays are in the wrong order, go back to editing either a Screen section or ServerLayout to adjust the layout.
Tip
Whenever you make configuration changes, you should check for warnings and errors in /var/log/Xorg.0.log after lightdm has been restarted.
Once you are happy with the display layout, proceed to configure-graphics-coordinates.