It depends upon the version of the Xorg server in use. By default under Linux, VNC Server in Virtual Mode uses an old version of the Xorg server built into Xvnc, which is still recommended for Ubuntu and SUSE systems providing you change the desktop environment. However, from VNC Connect 6.2.0 you can configure VNC Server to utilise the latest version of the Xorg server on your system instead, which may give a considerably better experience for Red Hat and CentOS systems.
For users running Xvnc
You can specify one or more screen resolutions (geometries) for a virtual desktop using the VNC Server RandR parameter. If you set multiple comma-separated screen resolutions, a connected VNC Viewer user can cycle between them. For example, specifying the resolutions 1024x768,1280x1024,800x600 allows a connected VNC Viewer user to choose the one they want dynamically by running the command xrandr –s <0|1|2>
.
For users running SystemXorg (vncserver-x11 -virtual)
Standard dummy driver
You can set non-standard screen resolutions by adding additional ModeLine
entries to the Monitor
section of the /etc/X11/vncserver-virtual-dummy.conf
file. In versions of VNC Server earlier than 6.7.0, the file is /etc/X11/vncserver-virtual.conf
A convenient way to generate the required Modeline is by using the gtf
command, e.g.
gtf 1920 1080 60
where 1920 is the width, 1080 is the height, and 60 is the refresh rate. Replace these values as required.
Note: the standard dummy driver on most platforms will not support large resolutions that have a pixel clock above 300. See the RealVNC dummy driver section for more information.
Refer to the Xorg.conf
man page for more information.
Note the VNC Server RandR parameter cannot be used to enable a connected VNC Viewer user to cycle between available screen resolutions in this environment. A connected user should use the standard Screen Display or Monitor app instead.
RealVNC dummy driver
There is a known issue when using the standard dummy driver that prevents resolutions with a pixel clocker greater than 300MHz from being available. Consider the following Modeline for a 4K resolution:
Modeline "3840x2160_60.00" 712.34 3840 4152 4576 5312 2160 2161 2164 2235 -HSync +Vsync
The pixel clock is the third value, which in this case is 712.34. Since this is above 300, it will not be available to select in the Virtual Mode session.
You can also find the pixel clock for a given resolution with the gtf
command:
gtf 3840 2160 60 -v | grep "PIXEL FREQ"
To use resolutions like this, you will need to install the RealVNC dummy driver, which is published here: https://github.com/RealVNC/xf86-video-vnc
To install it, you will need to compile it on the computer running VNC Server using the below commands:
sudo apt install git # Ubuntu
sudo yum install git # RedHat / CentOS
cd ~
git clone https://github.com/RealVNC/xf86-video-vnc
cd xf86-video-vnc
sudo ./buildAndInstall
Once the process completes, you will be able to use Modelines with a pixel clock above 300MHz.
With the RealVNC dummy driver, the configuration file used by SystemXorg is /etc/X11/vncserver-virtual-vnc.conf
file.
Using the RealVNC dummy driver also restores use of the RandR parameter, which can be set in the same way as any VNC Server parameter:
- Directly on the command line when starting VNC Server:
vncserver-virtual -RandR=2560x1440,1920x1080,1280x720
Note when applied this way, the parameter will be reset to any value set in a configuration file if the VNC Server Options dialog is opened during a session. - In a shared configuration file, such as /etc/vnc/config.d/common.custom:
RandR=2560x1440,1920x1080,1280x720
- In a user's own configuration file, such as $HOME/.vnc/config.d/common:
RandR=2560x1440,1920x1080,1280x720
Comments
I found that just using the xrand command on Ubuntu 16.04 and setting the resolution worked best through the terminal using the following command
xrandr --fb 1580x900
That size looked good on my 27-inch monitor using 2560 x1440
Please sign in to leave a comment.