AMD APU+AMD GPU Laptop - Can't turn on dedicated graphics

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
rdlf4
Level 2
Level 2
Posts: 72
Joined: Sun Jul 02, 2017 9:53 pm

AMD APU+AMD GPU Laptop - Can't turn on dedicated graphics

Post by rdlf4 »

Hello there.

So I bought this 2018 Acer Aspire 5 laptop with AMD A12 APU, featuring, according to

Code: Select all

xrandr --listproviders
the following GPUs:
Providers: number : 2
Provider 0: id: 0x79 cap: 0x9, Source Output, Sink Offload crtcs: 3 outputs: 2 associated providers: 1 name:AMD Radeon R7 Graphics @ pci:0000:00:01.0
Provider 1: id: 0x44 cap: 0x6, Sink Output, Source Offload crtcs: 5 outputs: 0 associated providers: 1 name:Radeon 500 Series @ pci:0000:03:00.0
And the reason I made this thread is because I just can't turn on my dedicated graphics card (AMD Radeon RX540).
I've asked away on Ubuntu, talked to a few people on Hexchat and I was pointed to very old forum threads when the fglrx and radeonsi drivers were around.
But mine is using amdgpu, so I'm afraid the solution differs a little. In other words, I need an updated solution to this issue.
Here are a few details I believe could help:

If I do

Code: Select all

echo ON > /sys/kernel/debug/vgaswitcheroo/switch
and then check back, nothing changes, as the terminal outputs:

Code: Select all

root@rodolfo-Aspire-A515-41G:/home/rodolfo# cat /sys/kernel/debug/vgaswitcheroo/switch 
0:IGD:+:Pwr:0000:00:01.0
1:DIS: :DynOff:0000:03:00.0
I've also checked Prime https://wiki.archlinux.org/index.php/AT ... _switching as well as https://help.ubuntu.com/community/Hybri ... switcheroo but no dice. Echoing DIS or ON does nothing so my guess is either this device has to be enabled first or I'm missing something.
This 2015 thread https://ubuntuforums.org/showthread.php?t=2304265 suggests to add a parameter to GRUB, which I believe is the only way to go about this situation, but haven't tried it myself just yet.

For reference, these are my machine's specs:
root@rodolfo-Aspire-A515-41G:/home/rodolfo# inxi -Fz
System: Host: rodolfo-Aspire-A515-41G Kernel: 4.15.0-38-generic x86_64 bits: 64 Console: tty 0
Distro: Linux Mint 19 Tara
Machine: Device: laptop System: Acer product: Aspire A515-41G v: V1.06 serial: <filter>
Mobo: BR model: Wartortle_BS v: V1.06 serial: <filter> UEFI [Legacy]: Insyde v: V1.06 date: 09/27/2017
Battery BAT1: charge: 13.6 Wh 28.5% condition: 47.7/48.9 Wh (97%)
CPU: Quad core AMD A12-9720P RADEON R7 12 COMPUTE CORES 4C+8G (-MCP-) cache: 4096 KB
clock speeds: max: 2700 MHz 1: 1613 MHz 2: 1580 MHz 3: 1413 MHz 4: 1418 MHz
Graphics: Card-1: Advanced Micro Devices [AMD/ATI] Carrizo
Card-2: Advanced Micro Devices [AMD/ATI] Polaris12
Display Server: X.Org 1.19.6 drivers: ati,amdgpu (unloaded: modesetting,fbdev,vesa,radeon)
Resolution: 1366x768@59.97hz
OpenGL: renderer: AMD Radeon R7 Graphics (CARRIZO / DRM 3.23.0 / 4.15.0-38-generic, LLVM 6.0.0)
version: 4.5 Mesa 18.0.5
Audio: Card-1 Advanced Micro Devices [AMD] Device 157a driver: snd_hda_intel
Card-2 Advanced Micro Devices [AMD/ATI] Kabini HDMI/DP Audio driver: snd_hda_intel
Sound: Advanced Linux Sound Architecture v: k4.15.0-38-generic
Network: Card-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller driver: r8169
IF: enp1s0f1 state: down mac: <filter>
Card-2: Qualcomm Atheros QCA9377 802.11ac Wireless Network Adapter driver: ath10k_pci
IF: wlp2s0 state: up mac: <filter>
Drives: HDD Total Size: 1000.2GB (5.6% used)
ID-1: /dev/sda model: WDC_WD10SPZX size: 1000.2GB
Partition: ID-1: / size: 195G used: 53G (29%) fs: ext4 dev: /dev/sda3
RAID: No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors: System Temperatures: cpu: 0.0C mobo: N/A gpu: 46.0,N/A
Fan Speeds (in rpm): cpu: N/A
Info: Processes: 235 Uptime: 4:36 Memory: 2905.2/7495.2MB Client: Shell (bash) inxi: 2.3.56
It goes without saying that, because my dedicated video card is off, my tests with DRI_PRIME=1 are basically just reflecting the results of my integrated video card.
Is there away to enable/turn on my dedicated video card? Again, there is no proprietary driver from AMD on this laptop, because they have never ever released a single driver for their own APU series on any Linux Distro, according to their own Download page.

