Multi-gpu, multi-monitor setup with GeForce RTX 3090s

I have been unable to get a multi-monitor setup working, and the information online for this topic is sparse and often conflicting. Hopefully someone here can provide a decisive answer.

I would like to run a single X server with a single X screen that spans across 4 monitors attached to 2 identical GPUs (3090s). Graphics applications should see a single display with a resolution equal to the sum of the four monitors (in this case, 7680x4320), and I should be able to move my mouse and draw windows seamlessly across the 4 displays.

I’m seeing options like Mosaic, Surround, and MultiGPU.

My question is:
Do any of these work for Linux with my hardware? And if so, how would I go about setting up my X11 environment (xorg.conf) to achieve this configuration?

I am referencing these guides without success:

Configuration:
Ubuntu Server 20.04
Driver 515.76
2x GeForce RTX 3090
4x 4K, 60hz monitors
No desktop manager yet, just vanilla X.org

I appreciate any help with this topic

You should be able to use BaseMosaic for this if your mainboard supports it (or you turn off iommu), but I actually don’t see any sense in doing so. Why don’t you just hook up all four monitors to one gpu?
Having all 4 monitor be recognized as one is a bit tricky, depending on window manager used. The modern way would be using randr monitor objects but rarely any WM is supporting this. The second, older method would be disabling the randr extension in the Xserver and then use a simple WM which doesn’t rely on it.

Yes it should work - at least all 4 monitors on 1 GPU to start with. Try KDE Plasma5 with SDDM window manager, then look into “kscreen” which replaces xrandr (well, sits on top). We have linux systems with RTX 2080 GPUs driving 4 monitors with base mosaic. nvidia-drivers 550.67 - our linux is Gentoo, but ubuntu should do it (else kubuntu - the KDE ubuntu?). I’ve just ssh -Y to the host. nvidia-settings GUI shows multiple monitors laid out ok.

Start with 2 screens connected and see if you get a desktop spanning both?

Here’s an real working example with 4 x 4K screens, set 2x2 all rotated in portrait mode. GPU is an L40. There is no /etc/X11/xorg.conf file - instead there’s 3 files in /etc/X11/xorg.conf.d

$ cd /etc/X11/xorg.conf.d

$ ls
20-opengl.conf 30-nvidiaL40.conf 99-virtualgl-dri

$ more *

20-opengl.conf

Section "Files"
        ModulePath "/usr/lib64/xorg/modules"
EndSection

30-nvidiaL40.conf

#
# 30-nvidiaL40.conf
#

# 
# $ nvidia-xconfig --query-gpu-info
# Number of GPUs: 1
#
# GPU #0:
#  Name      : NVIDIA L40
#  UUID      : GPU-a28********************************92
#  PCI BusID : PCI:181:0:0
#
# used to be:
#
# GPU #0:
#   Name      : NVIDIA L40
#   UUID      : GPU-95fc***********************************3
#   PCI BusID : PCI:202:0:0
# 
#   Number of Display Devices: 1
# 
#   Display Device 0 (TV-1):
#       EDID Name             : DELL U2415
#       Minimum HorizSync     : 30.000 kHz
#       Maximum HorizSync     : 83.000 kHz
#       Minimum VertRefresh   : 49 Hz
#       Maximum VertRefresh   : 61 Hz
#       Maximum PixelClock    : 193.250 MHz
#       Maximum Width         : 1920 pixels
#       Maximum Height        : 1200 pixels
#       Preferred Width       : 1920 pixels
#       Preferred Height      : 1200 pixels
#       Preferred VertRefresh : 60 Hz
#       Physical Width        : 520 mm
#       Physical Height       : 320 mm
#


# Wed Jan 25 06:30:19 PM AEDT 2023
# All of below is based on output from nvidia-settings, saved to /tmp
# except the first Sections are removed (ServerLayout, InputDevice)
# as they're no longer needed (they're already defined within the system).


## Section "Screen"
##     Identifier     "Screen0"
##     Device         "Device0"
##     Monitor        "Monitor0"
##     DefaultDepth    24
##     SubSection     "Display"
##         Depth       24
##     EndSubSection
## EndSection


#
# Thu Oct  5 11:42:27 AM AEDT 2023
# This is from nvidia-settings save X Config (show to screen in pop-up window)
# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings:  version 535.98
#
Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "LWR 3840x2160p60"
    HorizSync       134.0 - 136.0
    VertRefresh     59.0 - 61.0
    Option         "DPMS"
EndSection


Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "NVIDIA L40"
    BusID          "PCI:181:0:0"
EndSection


Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"

    ## Option         "nvidiaXineramaInfoOrder" "DFP-0"

    # Mon Apr 22 05:01:59 PM AEST 2024
    Option         "nvidiaXineramaInfoOrder" "DP-6"
    Option         "metamodes" "DP-2: 3840x2160_60 +2160+0 {rotation=left}, DP-6: 3840x2160_60 +0+0 {rotat
ion=left}, DP-0: 3840x2160_60 +2160+3840 {rotation=left}, DP-4: 3840x2160_60 +0+3840 {rotation=left}"

    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

99-virtualgl-dri

Section "DRI"
        Mode 0666
EndSection

Comments:

Seems we have all 3: multigpu, sli, and base mosaic set to off.
We def have a desktop spanning 4 screens.

Notice the line: BusID “PCI:181:0:0”

the way to figure out the “181” is to run dmesg or lspci -v and look for vga and nvidia. eg:

$ dmesg|grep -i vga|grep nvidia
[    4.911331] nvidia 0000:b5:00.0: vgaarb: VGA decodes changed: ****

Notice the PCI bus address with the “b5” there? That’s hexadecimal.
you want to convert it to decimal.

 $ echo $((0xb5))
181

that’s where the 181 came from for the BusID.
Your GPU will likely have a diff hex number.

hope that helps.
b.