170 lines
3.8 KiB
Markdown
170 lines
3.8 KiB
Markdown
# Hybrid GPU Configuration
|
|
|
|
Guide for configuring AMD + NVIDIA hybrid graphics on Legion laptops with Hyprland.
|
|
|
|
## Hardware Topology
|
|
|
|
On Legion laptops with hybrid graphics:
|
|
- **AMD iGPU (card1)**: Drives the laptop display (eDP-2)
|
|
- **NVIDIA dGPU (card0)**: Drives external displays (DP-1, DP-2 via USB-C)
|
|
|
|
This is hardware-wired and cannot be changed via software.
|
|
|
|
## BIOS Configuration
|
|
|
|
**Critical:** Set GPU mode to **Hybrid/Dynamic** (not Discrete).
|
|
|
|
Discrete mode may cause:
|
|
- Lower resolution options on laptop display
|
|
- Display detection issues
|
|
- Power management problems
|
|
|
|
## NVIDIA Driver Setup
|
|
|
|
### Install Drivers
|
|
```bash
|
|
emerge x11-drivers/nvidia-drivers
|
|
```
|
|
|
|
### Blacklist Nouveau
|
|
```bash
|
|
echo "blacklist nouveau" > /etc/modprobe.d/blacklist-nouveau.conf
|
|
echo "options nouveau modeset=0" >> /etc/modprobe.d/blacklist-nouveau.conf
|
|
```
|
|
|
|
### Enable DRM
|
|
```bash
|
|
echo "options nvidia_drm modeset=1 fbdev=1" > /etc/modprobe.d/nvidia.conf
|
|
```
|
|
|
|
### GRUB Configuration
|
|
Add to `/etc/default/grub`:
|
|
```bash
|
|
GRUB_CMDLINE_LINUX_DEFAULT="nvidia_drm.modeset=1 acpi_backlight=native"
|
|
```
|
|
|
|
Regenerate:
|
|
```bash
|
|
grub-mkconfig -o /boot/grub/grub.cfg
|
|
```
|
|
|
|
### Dracut Configuration
|
|
Create `/etc/dracut.conf.d/nvidia.conf`:
|
|
```bash
|
|
add_drivers+=" nvidia nvidia_modeset nvidia_uvm nvidia_drm "
|
|
force_drivers+=" nvidia nvidia_modeset nvidia_uvm nvidia_drm "
|
|
```
|
|
|
|
Rebuild initramfs:
|
|
```bash
|
|
emerge --config sys-kernel/gentoo-kernel
|
|
```
|
|
|
|
## Hyprland Configuration
|
|
|
|
### GPU Auto-Detection
|
|
|
|
Hyprland should auto-detect GPUs. **Do NOT** set these variables in your config:
|
|
```bash
|
|
# Leave these commented out for auto-detection
|
|
# env = AQ_DRM_DEVICES,/dev/dri/card0:/dev/dri/card1
|
|
# env = AQ_MGPU_NO_EXPLICIT,1
|
|
```
|
|
|
|
If auto-detection fails, try explicit order as fallback:
|
|
```bash
|
|
env = AQ_DRM_DEVICES,/dev/dri/card1:/dev/dri/card0
|
|
env = AQ_MGPU_NO_EXPLICIT,1
|
|
```
|
|
|
|
### Monitor Configuration
|
|
|
|
Example triple-monitor layout:
|
|
```bash
|
|
# Left external | Center laptop | Right external
|
|
monitor=DP-1, 1920x1080@60, 0x0, 1
|
|
monitor=eDP-2, 1920x1080@60, 1920x0, 1
|
|
monitor=DP-2, 1920x1080@60, 3840x0, 1
|
|
```
|
|
|
|
Use `hyprctl monitors` to get your monitor names.
|
|
|
|
### Cursor Fix (Multi-GPU)
|
|
|
|
Disable hardware cursors to prevent duplicate/missing cursor issues:
|
|
|
|
In `~/.config/hypr/configs/SystemSettings.conf`:
|
|
```
|
|
cursor {
|
|
no_hardware_cursors = 2
|
|
default_monitor = eDP-2
|
|
}
|
|
```
|
|
|
|
### Workspace Assignment
|
|
|
|
Assign workspaces to specific monitors:
|
|
```bash
|
|
workspace = 1, monitor:eDP-2, default:true
|
|
workspace = 2, monitor:DP-1, default:true
|
|
workspace = 3, monitor:DP-2, default:true
|
|
```
|
|
|
|
## Gaming
|
|
|
|
Games automatically use the NVIDIA GPU in hybrid mode. No `prime-run` needed for most cases.
|
|
|
|
If a game isn't using the NVIDIA GPU:
|
|
```bash
|
|
prime-run <application>
|
|
```
|
|
|
|
Or set environment variables:
|
|
```bash
|
|
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia <application>
|
|
```
|
|
|
|
## Backlight Control
|
|
|
|
The laptop backlight is controlled by the AMD iGPU. If brightness controls don't work:
|
|
|
|
1. Check available backlight devices:
|
|
```bash
|
|
ls /sys/class/backlight/
|
|
```
|
|
|
|
2. Use the correct device in brightness scripts (usually `amdgpu_bl1` for Legion).
|
|
|
|
3. GRUB setting helps:
|
|
```bash
|
|
GRUB_CMDLINE_LINUX_DEFAULT="... acpi_backlight=native"
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### Pink/Artifacts on External Monitors
|
|
|
|
1. Ensure BIOS is set to Hybrid/Dynamic mode
|
|
2. Try letting Hyprland auto-detect GPUs (comment out AQ_* variables)
|
|
3. If auto-detect fails, try explicit GPU order
|
|
|
|
### External Monitors Not Detected
|
|
|
|
1. Check connections (USB-C to DisplayPort)
|
|
2. Verify NVIDIA driver is loaded: `lsmod | grep nvidia`
|
|
3. Check Xorg/Wayland logs for errors
|
|
|
|
### Performance Issues
|
|
|
|
1. Verify NVIDIA persistence daemon is running
|
|
2. Check power profile: `powerprofilesctl get`
|
|
3. Monitor GPU usage: `nvidia-smi`
|
|
|
|
### Screen Tearing
|
|
|
|
Ensure NVIDIA DRM is enabled:
|
|
```bash
|
|
cat /sys/module/nvidia_drm/parameters/modeset
|
|
# Should return: Y
|
|
```
|