I need this to work, it's the ONLY thing keeping me coming back to Windows when I want to game.
Thank you.
Last edited by SMG on Wed Feb 02, 2022 2:01 pm, edited 1 time in total.
Reason: Locking the topic due to the age of the topic.
User avatar
roblm
Level 15
Level 15
Posts: 5939
Joined: Sun Feb 24, 2013 2:41 pm

Re: AMD APU+AMD GPU Laptop - Can't turn on dedicated graphics

Post by roblm »

Use this command: xrandr --setprovideroffloadsink 1 0

Then post the outputs of using these two commands:
glxinfo | grep "OpenGL renderer"
DRI_PRIME=1 glxinfo | grep "OpenGL renderer"
rdlf4
Level 2
Level 2
Posts: 72
Joined: Sun Jul 02, 2017 9:53 pm

Re: AMD APU+AMD GPU Laptop - Can't turn on dedicated graphics

Post by rdlf4 »

roblm wrote: Sun Nov 04, 2018 2:43 pm Use this command: xrandr --setprovideroffloadsink 1 0

Then post the outputs of using these two commands:
glxinfo | grep "OpenGL renderer"
DRI_PRIME=1 glxinfo | grep "OpenGL renderer"

Code: Select all

rodolfo@rodolfo-Aspire-A515-41G:~$  glxinfo | grep "OpenGL renderer"
OpenGL renderer string: AMD Radeon R7 Graphics (CARRIZO / DRM 3.23.0 / 4.15.0-38-generic, LLVM 6.0.0)
rodolfo@rodolfo-Aspire-A515-41G:~$  DRI_PRIME=1 glxinfo | grep "OpenGL renderer"OpenGL renderer string: Radeon 500 Series (POLARIS12 / DRM 3.23.0 / 4.15.0-38-generic, LLVM 6.0.0)
It seems to be OK at this point. I for one would believe it's somehow turned my dedicated graphics on and switched to it as the primary GPU renderer.
However, if I do this next:

Code: Select all

rodolfo@rodolfo-Aspire-A515-41G:~$ DRI_PRIME=1 glxgears
I still get:

Code: Select all

304 frames in 5.0 seconds = 60.690 FPS
So no, my dedicated card is doing nothing. That's pretty much my integrated one's performance result.
User avatar
roblm
Level 15
Level 15
Posts: 5939
Joined: Sun Feb 24, 2013 2:41 pm

Re: AMD APU+AMD GPU Laptop - Can't turn on dedicated graphics

Post by roblm »

Your inxi output doesn’t say which Mint edition is installed, probably because you used inxi -Fz instead of inxi -Fxz, but I assume it’s Cinnamon.

This web page has info on PRIME GPU Offloading: https://wiki.archlinux.org/index.php/PRIME

It says under the section Black screen with GL-based compositors:
Currently there are issues with GL-based compositors and PRIME offloading. While Xrender-based compositors (xcompmgr, xfwm, compton's default backend, cairo-compmgr, and a few others) will work without issue, GL-based compositors (Mutter/muffin, Compiz, compton with GLX backend, Kwin's OpenGL backend, etc) will initially show a black screen, as if there was no compositor running. While you can force an image to appear by resizing the offloaded window, this is not a practical solution as it will not work for things such as full screen Wine applications. This means that desktop environments such as GNOME3 and Cinnamon have issues with using PRIME offloading.

