From 33f6f753788398efdf20cde4aa0b4ca402eee8fe Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 29 Sep 2012 16:41:00 +0100 Subject: [PATCH] sna/dri: Swallow error from GetMSC Just ignore the error return from WaitVBlank and make up a value for last MSC/SBC similar to an unattached Drawable. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55395 Signed-off-by: Chris Wilson --- src/sna/sna_dri.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c index 676636a1..286f9a36 100644 --- a/src/sna/sna_dri.c +++ b/src/sna/sna_dri.c @@ -2065,30 +2065,29 @@ sna_dri_get_msc(DrawablePtr draw, CARD64 *ust, CARD64 *msc) { struct sna *sna = to_sna_from_drawable(draw); drmVBlank vbl; - int pipe = sna_dri_get_pipe(draw); + int pipe; DBG(("%s(pipe=%d)\n", __FUNCTION__, pipe)); + *ust = *msc = 0; /* Drawable not displayed, make up a value */ - if (pipe == -1) { - *ust = 0; - *msc = 0; + pipe = sna_dri_get_pipe(draw); + if (pipe == -1) return TRUE; - } VG_CLEAR(vbl); vbl.request.type = DRM_VBLANK_RELATIVE | pipe_select(pipe); vbl.request.sequence = 0; - if (sna_wait_vblank(sna, &vbl)) { + if (sna_wait_vblank(sna, &vbl) == 0) { + *ust = ((CARD64)vbl.reply.tval_sec * 1000000) + vbl.reply.tval_usec; + *msc = vbl.reply.sequence; + DBG(("%s: msc=%llu, ust=%llu\n", __FUNCTION__, + (long long)*msc, (long long)*ust)); + } else { DBG(("%s: query failed on pipe %d, ret=%d\n", __FUNCTION__, pipe, errno)); - return FALSE; } - *ust = ((CARD64)vbl.reply.tval_sec * 1000000) + vbl.reply.tval_usec; - *msc = vbl.reply.sequence; - DBG(("%s: msc=%llu, ust=%llu\n", __FUNCTION__, - (long long)*msc, (long long)*ust)); return TRUE; }