NVIDIA/nvidia-drivers

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

x11-drivers/nvidia-driversNVIDIA 製グラフィックスカード用のプロプライエタリなドライバを含んでいます。

このプロプライエタリなドライバはいくつかのラッパー関数を含んでいて、これらはLinuxカーネルと共にコンパイルされます。また、ドライバにはグラフィックスカードとのやりとりの大部分を行うバイナリ・ブロブが含まれています。ドライバーはカーネルモジュールとX11ドライバーの二つの部分で構成されています。この両方が一つのソフトウェアパッケージに含まれています。ドライバがパッケージ化された際の都合により、インストール前にいくつか決めなければならない事柄があります。

x11-drivers/nvidia-driversはNVIDIAの最新のドライバーが含まれていて、大半のカードがサポートされています。カードの製造時期によっては対応するドライバーのいくつかのバージョンが含まれています。このパッケージはeclassを使用し、システムに含まれるカードの種類を特定した上で正しいバージョンのドライバーをインストールします。

メモ
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 フラグ

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

ハードウェアの互換性

x11-drivers/nvidia-driversパッケージは、利用可能なさまざまな NVIDIA カードをサポートします。 システムに搭載されているカードに応じて、複数のバージョンをインストールできます。 どのバージョンの nvidia ドライバーを使用する必要があるかを確認するには、機能サポート リストと NVIDIA の公式ドキュメントレガシー ドライバーとは?を参照してください。

レガシーハードウェア

もしグラフィックスカードがレガシーカードと分かったならば、より最近の nvidia-drivers のリリースをマスクしてください、例えば:

ファイル /etc/portage/package.maskバージョン 470 より後のドライバーをマスクする
>x11-drivers/nvidia-drivers-471

Gentoo は 470.xx バージョンよりも古いレガシーなドライバを提供していないことを念頭に置いておいてください。もしこのドライバを必要とするグラフィックスカードがシステム内にあるならば、nouveau ドライバを使うことが推奨されます。

インストール

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:

ファイル /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.

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

カーネル

上記の通り、NVIDIAのカーネルドライバーは現在のカーネルに合わせてインストールされ、実行されます。カーネルモジュールとしてビルドされるので、カーネルはモジュールのロードに対応していなければなりません。(下記参照)

カーネルモジュール(nvidia.ko)は(バイナリ・ブロブとして一般的に知られている)グラフィックスチップを動かすプロプライエタリな部分と、(「のり」である)実行時にカーネルとプロプライエタリな部分の橋渡しをするオープンソースの部分から構成されます。これらがすべて協調して動作しないと、(カーネルパニックや未保存のデータが残っている状態でのXサーバーのクラッシュなどによる)データの損失につながります。また、(過熱やそのた電源管理の問題に代表される)ハードウェアの不具合も考えられます。

カーネルの互換性

時々、新しいカーネルのリリースによってドライバー用の内部ABIが変わることがあります。これは、それらのABIを利用するすべてのドライバーをこの変更に合わせなければならないことを意味します。オープンソースのドライバー、特にカーネルとともに頒布されるものに関しては、ドライバーやカーネルの他の部分をつなぐ一連の機能呼び出しを見直すことが容易で、この様な変更はほとんど手間な加えることができます。しかし、プロプライエタリなドライバーに関しては同じようにはいきません。内部ABIが変わるとき、プロプライエタリな部分によってどのように「のり」の部分が使われているか分からないため、ただ単に「のり」の部分を修正することは不可能です。うまく修正を重ねて順調に動いているようであっても、nvidia.koを新しい、サポートされていないカーネルで使うことにはデータの損失やハードウェアの不具合が起きるといったリスクが付随します。

新しい、互換性のないバージョンのカーネルがリリースされたとき、しばらくはサポートされる最新のカーネルを使用しつづけることが最善でしょう。NVIDIAが一般に公開してもいいと判断するプロプライエタリなドライバーを公開するのには通常数週間かかります。気長に待つべきです。もし新しいカーネルが絶対に必要ならば、nvidia-driversのebuildでepatch_userコマンドを使うこともできます。これによってnvidia-driversに何らかの修正を加えて、最新のサポートされていないカーネルでも動くようにすることができます。nvidia-driversのメンテナも、NVIDIA自体もこのような用法はサポートしないことを念頭に置いてください。ハードウェアの保証もおそらく無効になるでしょう。また、NVIDIAのみがまともにデバッグできるのでGentooのメンテナも修正を加えることはできません。(Gentoo、Upstreamの双方の)カーネルのメンテナはプロプライエタリなドライバー、ひいてはプロプライエタリなソフトウェアに「汚染」されたシステムの不調に対してサポートを提供しません。

もしgenkernel allによってカーネルが構築されたならば、準備は整っています。もしそうでなければ、以下が有効になっているかもう一度確認してください:

カーネル ロード可能なモジュールに対するサポートを有効にする(CONFIG_MODULES
[*] Enable loadable module support --->

カーネル内のMemory Type Range Registerも有効にしてください(/proc/mtrrを有効にします):

カーネル MTRRのサポートを有効にする(CONFIG_MTRR
Processor type and features --->
   [*] MTRR (Memory Type Range Register) support

すべてではないにせよ少なくともいくつかのドライババージョンでは、VGAアービトレーションとIPMIメッセージハンドラを有効にする必要がある場合もあります:

カーネル VGA アービトレーションを有効化する(CONFIG_VGA_ARB
Device Drivers --->
   PCI support --->
      [*] VGA Arbitration
カーネル IPMI メッセージハンドラを有効化する(CONFIG_ACPI_IPMI
Device Drivers --->
   Character devices --->
      [*] IPMI top-level message handler

システムに AGP グラフィックスカードがある場合は、カーネルのagpgartサポートを有効にすることもできます。モジュールとして有効にする他、カーネルに組み込むこともできます。もしagpgartモジュールが使用されなければ、ドライバーに含まれるNvAGPという独自のagpgartの実装が使用されます。システムによっては、こちらを使用する方がカーネル内のagpgartよりも高いパフォーマンスが得られ、その逆も場合もあります。使用しているシステムでどちらの方がよいパフォーマンスを得られるかを確認するとよいでしょう。分からない場合は、カーネル内のagpgartを使ってください。

カーネル agpgartサポートを有効にする(CONFIG_AGP
Device Drivers --->
   Graphics support --->
      -*- /dev/agpgart (AGP Support) --->
メモ
amd64では、IOMMUがagpgartの設定をします。
重要
x86 および AMD64 プロセッサでは、カーネル内蔵のフレームバッファドライバが NVIDIA 製のバイナリドライバと競合します。これらの CPU に対してカーネルをコンパイルするときは、以下のようにしてカーネル内蔵のドライバを完全に取り除いてください。
カーネル カーネル内蔵ドライバのサポートを無効にする (CONFIG_FB_NVIDIA, CONFIG_FB_RIVA)
Device Drivers --->
    Graphics support --->
        Frame buffer Devices --->
            <*> Support for frame buffer devices --->
               < > nVidia Framebuffer Support
               < > nVidia Riva support

nouveau ドライバを無効にすることもお忘れなく:

カーネル nouveauドライバのサポートを無効にする (CONFIG_DRM_NOUVEAU
Device Drivers  --->
    Graphics support  --->
        < > Nouveau (nVidia) cards

SimpleDRM を組み込んではなりません (CONFIG_DRM_SIMPLEDRM=y)[1]。 これを有効にすると、TTY がなくなる、Xorg セッション/Wayland コンポジタが機能しないなどの影響が考えられます。それにもかかわらず、モジュール(CONFIG_DRM_SIMPLEDRM=m)としては無害です。

カーネル Disable SimpleDRM support (CONFIG_DRM_SIMPLEDRM)
Device Drivers --->
   Graphics support --->
      < > Simple framebuffer driver

Linux コンソール (TTY) のレンダリングにはフレームバッファ ドライバが必要です。これは、この機能が独自の NVIDIA ドライバ[2][3]によってまだ提供されていないためです。つまり、nvidia ドライバは、ツリー内 DRM ドライバとは異なり、他のフレームバッファ ドライバに依存して、 独自のコンソールを提供する代わりに、Linux コンソール (TTY) サポートを提供します。 以下に示すように、Mark VGA/VBE/EFI FB を汎用システム フレームバッファとして設定し(CONFIG_SYSFB_SIMPLEFB=y)、フレームバッファ ドライバを有効にします。 このための一般的なオプションは、UEFI デバイスの場合はefifb (CONFIG_FB_EFI=y)、BIOS/CSM デバイスの場合は vesafb (CONFIG_FB_VESA=y)を使用することです。 simplefb (CONFIG_FB_SIMPLE=y|m)を選択することもできますが、他のものと同様に機能するというレポートが存在するため、機能しないというレポートもあります。 決定はエンドユーザーが行います。

カーネル 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

nvidia-drivers ebuild は /usr/src/linux のシンボリックリンクを元にカーネルバージョンを決定します。このシンボリックリンクが正しいソースを指し、きちんとコンフィグレーションができていることを確認してください。カーネルのコンフィグレーションについては Gentoo ハンドブックの「カーネルの設定」をお読みください。

まず、正しいカーネルソースをeselectを使用して選択してください。例えばバージョン3.7.10のsys-kernel/gentoo-sourcesを使用している場合、カーネル一覧はこのようになっているでしょう:

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

上記の出力の中で、linux-3.7.10-gentooというカーネルがアスタリスク(*)で印されています。これは、このカーネルがシンボリックリンクで指されていることを意味します。

シンボリックリンクが正しいソースを指していない場合は、上記の例のように、目的のカーネルソースの数を選択してリンクを更新します。

root #eselect kernel set 1

カーネルのGCCプラグイン

もしカーネルのGCCプラグインが有効になっている場合、nvidia-driversのコンパイルでそれらが使用されます。もしプラグインをコンパイルするのに使用したコンパイラのバージョンと、nvidia-driversのコンパイルで使用するコンパイラのバージョンが一致しない場合、エラーが発生します。

カーネル GCCプラグインを有効にする (CONFIG_GCC_PLUGINS)
General architecture-dependent options --->
   GCC plugins --->
      ...

この振る舞いは修正できません。bug #804618や、あるいはフォーラムの様々な投稿を参照してください。[4] [5] [6].これらのプラグインを使用することについて、議論がなされているようです[7]

問題が起こる場合は、プラグインを再コンパイルしてください (/usr/src/linux 内で):

root #make oldconfig && make prepare

設定

ドライバー

いよいよドライバをインストールします。まず X サーバ設定ガイドに従い /etc/portage/make.confVIDEO_CARDS="nvidia" と設定します。そうすると X サーバをインストールする際に、適切なバージョンの x11-drivers/nvidia-drivers をインストールしてくれます。

メモ
ドライバは /etc/portage/make.confgtk USEフラグを指定してインストールすることもできます。これを指定すると media-video/nvidia-settings という、グラフィックカードを様々な角度からモニタ・設定できる便利なGUIツールがインストールされます。
重要
カーネルをビルドする時は毎回、NVIDIA のカーネルモジュールを再インストールしなければなりません。x11-drivers/nvidia-drivers のように ebuild でインストールされるモジュールを再ビルドするには、emerge @module-rebuild を実行するのが簡単です。

インストールが済んだら、modprobe nvidiaを実行して、カーネルモジュールをメモリにロードしてください。もしこれがアップグレードならば、まず以前のモジュールを削除してください。

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

カーネルモジュールの署名 (任意)

メモ
これは署名済みカーネルモジュールを使わないシステムには関係ない話なので、読み飛ばしても構いません。

セキュアブートのためのカーネル署名を行っている場合は、NVIDIAのカーネルモジュールも読み込む前に署名しなければなりません。

これはカーネル付属の perl スクリプトで次のように行えます:

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-uvm.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.ko

ドライババージョン 358.09 以降では画面モード設定のために新しいモジュールが追加されたので、これも併せて署名しなければなりません。

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-modeset.ko

Wayland コンポジターを使用する場合、または PRIME オフロードを使用する必要がある場合は、次の 2 つのモジュールに署名します。:

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

正しく署名ができたら、ドライバはブート時に読み込まれるはずです。このモージュール署名の方法は nvidia-drivers に限らず、ほかのモジュールでも使えます。指定するモジュールのパスを変更するだけです。

Dracut 設定 (任意)

Dracut を使用している場合は、生成される ramdisk (initramfs) イメージに NVIDIA モジュールがバンドルされないようにすると良いかもしれません。そうしないと、更新のたびにイメージの再生成が必要になることがあります。

ファイル /etc/dracut.conf.d/nvidia.conframdisk 内で NVIDIA モジュールを無効化する
# 更新時に ramdisk を再生成しなくていいように、ramdisk から nvidia
# ドライバを省く。
omit_drivers+=" nvidia nvidia-drm nvidia-modeset nvidia-uvm "

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.

ファイル /etc/X11/xorg.conf.d/nvidia.confExplicit nvidia driver section
Section "Device"
   Identifier  "nvidia"
   Driver      "nvidia"
EndSection

統合 Intel グラフィックカードを持つノートパソコンにおいては、NVIDIA/Optimus のページで提案されている XOrg の設定 を試してみてください。

nvidia-persistenced

NVIDIA は、GPU デバイス状態の破棄が望ましくない状況を支援するために、nvidia-persistencedと呼ばれるデーモンをパッケージ化しています。 通常、デバイス状態の破棄は、デバイス ドライバーの意図された動作です。 それでも、デバイスの初期化を繰り返すことによって発生する遅延は、一部のアプリケーションのパフォーマンスに大きな影響を与える可能性があります。

nvidia-persistenced は、システムの初期化からデーモンとして実行されることを目的としており、一般に、グラフィカル ユーザー インターフェイスの表示に NVIDIA デバイスが使用されないコンピューティング専用プラットフォーム用のツールとして設計されています。ユーザのシステムとその用途によっては、persistenced USE フラグを設定する必要はないかもしれません。

現在、Gentoo は persistenced USE フラグをデフォルトとして設定することを選択していません。

パーミッション

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) 電源管理

NVIDIA GPU には多くの省電力メカニズムが備わっています。 それらの中には、チップのさまざまな部分へのクロックと電圧を下げるものもあります。 場合によっては、機能に影響を与えたり、動作を継続したりすることなく、クロックやチップの一部の電源を完全にオフにすることができますが、速度が低下するだけです。

NVIDIA Linux ドライバーには、NVIDIA GPU への電力を動的に管理するための初期実験サポートが含まれています。

したがって、この機能は次の条件が満たされる場合にのみ使用できます:

  • この機能はノートブックでのみサポートされています。
  • この機能には、システム ハードウェアと ACPI サポートが必要です。必要なハードウェアと ACPI サポートは、Intel Coffeelake チップセット シリーズに初めて追加されました。 したがって、この機能は Intel Coffeelake チップセット シリーズからサポートされています。
  • この機能には、Turing 以降の GPU が必要です。
  • この機能は、Linux カーネル バージョン 4.18 以降でサポートされています。古いカーネル バージョンでは、意図したとおりに動作しない可能性があります。
  • この機能は、Linux カーネルが CONFIG_PM=y を定義している場合にサポートされます。 通常、システムが S3 (RAM へのサスペンド) をサポートしている場合は、CONFIG_PM が定義されます。

Setup

ユーザーがこの機能を有効にしたい場合は、公式 NVIDIA README ドキュメントの第 22 章の'自動セットアップ'セクションに従うことをお勧めします。 便宜上、以下でも概要を説明します。

Create a file named 80-nvidia-pm.rules in /etc/udev/rules.d/ directory with the following contents:

ファイル /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"

この機能をシームレスに有効にするには、次のファイルを /etc/modprobe.d/ファイルに追加する必要があります。

ファイル /etc/modprobe.d/nvidia-pm.conf
# Enable RTD3
options nvidia NVreg_DynamicPowerManagement=0x02

詳細およびその他の構成オプションについては、NVIDIA の README ドキュメントの第 22 章に記載されています。

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.

他のアプリケーションの中にもnvidiaというUSEフラグを使用するものがあるので、/etc/portage/make.confに追加しておくといいかもしれません。

そしてemerge -uD --newuse @worldを実行して、このUSEフラグの変更による影響を受けるアプリケーションを再ビルドします。

NVIDIA 設定ツールを使う

NVIDIAは設定ツールも提供しています。このツールによってXサーバを再起動することなく、ユーザがグラフィックの設定を監視したり変更することができます。このツールはx11-drivers/nvidia-driverstoolsUSEフラグを有効にすることで、Portage経由で利用することができます。

使い方

カードをテストする

NVIDIAのカードをテストするためには、Xを起動してglxinfoを実行します。これはx11-apps/mesa-progsパッケージに付属しています。ダイレクトレンダリングが有効になっていると表示されるはずです:

user $glxinfo | grep direct
direct rendering: Yes

FPSを監視するには、glxgearsを実行してください。

トラブルシューティング

ランダムなフリーズ

フリーズは様々な理由で発生します。これらを確かめてください:

  • システム ファームウェアのセットアップですべての省電力オプションがオフになっています。
  • /etc/modprobe.d/nvidia.confファイルで定義された元の (インストール時の) ドライバー オプション カードのみ。

FATAL: modpost: GPL-incompatible module *.ko uses GPL-only symbol

もしebuildが'mutex_destroy'というGPL-only symbolに文句を言うのであれば:

root #emerge x11-drivers/nvidia-drivers
FATAL: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol 'mutex_destroy' 

このフォーラムのスレッドで提案されているように、カーネルの.configファイルの中でCONFIG_DEBUG_MUTEXESが無効になっていることを確認してください。

MSI割り込みが有効になっているときにドライバの初期化に失敗する

Linux NVIDIAドライバーは、デフォルトでメッセージ信号割り込み(MSI)を使用します。 これは、主にIRQ共有の回避による互換性とスケーラビリティの利点を提供します。 一部のシステムでは、仮想ワイヤ割り込みで正常に動作しているときにMSIのサポートに問題があることがわかっています。 これらの問題は、NVIDIAドライバーでXを起動できない、またはCUDAの初期化の失敗として現れます。

MSI割り込みは、NVIDIAのカーネルモジュールのパラメーター経由で無効にすることができますNVreg_EnableMSI=0。これはモジュールを読み込む際にコマンドラインから、あるいはより適切には、ディストリビューションのカーネルのモジュールの設定ファイル(例えば/etc/modprobe.d以下のファイル)で設定できます。

例えば:

ファイル /etc/modprobe.d/nvidia.confNvidiaの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=0660 NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=27 NVreg_ModifyDeviceFiles=1 NVreg_EnableMSI=0

4GB 以上のメモリを搭載したマシンで 2D アクセラレーションを使う

NVIDIA 2D アクセラレーションで問題が発生する場合、システムが MTRR を使用して書き込み結合範囲を設定できない可能性があります。 確認するには、/proc/mtrrの内容を確認します。:

root #cat /proc/mtrr

Every line should contain write-back or write-combining. When a line shows up with uncachable in it then it is necessary to change a BIOS setting to fix this.

Reboot and enter the BIOS, then find the MTRR settings (probably under "CPU Settings"). Change the setting from continuous to discrete and boot back into Linux. There is now no uncachable entry anymore and 2D acceleration now works without any glitches.

Alternatively, it might be necessary to enable MTRR cleanup support (CONFIG_MTRR_SANITIZER=Y) in the Linux 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

AMD セキュアメモリ暗号化を無効にしてください[8]:

カーネル AMD セキュアメモリ暗号化 (SME) サポートを無効化する
Processor type and features  --->
   [ ]   AMD Secure Memory Encryption (SME) support

カーネルモジュールをロードしようとしたときに、"no such device" が発生する

これは通常、次の問題のいずれかが原因です:

  1. The system does not have a NVIDIA card at all. Check lspci output to confirm that the system has a NVIDIA graphics card installed and detected.
  2. The currently installed version of x11-drivers/nvidia-drivers does not support the installed graphics card model. Check the README file in /usr/share/nvidia-drivers-*/ for a list of supported devices, or use the driver search at http://www.geforce.com/drivers.
  3. Another kernel driver has control of the hardware. Check lspci -k to see if another driver like "nouveau" or "efifb" is bound to the graphics card. If so, disable or blacklist this driver.

Direct rendering is not enabled

If direct rendering does not work, it may be because the kernel has Direct Rendering Manager enabled, which conflicts with the driver. See the direct rendering status by following instructions in the section Testing the card.

First, disable Direct Rendering Manager (CONFIG_DRM) in the kernel :

カーネル Direct Rendering Manager を無効にする
Device drivers --->
    Graphics support --->
        < > Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)

Next, rebuild x11-drivers/nvidia-drivers since the driver may have built against the kernel DRM symbols. It should fix the problem.

Video playback stuttering or slow

最近、NVIDIA バイナリ ドライバーを使用した一部の種類のビデオの再生に問題が発生し、ビデオの再生が遅くなったり、著しく途切れたりすることがあるようです。 この問題は、特定の CPU の一般的な ACPI CPU アイドリング方法ではなく、Intel CPU アイドル交換で発生しているようです。

Disable the Intel CPU idling method using intel_idle.max_cstate=0 on the kernel command line boot method, which should cause the kernel to automatically fall back to the normal or older ACPI CPU idling method. Also, disabling the NVIDIA Powermizer feature, or setting Powermizer to maximum performance within nvidia-settings has been said to help. Although the Intel CPU idling method recently was introduced as the default CPU idling method for i5 and i7 CPUs (versus using ACPI CPU idling) is the root cause here. This idling method significantly solves the problem, however some minimal stuttering or slow video is encountered if deinterlacing was enabled; this is when the video is likely already deinterlaced (ie. alias mplayer-nodeint with something similar to {{{1}}} as a work around.)

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

ファイル /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).

再起動後、変更が有効であることを確認できます:

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):

ファイル /etc/X11/xorg.conf
Section "Screen"
     . . .
    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.

nvidia ドライバーをビルドするときに、次のようなメッセージが表示されることがあります:

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)

これはエラーではなく、このエラーをチェックするコード ロジックです。 したがって、カーネル構成は実際には無効ではありません。

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.

ファイル /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.

上級者向け設定

オープンソースカーネルモジュール

警告
これは極めて実験的なものです! まだ抜けている機能もあり、デスクトップでの使用にはまだ準備ができていないと nvidia 自身が主張しています。Gentoo の Bugzilla には、パッケージ化に関連するものを除き、バグを報告しないでください。

2022 年 5 月、Nvidia は、自社のグラフィックカードのカーネルドライバのオープンソース化へ向けた作業を発表しました。ドライバはGitHub 上でホストされています

冒険好きなユーザーは、対応する USE フラグを有効にすることで新機能を試すことができます:

ファイル /etc/portage/package.use
x11-drivers/nvidia-drivers kernel-open

ドキュメント

The x11-drivers/nvidia-drivers package also comes with comprehensive documentation. This is installed into /usr/share/doc and can be viewed with the following command:

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

カーネルモジュールのパラメーター

The nvidia kernel module accepts a number of parameters (options) which can be used to tweak the behavior of the driver. Most of these are mentioned in the documentation. To add or change the values of these parameters, edit the file /etc/modprobe.d/nvidia.conf. Remember to run update-modules after modifying this file, and bear in mind to reload the nvidia module before the new settings take effect.

警告
これらのカーネルオプションはハードウェアがサポートしない機能も有効化できるため、この作業は十分に注意しなければなりません。設定値を間違えちゃった、では済まないかもしれません。その変更が本当に必要なのか、設定値は正しいのかをよく確かめない限り、変更を加えてはいけません。
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.

/etc/modprobe.d/nvidia.conf を編集:

root #update-modules

nvidia モジュールをアンロードして...

root #modprobe -r nvidia

...もう一度読み込みます:

root #modprobe nvidia

X の高度な設定

The GLX layer also has a plethora of options which can be configured. These control the configuration of TV out, dual displays, monitor frequency detection, etc. Again, all of the available options are detailed in the documentation.

To use any of these options, list them in the relevant Device section of the X config file (usually /etc/X11/xorg.conf.d/nvidia.conf). For example, to disable the splash logo:

ファイル /etc/X11/xorg.conf.d/nvidia.confスプラッシュロゴを無効化する
Section "Device"
  Identifier "nVidia Inc. GeForce2"
  Driver     "nvidia"
  Option     "NoLogo" "true"
  VideoRam   65536
EndSection

関連項目

参照


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.