You could run a Live Session using an Xfce or MATE USB / DVD, which have options for different Window Managers and run glxgears.

I also suggest running another more 3D graphics demanding test with the benchmark glmark2. Install it with the command
apt install glmark2
Start the program twice with the commands glmark2 and DRI_PRIME=1 glmark2 and get the final scores.
rdlf4
Level 2
Level 2
Posts: 72
Joined: Sun Jul 02, 2017 9:53 pm

Re: AMD APU+AMD GPU Laptop - Can't turn on dedicated graphics

Post by rdlf4 »

roblm wrote: Sun Nov 04, 2018 3:56 pm Your inxi output doesn’t say which Mint edition is installed, probably because you used inxi -Fz instead of inxi -Fxz, but I assume it’s Cinnamon.

This web page has info on PRIME GPU Offloading: https://wiki.archlinux.org/index.php/PRIME

It says under the section Black screen with GL-based compositors:
Currently there are issues with GL-based compositors and PRIME offloading. While Xrender-based compositors (xcompmgr, xfwm, compton's default backend, cairo-compmgr, and a few others) will work without issue, GL-based compositors (Mutter/muffin, Compiz, compton with GLX backend, Kwin's OpenGL backend, etc) will initially show a black screen, as if there was no compositor running. While you can force an image to appear by resizing the offloaded window, this is not a practical solution as it will not work for things such as full screen Wine applications. This means that desktop environments such as GNOME3 and Cinnamon have issues with using PRIME offloading.

You could run a Live Session using an Xfce or MATE USB / DVD, which have options for different Window Managers and run glxgears.

I also suggest running another more 3D graphics demanding test with the benchmark glmark2. Install it with the command
apt install glmark2
Start the program twice with the commands glmark2 and DRI_PRIME=1 glmark2 and get the final scores.
Well I'm using Linux Mint Tara 64-bit with MATE as my DE.
I might install XFCE and switch to it on my login screen. That way we might be able to figure out whether RX540 will perform as expected, but the primary issue remains: how am I going to power it on? I've been following the same page you mentioned and while I'm still unable to do that, I can tell vgaswitcheroo is not ideal, probably because it's too outdated to deal with my hardware.
Do you have any suggestions as to how I can power on a 2018 dedicated video card from AMD?
User avatar
roblm
Level 15
Level 15
Posts: 5939
Joined: Sun Feb 24, 2013 2:41 pm

Re: AMD APU+AMD GPU Laptop - Can't turn on dedicated graphics

Post by roblm »

Since MATE is installed, you could try different Window Managers under Preferences > Desktop Settings > Windows > Window Manager.

vga_switcheroo is the kernel mechanism that allows you to switch between GPUs but only if your machine has a hardware switch called a mux.

Most laptops today with hybrid graphics don’t have one. It’s in some higher end and gaming models. If it did, then there would be a setting in the BIOS to select either Hybrid Graphics or Discrete Graphics or an actual switch on the laptop.

From my understanding of the line 1:DIS: :DynOff:0000:03:00.0, the discrete card is dynamically powered off and will be automatically powered on when needed, such as when DRI_PRIME=1 is used.
rdlf4
Level 2
Level 2
Posts: 72
Joined: Sun Jul 02, 2017 9:53 pm

Re: AMD APU+AMD GPU Laptop - Can't turn on dedicated graphics

Post by rdlf4 »

roblm wrote: Sun Nov 04, 2018 4:34 pm Since MATE is installed, you could try different Window Managers under Preferences > Desktop Settings > Windows > Window Manager.
Yeah. That's correct, unfortunately. I say 'unfortunately' because Compiz is the only WM that makes screen tearing disappear when scrolling web pages, watching to moves, etc. Yeah, you read that right. SCREEN TEARING in Linux Mint in 2018. *sigh*
vga_switcheroo is the kernel mechanism that allows you to switch between GPUs but only if your machine has a hardware switch called a mux.

