diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-06-07 19:16:01 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-06-07 19:16:01 +0100 |
commit | 038f29c259c1463c0bff12f5f8f0b228c02e45b3 (patch) | |
tree | 04e628b7e1b673b03ec05ca2ae2bef50c025a2d3 | |
parent | 265d94e0aa46b30a3198893544dd3619cc9145de (diff) |
sna/blt: Flush batch before overwrite surface data
A left-over from before the surface was embedded into the tail of the
batch, we were only checking for room against the total size of the
batch buffer. So under the wrong set of circumstances we ended up
overwriting surface data with batch and triggering a GPU hang on gen4+.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/kgem.c | 2 | ||||
-rw-r--r-- | src/sna/sna_blt.c | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c index fdc21080..46cd4749 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -736,6 +736,7 @@ void _kgem_submit(struct kgem *kgem) assert(kgem->nbatch); assert(kgem->nbatch <= KGEM_BATCH_SIZE(kgem)); + assert(kgem->nbatch <= kgem->surface); sna_kgem_context_switch(kgem, KGEM_NONE); @@ -747,6 +748,7 @@ void _kgem_submit(struct kgem *kgem) kgem->nreloc, kgem->nexec, kgem->nfence, kgem->aperture)); assert(kgem->nbatch <= ARRAY_SIZE(kgem->batch)); + assert(kgem->nbatch <= kgem->surface); assert(kgem->nreloc <= ARRAY_SIZE(kgem->reloc)); assert(kgem->nexec < ARRAY_SIZE(kgem->exec)); assert(kgem->nfence <= kgem->fence_max); diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c index cdcfc3b0..d82f417b 100644 --- a/src/sna/sna_blt.c +++ b/src/sna/sna_blt.c @@ -281,7 +281,7 @@ static void sna_blt_copy_one(struct sna *sna, return; } - if (kgem->nbatch + 8 > KGEM_BATCH_SIZE(kgem) || + if (kgem->nbatch + 8 + KGEM_BATCH_RESERVED > kgem->surface || kgem->nreloc + 2 > KGEM_RELOC_SIZE(kgem)) _kgem_submit(kgem); |