summaryrefslogtreecommitdiff
path: root/present/present.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-07-20 18:53:52 -0700
committerKeith Packard <keithp@keithp.com>2014-07-31 00:03:53 -0700
commit627bce80894647c681b146a709aad4c390b4374e (patch)
treef8a0b6c6372d61d1dc940d6ec9bbfe8d42ed5861 /present/present.c
parentbd4198b01f2baf2284e61ea7ebf4600f554800e9 (diff)
present: Make window MSC offset 0 initially
The MSC offset used by a window is adjusted as the window moves between screens, and between shown/unshown. The value shouldn't matter, but it's helpful for debugging to have window MSC values be the same as the CRTC MSC at first. This patch introduces a unique CRTC value so that Present can detect the first time a window is a PresentPixmap destination and set the MSC offset to zero, rather than using the fake MSC value as the previous window MSC. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'present/present.c')
-rw-r--r--present/present.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/present/present.c b/present/present.c
index 3aea0d7c6..f624e5b7b 100644
--- a/present/present.c
+++ b/present/present.c
@@ -291,14 +291,18 @@ present_window_to_crtc_msc(WindowPtr window, RRCrtcPtr crtc, uint64_t window_msc
if (crtc != window_priv->crtc) {
uint64_t old_ust, old_msc;
- /* The old CRTC may have been turned off, in which case
- * we'll just use whatever previous MSC we'd seen from this CRTC
- */
+ if (window_priv->crtc == PresentCrtcNeverSet) {
+ window_priv->msc_offset = 0;
+ } else {
+ /* The old CRTC may have been turned off, in which case
+ * we'll just use whatever previous MSC we'd seen from this CRTC
+ */
- if (present_get_ust_msc(window->drawable.pScreen, window_priv->crtc, &old_ust, &old_msc) != Success)
- old_msc = window_priv->msc;
+ if (present_get_ust_msc(window->drawable.pScreen, window_priv->crtc, &old_ust, &old_msc) != Success)
+ old_msc = window_priv->msc;
- window_priv->msc_offset += new_msc - old_msc;
+ window_priv->msc_offset += new_msc - old_msc;
+ }
window_priv->crtc = crtc;
}
@@ -725,7 +729,7 @@ present_pixmap(WindowPtr window,
if (!pixmap)
target_crtc = window_priv->crtc;
- if (!target_crtc)
+ if (!target_crtc || target_crtc == PresentCrtcNeverSet)
target_crtc = present_get_crtc(window);
}