-
Notifications
You must be signed in to change notification settings - Fork 26
🐛 profiles/graphic_drivers: skip early KMS for eGPUs #227
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
Open
christophsanz
wants to merge
3
commits into
CachyOS:master
Choose a base branch
from
christophsanz:fix/egpu-skip-early-kms
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,10 +48,34 @@ conditional_packages = """ | |
|
|
||
| """ | ||
| pre_install = """ | ||
| cat <<EOF >/etc/mkinitcpio.conf.d/10-chwd.conf | ||
| # Enable early KMS for non-removable NVIDIA GPUs. | ||
| # Removable GPUs (Thunderbolt, USB4) aren't available during initramfs, | ||
| # so loading these modules early causes Xid errors and no display output. | ||
| for dev in /sys/bus/pci/devices/*; do | ||
| vendor="$(cat "$dev/vendor" 2>/dev/null)" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It probably is, but i'd figured it wont hurt either. |
||
| class="$(cat "$dev/class" 2>/dev/null)" | ||
|
|
||
| # Only check NVIDIA (0x10de) display devices | ||
| if [ "$vendor" != "0x10de" ]; then | ||
| continue | ||
| fi | ||
|
|
||
| case "$class" in | ||
| 0x0300*|0x0302*|0x0380*) ;; # VGA, 3D, or display controller | ||
| *) continue ;; | ||
| esac | ||
|
|
||
| # Skip removable GPUs (eGPU via Thunderbolt, USB4, etc.) | ||
| if [ "$(cat "$dev/removable" 2>/dev/null)" = "removable" ]; then | ||
|
christophsanz marked this conversation as resolved.
Outdated
|
||
| continue | ||
| fi | ||
|
|
||
| cat <<EOF >/etc/mkinitcpio.conf.d/10-chwd.conf | ||
| # This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. | ||
| MODULES+=(nvidia nvidia_modeset nvidia_uvm nvidia_drm) | ||
| EOF | ||
| break | ||
| done | ||
|
|
||
| # Remove kms hook from mkinitcpio.conf on desktops | ||
| device_type="$(cat /sys/devices/virtual/dmi/id/chassis_type)" | ||
|
|
@@ -126,10 +150,34 @@ conditional_packages = """ | |
|
|
||
| """ | ||
| pre_install = """ | ||
| cat <<EOF >/etc/mkinitcpio.conf.d/10-chwd.conf | ||
| # Enable early KMS for non-removable NVIDIA GPUs. | ||
| # Removable GPUs (Thunderbolt, USB4) aren't available during initramfs, | ||
| # so loading these modules early causes Xid errors and no display output. | ||
| for dev in /sys/bus/pci/devices/*; do | ||
| vendor="$(cat "$dev/vendor" 2>/dev/null)" | ||
| class="$(cat "$dev/class" 2>/dev/null)" | ||
|
|
||
| # Only check NVIDIA (0x10de) display devices | ||
| if [ "$vendor" != "0x10de" ]; then | ||
| continue | ||
| fi | ||
|
|
||
| case "$class" in | ||
| 0x0300*|0x0302*|0x0380*) ;; # VGA, 3D, or display controller | ||
| *) continue ;; | ||
| esac | ||
|
|
||
| # Skip removable GPUs (eGPU via Thunderbolt, USB4, etc.) | ||
| if [ "$(cat "$dev/removable" 2>/dev/null)" = "removable" ]; then | ||
| continue | ||
| fi | ||
|
|
||
| cat <<EOF >/etc/mkinitcpio.conf.d/10-chwd.conf | ||
| # This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. | ||
| MODULES+=(nvidia nvidia_modeset nvidia_uvm nvidia_drm) | ||
| EOF | ||
| break | ||
| done | ||
|
|
||
| # Remove kms hook from mkinitcpio.conf on desktops | ||
| device_type="$(cat /sys/devices/virtual/dmi/id/chassis_type)" | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think iterating over /sys/class/drm/*/device will be faster and allows to get rid of class id check in the loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the device will be present in
/sys/class/drm/when the driver is not installed right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If NVIDIA driver is not installed, then kernel simply fallbacks to nouveau, which is still creates drm device. It is theoretically possible when no driver is loaded, but I am not sure if we should handle it here.