You are not logged in.

#1 2020-04-22 00:28:22

danidani
Member
Registered: 2020-04-22
Posts: 3

AMD GPU scroll lag in browsers when window maximized

Hello, I know this has been posted  a few times in the past but I couldn't find anything that helps. I have 2 GPUs (Nvidia GTX 1060 and AMD RX 560). I use the Nvidia for passthrough, it is isolated in the kernel, and the RX for basic usage on Arch. The problem like the title says is that in every browser I get a noticeable lag (no tearing) when scrolling in a maximized window. Video playback is fine as well as scrolling in anything else. I have acquired the RX recently, so I have been using the Nvidia before as the main GPU and noticed no problems. I should also add that this is a multihead setup, but the problem persists when using only one display.

WM: awesomewm ( Tried a Plasma session and problem persists )
DM: sddm
Dmesg output

xrandr output

Screen 0: minimum 320 x 200, current 3840 x 1080, maximum 16384 x 16384
DisplayPort-0 disconnected (normal left inverted right x axis y axis)
HDMI-A-0 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 598mm x 336mm
   1920x1080     60.00*+  74.97    50.00    59.94  
   1680x1050     60.00  
   1600x900      60.00  
   1280x1024     75.02    60.02  
   1440x900      60.00  
   1280x800      60.00  
   1152x864      75.00  
   1280x720      60.00    50.00    59.94  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       75.00    60.00    59.94  
   720x400       70.08  
DVI-D-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 598mm x 336mm
   1920x1080     60.00*+  59.94  
   1680x1050     60.00  
   1600x900      60.00  
   1280x1024     75.02    60.02  
   1440x900      60.00  
   1280x800      60.00  
   1152x864      75.00  
   1280x720      60.00    59.94  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   720x480       60.00    59.94  
   640x480       75.00    60.00    59.94  
   720x400       70.08  

inxi -Gxx output:

Graphics:  Device-1: NVIDIA GP106 [GeForce GTX 1060 6GB] vendor: ASUSTeK driver: vfio-pci v: 0.2 bus ID: 01:00.0 
           chip ID: 10de:1c03 
           Device-2: AMD Baffin [Radeon RX 460/560D / Pro 450/455/460/555/555X/560/560X] vendor: Hightech Information System 
           driver: amdgpu v: kernel bus ID: 0b:00.0 chip ID: 1002:67ef 
           Display: x11 server: X.Org 1.20.8 driver: amdgpu FAILED: ati unloaded: modesetting,vesa alternate: fbdev 
           compositor: picom resolution: 1920x1080~60Hz, 1920x1080~60Hz 
           OpenGL: renderer: AMD Radeon RX 460 Graphics v: 4.6.13572 Core Profile Context compat-v: 4.6.13572 
           direct render: Yes 

I use amdgpu driver as can be seen above along with the mesa-git package.

What I have tried:

  • Uninstalled every nvidia package

  • Removed xorg.conf from Nvidia

  • I noticed that if I disable picom completely, the scrolling is  smoother, but I get some tearing.

Thank you for your time and have a nice day!

Edit: The problem could be better described as micro stuttering.

Last edited by danidani (2020-04-22 00:49:39)

Offline

#2 2020-04-22 01:40:24

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: AMD GPU scroll lag in browsers when window maximized

My guess would be that the browser is doing software rendering and isn't synced to the refresh of the monitor because it doesn't know about when the refresh happens. It's then rendering at its own 60fps timing and things appear like micro-stutter because graphics are sometimes held back one frame in picom.

To try to fix this, for Firefox, enable the "WebRender" beta feature. Firefox will then use the GPU for rendering. It will then know about Vsync and things will hopefully run smooth.

To enable this WebRender thing, visit the URL:

about:config

... then search for this setting here:

gfx.webrender.all

... and set it to "true".

In your picom config, you might then want to add this setting:

unredir-if-possible = true;

This setting will cause picom to disable itself for fullscreen programs. When WebRender is enabled, Firefox will know about Vsync and won't need picom for tearing prevention.

For Chromium, there's a config file "~/.config/chromium-flags.conf". I use the following settings there to force GPU rendering:

--ignore-gpu-blacklist
--enable-gpu-rasterization
--enable-native-gpu-memory-buffers
--enable-zero-copy
--enable-oop-rasterization

