diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2022-05-07 15:19:48 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2022-05-24 14:11:42 +0100 |
commit | 8a1f7a6ceb00e70ff1289def58bf603ba33dd820 (patch) | |
tree | 225e0ea90d9a6327ed53e5195cad98ce6363c15f | |
parent | Track invalidity on tiles themselves - to keep the keyframe around. (diff) | |
download | online-8a1f7a6ceb00e70ff1289def58bf603ba33dd820.tar.gz online-8a1f7a6ceb00e70ff1289def58bf603ba33dd820.zip |
deltas: render-id is obsolete, color deltas in debug mode.
Change-Id: I200ea80428d22686a0c2f5f0d803a4614a5eb94c
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r-- | browser/src/core/Socket.js | 3 | ||||
-rw-r--r-- | browser/src/layer/tile/CanvasTileLayer.js | 12 | ||||
-rw-r--r-- | common/RenderTiles.hpp | 10 | ||||
-rw-r--r-- | test/TileCacheTests.cpp | 22 | ||||
-rw-r--r-- | wsd/DocumentBroker.cpp | 6 | ||||
-rw-r--r-- | wsd/TileCache.cpp | 40 | ||||
-rw-r--r-- | wsd/protocol.txt | 19 |
7 files changed, 32 insertions, 80 deletions
diff --git a/browser/src/core/Socket.js b/browser/src/core/Socket.js index 414cf8053c..65af14d4ff 100644 --- a/browser/src/core/Socket.js +++ b/browser/src/core/Socket.js @@ -1642,9 +1642,6 @@ app.definitions.Socket = L.Class.extend({ else if (tokens[i].substring(0, 7) === 'params=') { command.params = tokens[i].substring(7).split(','); } - else if (tokens[i].substring(0, 9) === 'renderid=') { - command.renderid = tokens[i].substring(9); - } else if (tokens[i].substring(0, 12) === 'rendercount=') { command.rendercount = parseInt(tokens[i].substring(12)); } diff --git a/browser/src/layer/tile/CanvasTileLayer.js b/browser/src/layer/tile/CanvasTileLayer.js index 3b374e01f0..d22c11ff25 100644 --- a/browser/src/layer/tile/CanvasTileLayer.js +++ b/browser/src/layer/tile/CanvasTileLayer.js @@ -6533,13 +6533,16 @@ L.CanvasTileLayer = L.Layer.extend({ } tile.el = canvas; + // FIXME: remove this ... if (isKeyframe && delta.length != canvas.width * canvas.height * 4) { - console.log('Broken keyframe - assuming it is a delta, size mismatch: ' + - delta.length + ' vs. ' + (canvas.width * canvas.height * 4)); + console.debug('Broken keyframe - assuming it is a delta, size mismatch: ' + + delta.length + ' vs. ' + (canvas.width * canvas.height * 4)); isKeyframe = false; } + tile.lastKeyframe = isKeyframe; + // apply potentially several deltas in turn. var i = 0; var offset = 0; @@ -6701,9 +6704,10 @@ L.CanvasTileLayer = L.Layer.extend({ }); } else if (tile) { - if (this._tiles[key]._invalidCount > 0) { + tile.lastKeyframe = false; + + if (this._tiles[key]._invalidCount > 0) this._tiles[key]._invalidCount -= 1; - } tile.wireId = tileMsgObj.wireId; if (this._map._canvasDevicePixelGrid) diff --git a/common/RenderTiles.hpp b/common/RenderTiles.hpp index 9c271164bf..390e6002b3 100644 --- a/common/RenderTiles.hpp +++ b/common/RenderTiles.hpp @@ -20,12 +20,6 @@ #include "Rectangle.hpp" #include "TileDesc.hpp" -#if ENABLE_DEBUG -# define ADD_DEBUG_RENDERID (" renderid=" + Util::UniqueId() + '\n') -#else -# define ADD_DEBUG_RENDERID ("\n") -#endif - class ThreadPool { std::mutex _mutex; std::condition_variable _cond; @@ -353,7 +347,7 @@ namespace RenderTiles std::string tileMsg; if (combined) { - tileMsg = tileCombined.serialize("tilecombine:", ADD_DEBUG_RENDERID, renderedTiles); + tileMsg = tileCombined.serialize("tilecombine:", "\n", renderedTiles); LOG_TRC("Sending back painted tiles for " << tileMsg << " of size " << output.size() << " bytes) for: " << tileMsg); @@ -369,7 +363,7 @@ namespace RenderTiles size_t outputOffset = 0; for (auto &i : renderedTiles) { - tileMsg = i.serialize("tile:", ADD_DEBUG_RENDERID); + tileMsg = i.serialize("tile:", "\n"); const size_t responseSize = tileMsg.size() + i.getImgSize(); std::unique_ptr<char[]> response; response.reset(new char[responseSize]); diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index 776f2b117b..edd55747b0 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -70,7 +70,7 @@ class TileCacheTests : public CPPUNIT_NS::TestFixture CPPUNIT_TEST(testImpressTiles); CPPUNIT_TEST(testClientPartImpress); CPPUNIT_TEST(testClientPartCalc); - // FIXME CPPUNIT_TEST(testTilesRenderedJustOnce); + CPPUNIT_TEST(testTilesRenderedJustOnce); // TESTME: reliable ? // CPPUNIT_TEST(testTilesRenderedJustOnceMultiClient); // always fails, seems complicated to fix #if ENABLE_DEBUG CPPUNIT_TEST(testSimultaneousTilesRenderedJustOnce); @@ -680,19 +680,21 @@ void TileCacheTests::testTilesRenderedJustOnce() // Get same 3 tiles. sendTextFrame(socket, "tilecombine nviewid=0 part=0 width=256 height=256 tileposx=0,3840,7680 tileposy=0,0,0 tilewidth=3840 tileheight=3840", testname); const auto tile1 = assertResponseString(socket, "tile:", testname); - std::string renderId1; - COOLProtocol::getTokenStringFromMessage(tile1, "renderid", renderId1); - LOK_ASSERT_EQUAL(std::string("cached"), renderId1); + + // monotonically increasing id. + std::string wid1; + COOLProtocol::getTokenStringFromMessage(tile1, "wid", wid1); const auto tile2 = assertResponseString(socket, "tile:", testname); - std::string renderId2; - COOLProtocol::getTokenStringFromMessage(tile2, "renderid", renderId2); - LOK_ASSERT_EQUAL(std::string("cached"), renderId2); + + std::string wid2; + COOLProtocol::getTokenStringFromMessage(tile2, "wid", wid2); + LOK_ASSERT_EQUAL(wid1, wid2); // shouldn't have changed const auto tile3 = assertResponseString(socket, "tile:", testname); - std::string renderId3; - COOLProtocol::getTokenStringFromMessage(tile3, "renderid", renderId3); - LOK_ASSERT_EQUAL(std::string("cached"), renderId3); + std::string wid3; + COOLProtocol::getTokenStringFromMessage(tile3, "wid", wid3); + LOK_ASSERT_EQUAL(wid3, wid2); // Get new rendercount. sendTextFrame(socket, "ping", testname); diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp index 5e4f64c428..021c93f1db 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -55,12 +55,6 @@ using namespace COOLProtocol; using Poco::JSON::Object; -#if ENABLE_DEBUG -# define ADD_DEBUG_RENDERID (" renderid=cached\n") -#else -# define ADD_DEBUG_RENDERID ("\n") -#endif - void ChildProcess::setDocumentBroker(const std::shared_ptr<DocumentBroker>& docBroker) { assert(docBroker && "Invalid DocumentBroker instance."); diff --git a/wsd/TileCache.cpp b/wsd/TileCache.cpp index 639b28f431..c8c0a8f06a 100644 --- a/wsd/TileCache.cpp +++ b/wsd/TileCache.cpp @@ -190,46 +190,6 @@ void TileCache::saveTileAndNotify(const TileDesc& desc, const char *data, const std::shared_ptr<TileBeingRendered> tileBeingRendered = findTileBeingRendered(desc); if (tileBeingRendered) { -#if 0 - // FIXME: what is that renderid=cache thing ? ... - - // Send to first subscriber as-is (without cache marker). - auto payload = std::make_shared<Message>(response, - Message::Dir::Out, - response.size() + 1 + size); - payload->append("\n", 1); - payload->append(data, size); - - auto& firstSubscriber = tileBeingRendered->getSubscribers()[0]; - std::shared_ptr<ClientSession> firstSession = firstSubscriber.lock(); - if (firstSession) - { - firstSession->enqueueSendMessage(payload); - } - - if (subscriberCount > 1) - { - // All others must get served from the cache. - response += " renderid=cached\n"; - - // Create a new Payload. - payload.reset(); - payload = std::make_shared<Message>(response, - Message::Dir::Out, - response.size() + size); - payload->append(data, size); - - for (size_t i = 1; i < subscriberCount; ++i) - { - auto& subscriber = tileBeingRendered->getSubscribers()[i]; - std::shared_ptr<ClientSession> session = subscriber.lock(); - if (session) - { - session->enqueueSendMessage(payload); - } - } - } -#endif const size_t subscriberCount = tileBeingRendered->getSubscribers().size(); // sendTile also does enqueueSendMessage underneath ... diff --git a/wsd/protocol.txt b/wsd/protocol.txt index e15402074d..39621779ee 100644 --- a/wsd/protocol.txt +++ b/wsd/protocol.txt @@ -515,21 +515,22 @@ complexselection: Complex selections with embedded objects and large text selections need special export handling. This response signifies that the payload is large and/or complex and needs to be retrieved via the clipboard API. -tile: part=<partNumber> width=<width> height=<height> tileposx=<xpos> tileposy=<ypos> tilewidth=<tileWidth> tileheight=<tileHeight> [timestamp=<time>] [renderid=<id>] [wid=<wireId>] +tile: part=<partNumber> width=<width> height=<height> tileposx=<xpos> tileposy=<ypos> tilewidth=<tileWidth> tileheight=<tileHeight> [timestamp=<time>] [wid=<wireId>] <binaryPngImage> The parameters from the corresponding 'tile' command. - In a debug build, the renderid is either a unique identifier, - different for each actual call to LibreOfficeKit to render a tile, - or the string 'cached' if the tile was found in the cache. WireId - is a unique reference to a hashed tile on the server, and can - be included by the client in the next 'tile' message requesting - the same tile. + WireId is a monotonically incrementing, unique reference to a + state of the document on the server, and can be included by + the client in the next 'tile' message requesting the same tile. -delta: part=<partNumber> width=<width> height=<height> tileposx=<xpos> tileposy=<ypos> tilewidth=<tileWidth> tileheight=<tileHeight> [timestamp=<time>] [renderid=<id>] [wid=<wireId>] + the tile message has at least one keyframe, followed by any + number of concatentated compressed deltas. - A delta command is an incremental patch on top of a previous tile. +delta: part=<partNumber> width=<width> height=<height> tileposx=<xpos> tileposy=<ypos> tilewidth=<tileWidth> tileheight=<tileHeight> [timestamp=<time>] [wid=<wireId>] + + A delta command is like a tile: command but the payload is purely + an incremental patch on top of a previous tile. commandresult: <payload> This is used to acknowledge the commands from the client. |