Hybrid graphics for macOS on the Lenovo Legion 5 15IAX10 (Core Ultra 9 275HX with its Arrow Lake iGPU, RTX 5070 Laptop). The goal is what Windows gets from NVIDIA Optimus and Advanced Optimus: the RTX 5070 powered only when it is needed, apps rendering on it while the Intel GPU drives the panel, and the panel switched between the two GPUs.
Status, 2026-10-22: built, not yet run on hardware. Version 0.2 gives the primitives and a read-only probe. Turning the dGPU on and switching the panel are written but locked behind a boot-arg until a guarded test boot has shown they are safe.
kext/: LegionHybrid.kext. It loads at boot and does nothing on its own. Commands go in throughsysctl debug.legionhybridand results come back indebug.legionhybrid_log:probe: read-only. It reads the panel mux state, the support lists and capabilities of NVIDIA's_DSMinterfaces (Optimus, JT/GC6, GPS, NBCI, PCIe), Lenovo's EC flags and the root port's link state.eval,dsm,cfg,link,rescan,nv: single ACPI or PCI reads.ldis, and anyeval/dsmthat changes state, only with the boot-arglegionhybrid=arm.- For the first five minutes after load it also logs every change of the root port's Link Control and Link Status, because something sets Link Disable after boot in Hybrid mode.
tools/legion-hybrid: the sequences, kept in a script so they can change without a new kext. Commands:probe,mux,on --yes,mux-set igpu|dgpu --yes. Every step is logged to/Users/Shared/legion-diag/legion-hybrid.log.docs/RESEARCH.md: the full research behind it, with sources and confidence for each claim.docs/HOW-IT-WORKS.md: the firmware interfaces, the power and mux sequences, and why the earlier attempts cut power.
Two related changes live in the NvGfx fork:
hybrid-2.5.3: the NVRMFB proxy head on NvGfx 2.5.3. The RTX 5070 composites the desktop and the Intel GPU only scans it out.intel-xe: IGPUConsoleRange 0.5, which brings the dGPU up at boot with the same sequence whennvfbigpu=1is set.
./build.sh # out/LegionHybrid.kext, link-checked against the running Tahoe kernel collection
It needs the Command Line Tools with the macOS 15.5 SDK (as for the other Legion kexts). Inject the kext with OpenCore (Kernel > Add) and copy tools/legion-hybrid to /usr/local/bin.
On this machine, an earlier attempt to power the dGPU in Hybrid mode left it powered without a PCIe link, and the laptop cut its own power. The on sequence:
- refuses unless the panel is on the iGPU and the EC has released the GPU;
- clears Link Disable first, then calls the firmware's own power-on;
- waits two seconds for the link, and turns the GPU off again through the firmware if no link comes up.
Even so, run it only on a machine you can power-cycle.
The _DSM GUIDs and the GC6 and MXDS conventions come from NVIDIA and are common across Optimus laptops. The paths (RP01, PXSX, EDP1, EC0), the EC methods (WEJF, REJF) and the mux GPIO are this Legion's. Read your own ACPI tables before using any of it.
- NVIDIA's open-gpu-kernel-modules headers (
nvop.h,jt.h,nbci.h) and coreboot's NVIDIA-written Brya ACPI (nvjt.asl,power.asl), for the_DSMfunctions and the GC6 sequence. - Lenovo Legion Toolkit, for Lenovo's GPU mode and EC notification calls.
- LenovoLegionLinux and the Linux
lenovo-wmi-gamezonedocumentation. - Apple's IOPCIFamily and IOGraphics sources, and the Linux
apple-gmuxandvga_switcheroocode, for how macOS and Linux switch GPUs.