How do you switch beetween hybrid graphic cards? (Solved)

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
User avatar
farkas
Level 5
Level 5
Posts: 552
Joined: Mon Sep 21, 2015 6:10 pm
Location: Oregon

How do you switch beetween hybrid graphic cards? (Solved)

Post by farkas »

I have a Dell Inspiron 5567 with hybrid graphics.
Intel Corporation HD Graphics 620 and AMD Radeo R7 M445.
When checking System Info it says the Intel graphics is enabled.
Can't find anyway to switch to it in System Settings.
In the Software Manager there is a driver
Xserver-xorg-video-radeon, X.Org X server --AMD/ATI Radeon display driver installed.
It also lists Xserver-xorg-video-redeon-hwe-16.04, should I install it.

I'd like to able to switch to the AMD card and if necessary back to Intel.

So far what seems to most helpful is a Ubuntu documentation at:

https://help.ubuntu.com/community/HybridGraphics

It was last updated 2015-09-16 06:33:06 which is quite a while ago.

It looks like the most promising solution that I have found.
It involves enabling vga_switcheroo
I followed the first steps,

To check whether your kernel is compiled with the proper option you can examine the file config-2.6.nn-mm-generic in the /boot directory:

sudo grep -i switcheroo /boot/config-*

steve@steve:~$ sudo grep -i switcheroo /boot/config-*
[sudo] password for steve:
/boot/config-4.15.0-20-generic:CONFIG_VGA_SWITCHEROO=y
/boot/config-4.15.0-34-generic:CONFIG_VGA_SWITCHEROO=y
/boot/config-4.15.0-36-generic:CONFIG_VGA_SWITCHEROO=y
steve@steve:~$

It looks like it can be done.
There is a big But because in the next steps I'd have to modify a grub file.
Very concerned about editing a grub file without someone more kowledgable examining this solution.
Do I need a newer or differnt video driver?
I would appreciate someone to look this over and give their opinion if this is viable solution or not or a better alternative.

Here is my sytem info:

steve@steve:~$ inxi -Fxz
System: Host: steve Kernel: 4.15.0-36-generic x86_64 bits: 64 gcc: 7.3.0
Desktop: Cinnamon 3.8.9 (Gtk 3.22.30-1ubuntu1)
Distro: Linux Mint 19 Tara
Machine: Device: laptop System: Dell product: Inspiron 5567 serial: N/A
Mobo: Dell model: 05VRRG v: A00 serial: N/A
UEFI: Dell v: 1.1.2 date: 04/10/2017
Battery BAT0: charge: 42.0 Wh 107.5% condition: 39.1/42.0 Wh (93%)
model: Samsung SDI DELL C4HCW6C status: Full
hidpp__0: charge: 95% condition: NA/NA Wh
model: Logitech M705 status: Discharging
CPU: Dual core Intel Core i7-7500U (-MT-MCP-)
arch: Kaby Lake rev.9 cache: 4096 KB
flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 11616
clock speeds: max: 3500 MHz 1: 2302 MHz 2: 1700 MHz 3: 1659 MHz
4: 1634 MHz
Graphics: Card-1: Intel HD Graphics 620 bus-ID: 00:02.0
Card-2: Advanced Micro Devices [AMD/ATI] Topaz XT [Radeon R7 M260/M265 / M340/M360 / M440/M445]
bus-ID: 01:00.0
Display Server: x11 (X.Org 1.19.6 )
drivers: modesetting,ati,amdgpu (unloaded: fbdev,vesa)
Resolution: 1600x900@59.95hz
OpenGL: renderer: Mesa DRI Intel HD Graphics 620 (Kaby Lake GT2)
version: 4.5 Mesa 18.0.5 Direct Render: Yes
Audio: Card Intel Sunrise Point-LP HD Audio
driver: snd_hda_intel bus-ID: 00:1f.3
Sound: Advanced Linux Sound Architecture v: k4.15.0-36-generic
Network: Card-1: Intel Wireless 3165 driver: iwlwifi bus-ID: 02:00.0
IF: wlp2s0 state: up mac: <filter>
Card-2: Realtek RTL8101/2/6E PCIE Fast/Gigabit Ethernet controller
driver: r8169 v: 2.3LK-NAPI port: d000 bus-ID: 03:00.0
IF: enp3s0 state: down mac: <filter>
Drives: HDD Total Size: 1000.2GB (5.7% used)
ID-1: /dev/sda model: TOSHIBA_MQ01ABD1 size: 1000.2GB
Partition: ID-1: / size: 900G used: 38G (5%) fs: ext4 dev: /dev/dm-0
ID-2: swap-1 size: 17.08GB used: 0.00GB (0%)
fs: swap dev: /dev/dm-1
RAID: No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors: System Temperatures: cpu: 38.0C mobo: N/A gpu: 41.0
Fan Speeds (in rpm): cpu: N/A
Info: Processes: 229 Uptime: 7:53 Memory: 3041.6/15939.6MB
Init: systemd runlevel: 5 Gcc sys: 7.3.0
Client: Shell (bash 4.4.191) inxi: 2.3.56
steve@steve:~$
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
If your query has been resolved, edit your first post and add [SOLVED] to the subject line.
If you found a solution on your own please post it.
A generation which ignores history has no past and no future.
User avatar
roblm
Level 15
Level 15
Posts: 5939
Joined: Sun Feb 24, 2013 2:41 pm

Re: How do you switch beetween hybrid graphic cards?

Post by roblm »

stevep3129 wrote:So far what seems to most helpful is a Ubuntu documentation at:

https://help.ubuntu.com/community/HybridGraphics

The article in that link says:
vga_switcheroo is the kernel mechanism that allows you to switch between GPUs if your machine has a hardware mux

Most laptops today 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/UEFI to select either Hybrid Graphics or the Discrete Graphics card.

When you use the command sudo cat /sys/kernel/debug/vgaswitcheroo/switch, the output No such file or directory will verify vgaswitcheroo is not supported on your laptop.

You have to use PRIME GPU offloading to switch to the Radeon GPU. Check the info here:

https://wiki.archlinux.org/index.php/PRIME
User avatar
farkas
Level 5
Level 5
Posts: 552
Joined: Mon Sep 21, 2015 6:10 pm
Location: Oregon

Re: How do you switch beetween hybrid graphic cards?

Post by farkas »

Hi roblm!
Thanks for your reply.
When running the command "sudo cat /sys/kernel/debug/vgaswitcheroo/switch" , I get the following output
steve@steve:~$ sudo cat /sys/kernel/debug/vgaswitcheroo/switch
[sudo] password for steve:
0:IGD:+:Pwr:0000:00:02.0
1:DIS: :DynOff:0000:01:00.0
steve@steve:~$

When I navigate to /sys/kernel/debug/vgaswitcheroo/switch there is a file there.
It has this in it:
0:IGD:+:Pwr:0000:00:02.0
1:DIS: :DynOff:0000:01:00.0
Which is the same as the output of the above command. Looks like there is vgaswitcheroo support.
BIOS shows both cards present.
How do I proceed?
Last edited by farkas on Thu Oct 11, 2018 7:58 pm, edited 1 time in total.
If your query has been resolved, edit your first post and add [SOLVED] to the subject line.
If you found a solution on your own please post it.
A generation which ignores history has no past and no future.
phd21
Level 20
Level 20
Posts: 10104
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: How do you switch beetween hybrid graphic cards?

Post by phd21 »

Hi stevep3129,

I just read your post and the good replies to it. Here are my thoughts on this as well.

FYI: Here is some more information
Linux ubuntu switch beetween intel and amd hybrid graphic cards? - Google Search
https://www.google.com/search?ei=kdq_W5 ... rtMqXQkVJ4

You might be able to set a graphics card priority to AMD in your Bios too or to disable the Intel video card if you do not want to use that.
Phd21: Mint 20 Cinnamon & KDE Neon 64-bit Awesome OS's, Dell Inspiron I5 7000 (7573, quad core i5-8250U ) 2 in 1 touch screen
User avatar
farkas
Level 5
Level 5
Posts: 552
Joined: Mon Sep 21, 2015 6:10 pm
Location: Oregon

Re: How do you switch beetween hybrid graphic cards?

Post by farkas »

