sna: Avoid recursion by testing shadow.wait

References: https://bugs.freedesktop.org/show_bug.cgi?id=96695
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2016-06-28 12:26:55 +01:00
parent cac7c8dc4b
commit bc369bbf4a
2 changed files with 6 additions and 9 deletions

View File

@ -1538,12 +1538,12 @@ static bool wait_for_shadow(struct sna *sna,
assert(priv->move_to_gpu_data == sna);
assert(sna->mode.shadow != priv->gpu_bo);
if (flags == 0 || pixmap != sna->front)
if (flags == 0 || pixmap != sna->front || !sna->mode.shadow_enabled)
goto done;
if (!sna->mode.shadow_enabled)
return ret;
assert(sna->mode.shadow_damage);
if (sna->mode.shadow_wait)
return ret;
if ((flags & MOVE_WRITE) == 0) {
if ((flags & __MOVE_SCANOUT) == 0) {
@ -1586,7 +1586,6 @@ static bool wait_for_shadow(struct sna *sna,
assert(sna->mode.shadow_active);
sna->mode.shadow_wait = true;
sna->mode.shadow_enabled = false;
flip_active = sna->mode.flip_active;
if (flip_active) {
@ -1638,10 +1637,8 @@ static bool wait_for_shadow(struct sna *sna,
bo = sna->mode.shadow;
}
}
assert(!sna->mode.shadow_enabled);
assert(sna->mode.shadow_wait);
sna->mode.shadow_wait = false;
sna->mode.shadow_enabled = true;
if (bo->refcnt > 1) {
bo = kgem_create_2d(&sna->kgem,

View File

@ -2513,7 +2513,7 @@ static void chain_swap(struct sna_dri2_event *chain)
switch (chain->type) {
case SWAP_COMPLETE:
DBG(("%s: emitting chained vsync'ed blit\n", __FUNCTION__));
if (chain->sna->mode.shadow && chain->sna->mode.shadow_wait) {
if (chain->sna->mode.shadow_wait) {
/* recursed from wait_for_shadow(), simply requeue */
DBG(("%s -- recursed from wait_for_shadow(), requeuing\n", __FUNCTION__));
if (sna_next_vblank(chain))
@ -2608,7 +2608,7 @@ void sna_dri2_vblank_handler(struct drm_event_vblank *event)
/* else fall through to blit */
case SWAP:
assert(info->signal);
if (sna->mode.shadow && sna->mode.shadow_wait) {
if (sna->mode.shadow_wait) {
/* recursed from wait_for_shadow(), simply requeue */
DBG(("%s -- recursed from wait_for_shadow(), requeuing\n", __FUNCTION__));
} else if (can_xchg(info->sna, draw, info->front, info->back)) {
@ -2654,7 +2654,7 @@ void sna_dri2_vblank_handler(struct drm_event_vblank *event)
info->pending.bo->handle, info->pending.name, info->pending.bo->active_scanout,
get_private(info->front)->bo->handle, info->front->name, get_private(info->front)->bo->active_scanout));
if (sna->mode.shadow && sna->mode.shadow_wait) {
if (sna->mode.shadow_wait) {
/* recursed from wait_for_shadow(), simply requeue */
DBG(("%s -- recursed from wait_for_shadow(), requeuing\n", __FUNCTION__));
if (sna_next_vblank(info))