Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mouse delay is very serious. #368

Closed
binzhai opened this issue Apr 27, 2023 · 7 comments
Closed

Mouse delay is very serious. #368

binzhai opened this issue Apr 27, 2023 · 7 comments

Comments

@binzhai
Copy link

binzhai commented Apr 27, 2023

When I use Turbo VNC to play War3 game remotely, there is a serious mouse delay. By adding logs, I found that it takes 15 milliseconds for a mouse event to be transmitted from the VNC Viewer to the VNC Server.The higher the game resolution, the greater the mouse delay.Are there any optimization methods for this issue?

@binzhai
Copy link
Author

binzhai commented Apr 27, 2023

If I install TurboVNC Viewer and Server on the same physical machine, is there a way to directly read mouse events from /dev/input instead of sending them from TurboVNC Viewer to Server? This way, mouse event processing would be much faster.

@dcommander
Copy link
Member

TurboVNC is meant to be a remote display solution, so hacks for reading mouse events directly from the local device wouldn't make sense for the most common use case. TurboVNC's mouse handling is dead simple. When the TurboVNC Viewer gets notified by the client O/S that a mouse button or motion event has occurred, the viewer immediately translates the mouse event into an RFB mouse event and sends it to the VNC server. The TurboVNC Server, however, is single-threaded like all X servers are, so whether or not it can immediately read the mouse event and deliver it to X clients depends on how busy the X server is. If you are running the game using VirtualGL and a decently fast GPU, then TurboVNC should be able to keep up with no problem. If you are running the game using software OpenGL, however, then that will definitely bog down the TurboVNC X server. The rate at which TurboVNC can deliver mouse events from client to TurboVNC Server to X clients is subject to the client O/S's mouse sampling rate, the network latency, and the X server load, but 15 ms is definitely not expected on a LAN. If you are using a Linux or Windows client and VirtualGL is set up on the server, then you can test the mouse delay in isolation by running vglrun /opt/VirtualGL/bin/glxspheres64 -i in the TurboVNC session and then using tcbench (in the VirtualGL packages) on the client to drive mouse events continuously into the TurboVNC Viewer while measuring the frame rate. If you are observing a 15 ms delay at the low level-- that is, if it is not specific to the game-- then it should reflect in the frame rate observed through tcbench when performing the aforementioned tests.

If you are using VirtualGL, then I can think of a couple of other possible causes, so do let me know whether that is the case.

@binzhai
Copy link
Author

binzhai commented Apr 27, 2023

Thank you for your prompt response. Currently, I am using turbo vnc server in Docker and turbo vnc viewer on the host, so turbo vnc server and turbo vnc viewer are on the same machine. Also, I am using virtual GL. What is the reason for the delay issue? Or can the server directly access the mouse device?

@binzhai
Copy link
Author

binzhai commented Apr 27, 2023

If there is no change in the VNC screen, the mouse will not delay. However, when playing games or constantly rendering the screen, the mouse will experience significant delays

@dcommander
Copy link
Member

I don't know. You could try setting a frame rate limit in VGL (VGL_FPS=60, for instance) and see if that helps. I haven't ever seen this issue, but I also don't use VGL/TurboVNC for gaming. Do you see the same issue with all games or just this one?

@binzhai
Copy link
Author

binzhai commented Apr 28, 2023

Yes, I have tried many games that have this issue

@dcommander
Copy link
Member

In #368 (comment), I specified the tests that you should run in order to narrow down the cause of the delay. I cannot proceed without knowing the outcome of those tests.

@dcommander dcommander closed this as not planned Won't fix, can't repro, duplicate, stale Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants