Blame SOURCES/0027-dcc-Fix-QUIC-fallback-in-get_compression_for_bitmap.patch

c56f30
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
c56f30
From: Christophe Fergeau <cfergeau@redhat.com>
c56f30
Date: Fri, 20 Jul 2018 11:44:51 +0200
c56f30
Subject: [PATCH] dcc: Fix QUIC fallback in get_compression_for_bitmap()
c56f30
c56f30
There was a small regression introduced in get_compression_for_bitmap()
c56f30
by f401eb07f dcc: Rewrite dcc_image_compress.
c56f30
If SPICE_IMAGE_COMPRESSION_AUTO_GLZ is specified, and the bitmap has a
c56f30
stride which is bigger than its width (ie it has padding), then
c56f30
get_compression_for_bitmap() will return SPICE_IMAGE_COMPRESSION_OFF
c56f30
while in that case, we used to use QUIC for compression.
c56f30
c56f30
This happens because that function in the AUTO_GLZ case first checks if
c56f30
QUIC should be used, if not, it decides to use GLZ, but then decides it
c56f30
can't because of the stride, so falls back to OFF, while it used to
c56f30
fall back to QUIC.
c56f30
c56f30
This commit only slightly reworks a preexisting if (!can_lz_compress())
c56f30
check so that it's unconditional rather than depending on the previous
c56f30
checks having been unsuccessful.
c56f30
c56f30
This issue could be observed by using a spice-html5 without support for
c56f30
uncompressed bitmaps with end-of-line padding by simply starting a f28
c56f30
VM and connecting to it/moving the mouse cursor in it.
c56f30
c56f30
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
c56f30
Acked-by: Frediano Ziglio <fziglio@redhat.com>
c56f30
---
c56f30
 server/dcc.c | 6 ++++--
c56f30
 1 file changed, 4 insertions(+), 2 deletions(-)
c56f30
c56f30
diff --git a/server/dcc.c b/server/dcc.c
c56f30
index 3bf75a7..b632905 100644
c56f30
--- a/server/dcc.c
c56f30
+++ b/server/dcc.c
c56f30
@@ -806,8 +806,10 @@ static SpiceImageCompression get_compression_for_bitmap(SpiceBitmap *bitmap,
c56f30
                     bitmap_get_graduality_level(bitmap) == BITMAP_GRADUAL_HIGH) {
c56f30
                     return SPICE_IMAGE_COMPRESSION_QUIC;
c56f30
                 }
c56f30
-            } else if (!can_lz_compress(bitmap) ||
c56f30
-                       drawable->copy_bitmap_graduality == BITMAP_GRADUAL_HIGH) {
c56f30
+            } else if (drawable->copy_bitmap_graduality == BITMAP_GRADUAL_HIGH) {
c56f30
+                return SPICE_IMAGE_COMPRESSION_QUIC;
c56f30
+            }
c56f30
+            if (!can_lz_compress(bitmap)) {
c56f30
                 return SPICE_IMAGE_COMPRESSION_QUIC;
c56f30
             }
c56f30
         }