sna/present: Prevent recursion when handling TearFree waits

When draining the flipqueue for TearFree, we may recurse from the vblank
handlers. Avoid this by delaying the Present vblank until next frame.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2016-04-10 16:46:46 +01:00
parent b6917eced7
commit a7526ea2e0
2 changed files with 14 additions and 5 deletions

View File

@ -1483,8 +1483,10 @@ static bool wait_for_shadow(struct sna *sna,
int flip_active;
bool ret = true;
DBG(("%s: flags=%x, flips=%d, handle=%d, shadow=%d\n",
__FUNCTION__, flags, sna->mode.flip_active,
DBG(("%s: enabled? %d waiting? %d, flags=%x, flips=%d, pixmap=%ld [front?=%d], handle=%d, shadow=%d\n",
__FUNCTION__, sna->mode.shadow_enabled, sna->mode.shadow_wait,
flags, sna->mode.flip_active,
pixmap->drawable.serialNumber, pixmap == sna->front,
priv->gpu_bo->handle, sna->mode.shadow->handle));
assert(priv->move_to_gpu_data == sna);

View File

@ -376,6 +376,7 @@ void
sna_present_vblank_handler(struct drm_event_vblank *event)
{
struct sna_present_event *info = to_present_event(event->user_data);
uint64_t msc;
if (!info->queued) {
DBG(("%s: arrived unexpectedly early (not queued)\n", __FUNCTION__));
@ -389,9 +390,15 @@ sna_present_vblank_handler(struct drm_event_vblank *event)
sna_crtc_clear_vblank(info->crtc);
}
vblank_complete(info,
ust64(event->tv_sec, event->tv_usec),
sna_crtc_record_event(info->crtc, event));
msc = sna_crtc_record_event(info->crtc, event);
if (info->sna->mode.shadow_wait) {
DBG(("%s: recursed from TearFree\n", __FUNCTION__));
if (sna_present_queue(info, msc + 1))
return;
}
vblank_complete(info, ust64(event->tv_sec, event->tv_usec), msc);
}
static int