summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Kleiner <mario.kleiner.de@gmail.com>2014-12-05 08:42:30 +0100
committerEmil Velikov <emil.l.velikov@gmail.com>2014-12-14 15:26:35 +0000
commit0af41beaf708b7972459d659550da0ccff59c524 (patch)
tree3cacf6ef7b94cdd37f79901e0961f13d7471e3f5
parentc085fcd2f271ee4f22cb8659722141f9c8efecab (diff)
glx/dri3: Track separate (ust, msc) for PresentPixmap vs. PresentNotifyMsc (v2)
Prevent calls to glXGetSyncValuesOML() and glXWaitForMscOML() from overwriting the (ust,msc) values of the last successfull swapbuffers call (PresentPixmapCompleteNotify event), as glXWaitForSbcOML() relies on those values corresponding to the most recent completed swap, not to whatever was last returned from the server. Problematic call sequence without this patch would have been, e.g., glXSwapBuffers() ... wait ... swap completes -> PresentPixmapComplete event -> (ust,msc) updated to reflect swap completion time and count. ... wait for at least 1 video refresh cycle/vblank increment. glXGetSyncValuesOML() -> PresentNotifyMsc event overwrites (ust,msc) of swap completion with (ust,msc) of most recent vblank glXWaitForSbcOML() -> Returns sbc of last completed swap but (ust,msc) of last completed vblank, not of last completed swap. -> Client is confused. Do this by tracking a separate set of (ust, msc) for the dri3_wait_for_msc() call than for the dri3_wait_for_sbc() call. This makes the glXWaitForSbcOML() call robust again and restores consistent behaviour with the DRI2 implementation. Fixes applications originally written and tested against DRI2 which also rely on this not regressing under DRI3/Present, e.g., Neuro-Science software like Psychtoolbox-3. This patch fixes the problem. v2: Rename vblank_msc/ust to notify_msc/ust as suggested by Axel Davy for better clarity. Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org> Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Reviewed-by: Axel Davy <axel.davy@ens.fr> (cherry picked from commit ad8b0e8bf68850a57daba0b47629ca14807ea3ad) Conflicts: src/glx/dri3_glx.c
-rw-r--r--src/glx/dri3_glx.c11
-rw-r--r--src/glx/dri3_priv.h5
2 files changed, 11 insertions, 5 deletions
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index a150ac2e8ae..5844f32a999 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -392,11 +392,14 @@ dri3_handle_present_event(struct dri3_drawable *priv, xcb_present_generic_event_
break;
}
dri3_update_num_back(priv);
+
+ priv->ust = ce->ust;
+ priv->msc = ce->msc;
} else {
priv->recv_msc_serial = ce->serial;
+ priv->notify_ust = ce->ust;
+ priv->notify_msc = ce->msc;
}
- priv->ust = ce->ust;
- priv->msc = ce->msc;
break;
}
case XCB_PRESENT_EVENT_IDLE_NOTIFY: {
@@ -470,8 +473,8 @@ dri3_wait_for_msc(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
}
}
- *ust = priv->ust;
- *msc = priv->msc;
+ *ust = priv->notify_ust;
+ *msc = priv->notify_msc;
*sbc = priv->recv_sbc;
return 1;
diff --git a/src/glx/dri3_priv.h b/src/glx/dri3_priv.h
index c0e35ee4bbf..74a05204ada 100644
--- a/src/glx/dri3_priv.h
+++ b/src/glx/dri3_priv.h
@@ -178,9 +178,12 @@ struct dri3_drawable {
uint64_t send_sbc;
uint64_t recv_sbc;
- /* Last received UST/MSC values */
+ /* Last received UST/MSC values for pixmap present complete */
uint64_t ust, msc;
+ /* Last received UST/MSC values from present notify msc event */
+ uint64_t notify_ust, notify_msc;
+
/* Serial numbers for tracking wait_for_msc events */
uint32_t send_msc_serial;
uint32_t recv_msc_serial;