笔记本双显卡 intel 、nvidia 的驱动安装
Tofloor
poster avatar
摇摆哥
deepin
2020-01-08 21:14
Author
本帖最后由 supermew 于 2020-1-8 13:33 编辑

只针对单独使用 nvidia , 因为两个显卡自由的切换, 现在还不会玩。

关于在 archlinux 系统的双显卡的笔记本(inter + nvidia) 安装 nvidia 的驱动, 这是一个相当复杂的过程, 这里有原作者的博客 archlinux 笔记本安装nvidia显卡驱动与intel显卡驱动 现在我将起复制下来, 以免以后找不到了。

  1. >> pacman -S nvidia nvidia-libgl xorg-xrandr
  2. >> nvidia-xconfig  #该命令会创建 /etc/X11/xorg.conf
Copy the Code


这个 pacman -S 是 archlinux 包管理器, 跟 apt-get 是一样的功能的, 在 deepin 上, 不能使用上面的命令, 这需要到官方网站上下载 nvidia 的驱动进行安装。安装方法可以参考
这篇文章进行安装, 完成后需要按照下面进行配置。

编辑之前需要查询一些信息.用 lspci | grep -E "VGA|3D" 来查询 NVIDIA 显卡的 PCI 地址。PCI 地址是提到 NVIDIA 的输出行的前7个字符,看起来像 01:00.0 。在 xorg.conf 中,需转换为 #:#:# 格式;例如 01:00.0 应该写成 1:0:0 。BusID 那里 N 卡一般是 BusID “PCI:1:0:0” 注意格式,00:02.0 这种形式需要转换成 0:2:0 。在 /etc/X11/xorg.conf 最后添加如下内容:
  1. Section "Module"   
  2.               Load "modesetting"
  3. EndSection

  4. Section "Device"   
  5.               Identifier "nvidia"   
  6.               Driver "nvidia"   
  7.               BusID "PCI:1:0:0"   
  8.              Option "AllowEmptyInitialConfiguration"
  9. EndSection
Copy the Code

没使用窗框管理器的以下内容添加到 ~/.xinitrc 开头:
  1. ~/.xinitrc
Copy the Code

**对于 LightDM **

  1. #!/bin/bash
  2. # /etc/lightdm/display_setup.sh
  3. xrandr --setprovideroutputsource modesetting NVIDIA-0
  4. xrandr --auto
Copy the Code

赋予脚本可执行权限:
  1. >> chmod +x /etc/lightdm/display_setup.sh
Copy the Code



编辑 /etc/lightdm/lightdm.conf 的 [Seat:*] 部分以配置 lightdm 运行这个脚本:

  1. # nano /etc/lightdm/lightdm.conf
  2. [Seat:*]
  3. display-setup-script=/etc/lightdm/display_setup.sh
Copy the Code
重启,你的 DM 应该启动了。
但是有可能还是启动不了, 单独运行 display_setup.sh 时, 会提示 can't open display, 这时需要增加配置文件将 nvidia 设置成主要显卡。参考文章 nvidia optimus
/etc/X11/xorg.conf.d/ 下创建 /etc/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf , 其内容如下:
  1. Section "OutputClass"
  2.     Identifier "intel"
  3.     MatchDriver "i915"
  4.     Driver "modesetting"
  5. EndSection
  6. Section "OutputClass"
  7.     Identifier "nvidia"
  8.     MatchDriver "nvidia-drm"
  9.     Driver "nvidia"
  10.     Option "AllowEmptyInitialConfiguration"
  11.     Option "PrimaryGPU" "yes"
  12.     ModulePath "/usr/lib/nvidia/xorg"
  13.     ModulePath "/usr/lib/xorg/modules"
  14. EndSection
Copy the Code


Reply Favorite View the author
All Replies
avatar
cdercder
deepin
2020-01-09 01:34
#1
太好了,谢谢,收藏了,慢慢读,细细品
Reply View the author