diff options
author | Pierre Ossman <ossman@cendio.se> | 2024-02-16 14:31:54 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2024-06-19 16:39:07 +0200 |
commit | 3875912fb65c0710f666efd739a27d8c8835f209 (patch) | |
tree | 3449757103c2d04ceadfec74102fe765ab1b16ea /common/rfb | |
parent | 5322b8ffcdaa8479093917729acc987672546592 (diff) | |
download | tigervnc-3875912fb65c0710f666efd739a27d8c8835f209.tar.gz tigervnc-3875912fb65c0710f666efd739a27d8c8835f209.zip |
Add support for X Present extension
This makes it possible for applications to synchronize their updates to
the updates sent out to clients. This avoids tearing, and could in the
future also help with rate limiting applications to what the client can
actually show.
Diffstat (limited to 'common/rfb')
-rw-r--r-- | common/rfb/SDesktop.h | 4 | ||||
-rw-r--r-- | common/rfb/VNCServer.h | 2 | ||||
-rw-r--r-- | common/rfb/VNCServerST.cxx | 12 | ||||
-rw-r--r-- | common/rfb/VNCServerST.h | 2 |
4 files changed, 18 insertions, 2 deletions
diff --git a/common/rfb/SDesktop.h b/common/rfb/SDesktop.h index 560ee7ff..94e4b028 100644 --- a/common/rfb/SDesktop.h +++ b/common/rfb/SDesktop.h @@ -87,6 +87,10 @@ namespace rfb { return resultProhibited; } + // frameTick() is called whenever a frame update has been processed, + // signalling that a good time to render new data + virtual void frameTick(uint64_t msc) { (void)msc; } + // InputHandler interface // pointerEvent(), keyEvent() and clientCutText() are called in response to // the relevant RFB protocol messages from clients. diff --git a/common/rfb/VNCServer.h b/common/rfb/VNCServer.h index 3f97634b..314367eb 100644 --- a/common/rfb/VNCServer.h +++ b/common/rfb/VNCServer.h @@ -42,6 +42,8 @@ namespace rfb { virtual void blockUpdates() = 0; virtual void unblockUpdates() = 0; + virtual uint64_t getMsc() = 0; + // setPixelBuffer() tells the server to use the given pixel buffer (and // optionally a modified screen layout). If this differs in size from // the previous pixel buffer, this may result in protocol messages being diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx index 8d8dbfd7..bea32abe 100644 --- a/common/rfb/VNCServerST.cxx +++ b/common/rfb/VNCServerST.cxx @@ -1,5 +1,5 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. - * Copyright 2009-2019 Pierre Ossman for Cendio AB + * Copyright 2009-2024 Pierre Ossman for Cendio AB * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -88,7 +88,7 @@ VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_) renderedCursorInvalid(false), keyRemapper(&KeyRemapper::defInstance), idleTimer(this), disconnectTimer(this), connectTimer(this), - frameTimer(this) + msc(0), frameTimer(this) { slog.debug("creating single-threaded server %s", name.c_str()); @@ -257,6 +257,11 @@ void VNCServerST::unblockUpdates() } } +uint64_t VNCServerST::getMsc() +{ + return msc; +} + void VNCServerST::setPixelBuffer(PixelBuffer* pb_, const ScreenSet& layout) { if (comparer) @@ -634,6 +639,9 @@ void VNCServerST::handleTimeout(Timer* t) writeUpdate(); + msc++; + desktop->frameTick(msc); + // If this is the first iteration then we need to adjust the timeout frameTimer.repeat(1000/rfb::Server::frameRate); } else if (t == &idleTimer) { diff --git a/common/rfb/VNCServerST.h b/common/rfb/VNCServerST.h index 55d0c889..719b3f36 100644 --- a/common/rfb/VNCServerST.h +++ b/common/rfb/VNCServerST.h @@ -81,6 +81,7 @@ namespace rfb { virtual void blockUpdates(); virtual void unblockUpdates(); + virtual uint64_t getMsc(); virtual void setPixelBuffer(PixelBuffer* pb, const ScreenSet& layout); virtual void setPixelBuffer(PixelBuffer* pb); virtual void setScreenLayout(const ScreenSet& layout); @@ -206,6 +207,7 @@ namespace rfb { Timer disconnectTimer; Timer connectTimer; + uint64_t msc; Timer frameTimer; }; |