无法在笔记本电脑(具有 Optimus / Bumblebee)上激活 HDMI

无法在笔记本电脑(具有 Optimus / Bumblebee)上激活 HDMI

我正在尝试在带有 Debian (stretch) 的 PC (HP ZBook) 上使用 HDMI 输出。我已经配置了 Bumblebee,它运行良好(glxinfo 和 optirun glxinfo 报告了预期的信息,并且我测试了复杂的 GLSL 着色器,它们也按预期工作)。

现在我希望能够在 HDMI 上插入视频投影仪。我在这里读到[1],当 HDMI 连接到 NVidia 板上时,可以使用 intel-virtual-output 来配置它(使用可由 xrandr 操作的虚拟输出)。然而,英特尔虚拟输出说:

 no VIRTUAL outputs on ":0"

当我这样做时xrandr -q,没有列出虚拟输出,我只有:

Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 8192 x 8192
eDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 345mm x 194mm
   1920x1080     60.02*+  59.93  
   1680x1050     59.95    59.88  
   1600x1024     60.17  
   ... other video modes ...
   400x300       60.32    56.34  
   320x240       60.05  
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
HDMI-2 disconnected (normal left inverted right x axis y axis)

我安装的xserver-xorg-video-intel版本是:xser​​ver-xorg-video-intel_2.99.917+git20160706-1_amd64.deb

更新(2016 年 12 月 9 日星期六)我已经更新了 Debian,现在当我启动某些应用程序(例如 xemacs)时,第二个显示器处于活动状态时,X 会崩溃。星期六。 2016 年 12 月 17 日:是的,发现了! (更新了答案)。

更新(2017 年 9 月 27 日星期三)该方法适用于 99% 的情况,但上周我尝试了一个仅接受 50Hz 模式的投影仪,无法获得除 60Hz 以外的任何模式(因此它不起作用)。有人知道如何强制 50Hz 模式吗?

更新(2019 年 10 月 1 日星期二)啊!再次损坏:更新 X 和 NVidia 驱动程序后,optirun 现在崩溃(/var/log/Xorg.8.log在 Xorg 中显示崩溃,OsLookupColor+0x139)。更新(2019 年 10 月 7 日)找到临时修复(更新答案)。

[1]https://github.com/Bumblebee-Project/Bumblebee/wiki/Multi-monitor-setup

答案1

是的,发现了! 要激活intel驱动的VIRTUAL输出,需要20-intel.conf在Xorg配置目录中创建一个文件(/usr/share/X11/xorg.conf.d在Debianstretch下,通过阅读找到/var/log/Xorg.0.log

Section "Device"
    Identifier "intelgpu0"
    Driver "intel"
    Option "VirtualHeads" "2"
EndSection

我的/etc/bumblebee/xorg.conf.nvidia如下:

Section "ServerLayout"
    Identifier  "Layout0"
    Option      "AutoAddDevices" "true"
    Option      "AutoAddGPU" "false"
EndSection

Section "Device"
    Identifier  "DiscreteNvidia"
    Driver      "nvidia"
    VendorName  "NVIDIA Corporation"
    Option "ProbeAllGpus" "false"
    Option "NoLogo" "true"
    Option "AllowEmptyInitialConfiguration"
EndSection

Section "Screen"
    Identifier "Screen0"
    Device "DiscreteNVidia"
EndSection

一些解释:它需要一个“Screen”部分,否则它会尝试使用 20-intel.conf 中声明的 Intel 设备(我们之前刚刚添加,哦天哪......)。它还需要“AllowEmptyInitialConfiguration”才能在未连接外部显示器时仍然能够通过 optirun 启动。

通过此配置并启动intel-virtual-output,我能够访问我的 HDMI 端口。耶哈!!!

故障排除:如果optirunintel-virtual-output不起作用,请看一下/var/log/Xorg.8.log(bumblebee 创建一个 X 服务器,内部使用 display :8)。

笔记KeepUnusedXServer我在几个应该设置为truePMMethodto nonein 的地方读到/etc/bumblebee/bumblebee.conf,我没有这样做,但效果很好。如果我这样做,它会起作用,但即使在退出 optirun-ed 应用程序或终止 intel-virtual-output 之后,独立 GPU 仍保持打开状态,这是我不想要的。

更多笔记另一件让我头疼的事情是停用 Nouveau 并启动 Intel X 服务器:它需要通过传递到内核的标志来完成,这些标志在 GRUB 参数中指定。在 中/etc/defaults/grub,我有以下行:

GRUB_CMDLINE_LINUX_DEFAULT="quiet blacklist.nouveau=1 i915.modeset=1 gfxpayload=640x480 acpi_backlight=vendor acpi_osi=! acpi_osi=\"Windows 2009\""

(注意引号和转义引号)。

一些解释:它避免加载 nouveau(与 Nvidia X 服务器不兼容),并告诉 Intel 驱动程序在启动时立即进入图形模式。如果您不这样做,那么 Intel X 服务器将无法启动,并且它会退回到具有 CPU 端 3D 渲染功能的普通旧 VESA 服务器。此特定机器上需要这些acpi_xxx标志来克服 BIOS 错误,该错误导致在独立 GPU 关闭的情况下进入图形模式时崩溃。请注意,它是特定于该特定笔记本电脑(HP ZBook 便携式工作站)的,对于其他笔记本电脑可能没有必要或有所不同。

更新(2017 年 12 月 6 日)使用最新的 Debian 发行版 (Buster),不需要“915.modeset=1 gfxpayload=640x480”。要删除 nouveau,我还需要在 /etc/modprobe.d 中创建一个 nouveau.conf 文件,其中包含“blacklist nouveau”,然后使用“update-initramfs -u”重新创建 ramdisk。重新启动并确保“nouveau”不再使用“lsmod |grep nouveau”加载。

更新(2016 年 12 月 17 日)在最新的 xorg-server (1.19) 中,与 一起使用时管理 Gamma 的 RandR 函数似乎存在问题intel-virtual-output。以下是修补 Xserver 并使其正常工作的过程:

sudo apt-get build-dep xserver-xorg-core
apt-get source xorg-server

编辑 hw/xfree86/modes/xg86RandR12.c 第 1260 行,插入“return”(以便该函数xf86RandR12CrtcComputeGamma()不执行任何操作)

dpkg-buildpackage -rfakeroot -us -uc
cd ..
sudo dpkg -i xserver-xorg-core_n.nn.n-n_amd64.deb

n.nn.n-n用正确的版本替换),重新启动并耶哈!!又起作用了!(但这是一个快速而肮脏的修复)

