[radeon] Display output laggy from iGPU when operating on desktop with attaching AMD R7 430 graphic (dGPU)

Bug #1923153 reported by jeremyszu
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OEM Priority Project
Confirmed
Critical
jeremyszu
xserver-xorg-driver-ati
New
Unknown
xorg-server (Ubuntu)
New
Undecided
Unassigned
xserver-xorg-video-ati (Ubuntu)
New
Undecided
Unassigned

Bug Description

[Steps to reproduce this issue]

1. Install a focal base image
2. Attach an AMD R7 430 graphic as dGPU without connecting any monitor on it.
3. Attach DP monitor on iGPU (no matter the iGPU is Intel(i915), or AMD(amdgpu)).
4. After logging it, the display shows laggy.

[Additional information]
1. doesn't see this issue if selecting 'Wayland'

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: xserver-xorg 1:7.7+19ubuntu14
ProcVersionSignature: Ubuntu 5.10.0-1019.20-oem 5.10.18
Uname: Linux 5.10.0-1019-oem x86_64
ApportVersion: 2.20.11-0ubuntu27.16
Architecture: amd64
CasperMD5CheckResult: skip
Date: Fri Apr 9 16:23:42 2021
DistUpgraded: Fresh install
DistributionChannelDescriptor:
 # This is the distribution channel descriptor for the OEM CDs
 # For more information see http://wiki.ubuntu.com/DistributionChannelDescriptor
 canonical-oem-stella-focal-amd64-20210324-1458+pc-stella-cmit-focal-amd64+X00
DistroCodename: focal
DistroVariant: ubuntu
ExtraDebuggingInterest: Yes, including running git bisection searches
GraphicsCard:
 Advanced Micro Devices, Inc. [AMD/ATI] Oland [Radeon HD 8570 / R7 240/340 / Radeon 520 OEM] [1002:6611] (rev 87) (prog-if 00 [VGA controller])
   Subsystem: Hewlett-Packard Company Oland [Radeon HD 8570 / R7 240/340 / Radeon 520 OEM] [103c:3375]
 Advanced Micro Devices, Inc. [AMD/ATI] Renoir [1002:1636] (rev da) (prog-if 00 [VGA controller])
   Subsystem: Hewlett-Packard Company Renoir [103c:872b]
InstallationDate: Installed on 2021-04-09 (0 days ago)
InstallationMedia: Ubuntu 20.04 "Focal" - Build amd64 LIVE Binary 20210324-23:53
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-5.10.0-1019-oem root=UUID=027c2398-aef7-43d2-a339-6a2163287914 ro quiet splash vt.handoff=7
SourcePackage: xorg
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 12/30/2020
dmi.bios.release: 2.0
dmi.bios.vendor: HP
dmi.bios.version: S09 Ver. 02.02.00
dmi.board.name: 872B
dmi.board.vendor: HP
dmi.board.version: KBC Version 09.94.00
dmi.chassis.type: 3
dmi.chassis.vendor: HP
dmi.ec.firmware.release: 9.148
dmi.modalias: dmi:bvnHP:bvrS09Ver.02.02.00:bd12/30/2020:br2.0:efr9.148:svnHP:pn:pvr:rvnHP:rn872B:rvrKBCVersion09.94.00:cvnHP:ct3:cvr:
dmi.product.family: 103C_53307F HP EliteDesk
dmi.sys.vendor: HP
version.compiz: compiz N/A
version.libdrm2: libdrm2 2.4.102-1ubuntu1~20.04.1
version.libgl1-mesa-dri: libgl1-mesa-dri 20.2.6-0ubuntu0.20.04.1
version.libgl1-mesa-glx: libgl1-mesa-glx N/A
version.xserver-xorg-core: xserver-xorg-core 2:1.20.9-2ubuntu1.2~20.04.1
version.xserver-xorg-input-evdev: xserver-xorg-input-evdev N/A
version.xserver-xorg-video-ati: xserver-xorg-video-ati 1:19.1.0-1
version.xserver-xorg-video-intel: xserver-xorg-video-intel 2:2.99.917+git20200226-1
version.xserver-xorg-video-nouveau: xserver-xorg-video-nouveau 1:1.0.16-1