Hi phd21!
Thanks, I'll check them out.
If your query has been resolved, edit your first post and add [SOLVED] to the subject line.
If you found a solution on your own please post it.
A generation which ignores history has no past and no future.
User avatar
roblm
Level 15
Level 15
Posts: 5939
Joined: Sun Feb 24, 2013 2:41 pm

Re: How do you switch beetween hybrid graphic cards?

Post by roblm »

The info in the link to the Ubuntu HybridGraphics article says to use these commands to power on the Radeon card and connect it to the video outputs:

Try using: sudo echo ON > /sys/kernel/debug/vgaswitcheroo/switch

Then check the output of sudo cat /sys/kernel/debug/vgaswitcheroo/switch

If vgaswitcheroo is working, this output should be seen, where DynOff (dynamically powered off) is changed to DynPwr (dynamically powered on) for DIS (discrete graphics):
0:IGD:+:Pwr:0000:00:02.0
1:DIS: :DynPwr:0000:01:00.0


If you don’t see that, then try this command:
sudo tee /sys/kernel/debug/vgaswitcheroo/switch <<< ON

If that works, then try this command to connect the Radeon GPU to the video outputs:
sudo echo DIS > /sys/kernel/debug/vgaswitcheroo/switch

Then use sudo cat /sys/kernel/debug/vgaswitcheroo/switch

The output should show the + sign has moved from IGD (integrated) to DIS:

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


If you don’t see that, then try this command: sudo tee /sys/kernel/debug/vgaswitcheroo/switch <<< DIS

If that works, then use this command to check if the Radeon GPU is rendering the graphics:
glxinfo | grep renderer

If none of that works, then you will need to use PRIME GPU Offloading.
User avatar
farkas
Level 5
Level 5
Posts: 552
Joined: Mon Sep 21, 2015 6:10 pm
Location: Oregon

Re: How do you switch beetween hybrid graphic cards?

Post by farkas »

Hi roblm!
Tried your suggestion, here are the results:

steve@steve:~$ sudo echo ON > /sys/kernel/debug/vgaswitcheroo/switch
bash: /sys/kernel/debug/vgaswitcheroo/switch: Permission denied
steve@steve:~$

It looks like I need permission to execute that command.

steve@steve:~$ sudo cat /sys/kernel/debug/vgaswitcheroo/switch
[sudo] password for steve:
0:IGD:+:Pwr:0000:00:02.0
1:DIS: :DynOff:0000:01:00.0
steve@steve:~$

I also tried the video on "https://www.youtube.com/watch?v=7-ckiKQotNw" , that didn't work. Results:

steve@steve:~$ xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x64 cap: 0x9, Source Output, Sink Offload crtcs: 3 outputs: 2 associated providers: 1 name:modesetting
Provider 1: id: 0x3f cap: 0x4, Source Offload crtcs: 0 outputs: 0 associated providers: 1 name:Unknown AMD Radeon GPU @ pci:0000:01:00.0
steve@steve:~$ xrandr --setprovideroffloadsink 0x64 0x3f
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 140 (RANDR)
Minor opcode of failed request: 34 (RRSetProviderOffloadSink)
Value in failed request: 0x64
Serial number of failed request: 16
Current serial number in output stream: 17
steve@steve:~$

Also went to Google search page suggested by, phd 21, "Linux ubuntu switch beetween intel and amd hybrid graphic cards?"

" https://www.google.com/search?ei=kdq_W5 ... rtMqXQkVJ4 "

Checked out a lot of those links. Some led back to switcheroo and others just got me more confused.

At "https://askubuntu.com/questions/1038271 ... untu-18-04"
found a command that may help.
steve@steve:~$ lspci -k | grep -EA3 'VGA|Display|3D'
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 620 (rev 02)
Subsystem: Dell HD Graphics 620
Kernel driver in use: i915
Kernel modules: i915
--
01:00.0 Display controller: Advanced Micro Devices, Inc. [AMD/ATI] Topaz XT [Radeon R7 M260/M265 / M340/M360 / M440/M445] (rev c3)
Subsystem: Dell Radeon R7 M445
Kernel driver in use: amdgpu
Kernel modules: amdgpu
steve@steve:~$

