周熠 發表於 2022-10-13 02:01:00

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

<p></p><div class="toc"><div class="toc-container-header">目录</div><ul><li>识别显卡</li><li>检测并安装显卡驱动</li><li>配置<ul><li><code>/etc/X11/xorg.conf</code></li><li><code>/etc/lightdm/display_setup.sh</code></li><li><code>/etc/lightdm/lightdm.conf</code></li><li>重启系统,完成所有配置</li><li>检测结果</li></ul></li></ul></div><p></p>
<p>以下步骤全部根据官方文档操作<br>
官方文档:NvidiaGraphicsDrivers</p>
<h2 id="识别显卡">识别显卡</h2>
<pre><code>$ lspci -nn | egrep -i "3d|display|vga"
00:02.0 VGA compatible controller : Intel Corporation HD Graphics 530 (rev 06)
01:00.0 3D controller : NVIDIA Corporation GM107M (rev a2)
</code></pre>
<p>因为这条命令有2条输出,所以你有一个 Optimus (hybrid) graphics chipset。当以下步骤都做完后,需要去 NVIDIA Optimus 页面选择性配置。</p>
<h2 id="检测并安装显卡驱动">检测并安装显卡驱动</h2>
<p>安装 <code>nvidia-detect</code> 并执行,得到以下信息</p>
<pre><code>$ nvidia-detect
Detected NVIDIA GPUs:
01:00.0 3D controller : NVIDIA Corporation GM107M (rev a2)

Checking card:NVIDIA Corporation GM107M (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.
</code></pre>
<p>根据结果,安装 <code>nvidia-driver</code> 和 <code>firmware-misc-nonfree</code>。<br>
接着安装 CUDA: <code># apt install nvidia-cuda-dev nvidia-cuda-toolkit</code></p>
<h2 id="配置">配置</h2>
<p>选择 <code>Using NVIDIA PRIME Render Offload</code>,但是总黑屏。<br>
于是选择 <code>Using NVIDIA GPU as the primary GPU</code>。<br>
安装:<code># apt install x11-xserver-utils</code></p>
<h3 id="etcx11xorgconf"><code>/etc/X11/xorg.conf</code></h3>
<p>已经替换了BusID。</p>
<pre><code>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
</code></pre>
<h3 id="etclightdmdisplay_setupsh"><code>/etc/lightdm/display_setup.sh</code></h3>
<pre><code>xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
xrandr --dpi 96
</code></pre>
<p>添加权限:<code># chmod +x /etc/lightdm/display_setup.sh</code></p>
<h3 id="etclightdmlightdmconf"><code>/etc/lightdm/lightdm.conf</code></h3>
<p>已完成替换</p>
<pre><code>
display-setup-script=/etc/lightdm/display_setup.sh
</code></pre>
<h3 id="重启系统完成所有配置">重启系统,完成所有配置</h3>
<h3 id="检测结果">检测结果</h3>
<pre><code>$ 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:
</code></pre><br><br>
来源:https://www.cnblogs.com/mutuu/p/16786696.html
頁: [1]
查看完整版本: 记录 debian intel nvidia 笔记本安装显卡驱动详细过程