Page 1 of 1

[HOWTO] ATI hybrid graphics with open source radeon driver

Posted: Thu Jul 11, 2013 11:08 am
by Onyx47
[1] Introduction

I'm posting this here because most of the information you can find is either obsolete or hard to find, and info about muxless systems is mostly buried within endless pages of discussions about Nvidia cards or muxed systems.

First of all, you might wonder (if you don't already know) what is the difference between muxless and muxed hybrid graphics.

Muxed systems are older and generally easier to get running. In both cases you have two GPUs in your machine, either Intel (mostly on an i3 or i5 CPU) + ATI or ATI (on AMD CPU) + ATI. On a muxed system both of these GPUs are connected directly to your display and work independently. Sadly, there is still (to my knowledge) no way to have these switch dynamically for more battery life or better performance on Linux. However, using vgaswitcheroo (mentioned later in tutorial) on it's own without any additional steps should work for you.

Muxless systems are trickier. Only the integrated GPU is connected to your display, but it can offload intensive graphics calculations on to your ATI card and forward the results to your screen. Up until recently this was not possible without using the proprietary fglrx driver.

Note that fglrx has it's own mechanism for switching between cards in CCC and in both cases it requires a X restart. This tutorial deals with using the open source radeon driver instead.

Before you start you should check if you have a muxed or muxless system. Unfortunately I don't know a good way of checking this other than extensive googling. If you know of another reliable method please post it and I will update the tutorial. Generally, laptops produced from 2011 and onwards seem to be mostly muxless.

If you have a muxed system and you have all of the drivers already installed, you can skip ahead to step 4. In case of a muxless systems, just keep reading.

[2] Remove fglrx

If you already have fglrx installed you should remove it first.

If installed from driver manager/repository:

Code: Select all

$ sudo apt-get remove --purge fglrx*
If installed using the ATI installer downloaded from amd.com:

Code: Select all

$ sudo sh /usr/share/ati/fglrx-uninstall.sh
fglrx also generates a xorg.conf file which you won't need anymore and leaving as it is will actually crash your X on boot. Remove or backup this in case you want to roll back:

Code: Select all

$ sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.fglrx
At this point you might want to reboot to ensure everything went well. Your X should start using either the intel or radeon driver, depending on your integrated GPU.

[3] Xorg 1.14

In order to use the radeon driver with a muxless system you will need to upgrade your X server to 1.14. Fortunately, there's a ppa that will help you do it the easy way. It should also be installed in Ubuntu 13.10 (and, hopefully, by extension in LM 16) making this even easier. You can find the ppa at https://launchpad.net/~canonical-x/+archive/x-staging

Code: Select all

$ sudo apt-add-repository ppa:canonical-x/x-staging
$ sudo apt-get update
$ sudo apt-get dist-upgrade
Make sure that xserver-xorg-video-ati (and xserver-xorg-video-intel if needed) are installed. For some reason they didn't install by default for me. To fix this:

Code: Select all

$ sudo apt-get install xserver-xorg-video-ati
$ sudo apt-get install xserver-xorg-video-intel
At this point you should reboot again to ensure everything went well. As before, X should start up and use your integrated GPU.

[4] vgaswitcheroo and PRIME

First thing you should check is if your discrete GPU is even turned on. By default it should be off.

Code: Select all

$ sudo su
# cat /sys/kernel/debug/vgaswitcheroo/switch 
0:IGD:+:Pwr:0000:00:02.0
1:DIS: :Pwr:0000:01:00.0
The above output is what you should get if your discrete GPU is on (third line). The + sign indicates which GPU is currently used, in this case it's the integrated GPU.

For more info on vgaswitcheroo see https://help.ubuntu.com/community/HybridGraphics

MUXED SYSTEMS:

WARNING: I did NOT test this. Please report if it worked/didn't work and I will update this section of the tutorial.

At this point you should be able to just turn your discrete graphics on, restart X and have it working:

Code: Select all

# echo DDIS > /sys/kernel/debug/vgaswitcheroo/switch
This command will instruct your system to activate your discrete GPU next time X starts. Just log off and log back in again to trigger this.

If you want to disable your discrete GPU to get more battery life from your laptop:

Code: Select all

# echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
Log out and log in again for changes to take effect.

MUXLESS SYSTEMS

First thing you need to do is turn on your discrete GPU if it's not turned on already:

Code: Select all

# echo ON > /sys/kernel/debug/vgaswitcheroo/switch
Verify that this worked by issuing this command again:

Code: Select all

# cat /sys/kernel/debug/vgaswitcheroo/switch
Now, we have to know IDs that xrandr assigned to your cards. Do this as the regular user again, not root:

Code: Select all

$ xrandr --listproviders
Providers: number : 3
Provider 0: id: 108 cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 3 outputs: 4 associated providers: 2 name:Intel
Provider 1: id: 69 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 6 outputs: 0 associated providers: 2 name:radeon
Provider 2: id: 69 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 6 outputs: 0 associated providers: 2 name:radeon
In my case 3 cards get listed. Notice that both provides 1 and 2 have the same id. In this case my discrete card has id 69 and my integrated card has id 108.

Last thing we need it to tell X to use your discrete GPU for rendering:

Code: Select all

$ xrandr --setprovideroffloadsink 69 108
Where the first number is your discrete card and the second one is your integrated card. To verify this worked:

Code: Select all

$ DRI_PRIME=1 glxinfo | grep renderer
OpenGL renderer string: Gallium 0.4 on AMD TURKS
You should get Gallium 0.4 as your renderer. From now on all your 3D apps will be rendered on your ATI card, no need to restart X.

This has been tested on a Radeon HD 7670M and a i5 IvyBridge CPU. I have experienced similar or even better performance in both native games and wine compared to using the proprietary fglrx driver.

If you have any additional info, helpful scripts or any other feedback please post and I will update this tutorial.

Happy gaming :)

