Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 65 additions & 2 deletions docs/guides/hybrid-graphics.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ If you experience system freezes followed by high fan speeds and sudden shutdown

You can also control the AMD GPU DPM with GUI tools such as [radeon-profile](https://github.com/emerge-e-world/radeon-profile). For GPU intensive tasks like playing games, machine learning or rendering you can try setting the DPM to high instead.

## Enabling the iGPU
## Making the iGPU the primary display adapter

By default T2 Macs with hybrid graphics use the dGPU as primary display adapter, which in return requires the dGPU to be always powered on.
To save energy and reduce battery consumption, we can force the iGPU to be the primary display adapter and default graphics accelerator in a first step.

1. Configure apple-gmux to switch to the iGPU at boot

Expand All @@ -35,7 +38,67 @@ If you experience system freezes followed by high fan speeds and sudden shutdown
options apple-gmux force_igd=y
```

`glxinfo | grep "OpenGL renderer"` should show an Intel GPU. Running programs with `DRI_PRIME=1` will make them render on your AMD GPU (some things do this automatically). You will get more battery time now as your AMD GPU can be turned off when not needed.
2. Or alternatively, add kernel parameter `apple_gmux.force_igd=1`

After reboot `glxinfo | grep "OpenGL renderer"` should show an Intel GPU. Running programs with `DRI_PRIME=1` will make them render on your AMD GPU. On Gnome, by right clicking an application you can choose to run it using dedicated graphics.

## Disabling the dGPU

We can take this a step further and save substantial amounts of energy by deactivating the discrete graphics card.

1. We will create a systemd unit that will use `vgaswitcheroo` to disable the discrete graphics card on boot. Enter the full codeblock below and execute it.

```plain
sudo tee /etc/systemd/system/amdgpu-off.service >/dev/null <<'EOF'
[Unit]
Description=Disable AMD dGPU via vgaswitcheroo
After=systemd-modules-load.service
Before=display-manager.service


[Service]
Type=oneshot
ExecStart=/bin/sh -c 'for i in $(seq 1 30); do [ -e /sys/kernel/debug/vgaswitcheroo/switch ] && exec sh -c "echo OFF > /sys/kernel/debug/vgaswitcheroo/switch"; sleep 1; done; exit 1'

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable amdgpu-off.service
```

We can now run `sudo systemctl enable amdgpu-off.service` and reboot to disable our dGPU. This will decrease power draw on a MacBook significantly from around 20 to 9 Watts on idle using 50% display brightness, resulting in much longer battery life.
Enabling the dGPU again is done using `sudo systemctl disable amdgpu-off.service` and reboot. A more convenient solution using aliases is explained in the next step.

2. We can quickly disable, enable and check the current status of the dGPU by creating aliases. Simply execute the following block:

```plain
alias dgpu-off='sudo systemctl enable disable-amdgpu.service; sleep 2; sudo reboot'
alias dgpu-on='sudo systemctl disable disable-amdgpu.service; sleep 2; sudo reboot'
alias dgpu-status='sudo cat /sys/kernel/debug/vgaswitcheroo/switch'
```

From now on you can check the status of the dGPU by simply entering `dgpu-status` :

```plain
$ dgpu-status
0:DIS-Audio: :DynOff:0000:01:00.1
1:IGD:+:Pwr:0000:00:02.0
2:DIS: :Off:0000:01:00.0
```

`IGD` is the iGPU and `DIS` is the dGPU. The position of the `+` shows the GPU currently in use as the display adapter, while `Pwr` and `Off` refer to their respective power status.
Executing the aliases `dgpu-off` and `dgpu-on` will enable and disable our `amdgpu-off` systemd service and reboot the computer.

**Example:** Given the status above, executing `dgpu-on` will reboot your Mac. After reboot `dgpu-status` should be:

```plain
$ dgpu-status
0:DIS-Audio: :DynAuto:0000:01:00.1
1:IGD:+:Pwr:0000:00:02.0
2:DIS: :Pwr:0000:01:00.0
```

### Suspend workaround

Expand Down
Loading