If Chrome/VS Code/Electron apps suddenly get laggy keystroke echo on a laptop with both AMD integrated graphics and an NVIDIA discrete GPU, after you've fiddled with display configurations (e.g. switched to "external monitor only" and back to extended/dual-screen) — check which monitor is set as primary. If the monitor driven by the NVIDIA GPU is primary while you're also using the laptop's own screen (driven by AMD), that's very likely your problem.
xrandr --query | grep primary
xrandr --listproviders # shows which provider (GPU) drives which outputFix: set the AMD-driven internal panel back to primary:
xrandr --output eDP --primary # quick live testPermanent: Settings → Displays → click the internal display → set as primary
(this rewrites ~/.config/monitors.xml, moving <primary>yes</primary> to the
correct <logicalmonitor> block).
- Laptop: Acer (hybrid graphics)
- Discrete GPU: NVIDIA GeForce RTX 3060 Mobile / Max-Q (driver 580.159.03)
- Integrated GPU: AMD Radeon "Cezanne" (Ryzen 5000-series APU)
- Internal panel
eDP— wired ONLY to the AMD iGPU (NVIDIA cannot drive it) - External monitor via
HDMI-1-0— wired ONLY to the NVIDIA dGPU - OS: Pop!_OS 22.04, kernel 6.9.3, GNOME Shell 42.9, X11 (Mutter),
system76-power graphics hybrid
Severe keystroke/typing lag in Chrome and Electron apps (e.g. VS Code) whenever both the internal screen and an external monitor were active ("extended" mode). Closing the laptop lid while in extended mode (forcing a display reconfig) also triggered it. CPU/GPU load stayed low — it wasn't a resource-contention issue.
I had previously switched my display config to "external monitor only" mode.
At that point GNOME naturally made that monitor (the only one active) the
primary display, and the assignment was persisted to ~/.config/monitors.xml.
When I later switched back to using both screens, the external monitor (NVIDIA)
stayed primary while the internal panel (AMD) was secondary — and that bad
assignment kept getting reapplied on every login/reboot (so logging out or
rebooting did NOT fix it).
With the NVIDIA-driven screen as primary, Mutter's main compositing/buffer presentation path now had to copy frames from the AMD GPU (which renders most apps and the internal panel) across to the NVIDIA GPU — and the X server log showed it falling back to an unsynchronized copy method on that primary path:
(II) AMDGPU(0): Allocate new frame buffer 3840x1200
(II) AMDGPU(0): => pitch 15360 bytes
randr: falling back to unsynchronized pixmap sharing
(II) NVIDIA(G0): Setting mode "HDMI-1-0: nvidia-auto-select @1920x1200 +1920+0 ..."
This "unsynchronized pixmap sharing" fallback is a known PRIME-sync limitation between AMD and NVIDIA GPUs in X11 (see links below) — but it only became a visible, severe problem here because the wrong GPU's monitor was set as primary, putting the unsynced cross-GPU copy on the hot path for basically every redraw, instead of just for content shown on the secondary screen.
You may also see this in journalctl at every login — it's unrelated/cosmetic
and NOT the cause of the lag (it fires once at startup and stops):
gnome-shell[...]: Can't update stage views actor <unnamed>[<MetaWindowActorX11>:...]
is on because it needs an allocation.
- Logging out / rebooting — the bad primary-display assignment is saved in
monitors.xmland gets reapplied on every login. - Switching
system76-power graphicsmode — on this hardware the internal panel is wired only to AMD and the external port only to NVIDIA, sohybridis the only mode that drives both screens. Switching tonvidia/integrated/amd/computejust breaks one of the displays entirely (don't do it — ask me how I know 🙂).
xrandr --output eDP --primary…then made permanent by editing ~/.config/monitors.xml, moving
<primary>yes</primary> from the external monitor's <logicalmonitor> block
to the internal panel's block (in the <configuration> matching my current
monitor combo). Equivalent to doing it through Settings → Displays.
Lag disappeared immediately.
- Arch Linux forums — "[Solved] Prime Sync between dGPU Nvidia and iGPU Amd": https://bbs.archlinux.org/viewtopic.php?id=248346
- nvidia-xrun project — "randr: falling back to unsynchronized pixmap sharing": Witko/nvidia-xrun#163
- Ubuntu xorg-server bug — "X crashes with randr: falling back to unsynchroni...": https://bugs.launchpad.net/bugs/1789913
- ArchWiki — Hybrid graphics (PRIME / Optimus background): https://wiki.archlinux.org/title/Hybrid_graphics