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

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