diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-06-05 19:41:25 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-06-05 20:06:44 +0100 |
commit | bdb396a44bf64f823a44aafee19b5ec692f1bf5f (patch) | |
tree | bb74288a64f4ae233f928fb7186973db6089f31d | |
parent | 407257570fea1c6456fda47c9fab36c39f169c2b (diff) |
sna: PutImage: Copy straight to GTT if the bo is idle
This saves a copy in the typical PutImage to frontbuffer favoured by
flash. And we also happen to fix a bug if we should be requested to
PutImage outside of the clip region...
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_accel.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index bab2adb5..d1f5abf2 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -808,7 +808,8 @@ sna_put_image_upload_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region, __FUNCTION__, nbox, box->x1, box->y1, box->x2, box->y2)); - if (!priv->pinned && nbox == 1 && + if (gc->alu == GXcopy && + !priv->pinned && nbox == 1 && box->x1 <= 0 && box->y1 <= 0 && box->x2 >= pixmap->drawable.width && box->y2 >= pixmap->drawable.height) { @@ -869,6 +870,23 @@ sna_put_image_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region, if (gc->alu != GXcopy) return false; + if (priv->gpu_bo->rq == NULL && + sna_put_image_upload_blt(drawable, gc, region, + x, y, w, h, bits, stride)) { + if (region_subsumes_drawable(region, &pixmap->drawable)) { + sna_damage_destroy(&priv->cpu_damage); + sna_damage_all(&priv->gpu_damage, + pixmap->drawable.width, + pixmap->drawable.height); + } else { + assert_pixmap_contains_box(pixmap, RegionExtents(region)); + sna_damage_subtract(&priv->cpu_damage, region); + sna_damage_add(&priv->gpu_damage, region); + } + + return true; + } + if (priv->cpu_bo) kgem_bo_sync(&sna->kgem, priv->cpu_bo, true); @@ -947,11 +965,11 @@ sna_put_image(DrawablePtr drawable, GCPtr gc, int depth, RegionTranslate(clip, -dx, -dy); } - if (format != ZPixmap || - !PM_IS_SOLID(drawable, gc->planemask) || - !sna_put_image_blt(drawable, gc, ®ion, - x, y, w, h, - bits, PixmapBytePad(w, depth))) { + if (RegionNotEmpty(®ion) && + (format != ZPixmap || !PM_IS_SOLID(drawable, gc->planemask) || + !sna_put_image_blt(drawable, gc, ®ion, + x, y, w, h, + bits, PixmapBytePad(w, depth)))) { RegionTranslate(®ion, -dx, -dy); sna_drawable_move_region_to_cpu(drawable, ®ion, true); |