The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.
Difference between revisions of "Make.conf/VIDEO CARDS/NVIDIA and Nouveau Driver Switching"
(11 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
This page describes how to switch between nvidia and nouveau graphics drivers | This page describes how to switch between nvidia and nouveau graphics drivers from the boot menu with the same kernel. | ||
==Background== | ==Background== | ||
The use of libglvnd was introduced with Funtoo Release 1.4. libglvnd provides for the automatic detection and configuration of the graphics driver during boot. When more than one driver is available for the same card, the configuration depends on the driver detected. Previous to Release 1.4, the proper configuration was provided by 'eselect opengl'. The selection between the nvidia and nouveau driver for a Nvidia graphics card is such a case. | The use of libglvnd was introduced with Funtoo Release 1.4. libglvnd provides for the automatic detection and configuration of the graphics driver during boot. When more than one driver is available for the same card, the configuration depends on the driver detected. Previous to Release 1.4, the proper configuration was provided by 'eselect opengl'. The selection between the nvidia and nouveau driver for a Nvidia graphics card is such a case. | ||
Switching drivers from the boot menu requires blacklisting of all graphics kernel modules (including drm) and configuring the graphics from an init daemon before Xorg is started. The kernel | Switching drivers from the boot menu requires blacklisting of all graphics kernel modules (including drm) and configuring the graphics from an init daemon before Xorg is started. This will not work, for instance, if the kernel has been configured for the plymouth splash screen. The prebuilt {{c|debian-sources-lts}} kernel provided in the Funtoo stage3 base system is consistent with the switching procedure. | ||
==System Profile== | ==System Profile== | ||
Line 55: | Line 55: | ||
menuentry "Funtoo Linux [nvidia] - vmlinuz-2.6.32.71_p14-rh" { | menuentry "Funtoo Linux [nvidia] - vmlinuz-2.6.32.71_p14-rh" { | ||
</console> | </console> | ||
==Blacklist Drivers== | |||
We must blacklist all graphics kernel modules: | |||
== xcfgmaker | {{file|name=/etc/modprobe.d/blacklist|body= | ||
blacklist drm | |||
blacklist nouveau | |||
blacklist nvidia | |||
blacklist nvidia_modeset | |||
blacklist nvidia_drm | |||
}} | |||
== xcfgmaker daemon == | |||
A Section "Device" must be provided for each driver. The most basic form is: | |||
{{file|body= | |||
Section "Device" | |||
Identifier | |||
Driver "nvidia" #or "nouveau" | |||
VendorName | |||
BoardName | |||
Option | |||
EndSection | |||
}} | |||
<console> | <console> | ||
###i## mkdir /etc/X11/video/; | ###i## mkdir /etc/X11/video/; | ||
Line 66: | Line 87: | ||
Then create a new daemon. Edit the file <tt>/etc/init.d/xcfgmaker</tt>: | Then create a new daemon. Edit the file <tt>/etc/init.d/xcfgmaker</tt>: | ||
{{file|name=xcfgmaker|lang=|desc=init daemon|body= | |||
#!/sbin/openrc-run | #!/sbin/openrc-run | ||
Line 84: | Line 105: | ||
{ | { | ||
cmdline_display_mode_exist=$(cat /proc/cmdline | cmdline_display_mode_exist=$(cat /proc/cmdline {{!}} grep -e "nouveau.blacklist=" -e "nvidia.blacklist=") | ||
display_mode_nvidia_exist=$(ls /etc/X11/video/ | display_mode_nvidia_exist=$(ls /etc/X11/video/ {{!}} grep "10-monitor.conf.nvidia") | ||
display_mode_nouveau_exist=$(ls /etc/X11/video/ | display_mode_nouveau_exist=$(ls /etc/X11/video/ {{!}} grep "10-monitor.conf.nouveau") | ||
cmdline_display_mode=$(cat /proc/cmdline | cmdline_display_mode=$(cat /proc/cmdline {{!}} awk -Fnvidia.blacklist= '{print $2}' {{!}} awk '{print $1}') | ||
if [ -n "$cmdline_display_mode_exist" ]; then | if [ -n "$cmdline_display_mode_exist" ]; then | ||
if [ -n "$display_mode_nvidia_exist" ] && [ -n "$display_mode_nouveau_exist" ]; then | if [ -n "$display_mode_nvidia_exist" ] && [ -n "$display_mode_nouveau_exist" ]; then | ||
Line 112: | Line 133: | ||
} | } | ||
}} | |||
Do not forget: | Do not forget: | ||
<console> | <console> |
Latest revision as of 20:24, November 27, 2019
This page describes how to switch between nvidia and nouveau graphics drivers from the boot menu with the same kernel.
Background
The use of libglvnd was introduced with Funtoo Release 1.4. libglvnd provides for the automatic detection and configuration of the graphics driver during boot. When more than one driver is available for the same card, the configuration depends on the driver detected. Previous to Release 1.4, the proper configuration was provided by 'eselect opengl'. The selection between the nvidia and nouveau driver for a Nvidia graphics card is such a case.
Switching drivers from the boot menu requires blacklisting of all graphics kernel modules (including drm) and configuring the graphics from an init daemon before Xorg is started. This will not work, for instance, if the kernel has been configured for the plymouth splash screen. The prebuilt debian-sources-lts
kernel provided in the Funtoo stage3 base system is consistent with the switching procedure.
System Profile
Check your system profile with ego. Both the gfxcard-nouveau
mix-in and either the gfxcard-nvidia
orgfxcard-nvidia-legacy
mix-in need to be in your profile and installed. Check the information here and here.
boot-update
The most important change: edit /etc/boot.conf:
/etc/boot.conf
boot {
generate grub
default "Funtoo Linux [nvidia]"
# or
# default "Funtoo Linux [nouveau]"
timeout 3
}
color {
normal cyan/blue
highlight blue/cyan
}
display {
#gfxmode 1280x800
#font unifont.pf2
}
"Funtoo Linux [nvidia]" {
kernel vmlinuz[-v]
params += ro console=tty1 quiet <other standard boot options>
params += nouveau.blacklist=true vga=791 # nouveau.blacklist=true is important
# or
# params += nouveau.blacklist=true video=uvesafb:1440x900-8,mtrr:2
}
"Funtoo Linux [nouveau]" {
kernel vmlinuz[-v]
params += ro console=tty1 quiet <other standard boot options>
params += nvidia.blacklist=true # nvidia.blacklist=true is important
}
Next, run boot-update.
After boot-update has been run, you should have something like:
root # grep menuentry /boot/grub/grub.cfg | wc -l 2 root # grep menuentry /boot/grub/grub.cfg menuentry "Funtoo Linux [nouveau] - vmlinuz-2.6.32.71_p14-rh" { menuentry "Funtoo Linux [nvidia] - vmlinuz-2.6.32.71_p14-rh" {
Blacklist Drivers
We must blacklist all graphics kernel modules:
/etc/modprobe.d/blacklist
blacklist drm
blacklist nouveau
blacklist nvidia
blacklist nvidia_modeset
blacklist nvidia_drm
xcfgmaker daemon
A Section "Device" must be provided for each driver. The most basic form is:
Section "Device"
Identifier
Driver "nvidia" #or "nouveau"
VendorName
BoardName
Option
EndSection
root # mkdir /etc/X11/video/; root # cd /etc/X11/video/; root # nano 10-monitor.conf.nouveau # make default config for nouveau. or copy existing config… root # nano 10-monitor.conf.nvidia # also for nvidia
Then create a new daemon. Edit the file /etc/init.d/xcfgmaker:
xcfgmaker
- init daemon#!/sbin/openrc-run # by http://wiki.sabayon.org/index.php?title=HOWTO:_Create_a_boot_option_for_easy_dual_to_single_display_switching # To be placed in /etc/init.d/ # Run Command: rc-update add xcfgmaker boot depend() { need localmount before xdm-setup before xdm before alsasound } start() { cmdline_display_mode_exist=$(cat /proc/cmdline | grep -e "nouveau.blacklist=" -e "nvidia.blacklist=") display_mode_nvidia_exist=$(ls /etc/X11/video/ | grep "10-monitor.conf.nvidia") display_mode_nouveau_exist=$(ls /etc/X11/video/ | grep "10-monitor.conf.nouveau") cmdline_display_mode=$(cat /proc/cmdline | awk -Fnvidia.blacklist= '{print $2}' | awk '{print $1}') if [ -n "$cmdline_display_mode_exist" ]; then if [ -n "$display_mode_nvidia_exist" ] && [ -n "$display_mode_nouveau_exist" ]; then #Choose the xorg file to be copied over if [ "$cmdline_display_mode" == "true" ]; then ebegin "Configuring X display with nouveau" cp /etc/X11/video/10-monitor.conf.nouveau /etc/X11/xorg.conf.d/10-monitor.conf # eselect opengl set xorg-x11 >/dev/null 2>&1; /sbin/modprobe drm /sbin/modprobe nouveau; else ebegin "Configuring X display with nvidia" cp /etc/X11/video/10-monitor.conf.nvidia /etc/X11/xorg.conf.d/10-monitor.conf # eselect opengl set nvidia >/dev/null 2>&1; /sbin/modprobe nvidia-drm; fi sleep 5 eend 0 else ebegin "Xorg file missing. Exitting" eend 0 fi fi }
Do not forget:
root # chmod +x /etc/init.d/xcfgmaker root # rc-update add xcfgmaker boot