Thanks for your help.
If your query has been resolved, edit your first post and add [SOLVED] to the subject line.
If you found a solution on your own please post it.
A generation which ignores history has no past and no future.
User avatar
roblm
Level 15
Level 15
Posts: 5939
Joined: Sun Feb 24, 2013 2:41 pm

Re: How do you switch beetween hybrid graphic cards?

Post by roblm »

stevep3129 wrote: sudo echo ON > /sys/kernel/debug/vgaswitcheroo/switch
bash: /sys/kernel/debug/vgaswitcheroo/switch: Permission denied
Try using the other command I told you to try if that command failed:
sudo tee /sys/kernel/debug/vgaswitcheroo/switch <<< ON
User avatar
farkas
Level 5
Level 5
Posts: 552
Joined: Mon Sep 21, 2015 6:10 pm
Location: Oregon

Re: How do you switch beetween hybrid graphic cards?

Post by farkas »

Tried your suggestion
steve@steve:~$ sudo tee /sys/kernel/debug/vgaswitcheroo/switch <<< ON
[sudo] password for steve:
ON
steve@steve:~$ sudo echo DIS > /sys/kernel/debug/vgaswitcheroo/switch
bash: /sys/kernel/debug/vgaswitcheroo/switch: Permission denied
steve@steve:~$

How do I get permission?
If your query has been resolved, edit your first post and add [SOLVED] to the subject line.
If you found a solution on your own please post it.
A generation which ignores history has no past and no future.
User avatar
roblm
Level 15
Level 15
Posts: 5939
Joined: Sun Feb 24, 2013 2:41 pm

Re: How do you switch beetween hybrid graphic cards?

Post by roblm »

Try this command:
echo ON | sudo tee /sys/kernel/debug/vgaswitcheroo/switch

I won't be online again until tomorrow.
User avatar
farkas
Level 5
Level 5
Posts: 552
Joined: Mon Sep 21, 2015 6:10 pm
Location: Oregon

Re: How do you switch beetween hybrid graphic cards?

Post by farkas »

Edited grub file.
This is what it is after edit.

"sudo gedit /etc/default/grub"
In that text file there should be a
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
which must become
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash XXX.modeset=1"
where XXX = can be: "radeon" if you have a AMD/ATI card (most likely option since Intel and NVIDIA cards in dual-GPU notebooks have better ways of dealing with hybrid graphics, like bumblebee)
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash radeon.modeset=1"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"


Saved rebooted.
Ran "sudo update-grub"
Rebooted

Tried "echo ON | sudo tee /sys/kernel/debug/vgaswitcheroo/switch" command and it worked, but I had to to figure out where to put the | in the next steps and it became a mess.
I asked for help in Software and Applications, "viewtopic.php?f=47&t=279465" . A big thanks to WharfRat.
Using the ' sudo -i' this happened:

[sudo] password for steve:
root@steve:~# sudo ls -l /sys/kernel/debug/vgaswitcheroo/switch
-rw-r--r-- 1 root root 0 Oct 12 21:30 /sys/kernel/debug/vgaswitcheroo/switch
root@steve:~# sudo cat /sys/kernel/debug/vgaswitcheroo/switch
0:IGD:+:Pwr:0000:00:02.0
1:DIS: :DynOff:0000:01:00.0
root@steve:~# sudo echo ON > /sys/kernel/debug/vgaswitcheroo/switch
root@steve:~# sudo echo IGD > /sys/kernel/debug/vgaswitcheroo/switch
root@steve:~# sudo echo DIS > /sys/kernel/debug/vgaswitcheroo/switch
root@steve:~# sudo echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
root@steve:~# sudo cat /sys/kernel/debug/vgaswitcheroo/switch
0:IGD:+:Pwr:0000:00:02.0
1:DIS: :DynOff:0000:01:00.0
root@steve:~#

Intel GPU still in control.
cursor is blinking. When I try to close terminal, I get:
"There is still a process still running in this terminal. Closing the terminal will kill it."
It's been like this for over an hour, hoping something will miraculously will occur.
It must be in some loop it won't get out of.
I'm going to kill it and pour myself a glass of wine and try not bang my head on the keyboard.
Thank you. Good night.
If your query has been resolved, edit your first post and add [SOLVED] to the subject line.
If you found a solution on your own please post it.
A generation which ignores history has no past and no future.
User avatar
roblm
Level 15
Level 15
Posts: 5939
Joined: Sun Feb 24, 2013 2:41 pm

