From 0269ec5533ecf7bec0f01c682e085861a3d2ab00 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 12 Nov 2011 11:49:32 +0000 Subject: [PATCH] sna: Handle incremental uploads from PutImage PutImage rarely uploads the entire image inside a single request, instead breaking up into scanline segments to fit within the protocol limits. A few optimisations are based on detecting when we can discard the GPU bo for an all-dirty CPU pixmap, which are useful in this case so check for an entirely dirty pixmap following an incremental PutImage. Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 2dc86ca2..df237071 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -1381,9 +1381,16 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region, assert_pixmap_contains_box(pixmap, RegionExtents(region)); sna_damage_subtract(&priv->gpu_damage, region); sna_damage_add(&priv->cpu_damage, region); - if (priv->flush) - list_move(&priv->list, &sna->dirty_pixmaps); + if (sna_damage_is_all(&priv->cpu_damage, + pixmap->drawable.width, + pixmap->drawable.height)) { + sna_damage_destroy(&priv->gpu_damage); + if (priv->gpu_bo && !priv->pinned) + sna_pixmap_destroy_gpu_bo(sna, priv); + } } + if (priv->flush) + list_move(&priv->list, &sna->dirty_pixmaps); get_drawable_deltas(drawable, pixmap, &dx, &dy); x += dx + drawable->x;