sna: Prevent recursion during last-gasp disabling of outputs

If we fail an execbuffer, we disable outputs and try again. (In case we
have severe fragmentation issues and need to rearrange the scanouts in
GTT.) Afterwards we re-enable the outputs, but this causes us to flush
the pending rendering and so recurse into the execbuffer. Prevent this
with a slight hack during enabling of outputs.

References: https://bugs.freedesktop.org/show_bug.cgi?id=85058
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2014-10-15 16:51:42 +01:00
parent 49cf2803d3
commit 9a5ca59d2b
2 changed files with 8 additions and 2 deletions

View File

@ -3088,6 +3088,7 @@ out_4096:
}
if (!__kgem_busy(kgem, bo->handle)) {
assert(RQ(bo->rq)->bo == bo);
__kgem_retire_rq(kgem, RQ(bo->rq));
goto out_4096;
}
@ -3233,6 +3234,7 @@ retry:
ret = do_ioctl(kgem->fd,
DRM_IOCTL_I915_GEM_EXECBUFFER2,
execbuf);
DBG(("%s: last_gasp ret=%d\n", __FUNCTION__, ret));
sna_mode_enable(container_of(kgem, struct sna, kgem));
}
errno = err;
@ -3273,11 +3275,13 @@ void _kgem_submit(struct kgem *kgem)
__kgem_batch_debug(kgem, batch_end);
#endif
rq = kgem->next_request;
if (kgem->surface != kgem->batch_size)
size = compact_batch_surface(kgem);
else
size = kgem->nbatch * sizeof(kgem->batch[0]);
rq = kgem->next_request;
assert(rq->bo == NULL);
rq->bo = kgem_create_batch(kgem, size);
if (rq->bo) {
uint32_t handle = rq->bo->handle;

View File

@ -2260,7 +2260,9 @@ retry: /* Attach per-crtc pixmap or direct */
goto error;
}
kgem_bo_submit(&sna->kgem, bo);
/* Prevent recursion when enabling outputs during execbuffer */
if (bo->exec && RQ(bo->rq)->bo == NULL)
_kgem_submit(&sna->kgem);
sna_crtc->bo = bo;
if (!sna_crtc_apply(crtc)) {