Re: How do you switch beetween hybrid graphic cards?

Post by roblm »

You added radeon.modeset=1 to this line, but the inxi output lists the driver is amdgpu:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash radeon.modeset=1"

That’s the default setting for the open-source driver, so it should not be needed.

stevep3129 wrote: steve@steve:~$ xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x64 cap: 0x9, Source Output, Sink Offload crtcs: 3 outputs: 2 associated providers: 1 name:modesetting
Provider 1: id: 0x3f cap: 0x4, Source Offload crtcs: 0 outputs: 0 associated providers: 1 name:Unknown AMD Radeon GPU @ pci:0000:01:00.0
steve@steve:~$ xrandr --setprovideroffloadsink 0x64 0x3f
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 140 (RANDR)
Minor opcode of failed request: 34 (RRSetProviderOffloadSink)
Value in failed request: 0x64
Serial number of failed request: 16
Current serial number in output stream: 17
You used this command: xrandr --setprovideroffloadsink 0x64 0x3f

It should have been: xrandr --setprovideroffloadsink 0x3f 0x64

If that doesn’t work, try these:
xrandr --setprovideroffloadsink 1 0
xrandr --setprovideroffloadsink "Unknown AMD Radeon GPU @ pci:0000:01:00.0" modesetting


If that works, then use this command: glxinfo | grep "OpenGL renderer"
The output should have AMD instead of Mesa DRI Intel.
User avatar
farkas
Level 5
Level 5
Posts: 552
Joined: Mon Sep 21, 2015 6:10 pm
Location: Oregon

Re: How do you switch beetween hybrid graphic cards?

Post by farkas »

Tried your last suggestion.
Results:

steve@steve:~$ xrandr --setprovideroffloadsink 0x3f 0x64
steve@steve:~$ glxinfo | grep "OpenGL renderer"
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 620 (Kaby Lake GT2)
steve@steve:~$ xrandr --setprovideroffloadsink 1 0
steve@steve:~$ glxinfo | grep "OpenGL renderer"
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 620 (Kaby Lake GT2)
steve@steve:~$ xrandr --setprovideroffloadsink "Unknown AMD Radeon GPU @ pci:0000:01:00.0" modesetting
steve@steve:~$ glxinfo | grep "OpenGL renderer"
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 620 (Kaby Lake GT2)
steve@steve:~$

Looks like they didn't work.
If your query has been resolved, edit your first post and add [SOLVED] to the subject line.
If you found a solution on your own please post it.
A generation which ignores history has no past and no future.
User avatar
roblm
Level 15
Level 15
Posts: 5939
Joined: Sun Feb 24, 2013 2:41 pm

Re: How do you switch beetween hybrid graphic cards?

Post by roblm »

stevep3129 wrote:glxinfo | grep "OpenGL renderer"
That command was a mistake. After using the xrandr command, use these commands:

DRI_PRIME=1 glxinfo | grep "OpenGL renderer" should output AMD graphics.

DRI_PRIME=0 glxinfo | grep "OpenGL renderer" should output Mesa DRI Intel graphics.
User avatar
farkas
Level 5
Level 5
Posts: 552
Joined: Mon Sep 21, 2015 6:10 pm
Location: Oregon

Re: How do you switch beetween hybrid graphic cards?

Post by farkas »

Thanks . Progress at last!
That worked, but running sudo cat /sys/kernel/debug/vgaswitcheroo/switch still shows integrated video still on.

steve@steve:~$ xrandr --setprovideroffloadsink 0x3f 0x64
steve@steve:~$
steve@steve:~$ DRI_PRIME=1 glxinfo | grep "OpenGL renderer"
OpenGL renderer string: AMD ICELAND (DRM 3.23.0 / 4.15.0-36-generic, LLVM 6.0.0)
steve@steve:~$ sudo cat /sys/kernel/debug/vgaswitcheroo/switch
[sudo] password for steve:
0:IGD:+:Pwr:0000:00:02.0
1:DIS: :DynOff:0000:01:00.0
steve@steve:~$