EDIT: Whoops, wrong section... can a mod please move this to proper subforum? Thanks.

Re: [HOWTO] ATI hybrid graphics with open source radeon driv

Posted: Thu Feb 06, 2014 4:19 pm
by halfgaar
Thanks, I wish I could upvote here :)

However, what does one do if you have no vgaswitcheroo? I have a Samsung Series 7 730U (NP730U3E to be exact) with Radeon HD 8730M video, and especially since Mint 16, it's a hot, noisy, coal with short battery life. I wish to turn off the Radeon HD 8730M alltogether. But, I have no vgaswitcheroo...

fglrx-pxpress doesn't work. I just crashes without error message. And, I guess it's for the fgrlx driver, which also doesn't seem to work for the 8000 series Radeon.

(edit, BTW: linux mint 16, xorg 1.14, xserver-xorg-video-ati 1:7.2.0-0ubuntu10, kernel 3.11)

Re: [HOWTO] ATI hybrid graphics with open source radeon driv

Posted: Thu Feb 06, 2014 4:43 pm
by Onyx47
halfgaar wrote: However, what does one do if you have no vgaswitcheroo?
Yeah... I already wrote a complete reply and decided to hit up Google since I remembered reading something about 3.12 kernel power management changes.

The good news is, this should all automagically work now.
The bad news is, seems to be broken for mobility Radeon 7xxx. Fun.

See http://phoronix.com/forums/showthread.p ... sappearing

So yeah, this tutorial is now obsolete if you're running LM 16. Hopefully this gets fixed soon. I'm on LM 15 still myself, and in the light of this I think I'm postponing the upgrade for now, even though the 3.12 kernel was my main reason to upgrade until now. :(

EDIT: I just noticed you said your kernel was 3.11, not 3.12, not sure when changes hit, but check if your symptoms match those in the linked thread.

Re: [HOWTO] ATI hybrid graphics with open source radeon driv

Posted: Fri Feb 07, 2014 4:07 am
by halfgaar
I was reading up on Radeon power management. I enabled it by adding radeon.dpm=1 as kernel boot parameter in /etc/default/grub. Dmesg says it's enabled, and idle power use is now about 13W (which is about the same as it was with LM 15). It was about 18-19W without dpm. I still have to experiment with the tunables, though.

If I remember correctly, I also read that kernel 3.12 provides battery life on par with Windows (at least for people with an i5 or i7 and muxless Radeon chip, I think). Kernel 3.13 has the radeon.dpm enabled by default. I'm considering upgrading the kernel with a PPA.

Re: [HOWTO] ATI hybrid graphics with open source radeon driver

Posted: Tue Jan 30, 2018 5:02 am
by Cyberat
Hello,

Same problem here, Acer Aspire 7750G laptop, 2nd Gen. Sandybridge I-5 2450 CPU, AMD HD Radeon 7670/7760 (Thames).
I have followed many instructions and have re-installed Linux Mint (the only non-Unity distro to have for a capable PC ;-p) 5 times already, including everything listed on this page and I still have no clue where I stand, as to which GPU is being used.
I have the InsydeH2O Bios (do not get the wrong version not even 0.0001 off, if you don't find it move on) and had no problems with it in the past, in Windows I have had Leshcat 14.4 drivers (Intel installs first then AMD, last version that allows manual GPU switch over, would be great if they release their code for Linux Developers) working in "Muxed" mode. Now in Linux "Muxless" Dynamic seems to boot faster and be snappier. Which Bios mode is best for Linux Mint and how do I test what is used ? So far I had a decrease in performance on Steam Games I had for Windows, those that installed, the ones that did not install required directx 9/11 and may or may not work on opengl but refused to install (ex. - Skyrim V, Train Simulator, STO).
VGA Switcheroo seems to have done only one thing in Muxless Mode, switch the listing cards, but not activate the discrete:

0:DIS: :DynOff:0000:01:00.0
1:IGD:+:Pwr:0000:00:02.0

Here is my DRI_PRIME output:

GLX_MESA_multithread_makecurrent, GLX_MESA_query_renderer,
GLX_MESA_multithread_makecurrent, GLX_MESA_query_renderer,
Extended renderer info (GLX_MESA_query_renderer):
OpenGL renderer string: AMD TURKS (DRM 2.50.0 / 4.13.0-32-generic, LLVM 5.0.0)

I am hoping to be good now, but "Turks" is the wrong name label, inxi -SGx says otherwise:

System: Host: Cyberats Kernel: 4.13.0-32-generic x86_64 (64 bit gcc: 5.4.0)
Desktop: Cinnamon 3.6.7 (Gtk 3.18.9-1ubuntu3.3)
Distro: Linux Mint 18.3 Sylvia
Graphics: Card-1: Intel 2nd Generation Core Processor Family Integrated Graphics Controller
bus-ID: 00:02.0
Card-2: Advanced Micro Devices [AMD/ATI] Thames [Radeon HD 7500M/7600M Series]
bus-ID: 01:00.0
Display Server: X.Org 1.18.4 drivers: ati,radeon,intel (unloaded: fbdev,vesa)
Resolution: 1920x1080@60.00hz
GLX Renderer: Mesa DRI Intel Sandybridge Mobile
GLX Version: 3.0 Mesa 17.2.4 Direct Rendering: Yes

Any help will be appreciated, but I am reluctant to do something to upset Xorg again and reinstall the whole OS.

Thank You,
C.R.
PS: Also, in all configurations, good/bad/ugly, I seem to have a diagonal screen tear when scrolling pages, Compositing On or Off no difference.