Revision history for this message
jeremyszu (os369510) wrote :
Revision history for this message
jeremyszu (os369510) wrote :

I tried to install hirsute daily build (495fe189e32d873ba79d7753134c22353ea89e8e6d62498f6c825a5de6a8a4a7) and didn't see this issue.

but the xorg might have some problems when using hirsute.

here is the result of $ xrandr -d :0 --prop
---
 PRIME Synchronization: 0
  supported: 0, 1
 GAMMA_LUT_SIZE: 4096
  range: (0, -1)
 DEGAMMA_LUT_SIZE: 4096
  range: (0, -1)
 GAMMA_LUT: 0
  range: (0, 65535)
 CTM: 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0
  0 1
 DEGAMMA_LUT: 0
  range: (0, 65535)
 TearFree: auto
  supported: off, on, auto
 subconnector: HDMI
  supported: Unknown, VGA, DVI-D, HDMI, DP, Wireless, Native
 HDCP Content Type: HDCP Type0
  supported: HDCP Type0, HDCP Type1
 Content Protection: Undesired
  supported: Undesired, Desired, Enabled
 vrr_capable: 0
  range: (0, 1)
 max bpc: 8
  range: (8, 16)
 underscan vborder: 0
  range: (0, 128)
 underscan hborder: 0
  range: (0, 128)
 underscan: off
  supported: off, on, auto
 scaling mode: None
  supported: None, Full, Center, Full aspect
 link-status: Good
  supported: Good, Bad
 CONNECTOR_ID: 80
  supported: 80
 non-desktop: 0
  range: (0, 1)
---

When issuing the same command on hirsute daily build, it shows
---
 non-desktop: 0
  range: (0, 1)
---
only.

Tried packages from https://launchpad.net/~oibaf/+archive/ubuntu/graphics-drivers doesn't help.

tags: added: oem-priority originate-from-1916427 stella
Changed in oem-priority:
assignee: nobody → jeremyszu (os369510)
importance: Undecided → Critical
status: New → Confirmed
Revision history for this message
jeremyszu (os369510) wrote :

When I attached another monitor to dGPU (which means connecting monitor to each iGPU and dGPU), then there is no problem.

tags: added: amdgpu radeon
affects: xorg (Ubuntu) → xorg-server (Ubuntu)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Xorg actually doesn't have support for synchronizing multiple screens very well. The compositor can only paint all screens at once, and then the Xorg drivers have to output their areas at separate times later.

The 'modeset' Xorg driver will just sync to one and tear on the others. And I am not sure how radeon/amdgpu are expected to interplay. If they support a TearFree feature then that means at least one of them has to delay each frame, which you might see as lag. Also, if the monitors have different refresh rates then there's no guarantee Xorg will sync to the fastest one -- it might sync to the slowest, which has to be worked around in the drivers.

I suggest the first thing to investigate here is to see if you can get both GPUs using the same driver (from the kernel onward). Because using both 'radeon' and 'amdgpu' at the same time might be causing this.

GNOME Wayland sessions don't have this problem at all because there is no Xorg and it schedules each display separately.

affects: xorg-server (Ubuntu) → xserver-xorg-video-amdgpu (Ubuntu)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

What is the output from 'xrandr --verbose' ?

Revision history for this message
jeremyszu (os369510) wrote :
Revision history for this message
jeremyszu (os369510) wrote :

BTW, the FPS is 1.

$ DISPLAY=:0 glxgears
Running synchronized to the vertical refresh. The framerate should be
approximately the same as the monitor refresh rate.
344 frames in 5.6 seconds = 61.884 FPS
5 frames in 5.0 seconds = 0.997 FPS
6 frames in 6.0 seconds = 1.002 FPS
6 frames in 6.0 seconds = 1.000 FPS

---

I did confirm the i915(iGPU) + amdgpu(dGPU) could reproduce this issue as well.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Ooops, single monitor, I see.

Next we should probably verify whether it is mutter-specific or a general Xorg problem. Can you try a desktop that is not GNOME?

Revision history for this message
jeremyszu (os369510) wrote :

backport the patches from https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/460 doesn't help.

---

