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

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