summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@localhost.localdomain>2011-03-19 15:19:13 -0400
committerSøren Sandmann Pedersen <ssp@redhat.com>2011-03-19 15:51:35 -0400
commitab8fd100430f7a142799960ce371b36f4c673cda (patch)
tree03cf79801fec3033f2a6a978eb70c476d9756947
parent81e3d5c118bbe75688be61d7739a48452f1a9415 (diff)
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.
-rw-r--r--src/qxl_surface.c27
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)
{