TurboVNC+VirtualGL的FPS性能测试
一,测试环境
硬件:VirtualBox 7.0
操作系统:UbuntuKylin 20.04.3 LTS
二,准备FPS性能测试工具
1,Glxgears
$ sudo apt install mesa-utils
$ glxgears
$ vblank_mode=0 glxgears
vblank_mode=0 告诉图形卡忽略显示器的刷新率,仅尝试达到其关闭功能的maximux fps。
如果还是被限制为60fps,那就用:
$ env vblank_mode=0 __GL_SYNC_TO_VBLANK=0 glxgears
参考:https://blog.csdn.net/weixin_35868872/article/details/116888903
$ glxinfo -B
$ glxinfo | grep render
direct rendering: Yes 表明OpenGL正常打开
参考:https://www.cnblogs.com/ArsenalfanInECNU/p/14481655.html
OpenGL renderer string: llvmpipe (LLVM 9.0.0, 128 bits)
表示使用的是软件模拟GPU来完成OpenGL处理,也就是硬件GPU无法用,于是退回到使用的软件渲染器(software renderer)。
https://docs.mesa3d.org/drivers/llvmpipe.html
2,GL Mark 2
$ sudo apt install glmark2
$ glmark2
https://github.com/glmark2/glmark2
3,还有GpuTest、Phoronix Test Suite
具体参考:https://my.oschina.net/python8/blog/5176304
4,更专业的3D测试工具
https://benchmark.unigine.com/
三,VirtualBox本地性能
在VirtualBox自身的图形屏幕里执行,结果如下:
$ glxgears
1767 frames in 5.0 seconds = 353.371 FPS
2270 frames in 5.0 seconds = 453.964 FPS
2325 frames in 5.0 seconds = 464.976 FPS
2280 frames in 5.0 seconds = 455.983 FPS
2362 frames in 5.0 seconds = 472.350 FPS
2370 frames in 5.0 seconds = 473.856 FPS
2416 frames in 5.0 seconds = 483.060 FPS
2410 frames in 5.0 seconds = 481.908 FPS
2256 frames in 5.0 seconds = 451.078 FPS
2225 frames in 5.0 seconds = 444.927 FPS
2225 frames in 5.0 seconds = 444.908 FPS
1891 frames in 5.0 seconds = 378.102 FPS
2222 frames in 5.0 seconds = 444.309 FPS
X connection to :0 broken (explicit kill or server shutdown).
估计就是450。
CPU消耗:
进程号 USER PR NI VIRT RES SHR %CPU %MEM TIME+ COMMAND 1454 lenky 20 0 3510816 161444 115264 S 77.1 4.3 1:10.29 ukui-kwin_x11 5520 lenky 20 0 522016 66676 51860 R 62.9 1.8 0:51.20 glxgears 902 root 20 0 275360 85188 49388 S 15.2 2.3 0:19.77 Xorg 7446 lenky 39 19 22944 10740 6040 R 9.5 0.3 0:00.10 lsb_release
四,ssh图形性能
在Windows里通过ssh连接到虚拟机,然后在ssh终端里执行glxgears,会将图形界面显示到Windows本地,执行结果如下:
$ glxgears
150 frames in 5.0 seconds = 29.974 FPS
190 frames in 5.0 seconds = 37.821 FPS
196 frames in 5.0 seconds = 39.003 FPS
191 frames in 5.0 seconds = 38.015 FPS
189 frames in 5.0 seconds = 37.695 FPS
194 frames in 5.0 seconds = 38.743 FPS
187 frames in 5.0 seconds = 37.272 FPS
189 frames in 5.0 seconds = 37.619 FPS
190 frames in 5.0 seconds = 37.926 FPS
190 frames in 5.0 seconds = 37.958 FPS
193 frames in 5.0 seconds = 38.500 FPS
X connection to localhost:10.0 broken (explicit kill or server shutdown).
CPU消耗:
进程号 USER PR NI VIRT RES SHR %CPU %MEM TIME+ COMMAND 7378 lenky 20 0 14156 6324 4720 R 47.1 0.2 0:12.52 sshd 7673 lenky 20 0 522208 67860 52560 S 7.8 1.8 0:02.39 glxgears 650 root 20 0 901956 49360 27584 S 1.0 1.3 0:00.61 containerd 7798 lenky 20 0 15160 3932 3284 R 1.0 0.1 0:00.23 top
五,x11vnc的远程桌面性能
$ sudo apt-get install x11vnc
$ mkdir -p /home/lenky/.vnc/
$ x11vnc -storepasswd ~/.vnc/passwd
$ sudo x11vnc -display :0 -auth guess -forever -rfbport 5900 -rfbauth ~/.vnc/passwd
然后在windows里用VNC Viewer连接,进入桌面后,执行结果如下:
$ glxgears
1425 frames in 5.0 seconds = 284.892 FPS
1503 frames in 5.0 seconds = 300.503 FPS
1552 frames in 5.0 seconds = 310.308 FPS
1609 frames in 5.0 seconds = 321.768 FPS
1641 frames in 5.0 seconds = 328.145 FPS
1648 frames in 5.0 seconds = 329.500 FPS
1301 frames in 5.0 seconds = 260.141 FPS
1716 frames in 5.0 seconds = 343.008 FPS
1661 frames in 5.0 seconds = 331.550 FPS
1698 frames in 5.0 seconds = 339.238 FPS
1819 frames in 5.0 seconds = 363.761 FPS
1840 frames in 5.0 seconds = 367.983 FPS
1734 frames in 5.0 seconds = 346.351 FPS
1716 frames in 5.0 seconds = 343.107 FPS
X connection to :0 broken (explicit kill or server shutdown).
CPU消耗:
进程号 USER PR NI VIRT RES SHR %CPU %MEM TIME+ COMMAND 1454 lenky 20 0 3512612 163360 116788 S 75.0 4.3 2:10.89 ukui-kwin_x11 9569 lenky 20 0 522016 66376 51484 S 66.3 1.8 0:36.89 glxgears 902 root 20 0 282668 92676 54368 S 21.2 2.5 0:40.06 Xorg 9174 root 20 0 33512 16584 11980 S 10.6 0.4 0:08.04 x11vnc 12 root 20 0 0 0 0 S 1.0 0.0 0:00.12 ksoftirqd/0
六,安装TurboVNC,远程桌面性能
下载turbovnc_3.0_amd64.deb:https://sourceforge.net/projects/turbovnc/files/3.0/turbovnc_3.0_amd64.deb/download
1,安装
$ sudo dpkg -i turbovnc_3.0_amd64.deb
2,启动
登录VirtualBox本地桌面,打开终端,执行:/opt/TurboVNC/bin/vncserver
2.1,设置密码,如果前面测试做过了,这里可以跳过
$ mkdir -p /home/lenky/.vnc/
$ /opt/TurboVNC/bin/vncpasswd
3,远程接入
在windows里用VNC Viewer连接,进入桌面后,执行结果如下:
$ glxgears
1090 frames in 5.0 seconds = 217.826 FPS
1317 frames in 5.0 seconds = 263.277 FPS
1343 frames in 5.0 seconds = 268.446 FPS
1399 frames in 5.0 seconds = 279.368 FPS
1365 frames in 5.0 seconds = 272.930 FPS
1405 frames in 5.0 seconds = 280.885 FPS
1273 frames in 5.0 seconds = 254.574 FPS
1276 frames in 5.0 seconds = 255.053 FPS
1301 frames in 5.0 seconds = 260.140 FPS
1289 frames in 5.0 seconds = 257.622 FPS
1112 frames in 5.0 seconds = 222.312 FPS
X connection to :1 broken (explicit kill or server shutdown).
CPU消耗:
进程号 USER PR NI VIRT RES SHR %CPU %MEM TIME+ COMMAND 12229 lenky 20 0 3521204 170428 119392 S 68.6 4.5 0:57.81 ukui-kwin_x11 13131 lenky 20 0 522012 66292 51532 S 41.2 1.8 0:37.32 glxgears 12109 lenky 20 0 191736 86672 51292 R 36.3 2.3 0:45.14 Xvnc 12877 _apt 20 0 27124 9952 8940 S 4.9 0.3 0:04.59 http
glxinfo:
$ glxinfo | grep render direct rendering: Yes OpenGL renderer string: llvmpipe (LLVM 12.0.0, 256 bits)
七,TurboVNC+VirtualGL,远程桌面性能
第六步测试没有开启VirtualGL,参考如下地址把VirtualGL开起来看看。
https://blog.csdn.net/weixin_44831881/article/details/119810165
https://blog.csdn.net/huangzhicong3/article/details/121732076
下载virtualgl_3.0_amd64.deb:https://sourceforge.net/projects/virtualgl/files/3.0/virtualgl_3.0_amd64.deb/download
备注:以下命令均在VirtualBox本地桌面执行。
1,安装
$ sudo apt-get install libglu1-mesa
$ sudo dpkg -i virtualgl_3.0_amd64.deb
2,切换到本地文本终端
按ctrl+alt+f3或执行init 3切换到本地文本终端
$ lspci | grep -i vga
00:02.0 VGA compatible controller: VMware SVGA II Adapter
$ sudo init 3 #VirtualBox本地桌面退出,再按按ctrl+alt+f3
$ service lightdm status #确定lightdm为inactive状态
$ sudo /opt/VirtualGL/bin/vglserver_config #第一个选1,其他全选y,最后一步选X退出
3,编辑用户
$ sudo vi /etc/group
$ tail -1 /etc/group
vglusers:x:1001:root,lenky
4,切换到本地图形桌面
$ sudo init 5 #VirtualBox本地桌面重启
打开窗口终端执行:
$ xauth merge /etc/opt/VirtualGL/vgl_xauth_key
$ xdpyinfo -display :0
$ /opt/VirtualGL/bin/glxinfo -display :0 -c | grep OpenGL
OpenGL vendor string: Mesa/X.org
OpenGL renderer string: llvmpipe (LLVM 12.0.0, 256 bits)
…
没配置成功?先不管。
5,修改TurboVNC配置
$ sudo vi /etc/turbovncserver.conf
$ sudo cat /etc/turbovncserver.conf |grep GL
## $useVGL — 1 to run the window manager using VirtualGL. This variable
$useVGL = 1;
6,启动TurboVNC
$ /opt/TurboVNC/bin/vncserver
7,远程接入
在windows里用VNC Viewer连接,进入桌面后,桌面不正常。
看来有问题,待续~
—20221119更新—
这个问题原因应该是这样:
$ /opt/VirtualGL/bin/glxinfo -display :0 -c | grep OpenGL
OpenGL vendor string: Mesa/X.org
OpenGL renderer string: llvmpipe (LLVM 12.0.0, 256 bits)
上面表示VirtualBox本地桌面(当前display)也是用的软件模拟渲染,没有使用物理显卡(VMware SVGA)。
而VirtualGL必须绑定利用某个display的GPU,如果绑定的display的GPU本身就是软件模拟的,那VirtualGL也是软件模拟的。
over~
—更新—
八,TurboVNC+VirtualGL
换个VMware环境,除了将VirtualBox 7.0换成VMware Workstation 12 Pro,其他一切不变。
备注:以下命令均在VMware Workstation 12 Pro本地桌面执行。
1,安装
$ sudo apt-get install libglu1-mesa
$ sudo dpkg -i virtualgl_3.0_amd64.deb
2,切换到本地文本终端
$ sudo init 3 #退出VMware本地桌面
$ sudo /opt/VirtualGL/bin/vglserver_config #第一个选1,其他全选y,最后一步选X退出
3,编辑用户
$ sudo vi /etc/group
$ tail -1 /etc/group
vglusers:x:1001:root,lenky
4,切换到本地图形桌面
$ sudo init 5 #进入VMware本地桌面
打开窗口终端执行:
$ sudo xauth merge /etc/opt/VirtualGL/vgl_xauth_key
$ xdpyinfo -display :0
$ /opt/VirtualGL/bin/glxinfo -display :0 -c | grep OpenGL
OpenGL vendor string: VMware, Inc.
OpenGL renderer string: SVGA3D; build: RELEASE; LLVM;
…
这下对了。
5,安装并修改TurboVNC配置
$ sudo dpkg -i turbovnc_3.0_amd64.deb
$ mkdir -p /home/lenky/.vnc/
$ /opt/TurboVNC/bin/vncpasswd
$ sudo vi /etc/turbovncserver.conf
$ sudo cat /etc/turbovncserver.conf |grep GL
## $useVGL — 1 to run the window manager using VirtualGL. This variable
$useVGL = 1;
6,启动TurboVNC
$ /opt/TurboVNC/bin/vncserver
7,远程接入
在windows里用VNC Viewer连接,进入桌面后,桌面还是不正常。有黑块背景。
看来还有问题,待续~
转载请保留地址:http://www.lenky.info/archives/2022/11/3243 或 http://lenky.info/?p=3243
备注:如无特殊说明,文章内容均出自Lenky个人的真实理解而并非存心妄自揣测来故意愚人耳目。由于个人水平有限,虽力求内容正确无误,但仍然难免出错,请勿见怪,如果可以则请留言告之,并欢迎来信讨论。另外值得说明的是,Lenky的部分文章以及部分内容参考借鉴了网络上各位网友的热心分享,特别是一些带有完全参考的文章,其后附带的链接内容也许更直接、更丰富,而我只是做了一下归纳&转述,在此也一并表示感谢。关于本站的所有技术文章,欢迎转载,但请遵从CC创作共享协议,而一些私人性质较强的心情随笔,建议不要转载。
法律:根据最新颁布的《信息网络传播权保护条例》,如果您认为本文章的任何内容侵犯了您的权利,请以Email或书面等方式告知,本站将及时删除相关内容或链接。