Skip to content

Improve GPU mode change support in kernel module#346

Open
itmo153277 wants to merge 1 commit into
johnfanv2:mainfrom
itmo153277:igpu
Open

Improve GPU mode change support in kernel module#346
itmo153277 wants to merge 1 commit into
johnfanv2:mainfrom
itmo153277:igpu

Conversation

@itmo153277

@itmo153277 itmo153277 commented Jul 29, 2025

Copy link
Copy Markdown

Add some missing functions that are necessary for a proper GPU mode change.

Mode gsync (inverted) igpumode
dGPU 0 0
Hybrid 1 0
iGPU-only 1 1
Hybrid (auto) 1 2

To enable iGPU-only mode:

echo 1 > /sys/module/legion_laptop/drivers/platform\:legion/PNP0C09\:00/igpumode

# Wait for GPU to disappear
while lspci | grep -i nvidia &> /dev/null ; do
  echo 1 > /sys/module/legion_laptop/drivers/platform\:legion/PNP0C09\:00/notify_dgpu
  sleep 5
  # echo 1 > /sys/bus/pci/rescan
done
echo 0 > /sys/module/legion_laptop/drivers/platform\:legion/PNP0C09\:00/notify_dgpu

To go back to Hybrid mode:

echo 0 > /sys/module/legion_laptop/drivers/platform\:legion/PNP0C09\:00/igpumode

# Wait for GPU to appear
while ! lspci | grep -i nvidia &> /dev/null ; do
  echo 0 > /sys/module/legion_laptop/drivers/platform\:legion/PNP0C09\:00/notify_dgpu
  sleep 5
  echo 1 > /sys/bus/pci/rescan
done
echo 1 > /sys/module/legion_laptop/drivers/platform\:legion/PNP0C09\:00/notify_dgpu

Caveats:

  • prime-select should be set up correctly before changing modes
  • brightness in iGPU mode should be controlled by acpi_backlight=video, but in dGPU mode it does not work
  • changing modes requires reboot to fully work
  • hybrid-auto requires notify_dgpu to wake dGPU up and also requires rebooting the system

@itmo153277
itmo153277 marked this pull request as ready for review July 29, 2025 11:42
@MrDuartePT

MrDuartePT commented May 3, 2026

Copy link
Copy Markdown
Collaborator

Make sure you change the python gui to include iGPU-only and Hybrid mode (and that cover all the edge cages changing between mode, you can lock iGPU-only button when people are in dGPU mode for exemple).

If possible also make a README file that explain all the commands that need to be run to the change manually to each of the profiles.
Thanks for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants