Friday, February 13, 2026

linux dual gpu dual monitors

https://docs.google.com/document/d/1jS_DuHLMtI-DS1r_uXAt8HqzrZjNm0jx/edit?usp=drivesdk&ouid=106862052260871379871&rtpof=true&sd=true

Dual NVIDIA GPU Configuration Guide

RandR Multi-Monitor Setup with Different Display Specifications

Overview

This guide provides complete instructions for configuring dual discrete NVIDIA GPUs on X.org, where each GPU independently drives a display with different resolutions, refresh rates, or physical specifications. This configuration uses the modern RandR (Resize and Rotate) extension rather than legacy technologies like BaseMosaic or Xinerama.

Use Case

This configuration is appropriate when:

  • You have two discrete NVIDIA GPUs installed
  • Each GPU is connected to one physical display
  • Displays have different resolutions or refresh rates
  • You need mouse movement and window dragging between displays
  • Neither GPU is used for GPGPU or compute workloads

This setup provides a unified desktop experience where each monitor runs at its native resolution and the mouse can move freely between displays.

System Requirements




Hardware Setup Checklist

  • Both NVIDIA GPUs properly seated in PCIe slots
  • Each GPU connected to exactly one display via HDMI/DP/DVI
  • Power connectors attached to both GPUs
  • BIOS/UEFI settings configured (see below)

BIOS/UEFI Configuration

  • Secure Boot: Disabled (or MOK keys enrolled for NVIDIA driver)
  • Above 4G Decoding: Enabled (if available)
  • Primary Display Adapter: Set to PCIe
  • Integrated Graphics: Disabled (if present)


NVIDIA Driver Installation

Remove Existing Drivers

Remove any existing NVIDIA drivers and the nouveau driver:

# For Debian/Ubuntu

sudo apt remove --purge '*nvidia*'


# For Fedora/RHEL

sudo dnf remove '*nvidia*'


# For Arch

sudo pacman -R nvidia nvidia-utils


Blacklist Nouveau Driver

Create a blacklist configuration file:

echo "blacklist nouveau" | sudo tee /etc/modprobe.d/blacklist-nouveau.conf

echo "options nouveau modeset=0" | sudo tee -a /etc/modprobe.d/blacklist-nouveau.conf


Update initramfs:

# Debian/Ubuntu

sudo update-initramfs -u


# Fedora/RHEL/Arch

sudo dracut --force


Install NVIDIA 580 Proprietary Driver

Method 1: Distribution Repository (Recommended)

# Debian/Ubuntu

sudo apt update

sudo apt install nvidia-driver-580 nvidia-settings


# Fedora (RPM Fusion)

sudo dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda


Method 2: NVIDIA .run Installer

# Download from nvidia.com

chmod +x NVIDIA-Linux-x86_64-580.xx.xx.run

sudo ./NVIDIA-Linux-x86_64-580.xx.xx.run


  • Reboot the system after driver installation


Verify Driver Installation

After rebooting, verify the driver loaded successfully:

# Check kernel modules

lsmod | grep nvidia


# Verify both GPUs detected

nvidia-smi


Expected output: nvidia-smi should show two GPUs with their model names and driver version 580.xx.


X.org Configuration

Identify GPU PCI Bus IDs

Find the PCI bus ID for each GPU:

lspci | grep -i 'vga\|3d\|display'


Example output:

01:00.0 VGA compatible controller: NVIDIA Corporation ...

02:00.0 VGA compatible controller: NVIDIA Corporation ...


Convert to X.org format: 01:00.0 becomes PCI:1:0:0 (remove leading zeros from bus number).

Create /etc/X11/xorg.conf

Backup any existing configuration:

sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup 2>/dev/null || true


Create the configuration file with the following content:

sudo nano /etc/X11/xorg.conf


Complete xorg.conf Configuration

Replace the PCI:1:0:0 and PCI:2:0:0 values with your actual bus IDs:

