diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-12-24 18:44:15 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-12-24 21:31:06 +0000 |
commit | 0be136c21f0373d1eb2259b83c598655f4eb841e (patch) | |
tree | ae84dc6cd0c13db1f72eca2e120d8918b76cd018 | |
parent | e764a52ee8f0c552e218b3110318be9ba06634ae (diff) |
sna: use indirect uploads if the bo was last known to be unmappable
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_io.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c index 55fb88d4..1e4a9fb0 100644 --- a/src/sna/sna_io.c +++ b/src/sna/sna_io.c @@ -82,6 +82,18 @@ static void read_boxes_inplace(struct kgem *kgem, } while (--n); } +static bool map_will_stall(struct kgem *kgem, struct kgem_bo *bo) +{ + if (kgem_bo_is_busy(bo)) + return true; + + if (bo->presumed_offset && + bo->presumed_offset + bo->size >= kgem->aperture_mappable) + return true; + + return false; +} + void sna_read_boxes(struct sna *sna, struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy, PixmapPtr dst, int16_t dst_dx, int16_t dst_dy, @@ -100,9 +112,15 @@ void sna_read_boxes(struct sna *sna, __FUNCTION__, nbox, src_bo->handle, src_dx, src_dy, dst->drawable.width, dst->drawable.height, dst_dx, dst_dy)); - if (DEBUG_NO_IO || kgem->wedged || - !kgem_bo_is_busy(src_bo) || - src_bo->tiling != I915_TILING_X) { + if (DEBUG_NO_IO || kgem->wedged || src_bo->tiling == I915_TILING_Y) { + read_boxes_inplace(kgem, + src_bo, src_dx, src_dy, + dst, dst_dx, dst_dy, + box, nbox); + return; + } + + if (src_bo->tiling != I915_TILING_X && !map_will_stall(kgem, src_bo)){ read_boxes_inplace(kgem, src_bo, src_dx, src_dy, dst, dst_dx, dst_dy, @@ -296,9 +314,8 @@ void sna_write_boxes(struct sna *sna, DBG(("%s x %d\n", __FUNCTION__, nbox)); - if (DEBUG_NO_IO || kgem->wedged || - !kgem_bo_is_busy(dst_bo) || - dst_bo->tiling == I915_TILING_Y) { + if (DEBUG_NO_IO || kgem->wedged || dst_bo->tiling == I915_TILING_Y || + !map_will_stall(kgem, dst_bo)) { write_boxes_inplace(kgem, src, stride, bpp, src_dx, src_dy, dst_bo, dst_dx, dst_dy, |