SOLVED[Linux][Nvidia]Screen tearing, stuttering while playing a video on a second monitor while playing a game

I periodically get screen tearing, fps drops, and lag while watching videos in a browser on my secondary while playing a game on my primary. I’m attributing this to Nvidia drivers being awful, but I have no clue how to fix it.

Nvidia Driver 460.91.03
Debian 11 5.10.0-9-amd64

You can also blame the compositor. You need a DE which you can completely turn off the compositor.

But generally multi-monitor on Xorg and especially on Nvidia is just bad.

You can enable triple buffering with “Force Full Composition Pipeline” but that adds a TON of input lag on some DEs.

1 Like

I tried turning that on but it doesn’t seem to help much.

Then it’s the compositor. Your compositor is acting weird on secondary displays so it needs to be turned off. If there’s no way to fully shut it off, switch to a DE that can allow you to fully shut off compositing.

Out of curiosity, what Desktop Environment are you using?

KDE Plasma

Yup, turn off the compositor with Shift+Alt+F12.

Also use the Xrender backend instead of OpenGL. OpenGL is meant for Mesa, not Nvidia.

You also need to be sure both monitors are running at the same refresh rate in Nvidia Control Panel. Xorg doesn’t handle mixed refresh rates on multi monitor yet.

I am using xrenderer. I can’t use the same refresh rate without effectively tossing out my 165hz main display.

Disabling compositing and changing the refresh rates doesn’t seem to help any.

This is more down to Xorg in combination with Nvidia being god awful. It’s less bad on AMD and Intel, but Xorg still has issues if the monitors are not the same refresh rate.

The only solution I see right now is to use VFIO to run a Linux VM on your secondary monitor and run a browser within that.

Don’t I need 2 gpu’s to do that?

Unfortunately, yes. It’s just how broken Xorg + Nvidia is right now for multi-monitor. I honestly have no clue how Wayland might solve it if it even does on Nvidia with the GBM changes.

so, firefox ESR got updated and now i’m not having any issues.

That tells a lot actually. Is layers.acceleration.force-enabled true? Firefox doesn’t accelerate the 2D canvas all the time, when in some instances it actually does need it accelerated all the time.

You may also want to turn off hardware decode with media.hardware-video-decoding.enabled set to false.

Also, are you running a Snap or Flatpak? Don’t run a Snap or Flatpak of Firefox or anything that needs OpenGL and libGLX.so on Nvidia.