* d5016e5b61f96496f9b31d14eae16f5f0148b748 (HEAD -> backport-7-patches-from-Łukasz-sync_present_to_slave_outputs) Remove unused function ms_covering_xf86_crtc()
* d892481c2a3d67462f6d2c0d762c43b63cdcd45c xserver/output: rename some badly named variables/APIs.
* 1fb0dc09a60e97306088d75fefeed17a39e622ea (master) modesetting: Remove few common functions from ms namespace
* a1f28e05d602f5cde825111ca0654311c2aba73b modesetting: remove unnecessary ms_covering_xf86_crtc dup of ms_covering_randr_crtc
* d1b3204d1f1357426864c5125bf2ff8b84827d23 modesetting: Find crtc on secondary outputs as fallback instead of returning primary crtc
* 028688ba6dc50fbc6430812c608f69912e4196d4 randr: Fix link errors after previous commit
* 327441e28fa50fef18c0d15f377e61479fa956a4 present: fix msc offset calculation in screen mode
* 8477111ac5e3dee4066efc689d4507fa1b245900 present: Use crtc's screen present operation for syncing
* c271560a66d1d0a36dd7b784e75822ee00acc216 modesetting: Initialize present extension despite glamor is disabled
* 9f5b6b400462dd5b979c40361c4fcb35d08f9dd1 apt source xserver-xorg-core

Revision history for this message
jeremyszu (os369510) wrote :

@Daniel,

ok, let me try the other desktops.

BTW, the cursor moves smoothly but other operations laggy (e.g. move the terminal window).

Revision history for this message
jeremyszu (os369510) wrote :

XFCE has the same result.

I'm able to reproduce this issue on XFCE.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

The attachments only show radeon and amdgpu, but at the top of the bug you said it happens with i915 too. I wonder if you could please verify that, and if it happens with i915 then please attach data from that machine:

  lspci -kv > lspci2.txt
  journalctl -b0 > journal2.txt

If we can see the same bug occurring with i915 then we might be able to exclude one of the AMD drivers and would be left with only a single driver to blame then...

Revision history for this message
jeremyszu (os369510) wrote :
Revision history for this message
jeremyszu (os369510) wrote :
Revision history for this message
jeremyszu (os369510) wrote :

@Daniel,

Above are the outputs.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Thanks. That shows 'radeon' is the common problem.

Also, is "AMD R7 430" a typo? Should that be "AMD R7 340"?

no longer affects: xserver-xorg-video-amdgpu (Ubuntu)
summary: - Display output laggy from iGPU when operating on desktop with attaching
- AMD R7 430 graphic (dGPU)
+ [radeon] Display output laggy from iGPU when operating on desktop with
+ attaching AMD R7 430 graphic (dGPU)
tags: removed: amdgpu
Revision history for this message
jeremyszu (os369510) wrote :

Hi Daniel,

The "AMD R7 430" is the product name of the graphic card.
https://ssl.www8.hp.com/emea_africa/en/products/oas/product-detail.html?oid=26185185

I guess it's related to radeon driver since we could see this issue with amd RX550 as well.

tags: added: originate-from-1923120
tags: added: originate-from-1921875
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Another useful thing that would be easy to test: Does the same bug occur in hirsute?

Revision history for this message
jeremyszu (os369510) wrote :

BTW, for i915 case, it's not 100% reproduce if the boot-vga-device is i915.

Which means in Intel + AMD platform.

Sometime the system laggy when output from dGPU (AMD 430).
Sometime the system laggy when output from iGPU (intel) AFTER switching the monitor between dGPU and iGPU (e.g. boot vga: i915 -> moving monitor to dGPU -> moving monitor back to iGPU).

but all works smoothly when connecting two monitor from both iGPU and dGPU (this scenario works good on AMD + AMD platform).

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Comment #19 is probably important to answer because we need to know if we're looking for a backport or a whole new upstream fix.

Revision history for this message
jeremyszu (os369510) wrote :

The other finding for comment#20.

If connecting two monitors then there is a way to reproduce it.

1. Set iGPU as primary monitor
2. Run an application from secondary display (dGPU) (e.g. glxgear)
3. Moving the application from secondary display (dGPU) to primary display (iGPU) then the issue occur.

For comment#19, I'm preparing hirsute using today daily build. Will update the result here later.

Revision history for this message
jeremyszu (os369510) wrote :

Hi Daniel,