Most laptops today with hybrid graphics don’t have one. It’s in some higher end and gaming models. If it did, then there would be a setting in the BIOS to select either Hybrid Graphics or Discrete Graphics or an actual switch on the laptop.
Would you believe if I told you that I was digging through mailing Lists and Documentation from AMD in order to find an association between their newest Dedicated graphics on mobile laptops and switcheroo? I know it sounds crazy, but talk about a desperate guy trying to find a light at the end of the tunnel...
From my understanding of the line 1:DIS: :DynOff:0000:03:00.0, the discrete card is dynamically powered off and will be automatically powered on when needed, such as when DRI_PRIME=1 is used.
Bingo!! There you go. THAT'S E-X-A-C-T-L-Y what I needed to read. Now, after that I moved on, and did the following:
So the next thing I do is go to my window manager and change it to Marco+Compositing.
Back to the Terminal, I do DRI_PRIME=1 glxgears
Same result, around 67FPS.

I made sure RX540 is handling it with xrandr --setprovideroffloadsink 1 0
Double-check it with DRI_PRIME=1 glxinfo | grep "OpenGL renderer"
Tried it again. Same thing.

"Oh well, glxgears has been buggy for years" -- someone told me on the forums back when I was using Ubuntu Precise Pangolin. So I did something else.
I downloaded GLMark2 as you suggested and I was like "OK..well my R7 M400 could've done that."
So I opened it using the terminal with:

Code: Select all

DRI_PRIME=1 glmark2
And then I was blown away, as I saw the performance output:
[build] use-vbo=false: FPS: 402 FrameTime: 2.488 ms
[build] use-vbo=true: FPS: 488 FrameTime: 2.049 ms
[texture] texture-filter=nearest: FPS: 461 FrameTime: 2.169 ms
[texture] texture-filter=linear: FPS: 549 FrameTime: 1.821 ms
[texture] texture-filter=mipmap: FPS: 623 FrameTime: 1.605 ms
[shading] shading=gouraud: FPS: 642 FrameTime: 1.558 ms
[shading] shading=blinn-phong-inf: FPS: 662 FrameTime: 1.511 ms
[shading] shading=phong: FPS: 677 FrameTime: 1.477 ms
[shading] shading=cel: FPS: 640 FrameTime: 1.562 ms
Plus, my laptop was sounding like it was going to take off. That gave me a smile.
Opened up Steam, made sure my games (Euro Truck Simulator, Tomb Raider) had the 'DRI_PRIME=1 %command%' parameter set for the launcher and I was a happy gamer again. Oh and BTW I had my mind set that my dedicated GPU should be turned on manually. I did not believe the system would offload a task to it if it wasn't on. So thank you for telling me that.
I just find it real sad AMD has been making us go through this for YEARS (I mean it, I saw posts from 2012) and this is still a thing in 2018. Not only that, they've also made understanding their own previous drivers a mess with radeonsi, fglrx, amdgpu, amdgpu-pro. Talk about a company that not only doesn't help, but also makes things even more complicated than they have to be.
Anyway, thanks again :mrgreen:
User avatar
roblm
Level 15
Level 15
Posts: 5939
Joined: Sun Feb 24, 2013 2:41 pm

Re: AMD APU+AMD GPU Laptop - Can't turn on dedicated graphics

Post by roblm »

I was going to say PRIME GPU Offloading must only work with intel+radeon (or amdgpu) or intel+nouveau, but then I found this web page, but it’s from 2014:
https://askubuntu.com/questions/484606/ ... oesnt-work

The suggestion was to use Xfce and this format for the xrandr command (substituting your info):

xrandr --setprovideroffloadsink 0x44 0x79

In Xfce under Desktop Settings you can switch Window Managers but there is also this option in Settings > Window Manager Tweaks > Compositor for Enable display compositing.

MATE also has the option in Preferences > Windows for Enable software compositing window manager.

You can try different Window Managers with the Enable compositing turned on and off.
rdlf4
Level 2
Level 2
Posts: 72
Joined: Sun Jul 02, 2017 9:53 pm

Re: AMD APU+AMD GPU Laptop - Can't turn on dedicated graphics

Post by rdlf4 »

The only issue I'm having right now is with cpufreq.
Which is weird, 'cause I could swear I was able to change my CPU scaling monitor from powersave all the way up to performance, even when my laptop was running on battery. Now, using the CPU Frequency monitor applet, it only changes if I choose Powersave (1.4Ghz) and Performance (1.8Ghz); If I go for Ondemand or maximum speed (2.7Ghz), it will just sit on 1.8Ghz. I wonder what is telling the system to stay at 1.8Ghz? Why is this happening?
User avatar
roblm
Level 15
Level 15
Posts: 5939
Joined: Sun Feb 24, 2013 2:41 pm

