aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/present/present.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-11-21 08:43:25 +0100
committermarha <marha@users.sourceforge.net>2013-11-21 08:43:25 +0100
commitbb953a87489963f63e65c797a1f2837382ff7808 (patch)
tree458f44ffc1539fad170d96a414970a42b75d1190 /xorg-server/present/present.c
parent73db05c85f7a8cf2439f7c333ede6ff2dc4877d7 (diff)
downloadvcxsrv-bb953a87489963f63e65c797a1f2837382ff7808.tar.gz
vcxsrv-bb953a87489963f63e65c797a1f2837382ff7808.tar.bz2
vcxsrv-bb953a87489963f63e65c797a1f2837382ff7808.zip
xserver mesa git update 21 nov 2013
xserver commit 6403cbb143c67872ca9c58e3116ae7942def0ae1 mesa commit b7c0b61782251c1dedb0b0fb0e6654af81249910
Diffstat (limited to 'xorg-server/present/present.c')
-rw-r--r--xorg-server/present/present.c52
1 files changed, 43 insertions, 9 deletions
diff --git a/xorg-server/present/present.c b/xorg-server/present/present.c
index 228d43a20..f9eef6b26 100644
--- a/xorg-server/present/present.c
+++ b/xorg-server/present/present.c
@@ -171,7 +171,8 @@ present_vblank_notify(present_vblank_ptr vblank, CARD8 kind, CARD8 mode, uint64_
{
int n;
- present_send_complete_notify(vblank->window, kind, mode, vblank->serial, ust, crtc_msc - vblank->msc_offset);
+ if (vblank->window)
+ present_send_complete_notify(vblank->window, kind, mode, vblank->serial, ust, crtc_msc - vblank->msc_offset);
for (n = 0; n < vblank->num_notifies; n++) {
WindowPtr window = vblank->notifies[n].window;
CARD32 serial = vblank->notifies[n].serial;
@@ -320,8 +321,8 @@ present_unflip(ScreenPtr screen)
/* Update the screen pixmap with the current flip pixmap contents
*/
- if (screen_priv->flip_pixmap) {
- present_copy_region(&screen->GetScreenPixmap(screen)->drawable,
+ if (screen_priv->flip_pixmap && screen_priv->flip_window) {
+ present_copy_region(&screen_priv->flip_window->drawable,
screen_priv->flip_pixmap,
NULL, 0, 0);
}
@@ -336,8 +337,7 @@ present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc);
static void
present_flip_notify(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
{
- WindowPtr window = vblank->window;
- ScreenPtr screen = window->drawable.pScreen;
+ ScreenPtr screen = vblank->screen;
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
DebugPresent(("\tn %p %8lld: %08lx -> %08lx\n", vblank, vblank->target_msc,
@@ -363,8 +363,7 @@ present_flip_notify(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
if (vblank->abort_flip)
present_unflip(screen);
- if (!vblank->window_destroyed)
- present_vblank_notify(vblank, PresentCompleteKindPixmap, PresentCompleteModeFlip, ust, crtc_msc);
+ present_vblank_notify(vblank, PresentCompleteKindPixmap, PresentCompleteModeFlip, ust, crtc_msc);
present_vblank_destroy(vblank);
}
@@ -374,6 +373,8 @@ present_event_notify(uint64_t event_id, uint64_t ust, uint64_t msc)
present_vblank_ptr vblank, tmp;
int s;
+ if (!event_id)
+ return;
DebugPresent(("\te %lld ust %lld msc %lld\n", event_id, ust, msc));
xorg_list_for_each_entry_safe(vblank, tmp, &present_exec_queue, event_queue) {
if (vblank->event_id == event_id) {
@@ -398,6 +399,7 @@ present_event_notify(uint64_t event_id, uint64_t ust, uint64_t msc)
DebugPresent(("\tun %lld\n", event_id));
screen_priv->unflip_event_id = 0;
present_flip_idle(screen);
+ return;
}
}
}
@@ -451,6 +453,26 @@ present_check_flip_window (WindowPtr window)
}
/*
+ * Called when the wait fence is triggered; just gets the current msc/ust and
+ * calls present_execute again. That will re-check the fence and pend the
+ * request again if it's still not actually ready
+ */
+static void
+present_wait_fence_triggered(void *param)
+{
+ present_vblank_ptr vblank = param;
+ WindowPtr window = vblank->window;
+ uint64_t ust = 0, crtc_msc = 0;
+
+ if (window) {
+ present_window_priv_ptr window_priv = present_get_window_priv(window, TRUE);
+ if (window_priv)
+ (void) present_get_ust_msc(window, window_priv->crtc, &ust, &crtc_msc);
+ }
+ present_execute(vblank, ust, crtc_msc);
+}
+
+/*
* Once the required MSC has been reached, execute the pending request.
*
* For requests to actually present something, either blt contents to
@@ -467,11 +489,14 @@ present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
present_screen_priv_ptr screen_priv = present_screen_priv(window->drawable.pScreen);
if (vblank->wait_fence) {
- /* XXX check fence, queue if not ready */
+ if (!present_fence_check_triggered(vblank->wait_fence)) {
+ present_fence_set_callback(vblank->wait_fence, present_wait_fence_triggered, vblank);
+ return;
+ }
}
xorg_list_del(&vblank->event_queue);
- if (vblank->pixmap) {
+ if (vblank->pixmap && vblank->window) {
if (vblank->flip && screen_priv->flip_pending == NULL && !screen_priv->unflip_event_id) {
@@ -652,6 +677,12 @@ present_pixmap(WindowPtr window,
target_msc--;
}
+ if (wait_fence) {
+ vblank->wait_fence = present_fence_create(wait_fence);
+ if (!vblank->wait_fence)
+ goto no_mem;
+ }
+
if (idle_fence) {
vblank->idle_fence = present_fence_create(idle_fence);
if (!vblank->idle_fence)
@@ -762,6 +793,9 @@ present_vblank_destroy(present_vblank_ptr vblank)
if (vblank->update)
RegionDestroy(vblank->update);
+ if (vblank->wait_fence)
+ present_fence_destroy(vblank->wait_fence);
+
if (vblank->idle_fence)
present_fence_destroy(vblank->idle_fence);