xf86-video-intel: src/sna/kgem.h src/sna/sna_io.c
Chris Wilson
ickle at kemper.freedesktop.org
Fri Nov 1 17:02:41 CET 2013
src/sna/kgem.h | 2 +-
src/sna/sna_io.c | 32 +++++++++++++++++++++++---------
2 files changed, 24 insertions(+), 10 deletions(-)
New commits:
commit 6cb84c8d55f2f7cbb087a479c1dbc8bc58e97183
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri Nov 1 15:57:56 2013 +0000
sna: Guard the replace-with-xor fallback path
Before attempting to map the destination for uploading into after a
failure to use the BLT, we need to recheck that it is indeed mappable.
References: https://bugs.freedesktop.org/show_bug.cgi?id=70924
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index 9804d6c..7da359e 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 cf3c4d1..5d238f4 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
More information about the xorg-commit
mailing list