sna: Upon unwinding operations, also check for exec objects to clear

If we cancel an operation after partially committing it, we may leave
the batch bookkeeping in an inconsistent state with an exec object with
a zero-length batch. Ordinarily, this would not be an issue as we could
pass the extra object to the next batch. However, if we switch rings, we
need to clear the extra objects as they are currently flagged as being
on the wrong ring, leading to hilarity.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2013-10-09 23:54:57 +01:00
parent b9ad5b625e
commit b16999da21
2 changed files with 20 additions and 3 deletions

View File

@ -3622,10 +3622,19 @@ gen6_render_context_switch(struct kgem *kgem,
int new_mode)
{
if (kgem->nbatch) {
DBG(("%s: from %d to %d\n", __FUNCTION__, kgem->mode, new_mode));
DBG(("%s: from %d to %d, submit batch\n", __FUNCTION__, kgem->mode, new_mode));
_kgem_submit(kgem);
}
if (kgem->nexec) {
DBG(("%s: from %d to %d, reset incomplete batch\n", __FUNCTION__, kgem->mode, new_mode));
kgem_reset(kgem);
}
assert(kgem->nbatch == 0);
assert(kgem->nreloc == 0);
assert(kgem->nexec == 0);
kgem->ring = new_mode;
}

View File

@ -3844,11 +3844,19 @@ gen7_render_context_switch(struct kgem *kgem,
int new_mode)
{
if (kgem->nbatch) {
DBG(("%s: switch rings %d -> %d\n",
__FUNCTION__, kgem->mode, new_mode));
DBG(("%s: from %d to %d, submit batch\n", __FUNCTION__, kgem->mode, new_mode));
_kgem_submit(kgem);
}
if (kgem->nexec) {
DBG(("%s: from %d to %d, reset incomplete batch\n", __FUNCTION__, kgem->mode, new_mode));
kgem_reset(kgem);
}
assert(kgem->nbatch == 0);
assert(kgem->nreloc == 0);
assert(kgem->nexec == 0);
kgem->ring = new_mode;
}