Re: AMD APU+AMD GPU Laptop - Can't turn on dedicated graphics

Post by roblm »

I get the same results with my laptop using Cinnamon on AC or battery power. Only the Powersave and Performance settings work. I used commands in the Terminal. The first command sets the CPU governor, followed by the inxi -C command, which lists the frequencies of all cores:

echo "performance" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
performance

inxi -C
CPU: Quad core Intel Core i5-8250U (-MT-MCP-) cache: 6144 KB
clock speeds: max: 3400 MHz 1: 3402 MHz 2: 3401 MHz 3: 3400 MHz 4: 3408 MHz 5: 3400 MHz 6: 3400 MHz
7: 3400 MHz 8: 3400 MHz


echo "powersave" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
powersave

inxi -C
CPU: Quad core Intel Core i5-8250U (-MT-MCP-) cache: 6144 KB
clock speeds: max: 3400 MHz 1: 800 MHz 2: 800 MHz 3: 800 MHz 4: 800 MHz 5: 800 MHz 6: 799 MHz
7: 800 MHz 8: 800 MHz


echo "ondemand" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
ondemand
tee: /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor: Invalid argument
tee: /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor: Invalid argument
tee: /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor: Invalid argument
tee: /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor: Invalid argument
tee: /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor: Invalid argument
tee: /sys/devices/system/cpu/cpu5/cpufreq/scaling_governor: Invalid argument
tee: /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor: Invalid argument
tee: /sys/devices/system/cpu/cpu7/cpufreq/scaling_governor: Invalid argument
rdlf4
Level 2
Level 2
Posts: 72
Joined: Sun Jul 02, 2017 9:53 pm

Re: AMD APU+AMD GPU Laptop - Can't turn on dedicated graphics

Post by rdlf4 »

I'm working on this. I will have developed and reported some updates later today.
rdlf4
Level 2
Level 2
Posts: 72
Joined: Sun Jul 02, 2017 9:53 pm

Re: AMD APU+AMD GPU Laptop - Can't turn on dedicated graphics

Post by rdlf4 »

For those who are interested in the answer, please read the reply that I have posted to my own question on Askubuntu:
https://askubuntu.com/questions/1090380 ... 05#1090905
User avatar
roblm
Level 15
Level 15
Posts: 5939
Joined: Sun Feb 24, 2013 2:41 pm

Re: AMD APU+AMD GPU Laptop - Can't turn on dedicated graphics

Post by roblm »

What is the output of this command:
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_governors

Select performance from the CPU Frequency panel applet and then post the output of this command: inxi -C

Then use this command:
echo "performance" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

See if you get the same output from using inxi -C.
rdlf4
Level 2
Level 2
Posts: 72
Joined: Sun Jul 02, 2017 9:53 pm

Re: AMD APU+AMD GPU Laptop - Can't turn on dedicated graphics

Post by rdlf4 »

roblm wrote: Wed Nov 07, 2018 5:29 pm What is the output of this command:
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_governors

Code: Select all

-> The outputs below are taken while the laptop is discharging.
rodolfo@rodolfo-Aspire-A515-41G:~$  cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_governors
conservative ondemand userspace powersave performance schedutil 
conservative ondemand userspace powersave performance schedutil 
conservative ondemand userspace powersave performance schedutil 
conservative ondemand userspace powersave performance schedutil 
Select performance from the CPU Frequency panel applet and then post the output of this command: inxi -C
Here you go:

Code: Select all

rodolfo@rodolfo-Aspire-A515-41G:~$ inxi -C
CPU:       Quad core AMD A12-9720P RADEON R7 12 COMPUTE CORES 4C+8G (-MCP-) cache: 4096 KB
           clock speeds: max: 2700 MHz 1: 1792 MHz 2: 1791 MHz 3: 1784 MHz 4: 1773 MHz
Then use this command:
echo "performance" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

See if you get the same output from using inxi -C.
They look the same to me.

Code: Select all

