From ee7ea10148b7843091c3fa103f9f4476979f8b68 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 23 May 2013 12:55:21 +0100 Subject: [PATCH] sna: Only flags the PolyFillRect as REPLACES if it is unclipped Otherwise we discard a fill operation that is required to initialise the pixmap before drawing commences. Fixes regression from commit ef9dc6fae585d5616446eedc1e6e91173f4064c1 [2.21.7] Author: Chris Wilson Date: Mon May 20 11:08:51 2013 +0100 sna: Undo a few more overwritten operations upon a bo Reported-by: Matti Hamalainen Reported-by: Clemens Eisserer Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64841 Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 371abb02..49d0ba35 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -12164,9 +12164,16 @@ 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)) { + int16_t dx, dy; + region.data = NULL; - if (priv->cpu_damage && - region_is_singular(gc->pCompositeClip)) { + + get_drawable_deltas(draw, pixmap, &dx, &dy); + DBG(("%s: delta=(%d, %d)\n", __FUNCTION__, dx, dy)); + if (dx | dy) + RegionTranslate(®ion, dx, dy); + + if (priv->cpu_damage && (flags & 2) == 0) { if (region_subsumes_damage(®ion, priv->cpu_damage)) { DBG(("%s: discarding existing CPU damage\n", __FUNCTION__)); if (priv->gpu_bo && priv->gpu_bo->proxy) { @@ -12183,28 +12190,29 @@ sna_poly_fill_rect(DrawablePtr draw, GCPtr gc, int n, xRectangle *rect) if (region_subsumes_drawable(®ion, &pixmap->drawable)) hint |= REPLACES; if (priv->cpu_damage == NULL) { - if (hint & REPLACES && + if (priv->gpu_bo && + hint & REPLACES && box_inplace(pixmap, ®ion.extents)) { DBG(("%s: promoting to full GPU\n", __FUNCTION__)); - if (priv->gpu_bo) { - assert(priv->gpu_bo->proxy == NULL); - sna_damage_all(&priv->gpu_damage, - pixmap->drawable.width, - pixmap->drawable.height); - } + assert(priv->gpu_bo->proxy == NULL); + sna_damage_all(&priv->gpu_damage, + pixmap->drawable.width, + pixmap->drawable.height); } DBG(("%s: dropping last-cpu hint\n", __FUNCTION__)); priv->cpu = false; } + + if (dx | dy) + RegionTranslate(®ion, -dx, -dy); } /* If the source is already on the GPU, keep the operation on the GPU */ - if (gc->fillStyle == FillTiled) { - if (!gc->tileIsPixel && sna_pixmap_is_gpu(gc->tile.pixmap)) { - DBG(("%s: source is already on the gpu\n", __FUNCTION__)); - hint |= FORCE_GPU; - } + if (gc->fillStyle == FillTiled && !gc->tileIsPixel && + sna_pixmap_is_gpu(gc->tile.pixmap)) { + DBG(("%s: source is already on the gpu\n", __FUNCTION__)); + hint |= FORCE_GPU; } bo = sna_drawable_use_bo(draw, hint, ®ion.extents, &damage); @@ -12212,7 +12220,7 @@ sna_poly_fill_rect(DrawablePtr draw, GCPtr gc, int n, xRectangle *rect) DBG(("%s: not using GPU, hint=%x\n", __FUNCTION__, hint)); goto fallback; } - if (hint & REPLACES) + if (hint & REPLACES && (flags & 2) == 0) kgem_bo_undo(&sna->kgem, bo); if (gc_is_solid(gc, &color)) {