Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Getting AMD Radeon RX480 to work properly
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
NilPointer
n00b
n00b


Joined: 02 Feb 2015
Posts: 37

PostPosted: Wed Aug 17, 2016 6:21 pm    Post subject: [SOLVED] Getting AMD Radeon RX480 to work properly Reply with quote

I've recently assembled a new machine and migrated my Gentoo installation to it. For most part it went fine and I've got pretty much everything what used to work with old machine to work with a new one. However, I've decided to switch from NVidia graphics to AMD (was that a mistake?) and still haven't figured out how to get it to work properly. The best option for RX480 at the time seems to be amdgpu driver (aside from amdgpu-pro, which is available only from overlay and depends on former anyway). I've read that amdgpu shows decent performance (even though not as good as NVidia with blob driver). However, on my machine I'm getting terrible performance that's worse than my 7 years old NVidia GT9800. Feels like it's a misconfiguration on my part, it couldn't be that bad, could it?

After migrating to new machine, I've cleaned up nvidia blob driver, it's xorg config files, etc. and compiled amdgpu module (firmware built into kernel). Installed xf86-amdgpu driver. I used to run stable kernel (4.4.5), but it didn't work at all, so I had to switch to latest, 4.7.0 kernel. System now boots into FullHD terminal (late mode-setting) and desktop performance is decent. But 3D Games have poor perfomance and constant stutter.

glxinfo seems to indicate that amdgpu works:

Code:
direct rendering: Yes


Code:
OpenGL renderer string: Gallium 0.4 on AMD POLARIS10 (DRM 3.2.0 / 4.7.0-gentoo, LLVM 3.7.1)


I'm using default 10-amdgpu.conf and following 10-device.conf so I could use DRI3:

Code:
Section "Device"
    Identifier  "AMD Radeon RX 480 (POLARIS10)"
    Driver      "amdgpu"
    BusID       "PCI:1:0:0"
    Option      "DRI"         "3"
    Option      "AccelMethod" "glamor"
EndSection


