From: Pierre Ossman Date: Thu, 12 Nov 2015 12:18:22 +0000 (+0100) Subject: Decode rectangles in order if needed X-Git-Tag: v1.6.90~95^2~12 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a862add9b5a35fd628db40c7ecc873dfa7608aeb;p=tigervnc.git 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. --- 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::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 #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) { }