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