I don't know if all of this works like it's supposed to on multi-monitor setups. I use a single monitor setup, and here things seem to run fine. I use an RX480.

Last edited by Ropid (2020-04-22 01:41:36)

Offline

#3 2020-04-22 13:18:11

danidani
Member
Registered: 2020-04-22
Posts: 3

Re: AMD GPU scroll lag in browsers when window maximized

Ropid wrote:

My guess would be that the browser is doing software rendering and isn't synced to the refresh of the monitor because it doesn't know about when the refresh happens. It's then rendering at its own 60fps timing and things appear like micro-stutter because graphics are sometimes held back one frame in picom.

To try to fix this, for Firefox, enable the "WebRender" beta feature. Firefox will then use the GPU for rendering. It will then know about Vsync and things will hopefully run smooth.

To enable this WebRender thing, visit the URL:

about:config

... then search for this setting here:

gfx.webrender.all

... and set it to "true".

In your picom config, you might then want to add this setting:

unredir-if-possible = true;

This setting will cause picom to disable itself for fullscreen programs. When WebRender is enabled, Firefox will know about Vsync and won't need picom for tearing prevention.

For Chromium, there's a config file "~/.config/chromium-flags.conf". I use the following settings there to force GPU rendering:

--ignore-gpu-blacklist
--enable-gpu-rasterization
--enable-native-gpu-memory-buffers
--enable-zero-copy
--enable-oop-rasterization

I don't know if all of this works like it's supposed to on multi-monitor setups. I use a single monitor setup, and here things seem to run fine. I use an RX480.

Well, after messing with settings for a while, I found that

layers.acceleration.force-enabled

set to true works fine in my case on Firefox. The setting you recommended doesn't seem to change much. I guess it all comes down to a lucky combination of xorg, compositor and browser configs. I'll post some of them for anybody that may stumble into this.

This is my xorg.conf.d/20-radeon.conf

Section "Device"
  Identifier "AMD"
  Driver "amdgpu"
  Option "TearFree" "true"
  Option "VariableRefresh" "true"
EndSection

and picom has these values

unredir-if-possible=true
vsync=true
backend="glx"

Thank you for your help.

Offline

#4 2020-04-22 17:48:37

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: AMD GPU scroll lag in browsers when window maximized

For me here, that "TearFree" option is bad. It produced stutter in a certain game's animations. It was a 2D graphics side-scrolling type of game, where it was easy to see when it didn't do its side-scrolling at a perfect 60fps. There was no way to get it to render perfectly when TearFree was enabled. I'm explicitly setting TearFree to disabled here in my config because of that. My config looks like this:

$ cat /etc/X11/xorg.conf.d/20-amdgpu.conf 
Section "OutputClass"
    Identifier "my amdgpu settings"
    MatchDriver "amdgpu"
    Option "TearFree" "no"
    Option "VariableRefresh" "yes"
EndSection

EDIT:

There's another thing I just remembered because you use "VariableRefresh" in your config:

The "drirc" config files for Mesa disable variable-refresh for all compositors. This is so the screen doesn't refresh at 20Hz or something when you just move the mouse around. The config has rules for the process names. Those rules are missing the "picom" name, there's only a rule for the old "compton" name. You will have to add a rule yourself. I do this in my home folder in a file named like this:

~/.drirc

Contents look like this:

<driconf>
    <device>

        <!-- Adaptive sync blacklist follows below: -->
        <application name="picom" executable="picom">
            <option name="adaptive_sync" value="false" />
        </application>
        
    </device>
</driconf>

If you want to take a look at Mesa's config file, it's installed in /usr/share/drirc.d/.

Last edited by Ropid (2020-04-22 18:02:00)

Offline

#5 2020-04-22 22:42:06

danidani
Member
Registered: 2020-04-22
Posts: 3

Re: AMD GPU scroll lag in browsers when window maximized

I used the settings you provided for chromium, xorg and drirc and it seems to be a lot better! Thank you very much.

Offline

#6 2021-11-12 17:04:06

AlexDawn
Member
Registered: 2021-11-12
Posts: 1

Re: AMD GPU scroll lag in browsers when window maximized

In Vivaldi, it worked by disabling hardware acceleration, and using 

--vsync true 

and

 --experimental-backends true 

in picom.

Offline

Board footer

Powered by FluxBB