rodolfo@rodolfo-Aspire-A515-41G:~$  echo "performance" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
[sudo] password for rodolfo: 
performance
rodolfo@rodolfo-Aspire-A515-41G:~$ inxi -C
CPU:       Quad core AMD A12-9720P RADEON R7 12 COMPUTE CORES 4C+8G (-MCP-) cache: 4096 KB
           clock speeds: max: 2700 MHz 1: 1773 MHz 2: 1766 MHz 3: 1793 MHz 4: 1779 MHz
User avatar
roblm
Level 15
Level 15
Posts: 5939
Joined: Sun Feb 24, 2013 2:41 pm

Re: AMD APU+AMD GPU Laptop - Can't turn on dedicated graphics

Post by roblm »

I got the same glmark2 scores when either the governor was set to powersave or performance, so glmark2 only tests GPU performance.

When you change the /sys/module/processor/parameters/ignore_ppc setting from 0 to 1, do you see a different output in this command:

Code: Select all

cat /sys/devices/system/cpu/cpu*/cpufreq/bios_limit

Here is some info that hopefully will be helpful from this web page, under the section 2.3 Userspace:
https://www.kernel.org/doc/Documentatio ... ernors.txt
The CPUfreq governor "userspace" allows the user, or any userspace
program running with UID "root", to set the CPU to a specific frequency
by making a sysfs file "scaling_setspeed" available in the CPU-device
directory.

First change the ignore_ppc setting from 0 to 1, if not already using that setting.

Set the governor to userspace:

Code: Select all

echo "userspace" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

Use this command to try setting the frequency to 2.7 GHz:

Code: Select all

echo "2700000" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed

Check if the setting was changed:

Code: Select all

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed
rdlf4
Level 2
Level 2
Posts: 72
Joined: Sun Jul 02, 2017 9:53 pm

Re: AMD APU+AMD GPU Laptop - Can't turn on dedicated graphics

Post by rdlf4 »

roblm wrote: Fri Nov 09, 2018 2:18 pm I got the same glmark2 scores when either the governor was set to powersave or performance, so glmark2 only tests GPU performance.
If your statement is true, then whatever is limiting CPU performance also does does have an impact on the GPU's as well.
I'm afraid this has something to do with the amdgpu driver.
When you change the /sys/module/processor/parameters/ignore_ppc setting from 0 to 1, do you see a different output in this command:

Code: Select all

cat /sys/devices/system/cpu/cpu*/cpufreq/bios_limit
With ignore_ppc set to 0:

Code: Select all

rodolfo@rodolfo-Aspire-A515-41G:~$ cat /sys/devices/system/cpu/cpu*/cpufreq/bios_limit
1800000
1800000
1800000
1800000
And, with ignore_ppc set to 1, it gives me the same result. Which is weird.
But if I select a governor(like 'performance') and do:

Code: Select all

root@rodolfo-Aspire-A515-41G:/home/rodolfo# sudo cpupower frequency-set --max 2700000 --min 1800000
Setting cpu: 0
Setting cpu: 1
Setting cpu: 2
Setting cpu: 3
It will push the cpu frequency to 2.65Ghz to 2.88Ghz for 'performance'.
'ondemand' will fluctuate. It goes from 1.8Ghz all th way up to 2.7Ghz.
However, cat /sys/devices/system/cpu/cpu*/cpufreq/bios_limit will still output the same result as mentioned before.
So, after changing ignore_ppc to 1 and setting the cpu frequency values from 1.8Ghz to 2.7Ghz with 'performance' governor, I did cpufreq-info, which showed:

Code: Select all

root@rodolfo-Aspire-A515-41G:/home/rodolfo# cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 4.0 us.
  hardware limits: 1.40 GHz - 2.70 GHz
  available frequency steps: 2.70 GHz, 2.30 GHz, 1.80 GHz, 1.40 GHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance, schedutil
  current policy: frequency should be within 1.80 GHz and 2.70 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 1.80 GHz (asserted by call to hardware).
  cpufreq stats: 2.70 GHz:1,67%, 2.30 GHz:0,04%, 1.80 GHz:49,40%, 1.40 GHz:48,89%  (25337)
