DisplayLink
DisplayLink 是一种使用 USB 和 Wi-Fi 连接显示器的技术。
Linux 上的 DisplayLink 设备仍然只有实验性支持。虽然有些人成功使用了它们,但这通常不是一个容易的过程,也不能保证工作。此页面上的步骤描述了通常最成功的使用 DisplayLink 外接显示器的方法。
另请注意,即使通过 USB 3.0,DisplayLink 显示器也可能比 DisplayPort 显示器表现出明显更多的延迟,尤其是在屏幕的大部分区域被重绘时。
安装
USB 2.0 DL-1x5, DL-1x0 设备
DisplayLink 的内核 DRM 驱动程序是 udl
,它是原始 udlfb 驱动程序的重写版本。它允许使用 xrandr 配置 DisplayLink 显示器。
这应该在 linux 4.14.9-1 及更高版本上无需任何配置更改即可工作。如果您使用的是该软件包的早期版本,或者在内核配置中设置了 CONFIG_FB_UDL=m
,则需要屏蔽旧的内核模块 udlfb
,它可能会尝试首先加载自己。
USB 3.0 DL-6xxx, DL-5xxx, DL-41xx, DL-3xxx 设备
- 安装 evdiAUR 作为内核模块(在配置 DKMS 之后)。如 DKMS 页面所述,不要忘记安装 linux-headers 或另一个相关软件包,否则将不会发生任何事情。如果您遇到问题,可以使用开发版本 evdi-gitAUR,以及应用了一些上游补丁的版本 evdi-compat-gitAUR。
- 安装 displaylinkAUR 驱动程序。对于 Xorg,它允许像
udl
驱动程序一样使用 xrandr 配置 DisplayLink 显示器;对于 Wayland,则无需配置。 - 启用
displaylink.service
。 - 对于 Xorg,将 “modesetting” 驱动程序与 AccelMethod “none” 和 MatchDriver “evdi” 一起使用。
创建一个包含以下内容的文件
/etc/X11/xorg.conf.d/20-evdi.conf
Section "OutputClass" Identifier "DisplayLink" MatchDriver "evdi" Driver "modesetting" Option "AccelMethod" "none" EndSection
可能需要重启才能使设置生效。重启后,查看 Displaylink 屏幕是否显示在您的显示设置中。如果未显示,请继续执行后续步骤,这些步骤将 DVI-I 输入连接到您的 GPU。
设置 X 显示
之后,运行
$ xrandr --listproviders
Providers: number : 2 Provider 0: id: 0x49 cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 2 outputs: 8 associated providers: 0 name:Intel Provider 1: id: 0x13c cap: 0x2, Sink Output crtcs: 1 outputs: 1 associated providers: 0 name:modesetting
在上面的输出中,我们可以看到 provider 0 是系统的常规图形提供程序 (Intel),而 provider 1 (modesetting) 是 DisplayLink 提供程序。要使用 DisplayLink 设备,请将 provider 1 连接到 provider 0
$ xrandr --setprovideroutputsource 1 0
并且 xrandr 将添加一个 DVI 输出,您可以像往常一样使用 xrandr。这仍然是实验性的,但支持热插拔,并且如果工作正常,这是迄今为止最简单的设置。如果它工作正常,那么以下所有内容都是不必要的。
配置
这些说明假设您已经有一个正在运行的 X 服务器,并且只是将监视器添加到现有设置中。
加载帧缓冲设备
在您的系统识别您的 DisplayLink 设备之前,必须加载 udl
内核模块。为此,请运行
# modprobe udl
如果您的 DisplayLink 设备已连接,它应该会显示一些视觉指示。虽然绿屏是此功能的标准指示,但已发现其他变体并且完全正常。最重要的是,dmesg 的输出应显示如下内容,表明找到了新的 DisplayLink 设备
# dmesg
usb 2-1.1: new high-speed USB device number 7 using ehci-pci usb 2-1.1: New USB device found, idVendor=17e9, idProduct=03e0 usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 2-1.1: Product: Lenovo LT1421 wide usb 2-1.1: Manufacturer: DisplayLink usb 2-1.1: SerialNumber: 6V9BBRM1 [drm] vendor descriptor length:17 data:17 5f 01 00 15 05 00 01 03 00 04 udl 2-1.1:1.0: fb1: udldrmfb frame buffer device [drm] Initialized udl 0.0.1 20120220 on minor 1
此外,/dev
应包含一个新的 fb
设备,如果您已经为您的主显示器设置了帧缓冲,则可能是 /dev/fb1
。
您可以在启动时加载模块,而不是手动加载 udl
。
配置 X Server
使用 xrandr
或桌面环境的显示设置图形界面来配置运行 udl
或 displaylink
驱动程序的 USB 显示器。
xrandr
加载驱动程序后,DisplayLink 显示器将列为输出提供程序
$ xrandr --listproviders
Providers: number : 2 Provider 0: id: 0x43 cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 2 outputs: 2 associated providers: 1 name:Intel Provider 1: id: 0xcb cap: 0x2, Sink Output crtcs: 1 outputs: 1 associated providers: 1 name:modesetting
在上面的示例中,provider 1 是 DisplayLink 设备,而 provider 0 是默认显示器。运行 xrandr --current
会给出可用屏幕列表
$ xrandr --current
Screen 0: minimum 320 x 200, current 1600 x 900, maximum 8192 x 8192 LVDS1 connected 1600x900+0+0 (normal left inverted right x axis y axis) 309mm x 174mm 1600x900 60.0*+ 40.0 1440x900 59.9 1360x768 59.8 60.0 1152x864 60.0 1024x768 60.0 800x600 60.3 56.2 640x480 59.9 VGA1 disconnected (normal left inverted right x axis y axis) DVI-1-0 connected (normal left inverted right x axis y axis) 1366x768 60.0 + 1368x768_59.90 59.9 1368x768_59.90 (0xd0) 85.7MHz h: width 1368 start 1440 end 1584 total 1800 skew 0 clock 47.6KHz v: height 768 start 769 end 772 total 795 clock 59.9Hz
如果以上未列出 DisplayLink 屏幕,则您需要将 DisplayLink 卸载到主 GPU
$ xrandr --setprovideroutputsource 1 0
屏幕可用后,请参阅 xrandr 以获取有关设置它的信息。有关自动化配置过程,请参阅 displaylink.sh。
启动时启用 DVI 输出
在大多数情况下,DisplayLink 提供程序不会自动连接到主提供程序,因此 DVI 输出设备将不可用。在 X 启动时自动执行此操作以方便窗口管理器自动显示配置可能会很有用。
编辑您的桌面管理器的启动配置并添加类似于以下的命令
$(xrandr --listproviders | grep -q "modesetting") && xrandr --setprovideroutputsource 1 0
例如,SDDM 的相应启动配置文件是 /usr/share/sddm/scripts/Xsetup
。
避免将这些命令放在 ~/.xprofile
中,因为这会破坏某些窗口管理器的显示配置。相反,这些命令应在任何显示输出或设置之前运行。
modesetting
在 displaylink 和 NVIDIA/nouveau 驱动之间切换
从 displaylink 版本 1.3.54-1 开始,在基于 Optimus 的笔记本电脑上无法同时使用 displaylink 设备和 NVIDIA/nouveau 驱动程序。目前,为了能够在 Intel GPU 上使用 displaylink 设备,您应该创建一个配置文件(请参阅下面的 #故障排除)。但是,使用该配置文件无法使用 primusrun。Bumblebee 服务正在运行,但无法工作。此外,笔记本电脑风扇变得非常吵闹,笔记本电脑温度变得非常高。当您想要切换回激活 NVIDIA 驱动程序时,请注释掉该文件中的所有内容并重新启动。
为了简化切换过程,您可以安装 dl-switchAUR,并使用 内核参数 systemd.unit=displaylink.target
向您的启动加载器添加一个额外的菜单项,从而激活 displaylink 解决方法。
要检查您的独立显卡使用了哪个驱动程序,请运行 lspci -nnk -s xx:xx.x
(将 xx:xx.x 替换为您的 NVIDIA GPU PCI id)。
故障排除
无法正常工作的配置
这些在 Xfce 上使用显示设置(包含在 XFCE4 软件包中)和外部工具 - arandr 上进行了测试。XFCE4 显示设置可能会崩溃,因此 ARandR 可能会有所帮助。
当您通过 USB 将显示链接设备连接到计算机时,计算机应在显示设置中显示监视器。您应该尝试以下一些故障排除步骤
- 检查#设置 X 显示。如果您找不到任何已识别的外接显示器,则应尝试通过以下某些命令使它们可见
$ xrandr --setprovideroutputsource 1 0 $ xrandr --setprovideroutputsource 2 0 $ xrandr --setprovideroutputsource 3 0 ...
这将使它们在显示设置中可见并被识别。 - 重启
displaylink.service
。 - 重新连接 USB 电缆。
- 检查是否加载了
udl
驱动程序并且监视器已连接。
屏幕重绘损坏
如果您正在使用 udl
作为您的内核驱动程序,并且监视器似乎可以工作,但仅在您移动鼠标或窗口在某些位置更改时才更新,那么您的屏幕可能具有错误的 modeline。使用类似以下的命令为您的屏幕获取正确的 modeline
$ gtf 1366 768 59.9
其中 1366
和 768
是您的监视器的水平和垂直分辨率,而 59.9
是其规格中的刷新率。要使用它,请使用 xrandr
创建一个新模式,如下所示
$ xrandr --newmode "1368x768_59.90" 85.72 1368 1440 1584 1800 768 769 772 795 -HSync +Vsync
并将其添加到 xrandr
$ xrandr --addmode DVI-0 1368x768_59.90
然后告诉监视器对 DisplayLink 监视器使用该模式,这应该可以解决重绘问题。查看 xrandr 页面以获取有关使用不同模式的信息。
如果这不能解决问题(或者如果由于正确的 DDC 数据而已经存在正确的 modeline),则运行 合成器 可能会有所帮助。
重影
如果您遇到因移动光标而引起的重影,则可能是您的合成器配置导致了问题。更改设置可能会为您提供可行的设置,例如在启动时关闭合成器可以解决此问题。
用户报告注销并重新登录(以刷新显示管理器)可以暂时纠正此问题。可以通过执行以下操作在您的系统中实现更持久的解决方案
/etc/systemd/system/display-manager.service
[Service] # ... ExecStartPre=/bin/sleep 10
对于某些用户来说,延迟 10 秒似乎有效,但可能可以实现更短的睡眠时间。用户报告关闭自动登录可以解决 GNOME 中的问题。
此外,可能可以通过启用或禁用辅助功能中的缩放来修复此问题。用户报告称,关闭缩放功能可以解决问题,而另一些用户报告称,有时启用缩放功能(并将缩放比例设置为 1.0)可以解决问题。
DisplayLink 在 GNOME 环境下刷新率极慢
如果您在设置 DisplayLink 后发现整个桌面变得缓慢,请尝试设置一个“更简单”的背景图像,例如纯黑色。此外,自 2019 年以来,有报告称旋转的 Displaylink 屏幕本身就存在延迟,因此请查看将显示器设置为正常方向是否也能解决问题。
禁用内置屏幕后,所有显示器都被限制为 1 FPS
应用来自 https://gitlab.freedesktop.org/xorg/xserver/-/issues/1028#note_504826 的补丁到 xorg-server 似乎可以解决此问题。
Google Chrome 和基于 Webkit2 的应用程序中重绘缓慢/无响应
这与硬件加速中的错误有关,可以通过在 DisplayLink 屏幕中运行 glxgears 并导致 1fps 来测试。目前还没有完整的修复方案,但关闭受影响应用程序中的硬件加速可以作为临时修复。
这可以在没有硬件加速选项的应用程序中通过预先添加 LIBGL_ALWAYS_SOFTWARE=1
环境变量来完成。
无法激活 Displaylink 的屏幕
如果您能够在屏幕设置中通过 DisplayLink 设备看到连接的显示器,但在您打开它并应用设置后,它又变为未激活状态,请尝试将 nouveau 模块列入黑名单并重启。
/etc/modprobe.d/nouveau.conf
blacklist nouveau options nouveau modeset=0
睡眠问题
Displaylink 在睡眠后无法工作。拔下并重新插入 Displaylink 的 USB 电缆到您的计算机。通过 DisplayLink 连接的显示器将保持黑屏。如果您有锁屏,请登录系统,然后图像将出现在该显示器上,您将能够像往常一样使用 Displaylink。
USB 热插拔时 DisplayLink 无法工作
为了能够使用 DisplayLink 显示器,其 USB 电缆应在启动时连接到笔记本电脑。否则,它可能会表现得像它们可用,鼠标可以在那里移动,但其画面是冻结的,即使配置正确(参见解决方法 1)。如果它在启动时未连接,请连接它并重新启动。
在最近的 X 升级后,DisplayLink 驱动程序无法与 Intel GPU 协同工作
正如此支持页面 所述,将 X Window Server 升级到高于 1.18.3 的版本将使系统默认情况下与 DisplayLink 不兼容。这适用于使用集成 Intel GPU 或集成 Intel GPU 和独立 GPU 组合的系统。在 X Windows 系统发布修复程序之前,有两种解决方法
使用较旧的 intel 驱动程序作为后备方案
对集成 GPU 使用 “intel” 驱动程序,而不是现在默认的 “modesetting” 驱动程序。
创建一个包含以下内容的文件
/usr/share/X11/xorg.conf.d/20-displaylink.conf
Section "Device" Identifier "Intel Graphics" Driver "intel" EndSection
需要重启才能使设置生效。
您可能需要 evdi-gitAUR 软件包。
临时禁用 modesetting 的 PageFlip
对于喜欢继续使用 “modesetting” 驱动程序的用户,禁用页面翻转也应该有所帮助。创建一个包含以下内容的文件,或将 PageFlip
选项扩展到现有配置文件(例如 20-evdidevice.conf
)
/usr/share/X11/xorg.conf.d/20-displaylink.conf
Section "Device" Identifier "DisplayLink" Driver "modesetting" Option "PageFlip" "false" EndSection
使用 Dell D6000 扩展坞时,显示器在随机间隔断开连接
用户 报告称,当使用 Dell D6000 扩展坞时,他们的显示器可能会在使用期间随机间隔断开连接。这将需要物理重新连接扩展坞才能重新初始化显示器。
此问题似乎是由 PulseAudio 的 module-suspend-on-idle
模块引起的,该模块会在空闲时自动挂起 sink/source。
要禁用 module-suspend-on-idle
模块的加载,请注释掉正在使用的配置文件(~/.config/pulse/default.pa
或 /etc/pulse/default.pa
)中的以下行
/etc/pulse/default.pa
### Automatically suspend sinks/sources that become idle for too long # load-module module-suspend-on-idle
启动后仅识别出 1 个显示器
如果多个显示器连接到 DisplayLink 扩展坞,但在启动后仅识别出 1 个,可能的修复方法是强制 evdi 在启动时搜索多个显示器,方法是将 evdi
模块添加到 /etc/modules-load.d/evdi.conf
,并将 "options evdi initial_device_count=2"
添加到 /etc/modprobe.d/dkms.conf
DisplayLink 和 NVIDIA dGPU 在 X11 上 (Optimus+DL)
如果使用 NVIDIA Optimus 的笔记本电脑处于更永久的设置中(使用 X11),则最好永久设置视频输出以使用 dGPU。 nvidia-xconfig
可能会产生以下结果
/etc/X11/xorg.conf
Section "ServerLayout" Identifier "Layout0" Screen 0 "Screen0" InputDevice "Keyboard0" "CoreKeyboard" InputDevice "Mouse0" "CorePointer" EndSection # ... # Keyboard0 # Mouse0 # ... Section "Monitor" Identifier "Monitor0" VendorName "Unknown" ModelName "Unknown" Option "DPMS" EndSection Section "Device" Identifier "Device0" Driver "nvidia" VendorName "NVIDIA Corporation" BusID "PCI:1:0:0" EndSection Section "Screen" Identifier "Screen0" Device "Device0" Monitor "Monitor0" DefaultDepth 24 SubSection "Display" Depth 24 EndSubSection EndSection
即使安装了 evdiAUR 和 displaylinkAUR 软件包,连接的 DisplayLink 显示器仍然可能不出现。我们可以手动指示 Xorg 使用 modesetting(4) 插件,其视频接口由 displaylinkAUR 驱动程序提供。
识别哪个 DRI 设备。识别哪个设备的最简单方法是列出所有 DRI 设备的路径
$ ls -al /dev/dri/by-path
total 0 drwxr-xr-x 2 root root 160 May 11 19:10 . drwxr-xr-x 3 root root 180 May 10 16:03 .. lrwxrwxrwx 1 root root 8 May 10 16:03 pci-0000:00:02.0-card -> ../card0 lrwxrwxrwx 1 root root 13 May 10 16:03 pci-0000:00:02.0-render -> ../renderD128 lrwxrwxrwx 1 root root 8 May 11 19:10 pci-0000:01:00.0-card -> ../card1 lrwxrwxrwx 1 root root 13 May 10 16:03 pci-0000:01:00.0-render -> ../renderD129 lrwxrwxrwx 1 root root 8 May 10 16:03 platform-evdi.0-card -> ../card2 lrwxrwxrwx 1 root root 8 May 10 16:03 platform-evdi.1-card -> ../card3
正如您所见,第一个 evdiAUR 设备是 /dev/dri/card2
。
将以下内容添加到 Xorg 配置中
/etc/X11/xorg.conf
# Add the following to the ServerLayout section after Screen0 # ... Screen 1 "Screen1" # ... # ... at the end, add: Section "Device" Identifier "usbdev" Driver "modesetting" Option "kmsdev" "/dev/dri/card2" EndSection Section "Screen" Identifier "Screen1" Device "usbdev" EndSection
重启 X 服务器以查看更改。
DL 显示器应该会出现。根据需要使用 xrandr 进行配置。
USB 2.0 DisplayLink 无法工作
udl
非常挑剔。有些 USB 2 设备可以使用它,有些则不行。例如,HP NL571AA、Lenovo LT1421 wide 已经过测试可以工作。如果您的 USB 2.0 设备无法与 udl
一起使用(例如 EVGA “UV PLUS+16”),您将在 日志 中收到以下错误
[drm] vendor descriptor length:e0 data:00 00 00 00 00 00 00 00 00 00 00 [drm:udl_init [udl]] *ERROR* Unrecognized vendor firmware descriptor [drm] Initialized udl 0.0.1 20120220 for 1-1.3:1.0 on minor 1 [drm] Initialized udl on minor 1 udl 1-1.3:1.0: [drm] fb1: udldrmfb frame buffer device usbcore: registered new interface driver udl
另请参阅
- DisplayLink 开源:官方 DisplayLink 开源支持论坛