You are not logged in.

#1 2024-11-07 08:32:07

RounakDutta
Member
From: West Bengal, India
Registered: 2022-02-11
Posts: 192
Website

[SOLVED] How to turn off discrete gpu temporarily?

So I am using an Asus TUF A17 2023 (FA707XU) that has an AMD Ryzen cpu with integrated graphics and a NVIDIA discrete GPU.

Nvidia gpu depletes my battery faster so I want to disable it. I want to enable it only when I am playing games or doing some heavy work. (Usually when my laptop is connected to AC Power).

How can I do that ? Here is my full system info :- https://0x0.st/XDav.txt

Last edited by RounakDutta (2024-11-07 16:26:36)

Offline

#2 2024-11-07 10:14:02

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,101

Re: [SOLVED] How to turn off discrete gpu temporarily?

That should generally already be the default behaviour. Otherwise check setting up the udev rules mentioned in: https://wiki.archlinux.org/title/PRIME#NVIDIA and use the methods there to check the runtime state of the nvidia gpu.

Note that this is only really guaranteed to generally work properly in a xorg session, there are some additionals setup needed to approximate this for Wayland.

Offline

#3 2024-11-07 10:41:12

RounakDutta
Member
From: West Bengal, India
Registered: 2022-02-11
Posts: 192
Website

Re: [SOLVED] How to turn off discrete gpu temporarily?

V1del wrote:

That should generally already be the default behaviour. Otherwise check setting up the udev rules mentioned in: https://wiki.archlinux.org/title/PRIME#NVIDIA and use the methods there to check the runtime state of the nvidia gpu.

Note that this is only really guaranteed to generally work properly in a xorg session, there are some additionals setup needed to approximate this for Wayland.

I am using kde wayland. The process you showed me will disable the graphics card (cool because thats what I wanted). But how can I turn my gpu back on ? And will it work in wayland ?

EDIT: Can I use this method :- https://wiki.archlinux.org/title/Hybrid … _acpi_call ? I am not sure about it

Last edited by RounakDutta (2024-11-07 10:44:13)

Offline

#4 2024-11-07 10:58:07

RounakDutta
Member
From: West Bengal, India
Registered: 2022-02-11
Posts: 192
Website

Re: [SOLVED] How to turn off discrete gpu temporarily?

Also how can I switch between the 2 gpus (amd integrated gpu and nvidia discrete gpu) whenever I want ?

Last edited by RounakDutta (2024-11-07 11:07:58)

Offline

#5 2024-11-07 11:06:03

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,101

Re: [SOLVED] How to turn off discrete gpu temporarily?

There's no point or benefit to any other method if the PRIME one works properly. acpi_call was mostly used in the old times when nvidia did not have it implemented in the driver itself.

