diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-05-20 11:08:51 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-05-21 09:31:55 +0100 |
commit | ef9dc6fae585d5616446eedc1e6e91173f4064c1 (patch) | |
tree | d581f39596ee855a7a41bc07278efb05257fb014 /src/sna/sna_accel.c | |
parent | d6c30d1d4df6bcdfa075bd29da7c8aabee20774c (diff) |
sna: Undo a few more overwritten operations upon a bo
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_accel.c')
-rw-r--r-- | src/sna/sna_accel.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 2c785704..6ed9e770 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -2946,6 +2946,8 @@ sna_drawable_use_bo(DrawablePtr drawable, unsigned flags, const BoxRec *box, box->x1, box->y1, box->x2, box->y2, flags)); + assert((hint & REPLACES) == 0 || (hint & IGNORE_CPU)); + assert(box->x2 > box->x1 && box->y2 > box->y1); assert(pixmap->refcnt); assert_pixmap_damage(pixmap); @@ -3001,7 +3003,7 @@ sna_drawable_use_bo(DrawablePtr drawable, unsigned flags, const BoxRec *box, __FUNCTION__, priv->flush, priv->shm, priv->cpu, flags)); if ((flags & PREFER_GPU) == 0 && - (!priv->gpu_damage || !kgem_bo_is_busy(priv->gpu_bo))) { + (flags & REPLACES || !priv->gpu_damage || !kgem_bo_is_busy(priv->gpu_bo))) { DBG(("%s: try cpu as GPU bo is idle\n", __FUNCTION__)); goto use_cpu_bo; } @@ -12179,18 +12181,20 @@ sna_poly_fill_rect(DrawablePtr draw, GCPtr gc, int n, xRectangle *rect) } hint |= IGNORE_CPU; } - if (priv->cpu_damage == NULL && - (region_subsumes_drawable(®ion, &pixmap->drawable) || - 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); - } - } + if (region_subsumes_drawable(®ion, &pixmap->drawable)) + hint |= REPLACES; if (priv->cpu_damage == NULL) { + if (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); + } + } DBG(("%s: dropping last-cpu hint\n", __FUNCTION__)); priv->cpu = false; } @@ -12209,6 +12213,8 @@ 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) + kgem_bo_undo(&sna->kgem, bo); if (gc_is_solid(gc, &color)) { DBG(("%s: solid fill [%08x], testing for blt\n", |