aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2015-11-12 13:18:22 +0100
committerPierre Ossman <ossman@cendio.se>2015-11-27 11:10:15 +0100
commita862add9b5a35fd628db40c7ecc873dfa7608aeb (patch)
tree5d18b99c72df25e361a464bb65904342f6ce7723
parent1412789e1264b73f7f4d05242bcfbf960f618b15 (diff)
downloadtigervnc-a862add9b5a35fd628db40c7ecc873dfa7608aeb.tar.gz
tigervnc-a862add9b5a35fd628db40c7ecc873dfa7608aeb.zip
Decode rectangles in order if needed
Some encodings must be handled in the order they are received. Make sure we respect this in the decode manager.
-rw-r--r--common/rfb/DecodeManager.cxx13
-rw-r--r--common/rfb/Decoder.h2
-rw-r--r--common/rfb/TightDecoder.cxx2
-rw-r--r--common/rfb/ZRLEDecoder.cxx2
4 files changed, 15 insertions, 4 deletions
diff --git a/common/rfb/DecodeManager.cxx b/common/rfb/DecodeManager.cxx
index ddebf0a3..3c1ddb41 100644
--- a/common/rfb/DecodeManager.cxx
+++ b/common/rfb/DecodeManager.cxx
@@ -251,18 +251,27 @@ DecodeManager::QueueEntry* DecodeManager::DecodeThread::findEntry()
++iter) {
DecodeManager::QueueEntry* entry;
+ std::list<DecodeManager::QueueEntry*>::iterator iter2;
+
entry = *iter;
// Another thread working on this?
if (entry->active)
goto next;
+ // If this is an ordered decoder then make sure this is the first
+ // rectangle in the queue for that decoder
+ if (entry->decoder->flags & DecoderOrdered) {
+ for (iter2 = manager->workQueue.begin(); iter2 != iter; ++iter2) {
+ if (entry->encoding == (*iter2)->encoding)
+ goto next;
+ }
+ }
+
// Check overlap with earlier rectangles
if (!lockedRegion.intersect(entry->affectedRegion).is_empty())
goto next;
- // FIXME: check dependencies between rects
-
return entry;
next:
diff --git a/common/rfb/Decoder.h b/common/rfb/Decoder.h
index f631a551..9a03eb38 100644
--- a/common/rfb/Decoder.h
+++ b/common/rfb/Decoder.h
@@ -33,6 +33,8 @@ namespace rfb {
enum DecoderFlags {
// A constant for decoders that don't need anything special
DecoderPlain = 0,
+ // All rects for this decoder must be handled in order
+ DecoderOrdered = 1 << 0,
};
class Decoder {
diff --git a/common/rfb/TightDecoder.cxx b/common/rfb/TightDecoder.cxx
index 24236dba..ec329e40 100644
--- a/common/rfb/TightDecoder.cxx
+++ b/common/rfb/TightDecoder.cxx
@@ -46,7 +46,7 @@ static const int TIGHT_MIN_TO_COMPRESS = 12;
#include <rfb/tightDecode.h>
#undef BPP
-TightDecoder::TightDecoder() : Decoder(DecoderPlain)
+TightDecoder::TightDecoder() : Decoder(DecoderOrdered)
{
}
diff --git a/common/rfb/ZRLEDecoder.cxx b/common/rfb/ZRLEDecoder.cxx
index c9245c06..c13f2861 100644
--- a/common/rfb/ZRLEDecoder.cxx
+++ b/common/rfb/ZRLEDecoder.cxx
@@ -62,7 +62,7 @@ static inline rdr::U32 readOpaque24B(rdr::InStream* is)
#undef CPIXEL
#undef BPP
-ZRLEDecoder::ZRLEDecoder() : Decoder(DecoderPlain)
+ZRLEDecoder::ZRLEDecoder() : Decoder(DecoderOrdered)
{
}