vnc server on nvidia linux does not refresh screen after every keystroke

Hi,
I first asked RealVNC support for help with this issue but they have not been able to reproduce it with their nvidia graphic cards. So I suspect it only happens to some older graphics cards.

So vnc server on Linux does not refresh screen after every keystroke, but only after every other keystroke. It is rather frustrating to use a vnc connection and not being able to see correctly what I am typing in a terminal window.

I experience this both with realvnc and nomachine. Server is Kubuntu 18.04 with an nvidia GeForce GT 630. Client viewer on Mageia 6.
This has been reported before by someone else with a different nvidia card: see bug 1431881 – vino two-key refresh delay with Xorg, GTX 1080, nvidia drivers

I did enable vnc logging but nothing appears in that log while I type abcdefgh in a konsole terminal window.

As RealVNC does not support Kubuntu, I installed Ubuntu 18.4.1 LTS and CentOS 7 on a real physical computer and I can confirm that the issue happens with nvidia graphic drivers installed.
With nouveau drivers the issue does not happen!

connect vnc on ubuntu 18.0.4 lts :
Graphics card: nvidia GK208 [GeForce GT 630 Rev.2]
vnc viewer used on OS X.

first with nouveau display driver: no issues in vnc viewer typing characters in Terminal, xterm, gedit or alt-tabbing

output of glxinfo:
OpenGL renderer string: llvmpipe (LLVM 6.0, 256 bits)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 18.0.5

then with proprietary drivers nvidia-driver-390:

output of glxinfo:
OpenGL renderer string: GeForce GT 630/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 390.77

in xterm and konsole: type abcdefgh: a (with the cursor) appears normally , b only appears after I type c, d only appears after I type e, etc.

in gnome terminal no issue with the characters typed but after every other character the cursor does not appear. It is the same issue as with the characters in xterm but I guess, gnome terminal does not display the new character and the cursor together and thus after every other character I type, the cursor does not appear.

Also in text editor gedit I see this issue: after every other character (or second) the cursor does not appear. Moving the cursor through my text, I see the cursor jumping 2 characters at a time while on the real screen of the server I see it jump one character at a time.

In terminal and gedit with nouveau driver the cursor is a blinking one.

alt tabbing: also here with four programs running only after every other alt-tab do you see it jump to another program in the list (don’t have a web browser window in the foreground because if it has continuously changing graphics like ads the refresh happens sooner)

connect vnc on CentOS 7 (7.5.1804):

output of glxinfo:
OpenGL vendor string: nouveau
OpenGL renderer string: NV108
OpenGL core profile version string: 4.3 (Core Profile) Mesa 17.2.3

with nouveau display driver: no issues typing characters in Terminal, xterm, gedit or alt-tabbing

with proprietary drivers nvidia 410.73
(installed from NVIDIA-Linux-x86_64-410.73.run following https://linuxconfig.org/how-to-install-the-nvidia-drivers-on-centos-7-linux )

output of glxinfo:
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GT 630/PCIe/SSE2
OpenGL core profile version string: 4.4.0 NVIDIA 410.73

the same issues as in ubuntu with nvidia drivers

I also notice now in CentOS in gedit that the blinking cursor stops blinking after 10 seconds and then the cursor appears in vnc viewer after every (or two) character.
And in xterm the not appearing character (after very other character) eventually appears after 20 to 60 seconds.

I also noticed that if I have another terminal window open in the background where I run a tail on /var/log/vncserver-x11.log, then in the foreground, in the xterm window, every character that I type gets displayed immediately.
So to reproduce, only run one active terminal window.

Realvnc was very helpful trying to debug this but they could not reproduce it with their nvidia cards.

I have exactly the same problem with x11vnc using nvidia drivers except the workaround with another terminal window in the background does not work for me. Have you had any success to sort this issue out?

Does the client or the server have the nvidia gpu?
Does setting

__GL_MaxFramesAllowed=1

in system env work around the issue?

Both, but it is due to the server since it worked fine before the server switched from the nouveau drivers to the nvidia drivers. Setting the enviroment variable does not help which is not surprising since this did not seem related to the high CPU usage issue. The workaround from dieterr1 kind of works though - it’s not about opening another terminal in the background but about running something in it that changes output frequently which forces vnc to refresh frequently (not very efficient though).

That variable only has indirectly to do with high CPU usage of some compositors. It’s for disabling triple buffering, so restricting the driver to double buffering (which is the default for nouveau). This is often the reason for applications being one frame behind.
Since that has no effect in your case, did you try with a non-compositing window manager on the server?

The first thing I tried was turning the KDE compositor on and off, it did not help…

I have the exact same problem on Ubuntu 18.04. My Nvida card is GeForce RTX 2080 Ti, so it seems this is not due to an older card, but I have no idea what is causing this problem or how to fix it.

dieterr1 and skubakp hinted at a workaround until someone can figure out how to fix this properly. If I run and display dclock the remote screen seems to update on every keystroke. At least it’s not as annoying.

same issue here. Ubuntu 18.04.03 with RTX 2080Ti. nouveau drivers no problem, any nvidia-driver - problem. dclock does not seem to work on my system though.

I have the same issue, posted a question here:
https://askubuntu.com/questions/1208583/nvidia-rtx-2080-driver-issue-with-remote-desktop-vnc-nx-etc

I logged a bug report with nVidia.

Also note this is not an issue with just VNC but with other remote desktop protocols such as NX and whatever TeamViewer uses.

My workaround so far has been to ssh into the target machine from Terminal on my MacOS, but switching back and forth between the MacOS screen and Ubuntu screen is a pain.

Can confirm hamidtyj2e report that this problem occurs with other remote desktop applications. My latest work-around is to switch on “seconds” for the clock on Ubuntu 18.04 in the top-middle of the screen. This seems to trigger a remote screen refresh.