更新提交了错误报告(已知,并且刚刚修复): https://bugs.freedesktop.org/show_bug.cgi?id=99129

我是如何发现的:通过 ssh 从另一台机器 安装xserver-xorg-core-dbg并完成。gdb /usr/lib/xorg/Xorg <xorg pid>

更新(2017年1月11日)看来该错误现已在最新的 Debian 软件包中得到修复。

更新(18年1月24日)当您想要插入投影仪进行演示并需要在开始之前配置所有内容(intel-virtual-output + xrandr)时,这可能会带来压力。这是一个完成这项工作的小脚本(免责声明:关于风格等,还有很大的改进空间......):

# beamer.sh: sets Linux display for doing a presentation, 
#  for bumblebee configured on a laptop that has the HDMI
#  plugged on the NVidia board.
#
# Bruno Levy, Wed Jan 24 08:45:45 CET 2018
#
# Usage: 
#    beamer.sh widthxheight
#    (default is 1024x768)


# Note: output1 and output2 are hardcoded below,
#  change according to your configuration.
output1=eDP1
output2=VIRTUAL1

# Note: I think that the following command should have done
# the job, but it does not work. 
#    xrandr --output eDP1 --size 1024x768 --output VIRTUAL1 --size 1024x768 --same-as eDP1
# My guess: --size is not implemented with VIRTUAL devices.
# Thus I try to find a --mode that fits my needs in the list of supported modes.

wxh=$1

if [ -z "$wxh" ]; then
  wxh=1024x768
fi

# Test whether intel-virtual-output is running and start it.
ivo_process=`ps axu |grep 'intel-virtual-output' |egrep -v 'grep'`
if [ -z "$ivo_process" ]; then
   intel-virtual-output
   sleep 3
fi

# Mode names on the primary output are simply wxh (at least on
#  my configuration...)
output1_mode=$wxh

echo Using mode for $output1: $output1_mode

# Mode names on the virtual output are like: VIRTUAL1.ID-wxh
# Try to find one in the list that matches what we want.
output2_mode=`xrandr |grep $output2\\\. |grep $wxh |awk '{print $1}'`
# There can be several modes, take the first one.
output2_mode=`echo $output2_mode |awk '{print $1}'` 

echo Using mode for $output2: $output2_mode

# Showtime !
xrandr --output $output1 --mode $output1_mode --output $output2 --mode $output2_mode --same-as $output1

更新(10/07/2019)

新崩溃的“修复”:在脚本中编写以下内容(bumblebee-startx.sh例如调用它):

optirun ls # to load kernel driver
/usr/lib/xorg/Xorg :8 -config /etc/bumblebee/xorg.conf.nvidia \
 -configdir /etc/bumblebee/xorg.conf.d -sharevts \
 -nolisten -verbose 3 -isolateDevice PCI:01:00:0 \
 -modulepath /usr/lib/nvidia/nvidia,/usr/lib/xorg/modules/

(将 PCI:nn:nn:n 替换为通过 lspci 获取的 NVidia 卡的地址)

以 root ( ) 身份从终端窗口运行此脚本sudo bumblebee-startx.sh,保持终端打开,然后按预期optirun工作intel-virtual-output(注意:有时我还需要运行xrandr以检测到屏幕/视频投影仪)。现在我不明白为什么同样的命令从大黄蜂崩溃开始,这里有很多谜团......(但至少它提供了一个临时修复)。

我是如何发现的:编写了一个“包装器”脚本来启动 xserver,在 bumblebee.conf 中将其声明为 XorgBinary,使其将命令行 ($*) 保存到文件中,尝试了一些涉及 LD_PRELOAD 到 XServer 的补丁以修复 osLookupColor 中的崩溃(不起作用),但是当我尝试手动启动相同的命令行时,它起作用了,并且在没有我的补丁的情况下它继续工作(但我仍然不明白为什么)。

更新 11/15/2019 更新后,我遇到了很多闪烁,导致系统无法使用。通过添加内核参数i915.enable_psr=0(在/etc/defaults/grub,然后sudo update-grub)来修复。如果您现在想知道的话,PSR 的意思是“面板自刷新”,这是英特尔 GPU 的一项节能功能(可能会导致屏幕闪烁)。

相关内容