Section "ServerLayout"

    Identifier     "Layout0"

    Screen      0  "Screen0" 0 0

    Option         "Xinerama" "0"

EndSection


Section "Device"

    Identifier     "Device0"

    Driver         "nvidia"

    VendorName     "NVIDIA Corporation"

    BusID          "PCI:1:0:0"    # Replace with your first GPU

    Screen          0

EndSection


Section "Device"

    Identifier     "Device1"

    Driver         "nvidia"

    VendorName     "NVIDIA Corporation"

    BusID          "PCI:2:0:0"    # Replace with your second GPU

    Screen          0

EndSection


Section "Monitor"

    Identifier     "Monitor0"

EndSection


Section "Monitor"

    Identifier     "Monitor1"

EndSection


Section "Screen"

    Identifier     "Screen0"

    Device         "Device0"

    Device         "Device1"

    Monitor        "Monitor0"

    Monitor        "Monitor1"

    DefaultDepth    24

    Option         "AllowEmptyInitialConfiguration" "True"

    Option         "UseDisplayDevice" "none"

    SubSection     "Display"

        Depth       24

    EndSubSection

EndSection


Configuration Notes

  • AllowEmptyInitialConfiguration: Allows X to start without predetermined resolution
  • UseDisplayDevice "none": Disables static configuration, enabling RandR control
  • Xinerama "0": Disabled (incompatible with modern compositing and RandR)
  • One Screen section with two Device entries: Unified desktop across both GPUs



Display Configuration with RandR

Test X.org Configuration

Before restarting the display manager, test the configuration:

sudo X -config /etc/X11/xorg.conf -retro


Press Ctrl+Alt+Backspace to exit. Check for errors:

grep EE /var/log/Xorg.0.log


Restart Display Manager

# GDM (GNOME)

sudo systemctl restart gdm


# SDDM (KDE)

sudo systemctl restart sddm


# LightDM (XFCE/others)

sudo systemctl restart lightdm


Configure Displays with xrandr

After logging in, list available displays:

xrandr


Example output:

Screen 0: minimum 8 x 8, current 4480 x 1440, maximum 16384 x 16384

DP-0 connected primary 2560x1440+0+0 (normal left inverted right x axis y axis)

   2560x1440    144.00*+  59.95

DP-2 connected 1920x1080+2560+0 (normal left inverted right x axis y axis)

   1920x1080     60.00*+


Set Display Layout and Resolutions

Configure each display with its native resolution and position:

# Set first display (left monitor)

xrandr --output DP-0 --mode 2560x1440 --rate 144 --primary --pos 0x0


# Set second display (right monitor)

xrandr --output DP-2 --mode 1920x1080 --rate 60 --right-of DP-0


Alternative: Configure both in one command:

xrandr --output DP-0 --mode 2560x1440 --rate 144 --primary --pos 0x0 \

       --output DP-2 --mode 1920x1080 --rate 60 --pos 2560x0


Position Options




Making Display Settings Permanent

Display configuration needs to be applied on every login. Choose one method:

Method 1: Desktop Environment Settings (Recommended)

Use your desktop environment's display configuration tool:

  • GNOME: Settings → Displays → Arrange displays and click Apply
  • KDE Plasma: System Settings → Display Configuration
  • XFCE: Settings → Display


These tools save settings to ~/.config/monitors.xml or similar configuration files.

Method 2: Autostart Script

Create an xrandr script to run on login:

nano ~/.xprofile


Add the following content (adjust for your displays):

#!/bin/bash

xrandr --output DP-0 --mode 2560x1440 --rate 144 --primary --pos 0x0 \

       --output DP-2 --mode 1920x1080 --rate 60 --pos 2560x0


Make it executable:

chmod +x ~/.xprofile


Method 3: Static X.org Configuration (Not Recommended)

You can add static resolution settings to xorg.conf, but this is less flexible and harder to modify. The RandR approach (Method 1 or 2) is preferred.


