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>
This commit is contained in:
Chris Wilson 2011-09-13 17:24:14 +01:00
parent 831cdb8371
commit 34c03f2215
2 changed files with 28 additions and 4 deletions

View File

@ -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]);

View File

@ -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;
}