I could reproduce this issue when using today hirsute daily build

$ sha256sum ~/Downloads/hirsute-desktop-amd64.iso
4908a5c919f4b796a856be69a044334eb1a910727180618348db0a8a1ef70360 /home/jeremysu/Downloads/hirsute-desktop-amd64.iso

after switching back to xorg (hirsute default uses Wayland)

jeremyszu (os369510)
Changed in oem-priority:
status: Confirmed → In Progress
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

As a workaround you should be able to avoid the radeon Xorg driver with a custom config, something like:

       Section "Device"
         Identifier "MyRadeon"
         Driver "modesetting"
         BusID "pci:1:0:0"
       EndSection

Then it will use the same interfaces as in a Wayland session.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Or just remove/edit /usr/share/X11/xorg.conf.d/10-radeon.conf

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Combining the above two ideas you could add a new config file (make sure its name loads before "10-radeon.conf"):

Section "OutputClass"
 Identifier "MyRadeon"
 MatchDriver "radeon"
 Driver "modesetting"
EndSection

Revision history for this message
jeremyszu (os369510) wrote :

Hi Daniel,

Thanks for sharing comment#27.

Let me summarize the reproduce scenarios in Intel + AMD case.

1. Boot from iGPU -> switch to dGPU -> switch back to iGPU -> iGPU lag.
2. Boot from iGPU -> connect secondary monitor to dGPU -> remove 1st monitor from iGPU -> dGPU lag.
3. Boot from iGPU -> connect secondary monitor to dGPU -> set iGPU as primary display -> moving an application (e.g. glxgear) from secondary display (dGPU) to primary display (iGPU) -> iGPU lag.

The comment#27 could workaround case#1 and case #3.

but switch to wayland could fix these three cases.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I'm slightly worried you might be hitting multiple different bugs there. But instead of worrying, maybe just try the 'modesetting' driver. It might solve even more problems if you get both GPUs using the same driver:

Section "OutputClass"
  Identifier "Use Modesetting"
  MatchDriver "radeon|amdgpu"
  Driver "modesetting"
EndSection

I'm not sure why those drivers don't yet prefer "modesetting" by default because in Wayland sessions that's exactly what happens anyway.

Revision history for this message
jeremyszu (os369510) wrote :

@Daniel,

u@u-HP-EliteDesk-800-G6-Tower-PC:~$ dpkg -S /usr/share/X11/xorg.conf.d/10-radeon.conf
xserver-xorg-video-radeon: /usr/share/X11/xorg.conf.d/10-radeon.conf
u@u-HP-EliteDesk-800-G6-Tower-PC:~$ dpkg -S /usr/share/X11/xorg.conf.d/10-amdgpu.conf
xserver-xorg-video-amdgpu: /usr/share/X11/xorg.conf.d/10-amdgpu.conf

The radeon and amdgpu drivers are came from xserver-xorg-video-radeon/amdgpu.

xserver-xorg-video-radeon comes from xserver-xorg-video-ati
xserver-xorg-video-ati and xserver-xorg-video-amdgpu comes from xserver-xorg-video-all

Do you think we could remove both from xserver-xorg-video-all if the target is to use modesetting for amd gpu?

Or anything I can do to help to fix it?

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I've subscribed Timo who should know why Ubuntu still prefers 'radeon' and 'amdgpu' Xorg drivers.

But also I am only guessing that my recommended config changes will fix the issue. It would be useful to test them too.

Revision history for this message
Timo Aaltonen (tjaalton) wrote :

because the native drivers have features that modesetting_drv does not have, and how AMD expects them to be used

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Good point. Running 'man amdgpu' I can immediately see one such good reason:

  Option "TearFree" "boolean"

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Anyway, for this bug my thinking is that if a different config satisfies the OEM then that can be considered as a semipermanent workaround.

Other than that, it looks like the bug needs to be reported upstream to https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati

Revision history for this message
jeremyszu (os369510) wrote :

Hi Daniel,

Thank you for sharing.
We are not allow to provide a customization as workaround before we know the fix plan.

I reported an upstream issue:
https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/-/issues/194

jeremyszu (os369510)
Changed in oem-priority:
status: In Progress → Confirmed
Changed in xserver-xorg-driver-ati:
status: Unknown → New
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.