analyzing CPU 1:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 1
  CPUs which need to have their frequency coordinated by software: 1
  maximum transition latency: 4.0 us.
  hardware limits: 1.40 GHz - 2.70 GHz
  available frequency steps: 2.70 GHz, 2.30 GHz, 1.80 GHz, 1.40 GHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance, schedutil
  current policy: frequency should be within 1.80 GHz and 2.70 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 1.80 GHz (asserted by call to hardware).
  cpufreq stats: 2.70 GHz:1,68%, 2.30 GHz:0,04%, 1.80 GHz:48,79%, 1.40 GHz:49,50%  (22555)
analyzing CPU 2:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 2
  CPUs which need to have their frequency coordinated by software: 2
  maximum transition latency: 4.0 us.
  hardware limits: 1.40 GHz - 2.70 GHz
  available frequency steps: 2.70 GHz, 2.30 GHz, 1.80 GHz, 1.40 GHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance, schedutil
  current policy: frequency should be within 1.80 GHz and 2.70 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 1.80 GHz (asserted by call to hardware).
  cpufreq stats: 2.70 GHz:1,70%, 2.30 GHz:0,05%, 1.80 GHz:51,09%, 1.40 GHz:47,16%  (26884)
analyzing CPU 3:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 3
  CPUs which need to have their frequency coordinated by software: 3
  maximum transition latency: 4.0 us.
  hardware limits: 1.40 GHz - 2.70 GHz
  available frequency steps: 2.70 GHz, 2.30 GHz, 1.80 GHz, 1.40 GHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance, schedutil
  current policy: frequency should be within 1.80 GHz and 2.70 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 1.80 GHz (asserted by call to hardware).
  cpufreq stats: 2.70 GHz:1,68%, 2.30 GHz:0,04%, 1.80 GHz:48,95%, 1.40 GHz:49,33%  (20352)




Here is some info that hopefully will be helpful from this web page, under the section 2.3 Userspace:
https://www.kernel.org/doc/Documentatio ... ernors.txt
The CPUfreq governor "userspace" allows the user, or any userspace
program running with UID "root", to set the CPU to a specific frequency
by making a sysfs file "scaling_setspeed" available in the CPU-device
directory.

First change the ignore_ppc setting from 0 to 1, if not already using that setting.

Set the governor to userspace:

Code: Select all

echo "userspace" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

Use this command to try setting the frequency to 2.7 GHz:

Code: Select all

echo "2700000" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed

Check if the setting was changed:

Code: Select all

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed
It did:

Code: Select all

root@rodolfo-Aspire-A515-41G:/home/rodolfo# echo "2700000" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed
2700000
root@rodolfo-Aspire-A515-41G:/home/rodolfo# cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed
2700000
2700000
2700000
2700000
However, performance when rendering graphics is very very similar (not to say the same) when I choose, 'ondemand', 'performance' or 'schedutil'.
Tomb Raider benchmark will give 36FPS average.
Euro Truck Simulator will go from 13 to 34FPS.
[all results mentioned were taken while the laptop was discharging]

Those results pale in comparison to the machine when it's charging.
I'm not saying that it hands the job to my iGPU (Radeon R7 M440) because it doesn't: games have 'DRI_PRIME=1 %command%' set as the launcher parameters, so they're going with RX540. Which is... confusing.
It's almost as if the CPU was doing fine under heavy load, but the dGPU had some kind of limitation when it's running on battery. If so, why does it perform like a champ when its discharging or recharging on Windows? Is it because of Radeon Software (for handling the gpu frequency and voltage)? Well that wouldn't make much sense, because this is exactly what amdgpu is supposed to be doing: if this computer outperforms its own performance on battery, that's because something *else* might be boosting the GPU performance. I'm not sure it's got something to do with the CPU, as long as the governor is set to either 'performance' (1.8-2.7) or 'ondemand' (same policy). I guess I'll be digging through amdgpu documentation to see if my suspicions make any sense this weekend. *sigh* it never ends man. Why can' there be an option with a check mark labelled "Enable overall laptop performance management", that when checked, would make the governors available to choose? But when it's unchecked, just leave the system alone and performing on battery just as much as it would when charging.
Oh well, I guess that'd be too easy.
rdlf4
Level 2
Level 2
Posts: 72
Joined: Sun Jul 02, 2017 9:53 pm

Re: AMD APU+AMD GPU Laptop - Can't turn on dedicated graphics

Post by rdlf4 »

Something else worth mentioning:
cpupower is broken if ignore_ppc is set to 1.
This can be proven by doing the following:
Edit the /sys/module/processor/parameters/ignore_ppc file and set it to 1.
Select a governor. For example, 'powersave'.
Then, run:

Code: Select all

sudo cpupower frequency-set --max 1400000 --min 1400000
While it will work, instead of applying this ONLY FOR the selected governor (powersave), it will be applied to all the governors.
So, if you change from 'powersave' to 'performance', the cpu frequency will not change. Unless ignore_ppc is set back to 0.
User avatar
roblm
Level 15
Level 15
Posts: 5939
Joined: Sun Feb 24, 2013 2:41 pm

Re: AMD APU+AMD GPU Laptop - Can't turn on dedicated graphics

Post by roblm »

I assume you wanted the CPU frequency to stay at the maximum for gaming, when using battery power. After setting the userspace governor and then setting the frequency to 2.7 GHz through scaling_setspeed, why didn't you test your games with those settings. Instead, you switched back to ondemand and performance to test games, which lowered the maximum frequency to 1.8 GHz again. I suggest leaving the governor on userspace and test game performance. If that helps, then you can make desktop launchers to switch from ondemand and userspace.
rdlf4
Level 2
Level 2
Posts: 72
Joined: Sun Jul 02, 2017 9:53 pm

Re: AMD APU+AMD GPU Laptop - Can't turn on dedicated graphics

Post by rdlf4 »

roblm wrote: Sat Nov 10, 2018 2:51 pm I assume you wanted the CPU frequency to stay at the maximum for gaming, when using battery power. After setting the userspace governor and then setting the frequency to 2.7 GHz through scaling_setspeed, why didn't you test your games with those settings. Instead, you switched back to ondemand and performance to test games, which lowered the maximum frequency to 1.8 GHz again. I suggest leaving the governor on userspace and test game performance.
The reason I did that was to see if I could get the same results with 'ondemand' or 'performance' the same way you did with userspace. Why? Because ondemand and performance can be selected from the panel, while userspace has to be used through the terminal. Anyway, it doesn't matter really, because in order to achieve maximum system performance when using the battery, it's still required to bypass BIOS restrictions with ignore_ppc set to 1, no matter which governor I choose to go with.

Now, about this:
If that helps, then you can make desktop launchers to switch from ondemand and userspace.
You mean I can specify a governor as a launcher's parameter? Is it possible then to start a game or an application and let it enable a governor and, after it's finished the system will switch back to the previous governor it was running with (prior to opening such application), without my intervention? (I mean, aside from setting the parameters.. you get the point)
User avatar
roblm
Level 15
Level 15
Posts: 5939
Joined: Sun Feb 24, 2013 2:41 pm

Re: AMD APU+AMD GPU Laptop - Can't turn on dedicated graphics

Post by roblm »

I don't know if the ignore_ppc parameter is needed when setting the cpufreq governor to userspace. If it is, then it can be made persistent by added it to the grub file. Use this command to open that file for editing:
xed admin:///etc/default/grub

Change this line:

Code: Select all

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
By adding processor.ignore_ppc=1:

Code: Select all

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash processor.ignore_ppc=1"
Use this command to update grub and reboot: sudo update-grub; reboot


Open the File Manager and create a new document by right clicking in the empty space and selecting Create Document > Empty file. Name it .userspace (the dot makes it hidden). Add these lines to the file:

Code: Select all

#!/bin/sh
echo "userspace" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor &&
echo "3500000" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed
Close the script, right click on it and select Properties > Permissions and mark the checkbox next to Allow executing file as program.

Right click on the desktop and select Create Launcher. Next to Name, type Userspace. Next to Command, add this line: mate-terminal -e "sudo sh /home/your-user-name/.userspace"

Change your-user-name to your actual user name. Right click on the launcher and select Properties > Permissions and mark the checkbox next to Allow executing file as program.


Repeat those steps to create a second script named .ondemand with these lines:

Code: Select all

#!/bin/sh
echo "ondemand" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
Create a second desktop launcher named Ondemand with this line for the Command:
mate-terminal -e "sudo sh /home/your-user-name/.ondemand"


The Userspace launcher can be activated before running games and the Ondemand launcher activated after running games.
Locked

Return to “Graphics Cards & Monitors”