DRI3 appears to work, according to xorg log (although GLX still uses DRI2 for some reason and I can't figure out why):

Code:
[    30.903] (II) AMDGPU(G0): [DRI2] Setup complete
[    30.903] (II) AMDGPU(G0): [DRI2]   DRI driver: radeonsi
[    30.903] (II) AMDGPU(G0): [DRI2]   VDPAU driver: radeonsi
[    30.905] (**) AMDGPU(G0): DRI3 enabled
[    30.963] (II) AMDGPU(0): [DRI2] Setup complete
[    30.963] (II) AMDGPU(0): [DRI2]   DRI driver: radeonsi
[    30.963] (II) AMDGPU(0): [DRI2]   VDPAU driver: radeonsi
[    30.964] (**) AMDGPU(0): DRI3 enabled
[    31.036] (II) GLX: Initialized DRI2 GL provider for screen 0


I've also switched to latest Mesa 12.0.1. It's compiled with -bindist, so that it supports OpenGL 3.0.

But eselect opengl list shows only xorg-x11 implementation of OpenGL (which is AFAIK softrender). And this:

Code:
$ sudo eselect mesa list
64bit i915 (Intel 915, 945)
64bit i965 (Intel GMA 965, G/Q3x, G/Q4x, HD)
64bit r300 (Radeon R300-R500)
64bit r600 (Radeon R600-R700, Evergreen, Northern Islands)
64bit sw (Software renderer)
  [1]   classic
  [2]   gallium *
32bit i915 (Intel 915, 945)
32bit i965 (Intel GMA 965, G/Q3x, G/Q4x, HD)
32bit r300 (Radeon R300-R500)
32bit r600 (Radeon R600-R700, Evergreen, Northern Islands)
32bit sw (Software renderer)
  [1]   classic
  [2]   gallium


Looks like I'm stuck with software rendering. How could I enable GPU OpenGL acceleration with amdgpu?

P.S. Sorry, posted in wrong forum, moderators, please move to Hardware.


Last edited by NilPointer on Thu Aug 25, 2016 5:28 pm; edited 1 time in total
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5593

PostPosted: Wed Aug 17, 2016 7:01 pm    Post subject: Re: Getting AMD Radeon RX480 to work properly Reply with quote

NilPointer wrote:
glxinfo seems to indicate that amdgpu works:
...

I'm using default 10-amdgpu.conf and following 10-device.conf so I could use DRI3:
...

DRI3 appears to work, according to xorg log (although GLX still uses DRI2 for some reason and I can't figure out why):
...

I've also switched to latest Mesa 12.0.1. It's compiled with -bindist, so that it supports OpenGL 3.0.

Everything looks in order there.

Quote:
But eselect opengl list shows only xorg-x11 implementation of OpenGL (which is AFAIK softrender).

No, that's mesa.

Quote:
And this:

Code:
$ sudo eselect mesa list
64bit i915 (Intel 915, 945)
64bit i965 (Intel GMA 965, G/Q3x, G/Q4x, HD)
64bit r300 (Radeon R300-R500)
64bit r600 (Radeon R600-R700, Evergreen, Northern Islands)
64bit sw (Software renderer)
  [1]   classic
  [2]   gallium *
32bit i915 (Intel 915, 945)
32bit i965 (Intel GMA 965, G/Q3x, G/Q4x, HD)
32bit r300 (Radeon R300-R500)
32bit r600 (Radeon R600-R700, Evergreen, Northern Islands)
32bit sw (Software renderer)
  [1]   classic
  [2]   gallium

I don't think you should have an amdgpu entry in this list, that driver is new so it only supports gallium.

Quote:
Looks like I'm stuck with software rendering. How could I enable GPU OpenGL acceleration with amdgpu?

And now I'm confused. It sounds as if you've done everything right, and everything you've posted suggests it should be working. Can you post the full output of `glxinfo -B`?
Back to top
View user's profile Send private message
NilPointer
n00b
n00b


Joined: 02 Feb 2015
Posts: 37

PostPosted: Wed Aug 17, 2016 7:45 pm    Post subject: Reply with quote

Quote:
And now I'm confused. It sounds as if you've done everything right, and everything you've posted suggests it should be working. Can you post the full output of `glxinfo -B`?


Yes, that's the thing. While everything seems to indicate it works, it feels like something is broken. OpenGL renderer causes artifacts in DE (like, clicking shutdown button in KDE causes shutdown dialog to pop up and shadows background, but shadow is glitched). Even non GPU-intensive games, such as Tabletop Simulator have stuttering problems. Some games doesn't seem to work at all, for example, Serious Sam 3 renders so glitchy that it's impossible to play at all. What surprises me most - is that even 2D Worms Armageddon via Wine runs with awful framerate, which is why I feel GPU doesn't work properly.

Did you mean `glxinfo -v`? There's no -B option.

http://pastebin.com/nj7iZabj
Back to top
View user's profile Send private message
NilPointer
n00b
n00b


Joined: 02 Feb 2015
Posts: 37

PostPosted: Fri Aug 19, 2016 6:42 pm    Post subject: Reply with quote

Is there any advantages to build git (9999) mesa, or 12.0.1 should be fine?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42588
Location: 56N 3W

PostPosted: Fri Aug 19, 2016 6:56 pm    Post subject: Reply with quote

NilPointer,

What does
Code:
ls -l /dev/dri/*
show.
When it looks all OK but it doesn't work, Xorg may have fallen back to software rendering because of a permissions problem.
Code:
$ ls -l /dev/dri/*
crw-rw---- 1 root video 226,  0 Feb 16  2014 /dev/dri/card0
crw-rw---- 1 root video 226, 64 Feb 16  2014 /dev/dri/controlD64

That's for my nouveau, so the file names may be different for you. Only users in the video group get hardware acceleration.

The test is to make those files chmod 666, so that hardware rendering works for everyone, then restart Xorg.
If that works, its a permissions issue.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
NilPointer
n00b
n00b


Joined: 02 Feb 2015
Posts: 37

PostPosted: Fri Aug 19, 2016 8:18 pm    Post subject: Reply with quote

Hmm, basic permissions seems to be OK, though cards seem to have some extra permissions.

Code:
# ls -l /dev/dri/*
crw-rw----+ 1 root video 226,   0 Aug 19  2016 /dev/dri/card0
crw-rw----+ 1 root video 226,   1 Aug 19  2016 /dev/dri/card1
crw-rw----  1 root video 226,  64 Aug 19  2016 /dev/dri/controlD64
crw-rw----  1 root video 226,  65 Aug 19  2016 /dev/dri/controlD65
crw-rw----  1 root video 226, 128 Aug 19  2016 /dev/dri/renderD128
crw-rw----  1 root video 226, 129 Aug 19  2016 /dev/dri/renderD129


According to id, I'm in video group.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42588
Location: 56N 3W

PostPosted: Fri Aug 19, 2016 8:21 pm    Post subject: Reply with quote

NilPointer,

That looks good.

Please pastbin your /var/log/Xorg.0.log and your dmesg.
There may be something interesting there.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
NilPointer
n00b
n00b


Joined: 02 Feb 2015
Posts: 37

PostPosted: Fri Aug 19, 2016 8:34 pm    Post subject: Reply with quote

XOrg log:

http://pastebin.com/1v5f7g28

dmesg:

http://pastebin.com/FM8LeXjP
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42588
Location: 56N 3W

PostPosted: Fri Aug 19, 2016 9:04 pm    Post subject: Reply with quote

NilPointer,

Do you have debugfs in your kernel?
Code:
[    5.826807] [drm:amdgpu_ring_init [amdgpu]] *ERROR* Failed to register debugfs file for rings !

It may not be important but its worth a try.
There are no firmware loading errors, so that good.

Xorg.0.log looks good too.

That's a bit of a straw for grasping at.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5593

PostPosted: Sat Aug 20, 2016 1:21 am    Post subject: Reply with quote

NilPointer wrote:
Is there any advantages to build git (9999) mesa, or 12.0.1 should be fine?

It's worth a shot. You could also try xf86-video-amdgpu-9999 from the x11 overlay, but I don't see anything in there that could fix this much slowdown...

Can you try running some of those games and do `pstree` in another terminal while they're open? Wondering if it's silently falling back to software rendering somehow -- if that's the case, you should see "llvmpipe" threads under the game binary (and it'll be eating all cores of your CPU).
Back to top
View user's profile Send private message
NilPointer
n00b
n00b


Joined: 02 Feb 2015
Posts: 37

PostPosted: Sat Aug 20, 2016 8:10 am    Post subject: Reply with quote

Well, I've updated mesa and amdgpu to git versions. Now it feels noticeably better than it used to. Artifacts in DE disappeared. Everything feels faster. Only one annoying issue remains - for some reason, certain OpenGL apps keep deadlocking after a few minutes, such as Tabletop Simulator and Left 4 Dead 2. Others now run fine, Serious Sam 3 and Civilization 5 is playable even on maxed out settings (much better than old NVidia card). I suspect that this is driver bug. Nothing is printed to terminal before this happens.

Update: I've asked my friend who uses Manjaro Linux and he has no deadlocks in Tabletop Simulator on same GPU. Might be still a misconfiguration on my part.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5593

PostPosted: Sat Aug 20, 2016 11:57 pm    Post subject: Reply with quote

Yeah, sounds like it could be driver bugs. I had similar weird hangs with r300/r600 in the early days of those too. Try looking on the freedesktop.org bugzilla, someone else might be having the same problem.

You might find GALLIUM_HUD useful in narrowing down what causes the freezes: use `GALLIUM_HUD=help glxgears` to make it print usage docs.
Back to top
View user's profile Send private message
NilPointer
n00b
n00b


Joined: 02 Feb 2015
Posts: 37

PostPosted: Tue Aug 23, 2016 8:53 pm    Post subject: Reply with quote

I've ended up opening a bug on freedesktop.org bugzilla.

https://bugs.freedesktop.org/show_bug.cgi?id=97428

Although, it turned out to be a duplicate of another bug, I used wrong terms to search for existing bug.

To sum it up, drivers were perfectly fine. The issue was caused by DRI3 and Steam's outdated libraries that it drags around. There's several possible workarounds:

1. Disable DRI3 completely in XOrg configuration. Bad solution, especially since I specifically enabled it.
2. Disable DRI3 via variable LIBGL_DRI3_DISABLE=1. This is still a bad solution.
3. Load system libxcb, best workaround. Use

Code:
LD_PRELOAD='/usr/$LIB/libxcb.so.1':$LD_PRELOAD


Before starting Steam. That fixed all freezes for me.
Back to top
View user's profile Send private message
NilPointer
n00b
n00b


Joined: 02 Feb 2015
Posts: 37

PostPosted: Sat Aug 27, 2016 10:02 am    Post subject: Reply with quote

It seems the microfreezes I had were caused by CPU powersaving features and (primarily) by HPET enabled in BIOS. It seems to be malfunctioning and caused overall system choppiness (even when moving windows around). Now my Radeon feels much better than old NVidia GT9800.

P.S. AMD's OSS driver is really great, respect to them for being friendly towards Linux community.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum