记录 debian intel nvidia 笔记本安装显卡驱动详细过程

以下步骤全部根据官方文档操作
官方文档:NvidiaGraphicsDrivers

识别显卡

$ lspci -nn | egrep -i "3d|display|vga"
00:02.0 VGA compatible controller [0300]: Intel Corporation HD Graphics 530 [8086:191b] (rev 06)
01:00.0 3D controller [0302]: NVIDIA Corporation GM107M [GeForce GTX 960M] [10de:139b] (rev a2)

因为这条命令有2条输出,所以你有一个 Optimus (hybrid) graphics chipset。当以下步骤都做完后,需要去 NVIDIA Optimus 页面选择性配置。

检测并安装显卡驱动

安装 nvidia-detect 并执行,得到以下信息

$ nvidia-detect 
Detected NVIDIA GPUs:
01:00.0 3D controller [0302]: NVIDIA Corporation GM107M [GeForce GTX 960M] [10de:139b] (rev a2)

Checking card:  NVIDIA Corporation GM107M [GeForce GTX 960M] (rev a2)
Your card is supported by all driver versions.
Your card is also supported by the Tesla 510 drivers series.
Your card is also supported by the Tesla 470 drivers series.
Your card is also supported by the Tesla 450 drivers series.
Your card is also supported by the Tesla 418 drivers series.
It is recommended to install the
    nvidia-driver
package.

根据结果,安装 nvidia-driverfirmware-misc-nonfree
接着安装 CUDA: # apt install nvidia-cuda-dev nvidia-cuda-toolkit

配置

选择 Using NVIDIA PRIME Render Offload,但是总黑屏。
于是选择 Using NVIDIA GPU as the primary GPU
安装:# apt install x11-xserver-utils

/etc/X11/xorg.conf

已经替换了BusID。

Section "ServerLayout"
    Identifier "layout"
    Screen 0 "nvidia"
    Inactive "intel"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1:0:0" # e.g. PCI:1:0:0
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
    Option "AllowEmptyInitialConfiguration"
EndSection

Section "Device"
    Identifier "intel"
    Driver "modesetting"
    BusID "PCI:0:2:0" # e.g. PCI:0:2:0
    #Option "AccelMethod" "none"
EndSection

Section "Screen"
    Identifier "intel"
    Device "intel"
EndSection

/etc/lightdm/display_setup.sh

xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
xrandr --dpi 96

添加权限:# chmod +x /etc/lightdm/display_setup.sh

/etc/lightdm/lightdm.conf

已完成替换

[Seat:*]
display-setup-script=/etc/lightdm/display_setup.sh

重启系统,完成所有配置

检测结果

$ glxinfo | grep -i opengl
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce GTX 960M/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 510.85.02
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6.0 NVIDIA 510.85.02
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 510.85.02
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:
posted @ 2022-10-13 02:01  cliter  阅读(1507)  评论(0编辑  收藏  举报