Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPU hotplug support #130

Merged
merged 6 commits into from
Jan 10, 2025
Merged

GPU hotplug support #130

merged 6 commits into from
Jan 10, 2025

Conversation

maround95
Copy link
Contributor

Use Case

I have a Lenovo Legion 5 Pro (16ACH6H) laptop with an AMD iGPU and an NVIDIA dGPU. I want the flexibility to use different modules for the dGPU depending on my needs:

  1. No module: startup and power-saving.
  2. vfio-pci: For passthrough to a vm.
  3. nouveau: To use the connectors connected to the dGPU exclusively for driving additional monitors.
  4. nvidia (without modesetting): For CUDA workloads, offloaded rendering, etc.

Workflow involving Hyprland

  1. Load nouveau:
    I can now use the outputs connected to my dGPU only.
  2. Signal Aquamarine to release the dGPU:
udevadm trigger --type=devices --action=remove --subsystem-match=drm --property-match="MINOR=0"
  1. Unload nouveau and load something else.

I'm happy to take this to the finish line in case any changes are required.

@vaxerski vaxerski added the abi break breaks abi label Jan 7, 2025
@ikalco
Copy link
Contributor

ikalco commented Jan 8, 2025

looking at some of the stuff changed like closing fds, this might fix/help #83

@maround95
Copy link
Contributor Author

maround95 commented Jan 8, 2025

looking at some of the stuff changed like closing fds, this might fix/help #83

This patch also allows me to dissociate Hyprland from nouveau if I launch Hyprland with nouveau loaded from the start. I tested it with AQ_DRM_DEVICES=/dev/dri/card1(amd):/dev/dri/card0(nvidia) to set amd as the primary drm backend.

@vaxerski
Copy link
Member

vaxerski commented Jan 9, 2025

lgtm, can you please clang-format all the files though?

@maround95
Copy link
Contributor Author

maround95 commented Jan 10, 2025

Done
FYI There's also hyprwm/Hyprland#8980

@vaxerski
Copy link
Member

I realize, but we need a release here first.

src/backend/drm/DRM.cpp Outdated Show resolved Hide resolved
src/backend/drm/DRM.cpp Outdated Show resolved Hide resolved
@maround95
Copy link
Contributor Author

maround95 commented Jan 10, 2025

I forgot about having this hack because connectors were not being destroyed, so I forced them to. What I wanted was conn.disconnect() to destroy the outputs and then the conn refcount works out.

It's a plus that it looks much cleaner now

Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some final style nits. Content lgtm

src/allocator/GBM.cpp Outdated Show resolved Hide resolved
src/backend/Backend.cpp Outdated Show resolved Hide resolved
Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@vaxerski vaxerski merged commit 03677f8 into hyprwm:main Jan 10, 2025
1 check passed
@jbeich jbeich mentioned this pull request Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
abi break breaks abi
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants