NVIDIA/nvidia-drivers
x11-drivers/nvidia-drivers es el controlador propietario para tarjetas de vídeo NVIDIA. Una alternativa de código abierto es nouveau.
El paquete x11-drivers/nvidia-drivers del árbol lo mantiene NVIDIA y se construye con el núcleo Linux. Contienen un gran fichero binario (blob) que realiza el trabajo pesado para comunicarse con la tarjeta de vídeo. Los controladores están compuestos por dos partes, un módulo para el núcleo y un controlador X11. Ambas partes se incluyen en un solo paquete. Debido a la forma en que NVIDIA empaqueta sus controladores, es necesario tomar algunas decisiones antes de instalar los controladores.
El paquete x11-drivers/nvidia-drivers contiene los controladores más recientes de NVIDIA con soporte para la mayoría de las tarjetas, con varias versiones disponibles, dependiendo de la antigüedad que tenga su tarjeta. Utiliza un «eclass» para detectar qué tipo de tarjeta está funcionando en el sistema para que se instale la versión correcta.
Es siempre recomendado (Y ademas una buena práctica) comprobar la documentación oficial de nvidia para la versión que tienes instalado en el sistema, ya que esa información podría estar más actualizada y podría servir para mas casos. Si algún problema ocurre, leer la documentación README podría ayudar mucho. La documentación README para todos los drivers de nvidia se pueden encontrar en online.
USE flags
USE flags for x11-drivers/nvidia-drivers NVIDIA Accelerated Graphics Driver
+X
|
Add support for X11 |
+modules
|
Build the kernel modules |
+static-libs
|
Install the XNVCtrl static library for accessing sensors and other features |
+strip
|
Allow symbol stripping to be performed by the ebuild for special files |
+tools
|
Install additional tools such as nvidia-settings |
dist-kernel
|
Enable subslot rebuilds on Distribution Kernel upgrades |
kernel-open
|
Use the open source variant of the drivers (Turing/Ampere+ GPUs only, aka GTX 1650+ -- recommended with >=560.xx drivers if usable) |
modules-compress
|
Install compressed kernel modules (if kernel config enables module compression) |
modules-sign
|
Cryptographically sign installed kernel modules (requires CONFIG_MODULE_SIG=y in the kernel) |
persistenced
|
Install the persistence daemon for keeping devices state when unused (e.g. for headless) |
powerd
|
Install the NVIDIA dynamic boost support daemon (only useful with specific laptops, ignore if unsure) |
wayland
|
Enable dev-libs/wayland backend |
Open source kernel modules
This driver only works on Turing GPUs and newer (i.e. GTX 1650 and newer), as mentioned next to the kernel-open flag above.
In May 2022, Nvidia announced work towards open sourcing their graphics cards' kernel drivers. The driver is hosted on GitHub.
Users can try out the open source driver by enabling the corresponding USE flag:
x11-drivers/nvidia-drivers kernel-open
Compatibilidad del hardware
El paquete x11-drivers/nvidia-drivers es compatible con una amplia gama de tarjetas NVIDIA disponibles. Están disponibles múltiples versiones para su instalación, dependiendo de la tarjeta(s) que tenga el sistema. Consulte la documentación oficial de NVIDIA, ¿Qué es un controlador antiguo?, para averiguar qué versión de x11-drivers/nvidia-drivers debe ser utilizada. Una manera bastante decente para encontrar esta versión es a través de un formulario interactivo. Introduzca la tarjeta gráfica que es utilizada por el sistema (no olvide la opción de Legacy en el campo «Product Type») y el formulario debe terminar con la versión más compatible.
Tarjetas antiguas
If the card has been identified as a legacy card (470 or lower) then it is highly recommended to either replace the hardware or switch to the nouveau driver, as the official driver is no longer receiving security updates.
It is possible to still use the unsupported driver, if the user is happy with the risks and lack of support by Nvidia and Gentoo:
~x11-drivers/nvidia-drivers-470.256.02
>x11-drivers/nvidia-drivers-471
Change the values to the 390 variants if that driver is the one required.
Instalación
Kernel de distribucón
Cuando usas un kernel de distribucón (sys-kernel/gentoo-kernel o sys-kernel/gentoo-kernel-bin), compilar el soporte del driver es tan simple como añadir lo siguiente a /etc/portage/make.conf:
USE="dist-kernel"
This will trigger the Nvidia driver to automatically rebuild on every kernel update. Restarting is recommended after doing a kernel update.
If using GRUB as a bootloader then adding the useflag dbus to /etc/portage/make.conf will also trigger GRUB to update the boot
El núcleo de Linux
Como se mencionó anteriormente, el controlador NVIDIA del núcleo se instala y ejecuta al margen del núcleo actual. Se construye como módulo, por lo que el núcleo debe soportar la carga de los módulos del núcleo (ver más abajo).
El módulo del núcleo (nvidia.ko) consta de una parte propietaria comúnmente conocida como «blob» (abreviatura en inglés de Binary Large Objects —objetos binarios grandes—) que controla el chip gráfico, y una parte de código abierto (el «glue» o lenguaje de pegamento), que, en tiempo de ejecución, actúa como intermediario entre la parte propietaria y el núcleo. Ambos tienen que trabajar muy bien juntos, dado que, de otra manera, el usuario podría sufir la pérdida de datos (a través de un kernel panic, servidores X que se bloquean sin que las aplicaciones X hayan guardado los datos) e, incluso, un fallo de hardware (pensemos en sobrecalentamientos y otros temas relacionados con la administración de energía).
Compatibilidad del núcleo
De vez en cuando, una nueva versión del núcleo cambia la ABI (siglas en inglés de application binary interface —interfaz binaria de aplicación—) interna para los controladores, lo que significa que todos los controladores que utilizan esas ABI deben cambiar en consecuencia. Para controladores de código abierto, especialmente los distribuidos con el núcleo, estos cambios son casi triviales de arreglar, ya que toda la cadena de llamadas entre los controladores y otras partes del núcleo pueden ser revisadas con bastante facilidad. Para los controladores propietarios, como nvidia.ko, esto no funciona exactamente igual. Cuando cambia la ABI interna, entonces no es posible simplemente ajustar el «glue», porque nadie sabe cómo el glue se utiliza por la parte propietaria. Incluso después de arreglar las cosas de manera que parezcan funcionar bien, el usuario corre el riesgo de que la ejecución de nvidia.ko en el nuevo núcleo no esté soportada, dando lugar a la pérdida de datos y fallos del hardware.
Cuando se libera una nueva versión del núcleo incompatible, probablemente sea mejor quedarse, por un tiempo, con el núcleo con soporte más reciente. NVIDIA suele tardar un par de semanas en preparar una nueva versión patentada que considere apta para su uso general. Sea paciente. Si es absolutamente necesario, entonces es posible utilizar la orden epatch_user con los ebuilds de nvidia-drivers: esto permite al usuario parchear nvidia-drivers para adaptarse, de alguna manera, con lo último, es decir, la liberación del núcleo no compatible. Tenga en cuenta que ni los mantenedores de nvidia-drivers ni de NVIDIA dan soporte a esta situación. No habrá ninguna garantía para el hardware, los mantenedores de Gentoo no pueden comenzar a solucionar los problemas, ya que es un driver propietario que solo NVIDIA puede depurar adecuadamente, y los mantenedores del núcleo (tanto de Gentoo como los de desarrollo) no darán, sin duda, soporte a los controladores propietarios, o, de hecho, a cualquier sistema «viciado por estos» que pase a tener problemas.
Si se utiliza genkernel all para configurar el núcleo, entonces todo estará listo. En caso contrario, vuelva a comprobar la configuración del núcleo para que este soporte (cargas los módulos) esté activado:
[*] Enable loadable module support --->
Active también Memory Type Range Register en el núcleo:
Processor type and features --->
[*] MTRR (Memory Type Range Register) support
With at least some if not all driver versions it may also be required to enable VGA Arbitration and the IPMI message handler:
Device Drivers --->
PCI support --->
[*] VGA Arbitration
Device Drivers --->
Character devices --->
[*] IPMI top-level message handler
Si el sistema tiene una tarjeta gráfica AGP , entonces, active opcionalmente el soporte agpgart para el núcleo, ya sea compilado (en el núcleo) o como módulo. Si (la opción) del módulo agpgart (compilado) en el núcleo no se utiliza, entonces, los controladores usarán su propia implementación de agpgart, llamada NvAGP. En algunos sistemas, esto produce un mejor comportamiento que el módulo agpgart en el núcleo, y en otros, se comporta peor. Evalúe una u otra opción en el sistema para obtener el mejor rendimiento. Cuando no sepa qué hacer, utilice agpgart en el núcleo:
Device Drivers --->
Graphics support --->
-*- /dev/agpgart (AGP Support) --->
En amd64, el IOMMU controla el ajuste agpgart.
Para los procesadores x86 y AMD64, el controlador de framebuffer interno del núcleo entra en conflicto con el controlador binario ofrecido por NVIDIA. Cuando se compile el núcleo para éstas CPUs, eliminar completamente el soporte para el controlador interno del núcleo tal y como se muestra abajo:
Device Drivers --->
Graphics support --->
Frame buffer Devices --->
<*> Support for frame buffer devices --->
< > nVidia Framebuffer Support
< > nVidia Riva support
Now make sure the nouveau driver is disabled:
Device Drivers --->
Graphics support --->
< > Nouveau (nVidia) cards
Device Drivers --->
Graphics support --->
Frame buffer Devices --->
<*> Support for frame buffer devices --->
< > nVidia Framebuffer Support
< > nVidia Riva support
Now make sure the nouveau driver is disabled:
Device Drivers --->
Graphics support --->
< > Nouveau (nVidia) cards
SimpleDRM must not be built-in (CONFIG_DRM_SIMPLEDRM=y
)[1]. Effects of it being enabled might include: no TTY, not working Xorg sessions/Wayland compositors, etc. Nonetheless, it is harmless as a module (CONFIG_DRM_SIMPLEDRM=m
).
Device Drivers --->
Graphics support --->
< > Simple framebuffer driver
A framebuffer driver is required for rendering the Linux console (TTY) as this functionality is not yet provided by the proprietary NVIDIA driver[2][3], i.e. nvidia-drivers, unlike in-tree DRM drivers, rely on other framebuffer drivers to provide Linux console (TTY) support, instead of providing its own. As shown below, set Mark VGA/VBE/EFI FB as generic system framebuffer (CONFIG_SYSFB_SIMPLEFB=y
), and then enable a framebuffer driver. Common options for this are to use either efifb (CONFIG_FB_EFI=y
) for UEFI devices or vesafb (CONFIG_FB_VESA=y
) for BIOS/CSM devices. simplefb (CONFIG_FB_SIMPLE=y|m
) may also be chosen, however there are reports of it not working, as there exist reports of it working as well as others; the decision is up to end user to make.
Device Drivers --->
Firmware Drivers --->
[*] Mark VGA/VBE/EFI FB as generic system framebuffer
Graphics support --->
Frame buffer Devices --->
<*> Support for frame buffer devices --->
[*] VESA VGA graphics support
[*] EFI-based Framebuffer Support
<*> Simple framebuffer support
The nvidia-drivers ebuild automatically discovers the kernel version based on the /usr/src/linux symlink. Please ensure that this symlink is pointing to the correct sources and that the kernel is correctly configured. Please refer to the "Configuring the Kernel" section of the Gentoo Handbook for details on configuring the kernel.
First, choose the right kernel source using eselect. When using sys-kernel/gentoo-sources version 3.7.10 for instance, the kernel listing might look something like this:
root #
eselect kernel list
Available kernel symlink targets: [1] linux-3.7.10-gentoo * [2] linux-3.7.9-gentoo
In the above output, notice that the linux-3.7.10-gentoo kernel is marked with an asterisk (*
) to show that it is the kernel that the symbolic link points to.
If the symlink is not pointing to the correct sources, update the link by selecting the number of the desired kernel sources, as in the example above.
root #
eselect kernel set 1
Kernel GCC plugins
If GCC plugins of the Kernel are enabled compilation of nvidia-drivers will use them. If the compiler version that was used to compile the plugins does not match the nvidia-drivers' compiler an error will occur.
General architecture-dependent options --->
GCC plugins --->
...
This behavior cannot be fixed, see bug #804618 or various forum posts [4] [5] [6]. Using these plugins seems controversial, too [7].
If the problem occurs, re-compile the plugins (in /usr/src/linux):
root #
make oldconfig && make prepare
Configuración
Controladores
Ahora es el momento de instalar los controladores. En primer lugar, siga la X Server Configuration Guide y ajuste la variable VIDEO_CARDS="nvidia"
en /etc/portage/make.conf. Durante la instalación del servidor X, esto hará que se instale la versión correcta de x11-drivers/nvidia-drivers.
Los controladores se pueden instalar con el parámetro USE
gtk
establecido en /etc/portage/make.conf. Esto instalará media-video/nvidia-settings, una herramienta gráfica muy útil para supervisar y configurar varios aspectos de la tarjeta NVIDIA.Cada vez que un núcleo es compilado, es necesario volver a instalar los módulos del núcleo de NVIDIA. Una manera fácil de reconstruir los módulos instalados por los ebuilds (como x11-drivers/nvidia-drivers) es ejecutar emerge @module-rebuild.
Una vez finalizada la instalación, ejecute modprobe nvidia para cargar el módulo del núcleo en la memoria. Si se trata de una actualización, retire primero el módulo anterior.
root #
lsmod | grep nvidia
root #
rmmod nvidia
root #
modprobe nvidia
Kernel module signing (optional)
The information in this section is not necessary for systems that do not implement signed kernel modules. Feel free to skip it.
If secure boot kernel signing is used, then the NVIDIA kernel modules need to be signed before they can be loaded.
This can be accomplished by using the kernel-provided perl script as follows.
root #
perl /usr/src/linux/scripts/sign-file sha512 /usr/src/linux/signing_key.priv /usr/src/linux/signing_key.x509 /lib/modules/ruta-a-los-modulos-del-núcleo/video/nvidia-uvm.ko
root #
perl /usr/src/linux/scripts/sign-file sha512 /usr/src/linux/signing_key.priv /usr/src/linux/signing_key.x509 /lib/modules/ruta-a-los-modulos-del-núcleo/video/nvidia.ko
As of driver version 358.09 a new module has been made to handle monitor mode setting and for this driver version this module must also be signed.
root #
perl /usr/src/linux/scripts/sign-file sha512 /usr/src/linux/signing_key.priv /usr/src/linux/signing_key.x509 /lib/modules/ruta-a-los-modulos-del-núcleo/video/nvidia-modeset.ko
When using a Wayland compositor or need to use PRIME offload, sign the following two modules:
root #
/usr/src/linux/scripts/sign-file sha512 /usr/src/linux/certs/signing_key.pem /usr/src/linux/certs/signing_key.x509 /lib/modules/Kernel-Version-modules-path/video/nvidia-drm.ko
root #
/usr/src/linux/scripts/sign-file sha512 /usr/src/linux/certs/signing_key.pem /usr/src/linux/certs/signing_key.x509 /lib/modules/Kernel-Version-modules-path/video/nvidia-peermem.ko
Once the modules are signed, the driver will load as expected on boot up. This module signing method can be used to sign other modules too - not only the nvidia-drivers. Just modify the path and corresponding module accordingly.
Dracut configuration (optional)
When using Dracut, it may be worthwhile to ensure that the NVIDIA modules are not bundled in the generated ramdisk (initramfs) image. Otherwise, every update may require regeneration of the image.
# Omit the nvidia driver from the ramdisk, to avoid needing to regenerate
# the ramdisk on updates.
omit_drivers+=" nvidia nvidia-drm nvidia-modeset nvidia-uvm "
El servidor X
Once the appropriate drivers are installed, the X server should work without any extra configuration. An example of /etc/X11/xorg.conf for single-GPU systems is provided below.
Section "Device"
Identifier "nvidia"
Driver "nvidia"
EndSection
For laptops with integrated Intel graphics card, try the XOrg config as suggested by the NVIDIA/Optimus page.
nvidia-persistenced
NVIDIA packages a daemon called nvidia-persistenced to assist in situations where the tearing down of the GPU device state isn't desired. Typically, the tearing down of the device state is the intended behavior of the device driver. Still, the latencies incurred by repetitive device initialization can significantly impact performance for some applications.
nvidia-persistenced is intended to be run as a daemon from system initialization and is generally designed as a tool for compute-only platforms where the NVIDIA device is not used to display a graphical user interface. Depending on the user's system and its uses, it may not be necessary to set persistenced
USE flag.
Currently, Gentoo does not elect to set the persistenced
USE flag as default.
Permisos
The user(s) needing to access the video card will need to be added to the video group:
root #
gpasswd -a larry video
Note that users will be able to run X without permission to the DRI subsystem, but hardware acceleration will be disabled. For Wayland sessions not setting this may result in a very low FPS.
PCI-Express Runtime D3 (RTD3) Power Management
NVIDIA GPUs have many power-saving mechanisms. Some of them will reduce clocks and voltages to different parts of the chip. Sometimes, turning off clocks or power to parts of the chip entirely, without affecting functionality or continuing to function, just at a slower speed.
The NVIDIA Linux driver includes initial experimental support for dynamically managing power to the NVIDIA GPU.
Thus, this feature is available only when the following conditions are satisfied:
- This feature is supported only on notebooks.
- This feature requires system hardware as well as ACPI support. The necessary hardware and ACPI support was first added in the Intel Coffeelake chipset series. Hence, this feature is supported from Intel Coffeelake chipset series.
- This feature requires a Turing or newer GPU (i.e. GTX 1650+).
- This feature is supported with Linux kernel versions 4.18 and newer. With older kernel versions, it may not work as intended.
- This feature is supported when Linux kernel defines
CONFIG_PM=y
. Typically, if the system supports S3 (suspend-to-RAM), thenCONFIG_PM
would be defined.
Setup
If the user wants to enable this feature, then it's recommended to follow the 'Automated Setup' section in Chapter 22 of the official NVIDIA README documentation. It has also been outlined below for convenience.
Create a file named 80-nvidia-pm.rules in /etc/udev/rules.d/ directory with the following contents:
# Enable runtime PM for NVIDIA VGA/3D controller devices on driver bind
ACTION=="bind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030000", TEST=="power/control", ATTR{power/control}="auto"
ACTION=="bind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030200", TEST=="power/control", ATTR{power/control}="auto"
# Disable runtime PM for NVIDIA VGA/3D controller devices on driver unbind
ACTION=="unbind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030000", TEST=="power/control", ATTR{power/control}="on"
ACTION=="unbind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030200", TEST=="power/control", ATTR{power/control}="on"
The following file needs be added to /etc/modprobe.d/ file to seamlessly enable this feature.
# Enable RTD3
options nvidia NVreg_DynamicPowerManagement=0x02
More information and other configuration options are documented in Chapter 22 of NVIDIA's README documentation.
Enabling global NVIDIA support
Most NVIDIA GPUs have hardware encoding/decoding. Here is the support matrix. GeForce 8 series and later GPUs have VDPAU superseding legacy XvMCNVIDIA support. Some ebuilds, like media-video/ffmpeg and media-video/obs-studio, have USE flags vdpau
and nvenc
to enable NVIDIA hardware encoding/decoding.
Applications support the nvidia
USE flag in /etc/portage/make.conf.
To rebuild applications with new USE flags:
root #
emerge -uD --newuse @world
Using the NVIDIA settings tool
NVIDIA also provides a settings tool. This tool allows the user to monitor and change graphical settings without restarting the X server and is available through Portage as part of x11-drivers/nvidia-drivers with the tools
USE flag set.
Utilización
Probar la tarjeta gráfica
Para probar la tarjeta NVIDIA, encienda X y ejecute glxinfo, que es parte del paquete x11-apps/mesa-progs. Este debería decir que el renderizado directo está activado:
user $
glxinfo | grep direct
direct rendering: Yes
Para los FPS (siglas en inglés frames per second —fotogramas por segundo—) del monitor, ejecute glxgears.
Solución de problemas
Para una vista general de las incidencias abiertas registradas contra el paquete x11-drivers/nvidia-drivers, echar un vistazo a Gentoo bugtracker: known bugs.
Random freezes
Freezes can occur for various reasons. Check that:
- All power saving options turned off in the system firmware setup.
- Only the original (from installation) driver options card defined in the /etc/modprobe.d/nvidia.conf file.
FATAL: modpost: GPL-incompatible module *.ko uses GPL-only symbol
When the ebuild is complaining about the 'mutex_destroy' GPL-only symbol:
root #
emerge x11-drivers/nvidia-drivers
FATAL: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol 'mutex_destroy'
Be sure to disable CONFIG_DEBUG_MUTEXES in the kernel's .config file, as suggested by this forum thread.
El controlador falla al intentar inicializarse cuando las interrupciones MSI están activadas
El controlador Linux de NVIDIA utiliza Message Signaled Interrupts (MSI) de forma predeterminada. Esto proporciona beneficios de compatibilidad y escalabilidad, debido principalmente a la prevención de compartir IRQ (siglas en inglés de interrupt request —petición de interrupción—). Algunos sistemas ha tenido problemas con el soporte MSI, al tiempo que trabajan bien con las interrupciones de virtualwire. Estos problemas se manifiestan como una incapacidad para iniciar X con el controlador de NVIDIA, o fallos de inicialización de CUDA.
Las interrupciones MSI se pueden desactivar a través del parámetro del módulo del núcleo de NVIDIA NVreg_EnableMSI=0
. Esto se puede establecer en la línea de órdenes al cargar el módulo, o más apropiadamente a través de los ficheros de configuración de los módulos del núcleo de la distribución (por ejemplo, en /etc/modprobe.d/).
Por ejemplo:
# Nvidia drivers support
alias char-major-195 nvidia
alias /dev/nvidiactl char-major-195
# To tweak the driver the following options can be used, note that
# you should be careful, as it could cause instability!! For more
# options see /usr/share/doc/nvidia-drivers-337.19/README
#
# !!! SECURITY WARNING !!!
# DO NOT MODIFY OR REMOVE THE DEVICE FILE RELATED OPTIONS UNLESS YOU KNOW
# WHAT YOU ARE DOING.
# ONLY ADD TRUSTED USERS TO THE VIDEO GROUP, THESE USERS MAY BE ABLE TO CRASH,
# COMPROMISE, OR IRREPARABLY DAMAGE THE MACHINE.
options nvidia NVreg_DeviceFileMode=0660 NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=27 NVreg_ModifyDeviceFiles=1 NVreg_EnableMSI=0
Obtener aceleración 2D para funcionar en máquinas con 4GB o más de memoria
Cuando la aceleración 2D de NVIDIA está dando problemas, entonces es probable que el sistema no sea capaz de establecer un rango de combinación de escritura con MTRR. Para verificarlo, compruebe el contenido de /proc/mtrr:
root #
cat /proc/mtrr
Cada línea mostrada debe contener write-back
o write-combining
. Cuando una línea se presenta con uncachable
en ella, entonces es necesario cambiar la configuración de la BIOS para solucionar este problema.
Reinicie y entre en la BIOS, y luego encontre la configuración MTRR (probablemente bajo «CPU Settings»). Cambie el ajuste de continuous
por discrete
y arranque de nuevo en Linux. Ahora no habŕa ninguna entrada uncachable
y la aceleración 2D funcionará sin ningún tipo de interferencias.
Alternatively, it might be necessary to enable MTRR cleanup support (CONFIG_MTRR_SANITIZER=Y) in the Linux kernel:
Processor type and features --->
[*] MTRR (Memory Type Range Register) support
[*] MTRR cleanup support
(0) MTRR cleanup enable value (0-1)
(1) MTRR cleanup spare reg num (0-7)
Failed to initialize DMA on Ryzen
Disable AMD Secure Memory Encryption[8]:
Processor type and features --->
[ ] AMD Secure Memory Encryption (SME) support
«no such device» aparece al intentar cargar el módulo del núcleo
Esto, por lo general, es causado por uno de los siguientes problemas:
- El sistema no tiene una tarjeta NVIDIA en absoluto. Verifique la salida de lspci para confirmar que el sistema tiene una tarjeta gráfica NVIDIA instalada y detectada.
- La versión actual instalada de x11-drivers/nvidia-drivers no es compatible con el modelo de tarjeta gráfica instalado. Consulte el fichero README en /usr/share/nvidia-drivers-*/ para obtener una lista de dispositivos compatibles, o utilice la búsqueda del controlador en http://www.geforce.com/drivers.
- Otro controlador del núcleo tiene el control del hardware. Verifique la salida de lspci -k para ver si otro controlador, como «nouveau», maneja la tarjeta gráfica. Si es así, puede desactivar este controlador o incluirlo en una lista negra (conocida como blacklist).
El renderizado directo no está activado
Si el renderizado directo no funciona, puede ser debido a que el núcleo tiene activado el Direct Rendering Manager, que entra en conflicto con el controlador. Vea el estado del renderizado directo, siguiendo las instrucciones de la sección Probar la tarjeta.
Primero, desactive Direct Rendering Manager (CONFIG_DRM
) en el núcleo:
Device drivers --->
Graphics support --->
< > Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)
A continuación, recompile x11-drivers/nvidia-drivers, ya que el controlador pudo haberse construido en contra de los símbolos de DRM del núcleo. Esto debería solucionar el problema.
Reproducción de vídeo lenta o con parpadeo
Últimamente parece que hay cierta ruptura entre la reproducción de algunos tipos de vídeo con los controladores binarios NVIDIA, haciendo que la reproducción de vídeo sea lenta o con parpadeos significativos. Este problema parece estar ocurriendo como consecuencia de la sustitución del método más común ACPI CPU idling por el metodo Intel CPU Idle para ciertas CPU.
Desactive el método Intel CPU idling con intel_idle.max_cstate=0
en la fase de arranque de línea de órdenes del núcleo, que hace que el núcleo vuelva automáticamente al método antiguo o normal de ACPI CPU idling. Además, desactivar la función NVIDIA Powermizer, o ajustar Powermizer al rendimiento máximo con nvidia-settings, se dice que puede ayudar. Aunque el método Intel CPU idling recientemente fue presentado como el método por defecto de CPU idling para CPU i5 y i7 (frente a la utilización de la ACPI CPU idling) esta es la raíz del problema aquí. Cambiar el método idling resuelve de manera significativa el problema, sin embargo, todavía se puede encontrar con algunos parpadeos mínimos o lentitud de vídeo si deinterlacing («desentrelazado») fue desactivado; esto ocurre cuando el vídeo está probablemente ya desentrelazado (es decir, alias mplayer-nodeint
junto con algo similar a mplayer -vo vdpau:deint=0:denoise=0:nochroma-deint:colorspace=0:hqscaling=1, video.mpg
lo que daría como resultado trabajar sobre lo ya trabajado).
If using GRUB as the bootloader, add this kernel parameter to /etc/default/grub like so:
GRUB_CMDLINE_LINUX_DEFAULT="intel_idle.max_cstate=0"
Don't forget to run grub-mkconfig -o /boot/grub/grub.cfg after making the change, so that the new configuration is generated (see the GRUB article for further details).
After you have rebooted, you can verify that the change is active:
user $
cat /sys/module/intel_idle/parameters/max_cstate
0
No HDMI Output/Video/Sound
This problem tended to occur whenever the HDMI hub device turned-off for a period of time, or the computer was started with an HDMI hub device turned off.
First, find the PCI device ID, using lspci.
When this problem occurs, substitute the PCI ID within the following command for rescanning the PCI bus:
root #
echo on > /sys/bus/pci/devices/0000\:06\:00.0/power/control
This avoides disable runtime power management for PCI function 0, placing this PCI bus always on.
No vertical synchronization (no VSync, tearing) in OpenGL applications
Adding the following option to the screen section prevents tearing on GTX 660, 660 Ti, and probably some other GPUs (reference):
Section "Section"
. . .
Option "metamodes" "nvidia-auto-select +0+0 { ForceFullCompositionPipeline = On }"
. . .
EndSection
udevd using 100% of the CPU, X server failed to start
Workaround available in bug #670340 comment #8
Distorted white lines during early boot
If nothing but a black screen with distorted white lines appears right after the kernel and initramfs is loaded, try disabling CONFIG_SYSFB_SIMPLEFB
and all framebuffer device drivers except CONFIG_FB_EFI
.
ERROR: Kernel configuration is invalid.
When building nvidia-drivers, a message could appear like:
root #
emerge x11-drivers/nvidia-drivers
... * Preparing nvidia module make -j8 HOSTCC=x86_64-pc-linux-gnu-gcc 'LDFLAGS=-m elf_x86_64' NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC=/usr/src/linux SYSOUT=/usr/src/linux modules make[1]: Entering directory '/usr/src/linux-5.15.23-gentoo' test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \ echo >&2; \ echo >&2 " ERROR: Kernel configuration is invalid."; \ echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\ echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ echo >&2 ; \ /bin/false)
This is not an error but the code logic that checks for this error. Therefore, the kernel configuration is in fact not invalid.
Plymouth can't find nvidia-uvm
module
When using systemd, it may be worth considering adding the following configuration to /etc/modprobe.d to ensure that nvidia-uvm
is loaded as a soft dependency of the nvidia
module. This helps prevent an error that happens when the configuration file is added to the initrd but not the nvidia-uvm
module; causing an error on Plymouth about not being able to find the nvidia-uvm
module.
This may not be required unless specifically using Dracut, systemd, and observe the error produced by Plymouth (not finding nvidia-uvm
) in the logs.
# Make a soft dependency for nvidia-uvm as adding the module loading to
# /usr/lib/modules-load.d/nvidia-uvm.conf for systemd consumption, makes the
# configuration file to be added to the initrd but not the module, throwing an
# error on plymouth about not being able to find the module.
# Ref: /usr/lib/dracut/modules.d/00systemd/module-setup.sh
# Even adding the module is not the correct thing, as we don't want it to be
# included in the initrd, so use this configuration file to specify the
# dependency.
softdep nvidia post: nvidia-uvm
Wayland GLAMOR (weird keyboard typing bug)
Symtoms: weird keyboard behavior when trying, it deletes and redraw the characters.
Affected: xwayland apps, i noticed it especially on discord and skype
Workaround:
XWAYLAND_NO_GLAMOR=1
Enable this envvar and it will disable GLAMOR, will take more resources but the issue won't occur anymore. you can just add it to /etc/environment file. more information in the gitlab link.
- notice: disabling glamor causes wine-proton games to work a lot slower and there are reports of steam for linux not even starting.
API mismatch
Symptoms: API mismatch can cause launching GPU accelerated applications to fail to launch. It can also cause external displays which are connected via a discrete NVIDIA graphics card to be detected, but not be enabled or activated (the screen will show up in xrandr, but will refuse to display output - the display will stay in low power mode.).
Detection: This problem can be detected using a few different methods:
1. Compare the currently loaded kernel module version with the currently available userspace management utilities.
Kernel module check:
user $
modinfo nvidia | grep version | head -n 1
version: 515.65.01
Userspace utility version:
user $
nvidia-settings --version | grep version
nvidia-settings: version 520.56.06
Observe in the previous command output there is a difference in the patch versions: 515.65.01 vs 515.65.06.
2. Something like the following message will be written to the dmesg log:
user $
dmesg
[ 337.995427] NVRM: API mismatch: the client has the version 520.56.06, but NVRM: this kernel module has the version 515.65.01. Please NVRM: make sure that this kernel module and all NVIDIA driver NVRM: components have the same version. [ 339.048386] [drm:nv_drm_dumb_map_offset [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to lookup gem object for mapping: 0x00000006 [ 339.048400] [drm:nv_drm_dumb_map_offset [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to lookup gem object for mapping: 0x00000007
3. The post-install ebuild log output also includes logic to detect for the API mismatch and instructions for the solution:
user $
emerge @module-rebuild
>>> Installing (1 of 1) x11-drivers/nvidia-drivers-520.56.06::gentoo * >>> SetUID: [chmod go-r] /usr/bin/nvidia-modprobe ... [ ok ] * Removing x11-drivers/nvidia-drivers-520.56.06 from moduledb. * Updating module dependencies for 6.0.5-gentoo-x86_64 ... [ ok ] * Adding module to moduledb. * Currently loaded NVIDIA modules do not match the newly installed * libraries and may prevent launching GPU-accelerated applications. * The easiest way to fix this is usually to reboot
Cause: API mismatch occurs when the nvidia kernel modules are of a different version than the userspace utilities. This occurs when a full system reboot is not performed after an nvidia-drivers package the update.
Solution: The simplest solution is to perform a full system reboot.
Configuración experta
Documentación
El paquete x11-drivers/nvidia-drivers también viene con una amplia documentación. Esta se instala en /usr/share/doc y se puede ver con la siguiente orden:
user $
less /usr/share/doc/nvidia-drivers-*/README.bz2
Parámetros del módulo del núcleo
El módulo nvidia
del núcleo acepta un número de parámetros (opciones) que se pueden utilizar para modificar el comportamiento del controlador. La mayoría de ellos son mencionados en la documentación. Para agregar o cambiar los valores de estos parámetros, modifique el fichero /etc/modprobe.d/nvidia. Recuerde que debe ejecutar update-modules después de modificar este fichero y, para que la nueva configuración surta efecto, recargar el módulo nvidia
previamente.
Pay close attention to this section as these kernel options can enable features that the hardware may or may not support. These options are not forgiving, so be careful with the parameters. Do not make any changes without validating and double-checking that the change is needed.
Attribute | Default | Description |
---|---|---|
NVreg_DeviceFileUID |
0 |
Modify the user ID for the device file. The default value sets it to the root user. Setting this to another user ID will make the driver module create the device file with access available to that user ID. |
NVreg_DeviceFileGID |
27 |
Modify the Group ID for the device file. The default value sets it to the video group. |
NVreg_DeviceFileMode |
Undefined | Set the permissions for the device file. A value of 0660 grants the owner and group-owner read-write access while other users cannot access the device file. |
NVreg_ModifyDeviceFiles |
1 |
Instruct the driver to enable or disable dynamic device file management. |
NVreg_EnablePCIeGen3 |
0 |
Enable PCIe Gen 3.x support. If the system supports this 8GT high speed bus then enable it with this module option flag. When this is enabled but the system does not support Gen 3.0, the behavior of the system can become irratic and unstable. Some have even reported damage to hardware enabling this when it is not properly supported. By default the Nvidia driver is set to use PCIe Gen 2.x for compatibility reasons. |
NVreg_UsePageAttributeTable |
0 |
This is one of the latest and newest additions to the Nvidia driver modules option. It allows the driver to take full advantage of the PAT technology - a newer way of allocating memory, replacing the older Memory Type Range Register (MTRR) method. The PAT method creates a partition type table at a specific address mapped inside the register and utilizes the memory architecture and instruction set more efficiently and faster. If the computer supports PAT and the feature is enabled in the kernel then this flag can be enabled. Without PAT support, users may experience unstable performance and even crashes if this is enabled. So be careful with these options. |
NVreg_EnableVia4x |
0 |
Enable AGP 4x mode in the the NVIDIA driver on Via-chipset-powered systems. Some of these hardware configurations would not work properly in AGP 4x mode when others would. The default leaves it at AGP 2x mode. |
NVreg_EnableALiAGP |
0 |
On ALi1541 and ALi1647 chipsets, AGP support is by default disabled by the NVIDIA drivers. The value specifies the speed factor to use, so the values 1, 2, 4 and 8 represent AGP 1x, 2x, 4x and 8x respectively. NVIDIA does not recommend changing the value as it may lead to unstable systems. |
NVreg_ReqAGPRate |
Unspecified | Forces the AGP mode on the driver. For instance, a value of 1 means AGP 1x, while a value of 4 means AGP 4x. |
NVreg_NvAGP |
Changes the AGP Gart mode setting. Possible values are: 0 (Disable), 1 (Enable using NVIDIAs internal AGP-Gart), 2 (Enable using the Linux kernel AGP-Gart) and 3 (Enable and use any available, but try th NVIDIA internal one first).
| |
NVreg_EnableAGPSBA |
0 |
Disables (0 ) or enables (1 ) AGP Side Banding. For stability reasons, the setting is by default disabled, but the setting can be enabled for testing and debugging purposes. This is not supported by NVIDIA though.
|
NVreg_EnableAGPFW |
0 |
Enables AGP Fast-Writes when set to 1 . Depending on the system's chipset this may cause stability issues if enabled.
|
NVreg_Mobile |
0 |
Through this setting, users can force the EDID information for particular systems. This workaround is provided for mobile GPU's where EDID information is either non-functional or disabled. Potential values are 0 (Auto detection of the correct setting), 1 (Dell notebooks), 2 (non-Compaq Toshiba laptops), 3 (All other notebooks/laptops), 4 (Compaq Toshiba laptops) or 5 (Gateway machines).
|
NVreg_RemapLimit |
60 |
Maximum amount of system memory remapping. It specifies the amount of memory that the driver will be allowed to remap through the IOMMU/SWIOTLB on a 64-bit system. Only use it if the IOMMU or SMIOTLB is larger than 64mb. NVIDIA recommends to subtract 4mb from the total amount of memory to use. For instance, the default value is 60 which is in fact 64mb. To set it to 128mb, set the value to 124 .
|
NVreg_UpdateMemoryTypes |
0 |
Tweak the use of page table attributes. Possible values are: 0 (Nvidias logic mechanism), 1 (Enable the use of changed page table attributes) and 2 (Disable the use of page table attributes).
|
NVreg_InitializeSystemMemoryAllocations |
1 |
Tell the NVIDIA driver to clear system memory allocations prior to using it for the GPUs. Disabling can give a slight performance boost but at the cost of increased security risks. By default the driver will wipe the allocated by zeroing out its content. |
NVreg_UseVBios |
1 |
Enable or disable the use of the video BIOS int10 code. Set to 0 to disable.
|
NVreg_RMEdgeIntrCheck |
Unspecified | Enable or disable checking for edge-triggered interrupts. |
NVreg_EnableMSI |
1 |
Enable or disable PCIe-MSI capabilities. Enable this to use MSI interrupts instead of wired interrupts. |
NVreg_MapRegistersEarly |
0 |
If set to 1 , allow the driver to map the memory locations early when the system is probing the hardware instead of the default option of doing this when loaded by modprobe or during startx. This is a debugging feature.
|
NVreg_RegisterForACPIEvents |
1 |
Enable the driver to register with the ACPI of the system to receive ACPI events. This can be disabled (0 ) when issues occur with ACPI or while debugging an issue.
|
NVreg_EnableGpuFirmware |
Varies | Enable or disable use of GSP firmware. Turing and later GPUs include a GPU System Processor (GSP) which can be used to offload GPU initialization and management tasks. When using GSP firmware, the driver will not yet correctly support display-related features or power management related features. These features will be added to GSP firmware in future driver releases. |
Editar el fichero /etc/modprobe.d/nvidia.conf y después actualizar la información de los módulos:
root #
update-modules
Retire el módulo nvidia
...
root #
modprobe -r nvidia
...y cárguelo de nuevo:
root #
modprobe nvidia
Configuración avanzada de X
La capa GLX también tiene una gran cantidad de opciones que se pueden configurar. Estas opciones controlan la configuración de salida de TV, pantallas duales, detección de frecuencia del monitor, etc. Una vez más, todas las opciones disponibles se detallan en la documentación.
Para utilizar cualquiera de estas opciones, lístelas en la sección Device correspondiente del fichero de configuración de X (normalmente /etc/X11/xorg.conf). Por ejemplo, para desactivar el logo de bienvenida:
Section "Device"
Identifier "nVidia Inc. GeForce2"
Driver "nvidia"
Option "NoLogo" "true"
VideoRam 65536
EndSection
Véase también
- nouveau & nvidia-drivers switching - modo gráfico híbrido utilizando los controladores de código abierto.
- NVIDIA Optimus - Configurar un sistema para utilizar los controladores de código cerrado para gráficos híbridos (modesetting).
References
- ↑ https://github.com/NVIDIA/open-gpu-kernel-modules/issues/228
- ↑ https://bugzilla.kernel.org/show_bug.cgi?id=216303#c5
- ↑ https://github.com/NVIDIA/open-gpu-kernel-modules/issues/341#issuecomment-1201748789
- ↑ https://forums.gentoo.org/viewtopic-t-1103798-start-0.html
- ↑ https://forums.gentoo.org/viewtopic-t-1103938-start-0.html
- ↑ https://forums.gentoo.org/viewtopic-t-1117792-start-0.html
- ↑ https://lwn.net/ml/linux-kernel/CAHk-=whA6zru0BaNm4uu5KyZe+aQpRScOnmc9hdOpO3W+xN9Xw@mail.gmail.com/
- ↑ https://devtalk.nvidia.com/default/topic/1039297/linux/unable-to-start-x-failed-to-initialize-dma-/
This page is based on a document formerly found on our main website gentoo.org.
The following people contributed to the original document: Sven Vermeulen (SwifT) , M Curtis Napier, and Chris Gianelloni
They are listed here because wiki history does not allow for any external attribution. If you edit the wiki article, please do not add yourself here; your contributions are recorded on each article's associated history page.