Eliminate Input Lag on External Displays by Forcing Your NVIDIA dGPU


On my older XPS 15 laptop, plugging into an external display defaults to the integrated GPU—and the result is constant input lag. Even with low CPU/GPU usage, the system feels unresponsive.

Source from: https://darkghosthunter.medium.com/bluefin-making-your-nvidia-dgpu-primary-for-external-monitors-0b5a293a4b9f

Problem

When you plug your laptop into an external display, GNOME/Mutter defaults to the integrated GPU. Even though your discrete NVIDIA GPU sits idle and CPU usage is low, the desktop feels sluggish: mouse clicks lag, windows stutter, and dragging feels delayed.

TL;DR

Force Mutter to use the NVIDIA dGPU for all external monitors by adding a udev rule.

Prerequisites

  • A Linux distro running GNOME 43+ (with Mutter).
  • Root (sudo) access.
  • lspci installed.

Find Your NVIDIA IDs

Run:

lspci -nn | grep -i nvidia

Note the two hexadecimal codes in brackets:

01:00.0 3D controller [0302]: NVIDIA Corporation Device [10de:1c82] (rev a1)
  • Vendor ID: 10de
  • Device ID: 1c82

Create the udev Rule

  1. Open a new rule file:
sudo nano /etc/udev/rules.d/61-mutter-dgpu-preferred.rules
  1. Paste, replacing VENDOR_ID and DEVICE_ID:
SUBSYSTEM=="drm", ENV{DEVTYPE}=="drm_minor", ENV{DEVNAME}=="/dev/dri/card[0-9]", SUBSYSTEMS=="pci", ATTRS{vendor}=="0xVENDOR_ID", ATTRS{device}=="0xDEVICE_ID", TAG+="mutter-device-preferred-primary"

Example:

SUBSYSTEM=="drm", ENV{DEVTYPE}=="drm_minor", ENV{DEVNAME}=="/dev/dri/card[0-9]", SUBSYSTEMS=="pci", ATTRS{vendor}=="0x10de", ATTRS{device}=="0x1c82", TAG+="mutter-device-preferred-primary"

Apply & Verify

Simply reboot to apply the rules

Result: External displays now render on your NVIDIA card, banishing input latency and restoring silky-smooth desktop performance.