diff options
author | Pierre Ossman <ossman@cendio.se> | 2015-11-18 16:24:16 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2015-11-27 11:15:38 +0100 |
commit | c9dd3a40234b54c7cc9bade71a6cd84af5325fb2 (patch) | |
tree | 994af4dfd3fd75626007c15b316eb8148b443caf /vncviewer/CConn.cxx | |
parent | 5102fa96876907adca3d0897d67108c60a2545b0 (diff) | |
download | tigervnc-c9dd3a40234b54c7cc9bade71a6cd84af5325fb2.tar.gz tigervnc-c9dd3a40234b54c7cc9bade71a6cd84af5325fb2.zip |
Throttle overlapping screen updates
We need to make sure the display server has finished reading our
previous update before we overwrite the buffer with the next update.
Diffstat (limited to 'vncviewer/CConn.cxx')
-rw-r--r-- | vncviewer/CConn.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx index fb136b5f..262dd2ce 100644 --- a/vncviewer/CConn.cxx +++ b/vncviewer/CConn.cxx @@ -46,6 +46,7 @@ #include "CConn.h" #include "OptionsDialog.h" #include "DesktopWindow.h" +#include "PlatformPixelBuffer.h" #include "i18n.h" #include "parameters.h" #include "vncviewer.h" @@ -336,6 +337,9 @@ void CConn::setName(const char* name) // one. void CConn::framebufferUpdateStart() { + ModifiablePixelBuffer* pb; + PlatformPixelBuffer* ppb; + CConnection::framebufferUpdateStart(); // Note: This might not be true if sync fences are supported @@ -343,6 +347,22 @@ void CConn::framebufferUpdateStart() requestNewUpdate(); + // We might still be rendering the previous update + pb = getFramebuffer(); + assert(pb != NULL); + ppb = dynamic_cast<PlatformPixelBuffer*>(pb); + assert(ppb != NULL); + if (ppb->isRendering()) { + // Need to stop monitoring the socket or we'll just busy loop + assert(sock != NULL); + Fl::remove_fd(sock->getFd()); + + while (ppb->isRendering()) + run_mainloop(); + + Fl::add_fd(sock->getFd(), FL_READ | FL_EXCEPT, socketEvent, this); + } + // Update the screen prematurely for very slow updates Fl::add_timeout(1.0, handleUpdateTimeout, this); } |