-
-
Notifications
You must be signed in to change notification settings - Fork 8
Feat: Add dynamic menu generation and improved gpu assignments #34
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
Conversation
…ompatibility Replace unmaintainable bash-dependent script with POSIX sh compatible version that uses modern hardware detection instead of massive hardcoded device lists. GPU detection overhaul: - PCI vendor ID detection: 0x10de (NVIDIA), 0x1002 (AMD), 0x8086 (Intel) - Device ID range mapping instead of 2000+ hardcoded GPU model strings - Eliminated maintenance burden of updating lists for every new GPU release - Future-proof design that works with unreleased hardware NVIDIA improvements: - Real package detection: nvidia-driver-580/470/390/340/304/devel - Device ID range-based driver selection (RTX 50/40/30→580, RTX 20→470, etc.) - Automatic Linux compatibility layer setup and module loading - Proper nvidia-modeset vs nvidia module selection by driver version AMD enhancements: - Smart amdgpu vs radeonkms detection using device ID ranges - Newer cards (0x6900+) → amdgpu, legacy cards → radeonkms - Automatic kernel module loading and conflict resolution Intel graphics: - i915kms module loading with proper conflict handling - Auto-detection fallback when module loading fails - Enhanced compatibility across Intel GPU generations Shell compatibility fixes: - POSIX sh compatible (works with sh, zsh, fish - no bash dependency) - Eliminated $((...)) arithmetic and bash-specific syntax causing usage errors - Progressive fallback: auto-detection → hardware-specific → VESA → manual VirtualBox testing: - Confirmed working on FreeBSD in VirtualBox environment - Proper guest additions setup and service configuration - Eliminates "pkg: No package(s) matching nvidia-driver" errors Reduces codebase from 800+ lines of unmaintainable device lists to 400 lines of future-proof, hardware-agnostic detection logic.
Key changes: - Consistent -ignoreABI usage throughout all X configuration generation - Added test_x_config() function that uses -ignoreABI for testing configurations - Enhanced configuration testing in manual setup mode - Added IgnoreABI option to VESA config for consistency - Improved VMware setup with configuration testing and fallback - Enhanced system state check that tests X server responsiveness - Better error handling in X configuration generation
Improvements: - FreeBSD paths: /usr/local/etc/X11/xorg.conf (proper FreeBSD standard) - Kernel modules: Fixed sysrc kld_list handling with deduplication and persistence - NVIDIA: Removed unnecessary Linux compat, smart package fallback logic - X testing: Eliminated timeout dependency, uses vt9 for safe testing - Modern defaults: Prefers Xorg autoconfig, only writes xorg.conf when necessary - Code quality: Proper POSIX sh with set -eu, FreeBSD-specific sed syntax
Improvements: - Added ServerLayout with proper InputDevice references, InputDevice sections - Added DPMS support and better descriptions for ModeLine entries - Added ShadowFB true and DefaultRefresh 60 options - Added 8-bit depth, organized color depth sections
Improvements: - Added all missing sections (ServerLayout, Files, Module, InputDevice, Screen) - Proper Cirrus driver configuration with appropriate options - Limited to what QEMU/Cirrus can reliably handle
Improvements: - Added standard Files and Module sections - Enhanced with proper VirtualBox vendor info and wider sync ranges - Added ShadowFB false and VESA false options - Support for 1920x1080, 1680x1050, etc.
Improvements: -Missing closing quote in "AutoAddDevices" "Off → "Off" - Added Files, Module, InputDevice (Keyboard), complete Monitor section - Added multiple color depths and modern resolutions - Added HWcursor false and StaticXinerama false options
- Xinerama support for multi-monitor - Side-by-side monitor configuration - Alternative single-card dual-output setup - Includes configuration comments and examples
- SCFB driver with shadow framebuffer - Wide sync ranges for dynamic resolution - Enterprise virtualization support
- Glamor acceleration - Color tiling and page flipping - DRI2 support - Standard resolution support
- SNA acceleration method - TearFree option for smooth video - DRI3 support - Modern resolution support
- Added Hyper-V detection - Enhanced Intel support with both auto-detection and config file options - Improved AMD support by using appropriate external config files Additional setup functions: - setup_intel_config() - Uses external Intel config - setup_hyperv() - Microsoft Hyper-V support - setup_safe() - Safe/recovery mode - setup_dual() - Dual monitor template - Graceful fallbacks when external configs aren't available
Reviewer's GuideThis PR enriches xconfig with a complete user guide, implements dynamic menu generation in the script, enhances GPU detection and driver assignment logic (including NVIDIA branch heuristics and AMD auto-selection), and adds new external configuration templates for multiple scenarios. Class diagram for dynamic menu generation and GPU assignment logicclassDiagram
class XConfig {
+autoDetectHardware()
+generateDynamicMenu()
+applyConfiguration(template)
+installDriver(driver)
+backupXorgConf()
+selectNvidiaBranch()
+selectAmdBranch()
}
class Menu {
+options
+buildMenu(options)
+showMenu()
}
class GPU {
+type
+driver
+detectType()
+assignDriver()
}
class ConfigTemplate {
+name
+path
+apply()
}
XConfig --> Menu : uses
XConfig --> GPU : detects/assigns
XConfig --> ConfigTemplate : applies
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey there - I've reviewed your changes - here's some feedback:
- Refactor the GPU classification and driver branch selection logic in bin/xconfig into dedicated helper functions to improve readability and ease future enhancements.
- Add existence checks for cardDetect templates before including them in the interactive menu to avoid presenting missing or stale entries.
- Ensure dynamic menu entries are properly quoted and escaped to handle any special characters in template filenames safely.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Refactor the GPU classification and driver branch selection logic in bin/xconfig into dedicated helper functions to improve readability and ease future enhancements.
- Add existence checks for cardDetect templates before including them in the interactive menu to avoid presenting missing or stale entries.
- Ensure dynamic menu entries are properly quoted and escaped to handle any special characters in template filenames safely.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
ericbsd
left a comment
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.
LGTM
Summary by Sourcery
Add dynamic menu generation for xconfig and improve GPU and virtualization assignment logic
New Features:
Enhancements:
Documentation: