Package: spice-html5
Version: 0.1.7-3
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu eoan ubuntu-patch

Dear Maintainer,

When running a Windows VM using the QXL driver from [1] the display is inverted 
and therefore almost unusable.

In Ubuntu, the attached patch was applied to achieve the following:

  * d/p/fix-windows-spice-upside-down-bitmaps.patch:
    Handle non topdown bitmaps (LP: #1836361)

The Ubuntu bug is 
https://bugs.launchpad.net/ubuntu/+source/spice-html5/+bug/1836361
Commit taken from upstream 
https://github.com/freedesktop/spice-html5/commit/7ba763feb5322f0c97758070075b60cee5464f47


Thanks for considering the patch.


-- System Information:
Debian Release: buster/sid
  APT prefers disco-updates
  APT policy: (500, 'disco-updates'), (500, 'disco-security'), (500, 'disco'), 
(100, 'disco-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.0.0-20-generic (SMP w/24 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US 
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru 
spice-html5-0.1.7/debian/patches/fix-windows-spice-upside-down-bitmaps.patch 
spice-html5-0.1.7/debian/patches/fix-windows-spice-upside-down-bitmaps.patch
--- 
spice-html5-0.1.7/debian/patches/fix-windows-spice-upside-down-bitmaps.patch    
    1969-12-31 19:00:00.000000000 -0500
+++ 
spice-html5-0.1.7/debian/patches/fix-windows-spice-upside-down-bitmaps.patch    
    2019-07-12 10:24:36.000000000 -0400
@@ -0,0 +1,52 @@
+Description: Handle non topdown bitmaps
+ Backport of an upstream patch.
+ .
+ spice-html5 (0.1.7-3ubuntu1) eoan; urgency=medium
+ .
+   * d/p/fix-windows-spice-upside-down-bitmaps.patch:
+     Handle non topdown bitmaps (LP: #1836361)
+
+Origin: upstream, 
https://github.com/freedesktop/spice-html5/commit/7ba763feb5322f0c97758070075b60cee5464f47
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1836361
+
+--- spice-html5-0.1.7.orig/bitmap.js
++++ spice-html5-0.1.7/bitmap.js
+@@ -26,25 +26,31 @@
+ function convert_spice_bitmap_to_web(context, spice_bitmap)
+ {
+     var ret;
+-    var offset, x;
++    var offset, x, src_offset = 0, src_dec = 0;
+     var u8 = new Uint8Array(spice_bitmap.data);
+     if (spice_bitmap.format != SPICE_BITMAP_FMT_32BIT &&
+         spice_bitmap.format != SPICE_BITMAP_FMT_RGBA)
+         return undefined;
+ 
++    if (!(spice_bitmap.flags & SPICE_BITMAP_FLAGS_TOP_DOWN))
++    {
++        src_offset = (spice_bitmap.y - 1 ) * spice_bitmap.stride;
++        src_dec = 2 * spice_bitmap.stride;
++    }
++
+     ret = context.createImageData(spice_bitmap.x, spice_bitmap.y);
+-    for (offset = 0; offset < (spice_bitmap.y * spice_bitmap.stride); )
+-        for (x = 0; x < spice_bitmap.x; x++, offset += 4)
++    for (offset = 0; offset < (spice_bitmap.y * spice_bitmap.stride); 
src_offset -= src_dec)
++        for (x = 0; x < spice_bitmap.x; x++, offset += 4, src_offset += 4)
+         {
+-            ret.data[offset + 0 ] = u8[offset + 2];
+-            ret.data[offset + 1 ] = u8[offset + 1];
+-            ret.data[offset + 2 ] = u8[offset + 0];
++            ret.data[offset + 0 ] = u8[src_offset + 2];
++            ret.data[offset + 1 ] = u8[src_offset + 1];
++            ret.data[offset + 2 ] = u8[src_offset + 0];
+ 
+             // FIXME - We effectively treat all images as having 
SPICE_IMAGE_FLAGS_HIGH_BITS_SET
+             if (spice_bitmap.format == SPICE_BITMAP_FMT_32BIT)
+                 ret.data[offset + 3] = 255;
+             else
+-                ret.data[offset + 3] = u8[offset];
++                ret.data[offset + 3] = u8[src_offset];
+         }
+ 
+     return ret;
diff -Nru spice-html5-0.1.7/debian/patches/series 
spice-html5-0.1.7/debian/patches/series
--- spice-html5-0.1.7/debian/patches/series     2018-08-16 10:14:00.000000000 
-0400
+++ spice-html5-0.1.7/debian/patches/series     2019-07-12 10:24:36.000000000 
-0400
@@ -1,2 +1,3 @@
 add-ctrl-alt-del-button.patch
 fix-windows-spice-upside-down.patch
+fix-windows-spice-upside-down-bitmaps.patch

Reply via email to