[PATCH 3/3] present: When composited, get the bits into the window pixmap immediately
Keith Packard
keithp at keithp.com
Sat Dec 13 00:32:31 PST 2014
When a window is composited, we want to notify the compositing manager
of the new contents *before* the next frame, so that it can prepare
them for display at the next frame, instead of doing the copy at that
frame time, and notifying the compositor so that it would always be a
frame behind.
This change catches the common case of a operation destined for the
next frame and immediately performs the copy, leaving the queue entry
around so that the PresentComplete event can be delivered at the
target frame time. This should give applications the right answer if
the Compositor is able to get the frame constructed before that frame
happens, which is at least better than the current situation where the
client receives the PresentComplete notify at the target frame, but
the contents will not be displayed until a subsequent frame.
Signed-off-by: Keith Packard <keithp at keithp.com>
---
present/present.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/present/present.c b/present/present.c
index 06def61..4fce161 100644
--- a/present/present.c
+++ b/present/present.c
@@ -894,6 +894,23 @@ present_pixmap(WindowPtr window,
xorg_list_del(&vblank->event_queue);
vblank->queued = FALSE;
goto failure;
+ } else {
+
+ /* If the window is composited, and the contents are
+ * destined for the next frame, just do the copy, sending
+ * damage along to the compositor.
+ *
+ * Leave the vblank around to send the completion event at
+ * vblank time
+ */
+ if (pixmap && window && vblank->mode == PresentCompleteModeCopy &&
+ (target_msc - crtc_msc) <= 1 &&
+ screen->GetWindowPixmap(window) != screen->GetScreenPixmap(screen))
+ {
+ DebugPresent(("\tC %p %8lld: %08lx -> %08lx\n", vblank, crtc_msc,
+ vblank->pixmap->drawable.id, vblank->window->drawable.id));
+ present_copy(vblank);
+ }
}
} else
present_execute(vblank, ust, crtc_msc);
--
2.1.3
More information about the xorg-devel
mailing list