summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-06-17 22:44:58 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-06-18 10:54:16 +0100
commit6086abca13efdeaf9b24c9fbe425546cbe2cfb12 (patch)
tree7e212457a5e56a63a598721c7193df8492dbfb5c
parenta86b217934a9a16843ac17b38cd5b61393f65aa0 (diff)
sna: Try falling back through an upload if inplace mapping fails
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c2
-rw-r--r--src/sna/sna_io.c68
2 files changed, 34 insertions, 36 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 6ef9f187..41ed27de 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1484,6 +1484,7 @@ static void kgem_bo_free(struct kgem *kgem, struct kgem_bo *bo)
{
DBG(("%s: handle=%d\n", __FUNCTION__, bo->handle));
assert(bo->refcnt == 0);
+ assert(bo->proxy == NULL);
assert(bo->exec == NULL);
assert(!bo->snoop || bo->rq == NULL);
@@ -5635,6 +5636,7 @@ struct kgem_bo *kgem_create_buffer_2d(struct kgem *kgem,
return NULL;
}
assert(*ret != NULL);
+ assert(bo->proxy != NULL);
if (height & 1) {
struct kgem_buffer *io = (struct kgem_buffer *)bo->proxy;
diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c
index 14c0d8c7..3febc273 100644
--- a/src/sna/sna_io.c
+++ b/src/sna/sna_io.c
@@ -1392,48 +1392,44 @@ bool sna_replace(struct sna *sna,
bo = new_bo;
}
- if (bo->tiling == I915_TILING_NONE && bo->pitch == stride) {
- if (!kgem_bo_write(kgem, bo, src,
- (pixmap->drawable.height-1)*stride + pixmap->drawable.width*pixmap->drawable.bitsPerPixel/8))
- goto err;
- } else {
- if (upload_inplace__tiled(kgem, bo)) {
- BoxRec box;
+ if (bo->tiling == I915_TILING_NONE && bo->pitch == stride &&
+ kgem_bo_write(kgem, bo, src,
+ (pixmap->drawable.height-1)*stride + pixmap->drawable.width*pixmap->drawable.bitsPerPixel/8))
+ goto done;
- box.x1 = box.y1 = 0;
- box.x2 = pixmap->drawable.width;
- box.y2 = pixmap->drawable.height;
+ if (upload_inplace__tiled(kgem, bo)) {
+ BoxRec box;
- if (write_boxes_inplace__tiled(kgem, src,
- stride, pixmap->drawable.bitsPerPixel, 0, 0,
- bo, 0, 0, &box, 1))
- goto done;
- }
+ box.x1 = box.y1 = 0;
+ box.x2 = pixmap->drawable.width;
+ box.y2 = pixmap->drawable.height;
- if (kgem_bo_is_mappable(kgem, bo)) {
- dst = kgem_bo_map(kgem, bo);
- if (!dst)
- goto err;
+ if (write_boxes_inplace__tiled(kgem, src,
+ stride, pixmap->drawable.bitsPerPixel, 0, 0,
+ bo, 0, 0, &box, 1))
+ goto done;
+ }
- memcpy_blt(src, dst, pixmap->drawable.bitsPerPixel,
- stride, bo->pitch,
- 0, 0,
- 0, 0,
- pixmap->drawable.width,
- pixmap->drawable.height);
- } else {
- BoxRec box;
+ if (kgem_bo_is_mappable(kgem, bo) &&
+ (dst = kgem_bo_map(kgem, bo)) != NULL) {
+ memcpy_blt(src, dst, pixmap->drawable.bitsPerPixel,
+ stride, bo->pitch,
+ 0, 0,
+ 0, 0,
+ pixmap->drawable.width,
+ pixmap->drawable.height);
+ } else {
+ BoxRec box;
- box.x1 = box.y1 = 0;
- box.x2 = pixmap->drawable.width;
- box.y2 = pixmap->drawable.height;
+ box.x1 = box.y1 = 0;
+ box.x2 = pixmap->drawable.width;
+ box.y2 = pixmap->drawable.height;
- if (!sna_write_boxes(sna, pixmap,
- bo, 0, 0,
- src, stride, 0, 0,
- &box, 1))
- goto err;
- }
+ if (!sna_write_boxes(sna, pixmap,
+ bo, 0, 0,
+ src, stride, 0, 0,
+ &box, 1))
+ goto err;
}
done: