diff --git a/src/sna/kgem.h b/src/sna/kgem.h index 9804d6c2..7da359e0 100644 --- a/src/sna/kgem.h +++ b/src/sna/kgem.h @@ -530,7 +530,7 @@ static inline bool __kgem_bo_is_mappable(struct kgem *kgem, if (kgem->gen == 021 && bo->tiling == I915_TILING_Y) return false; - if (kgem->has_llc && bo->tiling == I915_TILING_NONE) + if (!bo->tiling && (kgem->has_llc || bo->domain == DOMAIN_CPU)) return true; if (!bo->presumed_offset) diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c index cf3c4d18..5d238f48 100644 --- a/src/sna/sna_io.c +++ b/src/sna/sna_io.c @@ -581,6 +581,7 @@ write_boxes_inplace__tiled(struct kgem *kgem, { uint8_t *dst; + assert(kgem_bo_can_map__cpu(kgem, bo, true)); assert(bo->tiling == I915_TILING_X); dst = kgem_bo_map__cpu(kgem, bo); @@ -718,7 +719,7 @@ bool sna_write_boxes(struct sna *sna, PixmapPtr dst, DBG(("%s x %d, src stride=%d, src dx=(%d, %d)\n", __FUNCTION__, nbox, stride, src_dx, src_dy)); - if (upload_inplace(kgem, dst_bo, box, nbox, dst->drawable.bitsPerPixel)&& + if (upload_inplace(kgem, dst_bo, box, nbox, dst->drawable.bitsPerPixel) && write_boxes_inplace(kgem, src, stride, dst->drawable.bitsPerPixel, src_dx, src_dy, dst_bo, dst_dx, dst_dy, @@ -1039,6 +1040,9 @@ write_boxes_inplace__xor(struct kgem *kgem, DBG(("%s x %d, tiling=%d\n", __FUNCTION__, n, bo->tiling)); + if (!kgem_bo_can_map(kgem, bo)) + return false; + kgem_bo_submit(kgem, bo); dst = kgem_bo_map(kgem, bo); @@ -1110,14 +1114,17 @@ bool sna_write_boxes__xor(struct sna *sna, PixmapPtr dst, DBG(("%s x %d\n", __FUNCTION__, nbox)); - if (upload_inplace__xor(kgem, dst_bo, box, nbox, dst->drawable.bitsPerPixel)) { -fallback: - return write_boxes_inplace__xor(kgem, - src, stride, dst->drawable.bitsPerPixel, src_dx, src_dy, - dst_bo, dst_dx, dst_dy, - box, nbox, - and, or); - } + if (upload_inplace__xor(kgem, dst_bo, box, nbox, dst->drawable.bitsPerPixel) && + write_boxes_inplace__xor(kgem, + src, stride, dst->drawable.bitsPerPixel, src_dx, src_dy, + dst_bo, dst_dx, dst_dy, + box, nbox, + and, or)) + return true; + + if (wedged(sna)) + return false; + can_blt = kgem_bo_can_blt(kgem, dst_bo) && (box[0].x2 - box[0].x1) * dst->drawable.bitsPerPixel < 8 * (MAXSHORT - 4); @@ -1406,6 +1413,13 @@ tile: sna->blt_state.fill_bo = 0; return true; + +fallback: + return write_boxes_inplace__xor(kgem, + src, stride, dst->drawable.bitsPerPixel, src_dx, src_dy, + dst_bo, dst_dx, dst_dy, + box, nbox, + and, or); } static bool