Sophie

Sophie

distrib > Fedora > 14 > i386 > by-pkgid > 42136cd5fec82fd91c21730eaa072e3e > files > 8

xorg-x11-drv-qxl-0.0.21-3.fc14.src.rpm

From ab8fd100430f7a142799960ce371b36f4c673cda Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B8ren=20Sandmann=20Pedersen?= <ssp@localhost.localdomain>
Date: Sat, 19 Mar 2011 15:19:13 -0400
Subject: [PATCH 08/13] Tiled upload of images after software fallback.

Instead of uploading the full software image in one go, upload it in
512x512 tiles to avoid having to find huge huge blocks of memory and
potentially running out.
---
 src/qxl_surface.c |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/src/qxl_surface.c b/src/qxl_surface.c
index 88b3ebb..bf91483 100644
--- a/src/qxl_surface.c
+++ b/src/qxl_surface.c
@@ -1024,7 +1024,7 @@ translate_rect (struct QXLRect *rect)
 }
 
 static void
-upload_box (qxl_surface_t *surface, int x1, int y1, int x2, int y2)
+real_upload_box (qxl_surface_t *surface, int x1, int y1, int x2, int y2)
 {
     struct QXLRect rect;
     struct QXLDrawable *drawable;
@@ -1060,6 +1060,31 @@ upload_box (qxl_surface_t *surface, int x1, int y1, int x2, int y2)
     push_drawable (qxl, drawable);
 }
 
+#define TILE_WIDTH 512
+#define TILE_HEIGHT 512
+
+static void
+upload_box (qxl_surface_t *surface, int x1, int y1, int x2, int y2)
+{
+    int tile_x1, tile_y1;
+
+    for (tile_y1 = y1; tile_y1 < y2; tile_y1 += TILE_HEIGHT)
+    {
+	for (tile_x1 = x1; tile_x1 < x2; tile_x1 += TILE_WIDTH)
+	{
+	    int tile_x2 = tile_x1 + TILE_WIDTH;
+	    int tile_y2 = tile_y1 + TILE_HEIGHT;
+
+	    if (tile_x2 > x2)
+		tile_x2 = x2;
+	    if (tile_y2 > y2)
+		tile_y2 = y2;
+
+	    real_upload_box (surface, tile_x1, tile_y1, tile_x2, tile_y2);
+	}
+    }
+}
+
 void
 qxl_surface_finish_access (qxl_surface_t *surface, PixmapPtr pixmap)
 {
-- 
1.7.4.4