diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-07-09 08:54:11 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-07-09 09:57:00 +0100 |
commit | 1b6ad7a6ae6820c8f66d1c80613885ee84e7d316 (patch) | |
tree | 8520bb59eff9f9b386ecf05a2393c51556f2a7a2 | |
parent | d8a75538ea1d2a79d6282b0e2dfd73cfdea1a480 (diff) |
sna: Only consider large clears as candidates for GPU migration
If we only operating on a small region of the pixmap and have require
damage migration in the past, we are likely to require migration again
at some point. So keep track of small damage areas.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_accel.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index ac98d358..fd1abc9c 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -2254,7 +2254,7 @@ static inline bool box_inplace(PixmapPtr pixmap, const BoxRec *box) { struct sna *sna = to_sna_from_pixmap(pixmap); - return ((box->x2 - box->x1) * (box->y2 - box->y1) * pixmap->drawable.bitsPerPixel >> 15) >= sna->kgem.half_cpu_cache_pages; + return ((int)(box->x2 - box->x1) * (int)(box->y2 - box->y1) * pixmap->drawable.bitsPerPixel >> 12) >= sna->kgem.half_cpu_cache_pages; } #define PREFER_GPU 0x1 @@ -10381,22 +10381,27 @@ sna_poly_fill_rect(DrawablePtr draw, GCPtr gc, int n, xRectangle *rect) */ hint = PREFER_GPU; if (n == 1 && gc->fillStyle != FillStippled && alu_overwrites(gc->alu)) { + region.data = NULL; if (priv->cpu_damage && region_is_singular(gc->pCompositeClip)) { - region.data = NULL; if (region_subsumes_damage(®ion, priv->cpu_damage)) { + DBG(("%s: discarding existing CPU damage\n", __FUNCTION__)); sna_damage_destroy(&priv->cpu_damage); list_del(&priv->list); } } - if (priv->cpu_damage == NULL) { - sna_damage_all(&priv->gpu_damage, - pixmap->drawable.width, - pixmap->drawable.height); - priv->undamaged = false; - priv->cpu = false; + if (region_subsumes_drawable(®ion, &pixmap->drawable) || + box_inplace(pixmap, ®ion.extents)) { + DBG(("%s: promoting to full GPU\n", __FUNCTION__)); + if (priv->cpu_damage == NULL) { + sna_damage_all(&priv->gpu_damage, + pixmap->drawable.width, + pixmap->drawable.height); + priv->undamaged = false; + priv->cpu = false; + } + hint |= IGNORE_CPU; } - hint |= IGNORE_CPU; } bo = sna_drawable_use_bo(draw, hint, ®ion.extents, &damage); |