[PATCH 2/4] present: Make window MSC offset 0 initially
Keith Packard
keithp at keithp.com
Thu Jul 24 16:39:19 PDT 2014
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 at keithp.com>
---
present/present.c | 18 +++++++++++-------
present/present_priv.h | 2 ++
present/present_screen.c | 1 +
3 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/present/present.c b/present/present.c
index 3aea0d7..f624e5b 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);
}
diff --git a/present/present_priv.h b/present/present_priv.h
index d8569a2..f5c1652 100644
--- a/present/present_priv.h
+++ b/present/present_priv.h
@@ -134,6 +134,8 @@ typedef struct present_window_priv {
struct xorg_list notifies;
} present_window_priv_rec, *present_window_priv_ptr;
+#define PresentCrtcNeverSet ((RRCrtcPtr) 1)
+
extern DevPrivateKeyRec present_window_private_key;
static inline present_window_priv_ptr
diff --git a/present/present_screen.c b/present/present_screen.c
index 25ef681..2f91ac7 100644
--- a/present/present_screen.c
+++ b/present/present_screen.c
@@ -45,6 +45,7 @@ present_get_window_priv(WindowPtr window, Bool create)
return NULL;
xorg_list_init(&window_priv->vblank);
xorg_list_init(&window_priv->notifies);
+ window_priv->crtc = PresentCrtcNeverSet;
dixSetPrivate(&window->devPrivates, &present_window_private_key, window_priv);
return window_priv;
}
--
2.0.1
More information about the xorg-devel
mailing list