Verification and Testing

Verification Checklist

  • Both displays are active and showing content
  • Each display running at its native resolution
  • Mouse pointer moves freely between displays
  • Windows can be dragged between displays
  • Each GPU driving its assigned display (verify in nvidia-smi)


Verification Commands

Check GPU status and driver version:

nvidia-smi


Verify display configuration:

xrandr --listproviders

xrandr --verbose


Check screen count (should be 1):

xdpyinfo | grep "number of screens"


Test OpenGL rendering on each display:

glxinfo | grep 'OpenGL renderer'

glxgears  # Move window between displays



Troubleshooting

X Server Fails to Start

  • Check X.org logs: grep EE /var/log/Xorg.0.log
  • Verify BusID matches lspci output (remove leading zeros)
  • Test configuration: sudo X -config /etc/X11/xorg.conf -retro
  • Check kernel module loading: dmesg | grep nvidia


One Display Not Working

  • Verify cable connections and monitor power
  • Check display detection: xrandr
  • Try swapping displays between GPUs to isolate hardware issue
  • Verify both GPUs visible: nvidia-smi


Mouse Cannot Move Between Displays

  • Verify Xinerama is disabled: grep Xinerama /etc/X11/xorg.conf
  • Check screen count: xdpyinfo | grep screens (should be 1)
  • Verify unified desktop: xrandr (should show relative positions)


Displays Running at Wrong Resolution

  • List available modes: xrandr
  • Manually set resolution: xrandr --output DP-0 --mode 2560x1440
  • Save settings in desktop environment or .xprofile


Screen Tearing

Enable ForceCompositionPipeline for each display:

nvidia-settings --assign CurrentMetaMode="DP-0: nvidia-auto-select +0+0 {ForceCompositionPipeline=On}, DP-2: nvidia-auto-select +2560+0 {ForceCompositionPipeline=On}"


Or add to xorg.conf Device section:

Option "metamodes" "DP-0: nvidia-auto-select +0+0 {ForceCompositionPipeline=On}, DP-2: nvidia-auto-select +2560+0 {ForceCompositionPipeline=On}"


Display Configuration Not Persistent

  • Verify .xprofile is being executed: add echo statement
  • Check desktop environment display settings are saved
  • Ensure xrandr commands complete without errors



Optional Optimizations

Power Management

Set adaptive power mode:

nvidia-settings -a GPUPowerMizerMode=1


Add to .xprofile to make permanent.


Per-Monitor DPI Scaling

For displays with different pixel densities:

xrandr --output DP-0 --scale 1x1 --dpi 109

xrandr --output DP-2 --scale 1x1 --dpi 92


Note: Perfect per-monitor DPI scaling on X11 is challenging. Wayland handles this better if you're willing to switch display servers.

Disable Unused Features

Add to Device sections in xorg.conf:

Option "AllowGPUCUDA" "0"


Since you're not using GPGPU/compute, this can reduce overhead.


Monitor GPU Temperature

watch -n 1 nvidia-smi



Additional Resources

  • NVIDIA Driver Documentation: https://download.nvidia.com/XFree86/Linux-x86_64/
  • X.org RandR Documentation: https://www.x.org/wiki/Projects/XRandR/
  • Arch Wiki NVIDIA: https://wiki.archlinux.org/title/NVIDIA
  • NVIDIA Forums: https://forums.developer.nvidia.com/


Summary

This configuration provides a unified desktop across two NVIDIA GPUs, where:

  • Each GPU independently drives one display
  • Each display runs at its native resolution and refresh rate
  • Mouse and windows move seamlessly between displays
  • Modern RandR provides flexible, dynamic display management
  • No deprecated technologies like Xinerama or BaseMosaic required


This setup is optimal for dual-GPU workstations with heterogeneous displays and provides the best balance of flexibility, performance, and user experience.


No comments:

Post a Comment