NVidia/drivers-nvidia

From Gentoo Wiki
< NVIDIA(Redirected from NVidia/nvidia-drivers/it)
Jump to:navigation Jump to:search
This page is a translated version of the page NVIDIA/nvidia-drivers and the translation is 33% complete.
Outdated translations are marked like this.

x11-drivers/nvidia-drivers è il driver grafico proprietario per schede grafiche nVidia. Una alternativa open source è nouveau.

I drivers x11-drivers/nvidia-drivers vengono rilasciati da nVidia e sono costruiti per il kernel di Linux. Essi contengono una parte binaria che fa il lavoro pesante per dialogare con la scheda video. I driver sono costituiti da due parti, un modulo del kernel, e un driver X11. Entrambe le parti sono incluse in un singolo pacchetto. A causa del modo in cui nVidia ha creato i suoi drivers, è necessario fare delle scelte prima di installarli.

Il pacchetto x11-drivers/nvidia-drivers contiene i driver più recenti di nVidia con supporto per tutte le schede video, con diverse versioni disponibili a seconda dell'età della scheda. Si avvale di un eclass per rilevare che tipo di scheda è in esecuzione sul sistema, in modo che installi la versione corretta.

Nota
It's always recommended (and good practice) to check the corresponding documentation provided by NVIDIA for the version of the system's installed driver, as that information may be more up-to-date and prevalent for more use cases. If any issues arise, README documentation may come of a great help. The official README documentation for all NVIDIA's drivers can also be found online.

USE flags

USE flags for x11-drivers/nvidia-drivers NVIDIA Accelerated Graphics Driver

X Add support for X11
dist-kernel Enable subslot rebuilds on Distribution Kernel upgrades
kernel-open Use the open source variant of drivers (Turing/Ampere+ GPUs only, aka GTX 1650+, experimental)
modules Build the kernel modules
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)
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
wayland Enable dev-libs/wayland backend

Compatibilità hardware

Il pacchetto x11-drivers/nvidia-drivers supporta una vasta gamma di schede nVidia disponibili. Versioni multiple sono disponibili per l'installazione, a seconda della scheda video che ha il sistema. Consultare la documentazione ufficiale di nVidia, What's a legacy driver?, per scoprire che versione di x11-drivers/nvidia-drivers dovrebbe essere installata. Un modo abbastanza buono per scoprirlo è attraverso an interactive form. Inserire la scheda grafica che viene utilizzata dal sistema (ricordare l'opzione Legacy nel campo 'Tipo di prodotto') e il form dirà qual'è la versione più supportata.

Se la scheda è stata identificata come legacy, mascherare le più recenti releases di nvidia-drivers, cioè

If the card has been identified as a legacy card then mask the more recent releases of x11-drivers/nvidia-drivers, e.g.:

FILE /etc/portage/package.maskMasking drivers with version higher than 470
>x11-drivers/nvidia-drivers-471

Si noti che Gentoo non fornisce la versione 71.86.xx. Se il sistema dispone di una scheda che ha bisogno di queste versioni di drivers, allora è consigliabile utilizzare il driver nouveau.

Installazione

Distribution Kernel

When using a distribution kernel (sys-kernel/gentoo-kernel or sys-kernel/gentoo-kernel-bin), building driver support is as simple as adding the following to /etc/portage/make.conf:

FILE /etc/portage/make.confNvidia make.conf example
USE="dist-kernel"

This will trigger the Nvidia driver to automatically rebuild on every kernel update. Restarting is recommended after doing a kernel update.

Suggerimento
If using GRUB as a bootloader then adding the useflag dbus to /etc/portage/make.conf will also trigger GRUB to update the boot

Kernel

Come accennato in precedenza, il driver del kernel nVidia installa ed esegue in opposizione al kernel corrente. Se costruito come modulo, il kernel deve supportare il caricamento dei moduli (vedi sotto).

Il modulo del kernel (nvidia.ko) è costituito da una parte proprietaria (comunemente nota come "binary blob") che pilota il chip grafico, e una parte open source (detta "glue") che durante il fuzionamento opera come intermediario tra la parte proprietaria e il kernel. Questi tutti hanno bisogno di lavorare bene insieme, altrimenti l'utente potrebbe trovarsi di fronte alla perdita di dati (attraverso kernel panic, X server crashing con i dati non salvati nelle applicazioni X) e anche guasti hardware (surriscaldamento e altre questioni di alimentazione relative che potrebbero venire in mente).

Compatibilità del kernel

Di tanto in tanto, una nuova release del kernel cambia l'ABI interno per i drivers, il che significa che tutti i drivers che utilizzano tali ABI devono essere modificati di conseguenza. Per i drivers open source, in particolare quelli distribuiti con il kernel, questi cambiamenti sono banali da risolvere dal momento che l'intera catena di chiamate tra i drivers e le altre parti del kernel possono essere riviste abbastanza facilmente. Per i drivers proprietari come nvidia.ko, non è proprio la stessa cosa. Quando l'ABI interno viene cambiato non è possibile sistemare semplicemente il "glue", perché nessuno sa come tale "glue" (collante) è utilizzato dalla parte proprietaria. Anche dopo essere riusciti a sistemare le cose e anche dopo che queste sembra funzionino bene, l'utente rischia ancora l'esecuzione di nvidia.ko nel nuovo kernel non supportato, e ciò porterà alla perdita di dati e guasti hardware.

Quando una nuova incompatibile versione del kernel viene rilasciata, è probabilmente meglio attaccarsi per un po' al nuovo kernel supportato. Nvidia richiede solitamente un paio di settimane per preparare una nuova release e in genere pensano che questa sia adatta per un uso generale. Sii paziente. Se assolutamente necessario è possibile utilizzare il comando epatch_user con gli ebuild nvidia-drivers: questo permette all'utente di adattare in qualche modo i drivers nvidia con l'ultima versione del kernel non supportata. Da notare che né i manutentori dei drivers nvidia né Nvidia stessa sosterranno questa situazione. La garanzia hardware molto probabilmente sarà nulla, i manutentori di Gentoo non potranno iniziare a risolvere i problemi in quanto si tratta di un driver proprietario che solo Nvidia può correttamente mettere a punto, e i manutentori del kernel certamente non supportano i driver proprietari o qualsiasi "sistema contaminato" che funziona in difficoltà.

Se per configurare il kernel è stato utilizzato genkernel all, ogni cosa è impostata. Se non è stato utilizzato, invece, va fatto un doppio controllo nella configurazione del kernel, in modo che il seguente supporto sia abilitato:

KERNEL Enable loadable module support
[*] Enable loadable module support --->

Abilitare anche il "Memory Type Range Register" nel kernel:

KERNEL Enable MTRR support
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:

KERNEL Enable VGA Arbitration (CONFIG_VGA_ARB)
Device Drivers --->
   PCI support --->
      [*] VGA Arbitration
KERNEL Enable IPMI message handler (CONFIG_ACPI_IPMI)
Device Drivers --->
   Character devices --->
      [*] IPMI top-level message handler

Se il sistema ha una scheda grafica AGP, abilitare opzionalmente l'agpgart supportato dal kernel, sia compilato direttamente nel kernel sia come modulo. Se il modulo agpgart compilato direttamente nel kernel non viene utilizzato, i drivers utilizzeranno la propria implementazione agpgart, chiamata NvAGP. Su alcuni sistemi, questa si comporta meglio rispetto alla agpgart compilata direttamente sul kernel, e su altri, invece, si comporta peggio. Valutare la scelta sul proprio sistema per ottenere le migliori prestazioni. Quando incerti sul da farsi, utilizzare l'agpgart compilato nel kernel:

KERNEL Enable agpgart support
Device Drivers --->
   Graphics support --->
      -*- /dev/agpgart (AGP Support) --->
Nota
Su amd64, IOMMU controlla le impostazioni di agpgart.
Importante
Per processori x86 e AMD64, il driver framebuffer compilato direttamente nel kernel va in conflitto con il driver binario fornito da nVidia. Quando si compila il kernel per tali CPUs, rimuovere completamente i drivers da compilare nel kernel come mostrato:
KERNEL Disable support for the in-kernel driver
Device Drivers --->
    Graphics support --->
        Frame buffer Devices --->
            <*> Support for frame buffer devices --->
            < >   nVidia Framebuffer Support
            < >   nVidia Riva support

Ora assicurarsi che il driver nouveau sia disabilitato:

KERNEL
Device Drivers  --->
    Graphics support  --->
        <*> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) --->
            < > Nouveau (nVidia) cards
KERNEL Disable support for the in-kernel driver (CONFIG_FB_NVIDIA, CONFIG_FB_RIVA)
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:

KERNEL Disable support for the nouveau driver (CONFIG_DRM_NOUVEAU)
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).

KERNEL Disable SimpleDRM support (CONFIG_DRM_SIMPLEDRM)
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.

KERNEL Enable framebuffer drivers for the kernel 5.15 and later (CONFIG_SYSFB_SIMPLEFB, CONFIG_FB_VESA, CONFIG_FB_EFI, CONFIG_FB_SIMPLE)
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

Gli ebuild nvidia-drivers rilevano automaticamente la versione del kernel basato sul link simbolico /usr/src/linux. Si prega di assicurarsi che tale link simbolico punti ai sorgenti corretti e che il kernel sia configurato correttamente. Si prega di consultare la sezione "Configuring the Kernel" del Gentoo Handbook per dettagli sulla configurazione del kernel.

Primo, scegliere la giusta sorgente del kernel utilizzando eselect. Quando si utilizza la versione 3.7.10 del pacchetto sys-kernel/gentoo-sources per esempio, la lista dei kernel potrebbe essere simile a questa:

root #eselect kernel list
Available kernel symlink targets:
  [1]   linux-3.7.10-gentoo *
  [2]   linux-3.7.9-gentoo

Nella schermata sopra, si noti che il kernel linux-3.7.10-gentoo è contrassegnato con un asterisco (*) per mostrare che è il kernel selezionato con un collegamento simbolico.

Se il link simbolico non punta ai sorgenti corretti, aggiornare il collegamento selezionando il numero della versione del kernel desiderata, come nell'esempio precedente.

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.

KERNEL Enable GCC plugins (CONFIG_GCC_PLUGINS)
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

Configurazione

Drivers

Ora è tempo di installare i drivers. Primo, segui la guida X Server Configuration Guide e imposta VIDEO_CARDS="nvidia" su /etc/portage/make.conf. Durante l'installazione del server X, verrà installata la versione corretta del pacchetto x11-drivers/nvidia-drivers.

Nota
I drivers possono essere installati con la USE flag gtk impostata in /etc/portage/make.conf. Questo installerà il pacchetto media-video/nvidia-settings, uno strumento grafico utile per il monitoraggio e la configurazione di diversi aspetti della scheda nVidia.
Importante
Ogni volta che il kernel è compilato, è necessario reinstallare i moduli del kernel nVidia. Un modo semplice per ricompilare i moduli installati dagli ebuilds (come ad esempio x11-drivers/nvidia-drivers) è eseguire emerge @module-rebuild.

Una volta terminata l'installazione, eseguire il comando modprobe nvidia per caricare il modulo del kernel in memoria. Se si tratta di un aggiornamento, rimuovere il modulo precedente.

root #lsmod | grep nvidia
root #rmmod nvidia
root #modprobe nvidia

Firmare i moduli del kernel (opzionale)

Nota
L'informazione di questa sezione non è necessaria per i sistemi che non implementano i moduli del kernel firmati. Potete saltarla.

Se si utilizza l'avvio sicuro del kernel con firma, allora si avrà bisogno di firmare i moduli del kernel Nvidia prima che possano essere caricati.

Questo si fa utilizzando lo script per il kernel fornito da perl, come segue.

root #perl /usr/src/linux/scripts/sign-file sha512 /usr/src/linux/signing_key.priv /usr/src/linux/signing_key.x509 /lib/modules/Kernel-Version-modules-path/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/Kernel-Version-modules-path/video/nvidia.ko

Come per la versione del driver 358.09, è stato fatto un nuovo modulo per la gestione della modalità monitor e per questa versione del driver deve essere firmato tale modulo.

root #perl /usr/src/linux/scripts/sign-file sha512 /usr/src/linux/signing_key.priv /usr/src/linux/signing_key.x509 /lib/modules/Kernel-Version-modules-path/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

Una volta firmati questi moduli, il driver viene caricato all'avvio come previsto. Questo metodo di firma può essere utilizzato per firmare altri moduli non solo nvidia-drivers. Di conseguenza si dovrà modificare il percorso e il modulo corrispondente.

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.

FILE /etc/dracut.conf.d/nvidia.confDisabling NVIDIA modules in ramdisk
# 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 "

L'X server

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.

FILE /etc/X11/xorg.conf.d/nvidia.confExplicit nvidia driver section
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.

Autorizzazioni

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.
  • 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), then CONFIG_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:

FILE /etc/udev/rules.d/80-nvidia-pm.rules
# 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.

FILE /etc/modprobe.d/nvidia-pm.conf
# Enable RTD3
options nvidia NVreg_DynamicPowerManagement=0x02

More information and other configuration options are documented in Chapter 22 of NVIDIA's README documentation.

Abilitazione del supporto globale nvidia

Most NVIDIA GPUs are capable of donig hardware encoding/decoding, the support matrix can be found here. GeForce 8 series and later GPUs do come with VDPAU support which superseded legacy XvMCNVIDIA support. Some ebuilds, like media-video/ffmpeg and media-video/obs-studio, have USE flags vdpau and nvenc to enable support for NVIDIA hardware encoding/decoding.

Ci sono anche alcune applicazioni che utilizzano la USE flag nvidia, così che potrebbe essere una buona idea aggiungerla su /etc/portage/make.conf.

Quindi, eseguire emerge -uD --newuse @world per ricompilare le applicazioni che beneficiano della variazione della USE flag.

Utilizzare lo strumento di impostazioni nVidia

nVidia fornisce anche uno strumento per le impostazioni. Tale strumento consente all'utente di monitorare e variare le impostazioni grafiche senza riavviare il server X ed è disponibile attraverso il Portage come media-video/nvidia-settings. Come accennato in precedenza, lo strumento per le impostazioni verrà incluso automaticamente durante l'installazione dei driver con la USE flag gtk impostata su /etc/portage/make.conf o su /etc/portage/package.use.

Utilizzo

Testare la scheda

Per testare la scheda nVidia, avviare X ed eseguire il comando glxinfo, il quale fa parte del pacchetto x11-apps/mesa-progs. Esso dovrebbe dire che il direct rendering è attivato:

user $glxinfo | grep direct
direct rendering: Yes

Per monitorare gli FPS, eseguire glxgears.

Risoluzione dei problemi

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.

Il driver non viene inizializzato quando gli interrupt MSI sono abilitati

Il driver Linux NVIDIA utilizza Message Signaled Interrupts (MSI) come impostazione predefinita. Questo offre vantaggi di compatibilità e scalabilità, dovuti principalmente alla prevenzione di condivisione IRQ. Alcuni sistemi hanno problemi di supporto MSI, mentre lavorano bene con i virtual wire interrupts. Questi problemi si manifestano come l'incapacità di lanciare X con il driver NVIDIA, o errori di inizializzazione CUDA.

MSI interrupts può essere disabilitato tramite il parametro del modulo del kernel NVIDIA NVreg_EnableMSI=0. Questo può essere impostato nella linea di comando durante il caricamento del modulo, o più appropriatamente tramite i files di configurazione del modulo del kernel della distribuzione (come quelli sotto /etc/modprobe.d/).

Per esempio:

FILE /etc/modprobe.d/nvidia.confSetting nvidia NVreg_EnableMSI
# 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=432 NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=27 NVreg_ModifyDeviceFiles=1 NVreg_EnableMSI=0

Ottenere l'accelerazione 2D su macchine con memoria da 4 GB in su

Quando l'accelerazione nVidia 2D da problemi, allora è probabile che il sistema è incapace di impostare una impostazione write-combining con MTRR. Per verificare, controllare il contenuto di /proc/mtrr:

root #cat /proc/mtrr

Ogni riga dovrebbe contenere write-back o write-combining. Quando una linea contiene uncachable è necessario variare l'impostazione del BIOS per risolvere.

Riavviare e accedere al BIOS, poi trovare le impostazioni MTRR (probabilmente sotto "Impostazioni della CPU"). Modificare l'impostazione da continuous a discrete e avviare Linux. A questo punto non c'è più uncachable e l'accelerazione 2D ora funziona senza errori.

Alternatively, it might be necessary to enable MTRR cleanup support (CONFIG_MTRR_SANITIZER=Y) in the Linux kernel:

KERNEL Enable MTRR cleanup support
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]:

KERNEL Disable AMD Secure Memory Encryption (SME) support
Processor type and features  --->
   [ ]   AMD Secure Memory Encryption (SME) support

"no such device" appare quando si cerca di caricare il modulo del kernel

Questo in genere è causato da uno dei seguenti problemi:

  1. Il sistema non ha affatto una scheda nVidia. Controllare il messaggio che rilascia il comando lspci per vedere se il sistema ha una scheda video nVidia installata e rilevata.
  2. La corrente versione installata del pacchetto x11-drivers/nvidia-drivers non supporta il modello di scheda video montata. Controllare il file README in /usr/share/nvidia-drivers-*/ per vedere la lista dei dispositivi supportati, oppure ricercare il driver corretto su http://www.geforce.com/drivers.
  3. Un altro driver del kernel ha il controllo dell'hardware. Digitare lspci -k per vedere se un altro driver, tipo "nouveau", è legato alla scheda grafica. Se è così, disattivare o mettere in blacklist tale driver.

Direct rendering non è abilitato

Se direct rendering non funziona, questo può derivare dal fatto che il kernel ha Direct Rendering Manager attivato, il quale va in conflitto con il driver. Vedere lo stato di direct rendering seguendo le istruzioni nella sezione Testing the card.

Per prima cosa, disabilitare Direct Rendering Manager (CONFIG_DRM) nel kernel:

KERNEL Disabilitare Direct Rendering Manager
Device drivers --->
    Graphics support --->
        < > Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)

Successivamente, ricostruire il pacchetto x11-drivers/nvidia-drivers dal momento che il driver possa aver compilato il DRM del kernel. Questo dovrebbe risolvere il problema.

Riproduzione video a scatti o lenta

Ultimamente sembra che ci siano certi problemi con la riproduzione di alcuni tipi di video con i driver binari NVidia, causando la riproduzione dei video significativamente a scatti o lenta. Questo problema sembra si verifichi sulle CPU Intel anzichè sulle comuni CPU ACPI.

Disabilitare il metodo minimo della CPU intel utilizzando intel_idle.max_cstate=0 nella linea di comando di avvio del kernel, il quale dovrebbe causare l'automatica caduta del kernel al normale o più vecchio metodo minimo della CPU ACPI. Disabilitare anche la caratteristica Powermizer di NVidia, o impostare Powermizer alla massima performance con nvidia-settings può essere d'aiuto. Il metodo minimo della CPU Intel recentemente ha introdotto come predefinito il metodo minimo per i5 e i7 CPUs (rispetto all'utilizzo del minimo della CPU ACPI) ed è questa la causa principale. Questo metodo minimo risolve in maniera significativa il problema, tuttavia si incontra un pò di scattosità o lentezza nella riproduzione dei video se il deinterlacciamento è stato attivato; questo è quando il video è già deinterlacciato (per esempio alias mplayer-nodeint con qualcosa simile a mplayer -vo vdpau:deint=0:denoise=0:nochroma-deint:colorspace=0:hqscaling=1, video.mpg come un lavoro sparso.)

If using GRUB as the bootloader, add this kernel parameter to /etc/default/grub like so:

FILE /etc/default/grubAdding intel_idle.max_cstate kernel parameter in GRUB
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.

Nessuna sincronizzazione verticale (no VSync, lacerazione) nelle applicazioni OpenGL

Aggiungere la seguente opzione alla sezione screen, previene l'effetto lacerazione su GTX 660, 660 Ti, e probabilmente qualche altra GPUs (reference):

FILE /etc/X11/xorg.conf
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.

FILE /etc/modprobe.d/nvidia-uvm.confMake nvidia-uvm a soft dependency of the nvidia module (on systemd)
# 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.

Configurazione per esperti

Open source kernel modules

Attenzione
This is extremely experimental! Features are still missing and nvidia themselves don't claim that this is ready yet for desktop usage. Do not report bugs on Gentoo's Bugzilla unless it is packaging related.

In May 2022, Nvidia announced work towards open sourcing their graphics cards' kernel drivers. The driver is hosted on GitHub.

Adventurous users can try out the new features by enabling the corresponding USE flag:

FILE /etc/portage/package.use
x11-drivers/nvidia-drivers kernel-open

Documentazione

Anche il pacchetto x11-drivers/nvidia-drivers viene fornito con una documentazione completa. Questo è installato dentro /usr/share/doc e può essere consultato con il seguente comando:

user $less /usr/share/doc/nvidia-drivers-*/README.bz2

Parametri del modulo del kernel

Il modulo del kernel nvidia accetta un numero di parametri (opzioni) che possono essere utilizzati per monitorare il comportamento del driver. Molti di questi sono menzionati nella documentazione. Per aggiungere o variare i valori di questi parametri, modificare il file /etc/modprobe.d/nvidia.conf. Ricordare di eseguire update-modules dopo la modifica di questo file, e tenere presente di ricaricare il modulo nvidia prima che le nuove impostazioni abbiano effetto.

Attenzione
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 made 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.

Modificare /etc/modprobe.d/nvidia.conf:

root #update-modules

Scaricare il modulo nvidia...

root #modprobe -r nvidia

... e caricarlo nuovamente:

root #modprobe nvidia

Configurazioni di X avanzate

Anche GLX ha una vastità di opzioni che possono essere configurate. Queste controllano la configurazione di uscita TV, dual displays, la rilevazione della frequenza del monitor, ecc... Anche in questo caso, tutte le opzioni disponibili sono descritte nella documentazione.

Per utilizzare ognuna di queste opzioni, elencarle nella relativa sezione Device del file di configurazione di X (in genere /etc/X11/xorg.conf). Per esempio, per disabilitare il logo splash:

FILE /etc/X11/xorg.confDisabilitare il logo splash
Section "Device"
  Identifier "nVidia Inc. GeForce2"
  Driver     "nvidia"
  Option     "NoLogo" "true"
  VideoRam   65536
EndSection

Vedi anche

References


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.