diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-06-01 08:44:13 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-06-02 08:32:11 +0100 |
commit | c95a4002d1d27937731c59e84254ccb3b1246ccd (patch) | |
tree | 252915e3e71106aed959ea66bf6e829a2d03f4fb /src/sna/sna_dri2.c | |
parent | b1c07c20a371795a8dc4102f83fe542d62d8a4e6 (diff) |
sna/dri2: Hide MSC reported as going backwards
OML_sync_control mandates that MSC must be monotonic, so if the kernel
reports that they go backwards, lie.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_dri2.c')
-rw-r--r-- | src/sna/sna_dri2.c | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c index 117f8795..f6d2fea0 100644 --- a/src/sna/sna_dri2.c +++ b/src/sna/sna_dri2.c @@ -2410,37 +2410,29 @@ static int sna_dri2_get_msc(DrawablePtr draw, CARD64 *ust, CARD64 *msc) { struct sna *sna = to_sna_from_drawable(draw); - union drm_wait_vblank vbl; xf86CrtcPtr crtc = sna_dri2_get_crtc(draw); + const struct ust_msc *swap; DBG(("%s(draw=%ld, pipe=%d)\n", __FUNCTION__, draw->id, crtc ? sna_crtc_to_pipe(crtc) : -1)); - if (crtc == NULL) { - const struct ust_msc *swap; - crtc = sna_mode_first_crtc(sna); -fail: - /* Drawable not displayed, make up a *monotonic* value */ - swap = sna_crtc_last_swap(crtc); - *msc = draw_current_msc(draw, crtc, swap->msc); - *ust = ust64(swap->tv_sec, swap->tv_usec); - return TRUE; - } + if (crtc != NULL) { + union drm_wait_vblank vbl; - VG_CLEAR(vbl); - vbl.request.type = _DRM_VBLANK_RELATIVE; - vbl.request.sequence = 0; - if (sna_wait_vblank(sna, &vbl, sna_crtc_to_pipe(crtc)) == 0) { - *ust = ust64(vbl.reply.tval_sec, vbl.reply.tval_usec); - *msc = draw_current_msc(draw, crtc, sna_crtc_record_vblank(crtc, &vbl)); - 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__, sna_crtc_to_pipe(crtc), errno)); - goto fail; - } + VG_CLEAR(vbl); + vbl.request.type = _DRM_VBLANK_RELATIVE; + vbl.request.sequence = 0; + if (sna_wait_vblank(sna, &vbl, sna_crtc_to_pipe(crtc)) == 0) + sna_crtc_record_vblank(crtc, &vbl); + } else + /* Drawable not displayed, make up a *monotonic* value */ + crtc = sna_mode_first_crtc(sna); + swap = sna_crtc_last_swap(crtc); + *msc = draw_current_msc(draw, crtc, swap->msc); + *ust = ust64(swap->tv_sec, swap->tv_usec); + DBG(("%s: msc=%llu, ust=%llu\n", __FUNCTION__, + (long long)*msc, (long long)*ust)); return TRUE; } |