Disable discrete GPU in optimus laptop

New Fedora user coming from Ubuntu, using an optimus laptop with NVIDIA discrete gpu and Intel integrated gpu (see below). On Ubuntu, there is prime-select to completely disable the discrete gpu when not needed. This significantly reduces power draw. However, prime-select is a script made by Canonical specifically for Ubuntu, and thus is not present on Fedora. I haven’t been able to find any form of equivalent. Even RPM Fusion’s guide on optimus does not mention how to do this. Is there a way to make this work?

sudo lshw -display
  *-display                 
       description: 3D controller
       product: GA107M [GeForce RTX 3050 Mobile]
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       logical name: /dev/fb0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list rom fb
       configuration: depth=32 driver=nvidia latency=0 mode=1920x1200 visual=truecolor xres=1920 yres=1200
       resources: iomemory:600-5ff iomemory:610-60f irq:207 memory:be000000-beffffff memory:6000000000-60ffffffff memory:6100000000-6101ffffff ioport:3000(size=128)
  *-display
       description: VGA compatible controller
       product: Alder Lake-P Integrated Graphics Controller
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 0c
       width: 64 bits
       clock: 33MHz
       capabilities: pciexpress msi pm vga_controller bus_master cap_list rom
       configuration: driver=i915 latency=0
       resources: iomemory:610-60f iomemory:400-3ff irq:169 memory:6188000000-6188ffffff memory:4000000000-400fffffff ioport:4000(size=64) memory:c0000-dffff memory:4010000000-4016ffffff memory:4020000000-40ffffffff

I once had a MacPro laptop with a hardware problem that prevented switching OPTIMUS graphics. I was able to tweak the configuration to ignore the integrated controller, but I gather you want to disable the discrete graphics. Can you live with never using the discrete graphics or do you need switching?

Fedora How To that mostly deals with getting Nvidia working, and appears to predate the recent addition of Wayland support by Nvidia.

You should be able to get a copy of the Ubuntu script. Just because Fedora doesn’t provide it doesn’t mean it can’t be tweaked to work on Fedora, but you should understand how it works before attempting to use it. Arch linux generally has excellent documentation, so arch linux wiki entry for PRIME may behelpful in understanding the script.

Switching is a must. I have looked over the Ubuntu script, with enough time and effort I think I could adapt it to Fedora. I am just in disbelief that something like this doesn’t already exist.

On fedora the optimus systems using nvidia by default are designed to use the iGPU for almost everything when running gnome.

The user is able to right-click on an app icon and select to run that app on the dGPU if they choose but otherwise it remains in an idle state mostly. Some graphics intensive apps may force it to run, but it is mostly up to the user when it is used.

This has been the status with nvidia & gnome for quite some time.

Yes, but the dGPU is still powered on and that has quite the effect on my battery life. It can singlehandedly use up to 5% of my battery per hour even when I haven’t run a single program using it. On Ubuntu, when I’m not using it, I can keep it completely disabled and that gives me several more hours.

AFAIK there is no way to power off a dGPU in any optimus system. If Ubuntu is able to do so that seems strange to me since the device has no separate power connection and is configured by the kernel at boot time.

Do you have any clue how that might be achieved?
I have always thought the control was which GPU is active, not which has power applied. There have been several threads here with the same discussion and it seems the consensus has been usage control and not power control.

That’s a good point, I don’t really know. What I do know is that when I figured out how to disable it on Ubuntu, my power usage went down about 4W, and then when I turned it back on power usage went up 4W. And nvidia-smi said that my dGPU was using 4W.

:person_shrugging:

And currently my Fedora installation uses around 17W on idle while Ubuntu around 6W. I know that’s not the whole difference, but I figured dGPU was a good place to start.

Unless the power meters I was using were lying to me because the NVIDIA drivers were disabled so they couldn’t read power from the dGPU? That would be concerning. But I don’t really know how power meters work so idk if they would fail like that.

Try this out please:

# for my NVIDIA Corporation GP107M [GeForce GTX 1050 Ti Mobile]
echo 1 > /sys/bus/pci/devices/0000:01:00.0/remove

This should change the state of the PCI device and of course you have to adapt the command line to your device ID. What are your results then?

Ok so after some more testing it seems that whatever tools I was using when I first got Ubuntu set up were just completely wrong. Enabling/disabling dGPU has no effect on power draw, at least according to KDE’s power monitor. So… this thread is moot now lol

Sorry to waste everyone’s time.