您尚未登录。

#1 2020-10-01 16:59:05

airmh
会员
注册时间: 2020-06-28
帖子: 29

【已解决】双显卡多显示器笔记本运行 xrandr --auto 导致 xorg 崩溃

我有一个搭载了 intel+nvidia 双显卡的笔记本,它自带一个显示屏,并且通过 minidp 接口外接了一个显示器。

我想要让自带的显示器使用 intel 显卡,让外接的显示器使用 nvidia 显卡。

我查看了 wiki 中有关 xorg 和 xrandr 的内容,简单地设置了 xorg.conf,但是运行 xrandr --auto 后 xorg 会崩溃。我不清楚问题出在哪里、如何修复。

同时我使用 awesome 窗口管理器,我想要让这两个显示器共享同一个桌面,让窗口可以自由地在两个屏幕之间移动。我在 wiki 上看到了大量相关的页面,比如

这些页面提供了很多不同的方案,也提供了不同的 xorg.conf 模板,但同时让我感到迷惑。我不太清楚其中的某些概念,比如 Source Output, Sink Output, Sink Offload 这些概念,也不知道某些选项意味着什么,比如 Option "AllowEmptyInitialConfiguration"。我应该选择哪个方案,如何更深入的理解这些方案之间的区别,或者你现在采用的是什么方案,欢迎提供你的建议。


复现步骤
  1. 运行

    startx

    ,进入 awesome 窗口管理器

  2. 打开图形终端运行

    xrandr --auto
  3. 图形界面消失,显示 tty,startx 输出了一些错误内容

可能有用的信息
  1. 复现步骤 3 中,回到 tty 后 startx 输出的错误内容在这里
    https://dpaste.com/78CEPSADJ

  2. 对应的 xorg.log 文件在这里
    dpaste.com/5P5EQCNPE

  3. xrandr 的输出为
    https://dpaste.com/5GBSK22L8

  4. xrandr --listproviders 的输出

    Providers: number : 2
    Provider 0: id: 0x45 cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 4 outputs: 2 associated providers: 1 name:Intel
    Provider 1: id: 0x220 cap: 0x2, Sink Output crtcs: 4 outputs: 5 associated providers: 1 name:NVIDIA-G0
  5. 电脑的两个图形卡

    00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06)
    01:00.0 VGA compatible controller: NVIDIA Corporation GP106M [GeForce GTX 1060 Mobile] (rev a1)
  6. /etc/X11/xorg.conf 的内容如下

    $ cat /etc/X11/xorg.conf 
    Section "Device"
        Identifier             "Screen0"
        Driver                 "intel"
        BusID                  "PCI:0:2:0"
    EndSection
    
    Section "Device"
        Identifier             "Screen1"
        Driver                 "nvidia"
        BusID                  "PCI:1:0:0"
    EndSection
已安装的包
  • awesome 4.3-2

  • xorg-xrandr 1.5.1-2

  • xorg-server 1.20.9-2

  • xf86-video-intel 1:2.99.917+908+g7181c5a4-1

  • mesa 20.1.8-1

  • nvidia 455.23.04-2

  • nvidia-prime 1.0-4

  • nvidia-settings 455.23.04-1

  • nvidia-utils 455.23.04-1

最近编辑记录 airmh (2020-12-20 16:17:27)

离线

#2 2020-10-01 17:13:49

airmh
会员
注册时间: 2020-06-28
帖子: 29

Re: 【已解决】双显卡多显示器笔记本运行 xrandr --auto 导致 xorg 崩溃

另外,如果我运行

$ xrandr --setprovideroutputsource Intel NVIDIA-G0

得到的结果是这样的

X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  35 (RRSetProviderOutputSource)
  Value in failed request:  0x220
  Serial number of failed request:  16
  Current serial number in output stream:  17

离线

#3 2020-10-01 18:13:48

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,431
个人网站

Re: 【已解决】双显卡多显示器笔记本运行 xrandr --auto 导致 xorg 崩溃

为什么你有一个 NVIDIA(GPU-0),以及你的 BusID 确定没写错吗?你不手写配置而是安装 nvidia-prime 包呢?你不使用 xf86-video-intel 呢?

我想要让自带的显示器使用 intel 显卡,让外接的显示器使用 nvidia 显卡。

这个好像不是你可以选择的。

离线

#4 2020-10-01 19:32:08

airmh
会员
注册时间: 2020-06-28
帖子: 29

Re: 【已解决】双显卡多显示器笔记本运行 xrandr --auto 导致 xorg 崩溃

依云 说:

为什么你有一个 NVIDIA(GPU-0)

我不知道这意味着什么

依云 说:

以及你的 BusID 确定没写错吗?

我不知道错在哪里,因为我完全按照 Xorg#More_than_one_graphics_card 中的样例来写:

To get your bus IDs (in hexadecimal):

$ lspci | grep -e VGA -e 3D
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)
01:00.0 3D controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] (rev a1)

The bus IDs here are 0:2:0 and 1:0:0.

依云 说:

你不手写配置而是安装 nvidia-prime 包呢?

我安装了 nvidia-prime 是因为在我使用外接显示器之前,只使用笔记本自带的显示屏。当时我想要动态切换显卡,便根据 wiki 上的PRIME#PRIME_render_offload 内容进行了设置。

你的意思是现在有了外接显示器我需要手写配置吗,我不清楚需要怎样写

