Skip to content

Conversation

@xcrsz
Copy link
Contributor

@xcrsz xcrsz commented Dec 2, 2025

Summary by Sourcery

Update the xconfig script, likely adjusting menu or configuration handling for graphics driver selection.

xcrsz and others added 6 commits December 2, 2025 08:05
- Fix SCRIPT_DIR resolution to always produce absolute path using
  cd/pwd instead of unreliable readlink -f fallback

- Add consistent error propagation across all setup_* functions;
  previously only setup_amd_auto handled template failures

- Make NVIDIA driver version configurable via NVIDIA_DRIVER_VERSION
  environment variable (default: 580)

- Fix enable_rc_conf to update existing keys with incorrect values,
  not just check for key presence

- Add backup rotation to prevent unbounded growth in /etc/X11/backup;
  keeps last 10 backups (configurable via BACKUP_KEEP)

- Cache detect_vm_guest result to avoid repeated sysctl calls during
  auto-detection sequence

- Add detect_hybrid_gpu function for multi-vendor GPU detection;
  automatically selects dual config when hybrid graphics detected

- Enhance debug output with GPU vendor detection status, hybrid
  detection result, and backup directory listing

- Document NVIDIA_DRIVER_VERSION in usage text

- Add warning in offline install path about dependency requirements

- Add service support for virtualbox
Correct hybrid GPU detection false positives

The detect_hybrid_gpu function was counting grep matches rather than actual GPU devices, causing single-GPU systems to be misidentified as hybrid configurations.

Changes:
- Add count_gpu_devices() to count actual VGA/display class PCI devices instead of grep line matches
- Rewrite detect_hybrid_gpu to require multiple devices AND multiple
  vendors (Intel+NVIDIA, Intel+AMD, etc.)
- Change auto-detection to prefer discrete GPU over dual config;
  hybrid systems now select NVIDIA > AMD > Intel by priority
- Make 'dual' command manual-only for users who need displays
  connected to separate GPUs
- Improve debug output to show GPU device count and scoped pciconf output

Previously a system with one NVIDIA GPU would match multiple grep lines and incorrectly trigger the dual monitor template.
GhostBSD pkg requires exact package names including full version
(nvidia-driver-580.105.08), not just major version (nvidia-driver-580).

Changes:
- Query pkg search to find matching package by major version
- Support both major (580) and full (580.105.08) version formats
- Exclude -devel packages unless explicitly requested
- Fall back to latest non-legacy driver if requested version unavailable
- Add selected package name to debug output

Fixes installation failure:
  pkg: No packages available to install matching 'nvidia-driver-580'
Key Changes:

3D Controller Class Detection - NVIDIA dGPUs in laptops and servers often register as "3D controller" rather than "VGA/display". Updated detect_nvidia_gpu(), get_nvidia_device_ids(), count_gpu_devices(), and detect_hybrid_gpu() to include this class.
Explicit Device ID Table - Added ~150 specific device IDs in nvidia_device_to_driver() for known edge cases that don't fit neat prefix patterns:

304 legacy: NV4x/G7x (GeForce 6xxx/7xxx) with explicit 00xx-03xx device IDs
340 legacy: Tesla architecture (GeForce 8xxx/9xxx/2xx/3xx)
390 legacy: Fermi (GTX 4xx/5xx/6xx low-end)
470 legacy: Early Kepler (GK1xx) devices dropped from 535+


Better Architecture Coverage:
Added Hopper (H100, 23xx) for data center GPUs
Added Volta (1dxx) for Titan V / Quadro GV100
Fixed Blackwell range (2bxx/2cxx, not all 2xxx)
Separated Pascal (1bxx/1cxx) from Volta (1dxx)

Enhanced Debug Output - Shows per-device driver mapping so you can see exactly what driver each GPU will get.
Deduplication - get_nvidia_device_ids() now uses sort -u to avoid duplicate entries in multi-GPU systems.
Add 'nvidia-select' command for manual driver selection via bsddialog/dialog.
The menu displays detected GPU device IDs, auto-detected driver recommendations,
and allows users to override automatic detection when needed.

Features:
- Detects bsddialog (preferred) or dialog as fallback
- Shows all detected NVIDIA GPUs with PCI device IDs
- Lists all supported driver versions (580, 470, 390, 340, 304)
- Includes "auto" option to use auto-detected driver
- Allows cancel without making changes
@xcrsz xcrsz requested review from a team as code owners December 2, 2025 00:21
@sourcery-ai
Copy link

sourcery-ai bot commented Dec 2, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds an NVIDIA driver configuration/menu flow to the xconfig script, integrating it into the existing CLI/menu structure.

File-Level Changes

Change Details Files
Introduce an NVIDIA driver configuration menu into the xconfig script.
  • Extend the xconfig CLI/menu logic to include a new NVIDIA driver menu entry and navigation path.
  • Implement the underlying actions invoked when the NVIDIA driver menu is used (e.g., detection, install/update, or configuration hooks).
  • Wire the new NVIDIA driver menu into any existing help/output flows so it appears in user-facing usage information.
bin/xconfig

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@xcrsz xcrsz closed this Dec 2, 2025
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