summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-04-10 16:46:46 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2016-04-10 16:46:46 +0100
commita7526ea2e038f1f1bb92869f584d2fe4c8db1dce (patch)
treed5e8973bf4d50037b734ce7b025c9a7f1c3cee15
parentb6917eced7b2a96ec2432eac924a526e94371643 (diff)
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>
-rw-r--r--src/sna/sna_display.c6
-rw-r--r--src/sna/sna_present.c13
2 files changed, 14 insertions, 5 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index dd1466c2..ff80a4e3 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -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);
diff --git a/src/sna/sna_present.c b/src/sna/sna_present.c
index eca09e60..96d42e3d 100644
--- a/src/sna/sna_present.c
+++ b/src/sna/sna_present.c
@@ -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