What else is needed to get the AMD card output ?
Will that show up System Info instead of Intel?
If your query has been resolved, edit your first post and add [SOLVED] to the subject line.
If you found a solution on your own please post it.
A generation which ignores history has no past and no future.
User avatar
roblm
Level 15
Level 15
Posts: 5939
Joined: Sun Feb 24, 2013 2:41 pm

Re: How do you switch beetween hybrid graphic cards?

Post by roblm »

stevep3129 wrote:running sudo cat /sys/kernel/debug/vgaswitcheroo/switch still shows integrated video still on.
You don’t need to be concerned about vgaswitcheroo when using PRIME GPU Offloading. The Intel GPU will stay on. The Radeon GPU will only be used for rendering the graphics when the DRI_PRIME=1 command is used to launch an application. The Radeon GPU is not physically connected to the laptop’s screen, so the processed data must be sent to the Intel GPU, which is connected to the screen, and it then displays the image onto the screen.

The vgaswitcheroo commands for switching graphics only work when there is a hardware switch, called a mux (multiplexer) present. As I stated in my first post, there should be a setting in the BIOS to switch GPUs if the mux is present, or an actual switch on the laptop.

Use this command to start the 3D program glxgears with the Radeon GPU doing the rendering: DRI_PRIME=1 glxgears

Then open a second Terminal window and use this command: glxinfo | grep "OpenGL renderer"
If the output has AMD ICELAND, then everything is working correctly.

Also jot down the listed framerate.

Just as a curiosity, use this command in the second Terminal window:
sudo cat /sys/kernel/debug/vgaswitcheroo/switch

Close the first Terminal window. In the second one, use the command glxgears, so the Intel GPU will be doing the rendering. Compare the framerate with the other one for the Radeon GPU.

So use DRI_PRIME=1 for any application you want to run using the Radeon GPU. For example, to run firefox:
DRI_PRIME=1 firefox
User avatar
farkas
Level 5
Level 5
Posts: 552
Joined: Mon Sep 21, 2015 6:10 pm
Location: Oregon

Re: How do you switch beetween hybrid graphic cards?

Post by farkas »

Once again thanks for your help.

First terminal window

steve@steve:~$ DRI_PRIME=1 glxgears
243 frames in 5.0 seconds = 48.548 FPS
301 frames in 5.0 seconds = 60.004 FPS
301 frames in 5.0 seconds = 60.007 FPS
301 frames in 5.0 seconds = 60.008 FPS
301 frames in 5.0 seconds = 59.998 FPS
XIO: fatal IO error 110 (Connection timed out) on X server ":0"
after 2751 requests (42 known processed) with 0 events remaining.
steve@steve

Second terminal window

steve@steve:~$ glxinfo | grep "OpenGL renderer"
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 620 (Kaby Lake GT2)
steve@steve:~$ sudo cat /sys/kernel/debug/vgaswitcheroo/switch
[sudo] password for steve:
0:IGD:+:Pwr:0000:00:02.0
1:DIS: :DynOff:0000:01:00.0
steve@steve:~$ glxgears
419 frames in 5.0 seconds = 83.721 FPS
301 frames in 5.0 seconds = 60.006 FPS
301 frames in 5.0 seconds = 60.003 FPS
301 frames in 5.0 seconds = 60.004 FPS
301 frames in 5.0 seconds = 60.002 FPS
XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":0"
after 2578 requests (42 known processed) with 0 events remaining.
steve@steve:~$

Then I tried

steve@steve:~$ DRI_PRIME=1 glxgears
313 frames in 5.0 seconds = 62.491 FPS
301 frames in 5.0 seconds = 60.007 FPS
301 frames in 5.0 seconds = 60.004 FPS
301 frames in 5.0 seconds = 60.002 FPS
301 frames in 5.0 seconds = 60.003 FPS
XIO: fatal IO error 110 (Connection timed out) on X server ":0"
after 2785 requests (42 known processed) with 0 events remaining.
steve@steve:~$ glxinfo | grep "OpenGL renderer"
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 620 (Kaby Lake GT2)
steve@steve:~$

Just for the heck of it tried

steve@steve:~$ DRI_PRIME=1 glxinfo | grep "OpenGL renderer"
OpenGL renderer string: AMD ICELAND (DRM 3.23.0 / 4.15.0-36-generic, LLVM 6.0.0)
steve@steve:~$ glxgears
337 frames in 5.0 seconds = 67.219 FPS
301 frames in 5.0 seconds = 60.004 FPS
301 frames in 5.0 seconds = 60.004 FPS
301 frames in 5.0 seconds = 60.002 FPS
301 frames in 5.0 seconds = 60.005 FPS
XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":0"
after 1626 requests (80 known processed) with 0 events remaining.
steve@steve:~$ glxinfo | grep "OpenGL renderer"
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 620 (Kaby Lake GT2)

It doesn't look like its working. After each glxgears the glxinfo comes back with Mesa DRI Intel.
If your query has been resolved, edit your first post and add [SOLVED] to the subject line.
If you found a solution on your own please post it.
A generation which ignores history has no past and no future.
User avatar
roblm
Level 15
Level 15
Posts: 5939
Joined: Sun Feb 24, 2013 2:41 pm

Re: How do you switch beetween hybrid graphic cards?

Post by roblm »

This xrandr command only lasts for one session, so if you have rebooted or restarted your laptop since it was last used, then it needs to be used again before using the DRI_PRIME= command:
xrandr --setprovideroffloadsink 0x3f 0x64
User avatar
farkas
Level 5
Level 5
Posts: 552
Joined: Mon Sep 21, 2015 6:10 pm
Location: Oregon

Re: How do you switch beetween hybrid graphic cards?

Post by farkas »

Read your post and tried the following
First window

steve@steve:~$ xrandr --setprovideroffloadsink 0x3f 0x64
steve@steve:~$ DRI_PRIME=1 glxgears
322 frames in 5.0 seconds = 64.357 FPS
300 frames in 5.0 seconds = 59.994 FPS
300 frames in 5.0 seconds = 59.995 FPS
300 frames in 5.0 seconds = 59.994 FPS
300 frames in 5.0 seconds = 59.996 FPS
300 frames in 5.0 seconds = 59.986 FPS
301 frames in 5.0 seconds = 60.003 FPS
300 frames in 5.0 seconds = 59.992 FPS
300 frames in 5.0 seconds = 59.998 FPS

Second window while DRI_PRIME=1 glxgears is running in the first window.

steve@steve:~$ glxinfo | grep "OpenGL renderer"
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 620 (Kaby Lake GT2)
steve@steve:~$ sudo cat /sys/kernel/debug/vgaswitcheroo/switch
[sudo] password for steve:
0:IGD:+:Pwr:0000:00:02.0
1:DIS: :DynPwr:0000:01:00.0
steve@steve:~$
If your query has been resolved, edit your first post and add [SOLVED] to the subject line.
If you found a solution on your own please post it.
A generation which ignores history has no past and no future.
User avatar
roblm
Level 15
Level 15
Posts: 5939
Joined: Sun Feb 24, 2013 2:41 pm

Re: How do you switch beetween hybrid graphic cards?

Post by roblm »

I think some of my reasoning has been incorrect. I came to some conclusions from testing on a laptop with hybrid graphics (intel+nvidia) that uses the nvidia-prime tool to switch GPUs, but this uses the proprietary Nvidia driver. PRIME GPU Offloading is only for the open-source drivers. When I attempted to use it with the open-source nouveau driver, glxgears would not work correctly for me.

So the second Terminal window you opened will be processed by the Intel GPU and not Radeon unless DRI_PRIME= is used to open it also. So I think PRIME GPU Offloading is probably working correctly.

The framerate was the same whether Radeon or Intel was used but glxgears puts very little stress on 3D processing. You need to run a more demanding OpenGL benchmark to see the differences between the two. The benchmark glmark2 can be installed with the command sudo apt install glmark2. Then run the program with the command glmark2 to test the Intel GPU performance and a second time using the command DRI_PRIME=glmark2 to test the Radeon GPU.
Locked

Return to “Graphics Cards & Monitors”