Blame SOURCES/0001-worst-hack-of-all-time-to-qxl-driver.patch

337bb7
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
337bb7
From: Dave Airlie <airlied@redhat.com>
337bb7
Date: Tue, 26 Nov 2013 10:45:26 +1000
337bb7
Subject: [PATCH] worst hack of all time to qxl driver
337bb7
337bb7
---
337bb7
 src/qxl_surface.c | 30 ++++++++++++++++++++++++++++--
337bb7
 1 file changed, 28 insertions(+), 2 deletions(-)
337bb7
337bb7
diff --git a/src/qxl_surface.c b/src/qxl_surface.c
337bb7
index 6a7e275..bb59f9e 100644
337bb7
--- a/src/qxl_surface.c
337bb7
+++ b/src/qxl_surface.c
337bb7
@@ -770,8 +770,9 @@ qxl_surface_composite (qxl_surface_t *dest,
337bb7
       qxl->bo_funcs->bo_decref(qxl, derefs[i]);
337bb7
 }
337bb7
 
337bb7
-Bool
337bb7
-qxl_surface_put_image (qxl_surface_t *dest,
337bb7
+
337bb7
+static Bool
337bb7
+qxl_surface_put_image_for_reals (qxl_surface_t *dest,
337bb7
 		       int x, int y, int width, int height,
337bb7
 		       const char *src, int src_pitch)
337bb7
 {
337bb7
@@ -814,6 +815,31 @@ qxl_surface_put_image (qxl_surface_t *dest,
337bb7
     return TRUE;
337bb7
 }
337bb7
 
337bb7
+#define HACK_THE_PLANET 1
337bb7
+Bool
337bb7
+qxl_surface_put_image (qxl_surface_t *dest,
337bb7
+		       int x, int y, int width, int height,
337bb7
+		       const char *src, int src_pitch)
337bb7
+{
337bb7
+#ifdef HACK_THE_PLANET
337bb7
+    Bool use_hack = FALSE;
337bb7
+
337bb7
+    /* worst heuristic ever - should really block the gnome-shell issue for now */
337bb7
+    if (width == pixman_image_get_width(dest->host_image) && height < pixman_image_get_height(dest->host_image))
337bb7
+        use_hack = TRUE;
337bb7
+
337bb7
+    if (use_hack) {
337bb7
+        int gross = rand() % height;
337bb7
+        int h2 = height - gross;
337bb7
+        if (gross > 0)
337bb7
+            qxl_surface_put_image_for_reals(dest, x, y, width, gross, src, src_pitch);
337bb7
+        qxl_surface_put_image_for_reals(dest, x, y + gross, width, h2, src + (gross * src_pitch), src_pitch);
337bb7
+        return TRUE;
337bb7
+    } else
337bb7
+#endif
337bb7
+    return qxl_surface_put_image_for_reals(dest, x, y, width, height, src, src_pitch);
337bb7
+}
337bb7
+
337bb7
 void
337bb7
 qxl_get_formats (int bpp, SpiceSurfaceFmt *format, pixman_format_code_t *pformat)
337bb7
 {