Install the nvidia-prime package and use prime-run. The udev rules will set the device into a "ready but off" mode (assuming it can be properly set, check the methods mentioned whether it's really declared suspended), where invoking it explicitly via prime-run (or e.g. steam and particularly proton/DXVK/VKD3D will automatically render on the dedicated card given no configuration to the contrary)

Whether it will work well depends on how KWin accesses the device, last info I have is that this was still WIP, but I don't have a setup to test this on myself so chances are that some logic to disable it when not being an active renderer card are in place.  Otherwise if your screen is actually attached to the integrated GPU you almost never need Kwin to directly handle the card, so you should be able to export https://invent.kde.org/plasma/kwin/-/wi … rm_devices but only expose the integrated card and then to make sure things don't wakeup the nvidia gpu unnecessarily, there's also: https://wiki.archlinux.org/title/Waylan … IA_modules

Last edited by V1del (2024-11-07 11:15:55)

Offline

#6 2024-11-07 11:35:05

RounakDutta
Member
From: West Bengal, India
Registered: 2022-02-11
Posts: 192
Website

Re: [SOLVED] How to turn off discrete gpu temporarily?

V1del wrote:

There's no point or benefit to any other method if the PRIME one works properly. acpi_call was mostly used in the old times when nvidia did not have it implemented in the driver itself.

Install the nvidia-prime package and use prime-run. The udev rules will set the device into a "ready but off" mode (assuming it can be properly set, check the methods mentioned whether it's really declared suspended), where invoking it explicitly via prime-run (or e.g. steam and particularly proton/DXVK/VKD3D will automatically render on the dedicated card given no configuration to the contrary)

Whether it will work well depends on how KWin accesses the device, last info I have is that this was still WIP, but I don't have a setup to test this on myself so chances are that some logic to disable it when not being an active renderer card are in place.  Otherwise if your screen is actually attached to the integrated GPU you almost never need Kwin to directly handle the card, so you should be able to export https://invent.kde.org/plasma/kwin/-/wi … rm_devices but only expose the integrated card and then to make sure things don't wakeup the nvidia gpu unnecessarily, there's also: https://wiki.archlinux.org/title/Waylan … IA_modules


So according to my lspci output :-

00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14e8
00:00.2 IOMMU: Advanced Micro Devices, Inc. [AMD] Device 14e9
00:01.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14ea
00:01.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 14ed
00:02.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14ea
00:02.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 14ee
00:02.2 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 14ee
00:02.4 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 14ee
00:03.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14ea
00:03.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Family 19h USB4/Thunderbolt PCIe tunnel
00:04.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14ea
00:08.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14ea
00:08.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 14eb
00:08.2 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 14eb
00:08.3 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 14eb
00:14.0 SMBus: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller (rev 71)
00:14.3 ISA bridge: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge (rev 51)
00:18.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14f0
00:18.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14f1
00:18.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14f2
00:18.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14f3
00:18.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14f4
00:18.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14f5
00:18.6 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14f6
00:18.7 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14f7
01:00.0 VGA compatible controller: NVIDIA Corporation AD107M [GeForce RTX 4050 Max-Q / Mobile] (rev a1)
01:00.1 Audio device: NVIDIA Corporation AD107 High Definition Audio Controller (rev a1)
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet Controller (rev 15)
03:00.0 Network controller: MEDIATEK Corp. MT7921 802.11ax PCI Express Wireless Network Adapter
04:00.0 Non-Volatile memory controller: Micron Technology Inc 2400 NVMe SSD (DRAM-less) (rev 03)
65:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Phoenix1 (rev c1)
65:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Rembrandt Radeon High Definition Audio Controller
65:00.2 Encryption controller: Advanced Micro Devices, Inc. [AMD] Family 19h (Model 74h) CCP/PSP 3.0 Device
65:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Device 15b9
65:00.4 USB controller: Advanced Micro Devices, Inc. [AMD] Device 15ba
65:00.5 Multimedia controller: Advanced Micro Devices, Inc. [AMD] ACP/ACP3X/ACP6x Audio Coprocessor (rev 63)
65:00.6 Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h/19h HD Audio Controller
66:00.0 Non-Essential Instrumentation [1300]: Advanced Micro Devices, Inc. [AMD] Device 14ec
66:00.1 Signal processing controller: Advanced Micro Devices, Inc. [AMD] AMD IPU Device
67:00.0 Non-Essential Instrumentation [1300]: Advanced Micro Devices, Inc. [AMD] Device 14ec
67:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Device 15c0
67:00.4 USB controller: Advanced Micro Devices, Inc. [AMD] Device 15c1
67:00.5 USB controller: Advanced Micro Devices, Inc. [AMD] Pink Sardine USB4/Thunderbolt NHI controller #1

I should add :-

KWIN_DRM_DEVICES="/dev/dri/by-path/pci-0000\:65\:00.0-card"
__EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json

to `~/.config/environment.d/envvars.conf` ?

Offline

#7 2024-11-07 11:38:45

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,101

Re: [SOLVED] How to turn off discrete gpu temporarily?

sounds about right

Offline

#8 2024-11-07 14:54:09

RounakDutta
Member
From: West Bengal, India
Registered: 2022-02-11
Posts: 192
Website

Re: [SOLVED] How to turn off discrete gpu temporarily?

V1del wrote:

sounds about right

All right! So I have added those environment variables and I have installed the nvidia-prime package. So should I use prime-run %command% in the steam launch command to play the game from nvidia graphics card ?

Last edited by RounakDutta (2024-11-07 14:58:37)

Offline

#9 2024-11-07 16:02:54

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,101

Re: [SOLVED] How to turn off discrete gpu temporarily?

Yeah, stuff that runs on proton and with VKD3D/DXVK should automatically seek out and prefer the dedicated GPU anyway but it's not going to hurt to explicitly call them like that.

Offline

#10 2024-11-07 16:26:17

RounakDutta
Member
From: West Bengal, India
Registered: 2022-02-11
Posts: 192
Website

Re: [SOLVED] How to turn off discrete gpu temporarily?

Thanks a lot! Marking the post as [SOLVED].

Offline

#11 2024-11-07 16:30:31

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,101

Re: [SOLVED] How to turn off discrete gpu temporarily?

Note that one caveat of setting KWIN_DRM_DEVICES to a single GPU will be that you are most likely unable to have on the fly hotplug of external monitors that are attached to the nvidia card, should that be something you might be doing.

Offline

Board footer

Powered by FluxBB