将虚拟输出添加到 Xorg

Pau*_*lus 16 xorg opengl x11 xrandr virtual-desktop

我想在当前 Intel iGPU(在 Ubuntu 16.04.2 HWE,Xorg 服务器版本 1.18.4)上的 Xorg 服务器上创建一个虚拟的虚拟输出。它类似于 Linux Mint 18.2,其中一个xrandr输出显示如下:

Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767
...
eDP1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
...
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
...
Run Code Online (Sandbox Code Playgroud)

在 Linux Mint 18.2 中,我可以关闭内置显示器 ( eDP1) 并VIRTUAL1使用 X 服务器支持的任意模式打开显示器,连接x11vnc到我的主显示器,我将获得 GPU 加速的远程桌面。

但在 Ubuntu 16.04.2 中,情况并非如此。该VIRTUAL*显示器完全不存在距离xrandr。此外,仅供参考,xrandr 的输出名称在 Ubuntu 16.04.2 上略有不同,其中每个数字都以-. 例如,eDP1在 Linux Mint 中变为eDP-1Ubuntu,HDMI1变为HDMI-1,等等。

那么,如何在 Xorg/xrandr 中添加虚拟输出呢?

为什么 Linux Mint 18.2 和 Ubuntu 16.04.2(我相信它们使用完全相同的 Xorg 服务器,因为 LM 18.2 基于 Ubuntu,对吗?)可以有非常不同的 xrandr 配置?

使用xserver-xorg-video-dummy不是一种选择,因为虚拟输出不会被 GPU 加速。

ook*_*osi 20

创建一个20-intel.conf文件:

sudo vi /usr/share/X11/xorg.conf.d/20-intel.conf

将以下配置信息添加到文件中:

Section "Device"
    Identifier "intelgpu0"
    Driver "intel"
    Option "VirtualHeads" "2"
EndSection
Run Code Online (Sandbox Code Playgroud)

这告诉英特尔 GPU 创建 2 个虚拟显示器。您可以根据VirtualHeads需要更改数量。

然后注销并登录。您应该看到VIRTUAL1VIRTUAL2当您运行xrandr

请注意,如果您之前使用的是模式设置驱动程序(这是现代默认设置),切换到 intel 驱动程序将导致显示器名称从例如HDMI-1或更改DP-1HDMI1DP1

  • 有没有办法用 Nvidia GPU 而不是 Intel GPU 做同样的事情? (2认同)

小智 5

如果使用 启动时出现黑屏,请使用以下内容20-intel.conf创建一个:30-virtscreen.conf

# nvidia/nouveau/amdgpu device should be configured first before Intel GPU
Section "Device"
  Identifier "nvidiagpu0"
  Driver     "nvidia" # Because you are using Nvidia proprietary driver. Change to "nouveau" if you are using open source nouveau driver
EndSection

# Then configure intel internal GPU
Section "Device"
  Identifier "intelgpu0"
  Driver     "intel"
  Option     "VirtualHeads" "2"
EndSection
Run Code Online (Sandbox Code Playgroud)

我在kbumsik/VirtScreen Github 项目的 Issues 页面上找到了这个解决方案。