依云 说:

你不使用 xf86-video-intel 呢?

我确实有安装 xf86-video-intel 这个包,也在 xorg.conf 中写入了 Driver "intel"。我不知道你说的不使用是指什么。

依云 说:

这个好像不是你可以选择的。

我这样要求是因为我在这个电脑上使用 Winsows 10 系统时,我观察到:这个通过 minidp 口连接的外接显示器能被点亮当且仅当 nvidia 驱动被加载。如果仅加载 intel 的图形驱动,在 intel 驱动的图形设置界面里是无法识别到这个外接显示器的。感觉就像是这个 minidp 接口被硬接线到了 nvidia 显卡上一样。

你这样说是否有依据?

离线

#5 2020-10-01 19:40:35

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,431
个人网站

Re: 【已解决】双显卡多显示器笔记本运行 xrandr --auto 导致 xorg 崩溃

哦。这种我就不了解了。

离线

#6 2020-10-01 19:48:08

airmh
会员
注册时间: 2020-06-28
帖子: 29

Re: 【已解决】双显卡多显示器笔记本运行 xrandr --auto 导致 xorg 崩溃

: (

离线

#7 2020-10-03 11:38:49

luxni
会员
注册时间: 2014-06-08
帖子: 280

Re: 【已解决】双显卡多显示器笔记本运行 xrandr --auto 导致 xorg 崩溃

$ xrandr --output DP-1-0 --auto

试下呢,我看到你的NVIDIA驱动已经识别了minidp接口,并已经连接上了dell的显示器,理论上就可以出图了(可能它是个黑屏,你要看下显示器的背光有没有打开)。

---------------------------------------------------------------

$ xrandr --setprovideroutputsource Intel NVIDIA-G0

貌似命令不是这样写的吧?可能是我记错了。
应该是:

$ xrandr --listproviders

得到那个Provider号,然后:

$ xrandr --setprovideroutputsource 0 1

这样的。


虽然人菜菜的,但也想做个有趣的人。

离线

#8 2020-10-07 00:25:24

airmh
会员
注册时间: 2020-06-28
帖子: 29

Re: 【已解决】双显卡多显示器笔记本运行 xrandr --auto 导致 xorg 崩溃

很抱歉现在才回复

luxni 说:
$ xrandr --output DP-1-0 --auto

试下呢,我看到你的NVIDIA驱动已经识别了minidp接口,并已经连接上了dell的显示器,理论上就可以出图了(可能它是个黑屏,你要看下显示器的背光有没有打开)。

我的外接显示器的背光灯确实有被点亮。更具体的现象是这样的

  1. 执行 startx

  2. 内置显示器被点亮并显示 awesome 桌面

  3. 同时外接显示器被点亮发光,但是显示“无信号输入”,几秒后外接显示器不再显示任何东西

我执行上面的语句之后得到的结果和之前的类似:“图形界面消失,显示 tty,startx 输出了一些错误内容”。

如果有需要,我可以再收集一次错误报告并上传。

======

luxni 说:
$ xrandr --setprovideroutputsource Intel NVIDIA-G0

貌似命令不是这样写的吧?可能是我记错了。
应该是:

$ xrandr --listproviders

得到那个Provider号,然后:

$ xrandr --setprovideroutputsource 0 1

这样的。

我执行了

$ xrandr --setprovideroutputsource 0 1

但是得到的结果和

$ xrandr --setprovideroutputsource Intel NVIDIA-G0

是完全一致的:

X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  35 (RRSetProviderOutputSource)
  Value in failed request:  0x220
  Serial number of failed request:  16
  Current serial number in output stream:  17

离线

#9 2020-11-10 13:44:52

airmh
会员
注册时间: 2020-06-28
帖子: 29

Re: 【已解决】双显卡多显示器笔记本运行 xrandr --auto 导致 xorg 崩溃

我用以下的配置解决了问题,具体请见 Offloading Graphics Display with RandR 1.4 或是 NVIDIA Accelerated Linux Graphics Driver README and Installation Guide smile

/etc/X11/xorg.conf.d/nvidia.conf

# double screen
# [ external monitor ] [ laptop default screen ]
# [ NVIDIA           ] [ Intel                 ]
# [ primary          ] [ subordinate           ]
# see http://download.nvidia.com/XFree86/Linux-x86_64/455.38/README/randr14.html

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

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1:0:0"
EndSection

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

Section "Device"
    Identifier "intel"
    Driver "modesetting"
EndSection

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

每次启动 xorg 后还需要运行以下内容:

nvidia-settings --assign CurrentMetaMode="nvidia-auto-select +0+0 { ForceFullCompositionPipeline = On }" # optional, to avoid tearing on nvidia screen
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --output eDP-1-1 --auto --output DP-0 --left-of eDP-1-1
xrandr --output eDP-1-1 --set "PRIME Synchronization" 1

可以看到,为了避免 nvidia 显卡的屏幕撕裂问题,我使用了

 nvidia-settings --assign CurrentMetaMode="nvidia-auto-select +0+0 { ForceFullCompositionPipeline = On }" 

不知道这是不是一个好的实践方案。

另外我的 Intel 显卡使用 modesetting 驱动时也存在屏幕撕裂问题,不知道如何解决

最近编辑记录 airmh (2020-11-11 12:02:17)

离线

页脚