summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-09-13 17:24:14 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-09-13 17:24:14 +0100
commit34c03f22158d8fc1ec2fc56cb5e87f74e42d9a8f (patch)
tree0ea23baa4fe20b6b9ae75409f332751061a449ed
parent831cdb837189e92aee80030dec553f28e53ba0bc (diff)
sna: Clear the list of buffers upon server regen
Or else we may try to clear the new framebuffer with an invalid batch, because it will reuse the same bo as last time and that bo may still think it is part of the old batch. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c18
-rw-r--r--src/sna/sna_blt.c14
2 files changed, 28 insertions, 4 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 615e3c5c..82c5cf1c 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -815,6 +815,22 @@ static int kgem_batch_write(struct kgem *kgem, uint32_t handle)
void kgem_reset(struct kgem *kgem)
{
+ struct kgem_request *rq = kgem->next_request;
+ struct kgem_bo *bo;
+
+ while (!list_is_empty(&rq->buffers)) {
+ bo = list_first_entry(&rq->buffers, struct kgem_bo, request);
+
+ bo->src_bound = bo->dst_bound = 0;
+ bo->exec = NULL;
+ bo->dirty = false;
+ bo->gpu = true;
+ bo->cpu_read = false;
+ bo->cpu_write = false;
+
+ list_del(&bo->request);
+ }
+
kgem->nfence = 0;
kgem->nexec = 0;
kgem->nreloc = 0;
@@ -1614,6 +1630,8 @@ uint32_t kgem_add_reloc(struct kgem *kgem,
{
int index;
+ assert ((read_write_domain & 0x7fff) == 0 || bo != NULL);
+
index = kgem->nreloc++;
assert(index < ARRAY_SIZE(kgem->reloc));
kgem->reloc[index].offset = pos * sizeof(kgem->batch[0]);
diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c
index c8bf92ff..e7a74aa1 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -186,7 +186,9 @@ static void sna_blt_fill_one(struct sna *sna,
b[3] = ((y + height) << 16) | (x + width);
b[4] = kgem_add_reloc(kgem, kgem->nbatch + 4,
blt->bo[0],
- I915_GEM_DOMAIN_RENDER << 16 | I915_GEM_DOMAIN_RENDER | KGEM_RELOC_FENCED,
+ I915_GEM_DOMAIN_RENDER << 16 |
+ I915_GEM_DOMAIN_RENDER |
+ KGEM_RELOC_FENCED,
0);
b[5] = blt->pixel;
kgem->nbatch += 6;
@@ -276,7 +278,8 @@ static void sna_blt_copy_one(struct sna *sna,
b[6] = blt->pitch[0];
b[7] = kgem_add_reloc(kgem, kgem->nbatch + 7 - 6,
blt->bo[0],
- I915_GEM_DOMAIN_RENDER << 16 | KGEM_RELOC_FENCED,
+ I915_GEM_DOMAIN_RENDER << 16 |
+ KGEM_RELOC_FENCED,
0);
kgem->nbatch += 8 - 6;
return;
@@ -293,13 +296,16 @@ static void sna_blt_copy_one(struct sna *sna,
b[3] = ((dst_y + height) << 16) | (dst_x + width);
b[4] = kgem_add_reloc(kgem, kgem->nbatch + 4,
blt->bo[1],
- I915_GEM_DOMAIN_RENDER << 16 | I915_GEM_DOMAIN_RENDER | KGEM_RELOC_FENCED,
+ I915_GEM_DOMAIN_RENDER << 16 |
+ I915_GEM_DOMAIN_RENDER |
+ KGEM_RELOC_FENCED,
0);
b[5] = (src_y << 16) | src_x;
b[6] = blt->pitch[0];
b[7] = kgem_add_reloc(kgem, kgem->nbatch + 7,
blt->bo[0],
- I915_GEM_DOMAIN_RENDER << 16 | KGEM_RELOC_FENCED,
+ I915_GEM_DOMAIN_RENDER << 16 |
+ KGEM_RELOC_FENCED,
0);
kgem->nbatch += 8;
}