summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-12-12 23:54:41 -0800
committerKeith Packard <keithp@keithp.com>2014-12-13 00:02:09 -0800
commit562fe0156d0f40e0a59434fc6246e7ea6cb45c3e (patch)
tree87bb4af7dda7ff103140ba061e54db997fb39b2f
parentd9440aa391340fae76b068bac457ab5b198542fe (diff)
present: When composited, get the bits into the window pixmap immediatelypresent-compositor
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@keithp.com>
-rw-r--r--present/present.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/present/present.c b/present/present.c
index 06def61c1..4fce161e1 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);