diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-03-31 11:14:46 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-03-31 11:14:46 +0100 |
commit | 8f796d4586507a0a6e9ca3608f43448983a3b965 (patch) | |
tree | d5ef1777077153d0cf20bd378865b6eff59a833b /src | |
parent | 27c086a89d838fe0060e5ddd0fb2f37434078e4d (diff) |
sna: Promote to the GPU operations that cover the whole pixmap
If the pixmap is already partially on the GPU, and the next operation
touches the entire pixmap, promote that operation back to the whole GPU.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/sna/sna.h | 8 | ||||
-rw-r--r-- | src/sna/sna_accel.c | 9 | ||||
-rw-r--r-- | src/sna/sna_composite.c | 4 |
3 files changed, 17 insertions, 4 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h index a2b5e83d..00175828 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -632,6 +632,14 @@ static inline bool box_empty(const BoxRec *box) } static inline bool +box_covers_pixmap(PixmapPtr pixmap, const BoxRec *box) +{ + int w = box->x2 - box->x1; + int h = box->y2 - box->y1; + return pixmap->drawable.width <= w && pixmap->drawable.height <= h; +} + +static inline bool box_inplace(PixmapPtr pixmap, const BoxRec *box) { struct sna *sna = to_sna_from_pixmap(pixmap); diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 3640b574..25b2ec36 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -3348,7 +3348,8 @@ done: priv->clear = false; if (!DAMAGE_IS_ALL(priv->gpu_damage) && priv->cpu_damage == NULL && - box_inplace(pixmap, &r.extents)) { + (box_covers_pixmap(pixmap, &r.extents) || + box_inplace(pixmap, &r.extents))) { DBG(("%s: large operation on undamaged, promoting to full GPU\n", __FUNCTION__)); assert(priv->gpu_bo); @@ -3442,7 +3443,7 @@ sna_drawable_use_bo(DrawablePtr drawable, unsigned flags, const BoxRec *box, flags &= ~PREFER_GPU; if ((flags & (PREFER_GPU | IGNORE_CPU)) == IGNORE_CPU) { - if (priv->gpu_bo && box_inplace(pixmap, box)) + if (priv->gpu_bo && (box_covers_pixmap(pixmap, box) || box_inplace(pixmap, box))) flags |= PREFER_GPU; } @@ -14145,7 +14146,9 @@ sna_poly_fill_rect(DrawablePtr draw, GCPtr gc, int n, xRectangle *rect) } if (priv->cpu_damage == NULL) { if (priv->gpu_bo && - (hint & REPLACES || box_inplace(pixmap, ®ion.extents))) { + (hint & REPLACES || + box_covers_pixmap(pixmap, ®ion.extents) || + box_inplace(pixmap, ®ion.extents))) { DBG(("%s: promoting to full GPU\n", __FUNCTION__)); assert(priv->gpu_bo->proxy == NULL); diff --git a/src/sna/sna_composite.c b/src/sna/sna_composite.c index d34b5172..5bcea883 100644 --- a/src/sna/sna_composite.c +++ b/src/sna/sna_composite.c @@ -955,7 +955,9 @@ sna_composite_rectangles(CARD8 op, } if (region_subsumes_drawable(®ion, &pixmap->drawable)) hint |= REPLACES; - if (hint & REPLACES || box_inplace(pixmap, ®ion.extents)) { + if (hint & REPLACES || + box_covers_pixmap(pixmap, ®ion.extents) || + box_inplace(pixmap, ®ion.extents)) { DBG(("%s: promoting to full GPU\n", __FUNCTION__)); if (priv->gpu_bo && priv->cpu_damage == NULL) { assert(priv->gpu_bo->proxy == NULL); |