summaryrefslogtreecommitdiff
path: root/present
diff options
context:
space:
mode:
Diffstat (limited to 'present')
-rw-r--r--present/present.c34
-rw-r--r--present/present_event.c2
-rw-r--r--present/present_fence.c29
-rw-r--r--present/present_priv.h15
4 files changed, 76 insertions, 4 deletions
diff --git a/present/present.c b/present/present.c
index 67d7f6eee..16dc3811e 100644
--- a/present/present.c
+++ b/present/present.c
@@ -453,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
@@ -469,7 +489,10 @@ 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);
@@ -654,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)
@@ -764,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);
diff --git a/present/present_event.c b/present/present_event.c
index a30bc8286..a8f7176eb 100644
--- a/present/present_event.c
+++ b/present/present_event.c
@@ -26,8 +26,6 @@
#include "present_priv.h"
-#include "present_priv.h"
-
RESTYPE present_event_type;
static int
diff --git a/present/present_fence.c b/present/present_fence.c
index db5efcaad..e09657d31 100644
--- a/present/present_fence.c
+++ b/present/present_fence.c
@@ -37,6 +37,8 @@
struct present_fence {
SyncTrigger trigger;
SyncFence *fence;
+ void (*callback)(void *param);
+ void *param;
};
/*
@@ -45,12 +47,18 @@ struct present_fence {
static Bool
present_fence_sync_check_trigger(SyncTrigger *trigger, XSyncValue oldval)
{
- return FALSE;
+ struct present_fence *present_fence = container_of(trigger, struct present_fence, trigger);
+
+ return present_fence->callback != NULL;
}
static void
present_fence_sync_trigger_fired(SyncTrigger *trigger)
{
+ struct present_fence *present_fence = container_of(trigger, struct present_fence, trigger);
+
+ if (present_fence->callback)
+ (*present_fence->callback)(present_fence->param);
}
static void
@@ -101,6 +109,25 @@ present_fence_set_triggered(struct present_fence *present_fence)
(*present_fence->fence->funcs.SetTriggered) (present_fence->fence);
}
+Bool
+present_fence_check_triggered(struct present_fence *present_fence)
+{
+ if (!present_fence)
+ return TRUE;
+ if (!present_fence->fence)
+ return TRUE;
+ return (*present_fence->fence->funcs.CheckTriggered)(present_fence->fence);
+}
+
+void
+present_fence_set_callback(struct present_fence *present_fence,
+ void (*callback) (void *param),
+ void *param)
+{
+ present_fence->callback = callback;
+ present_fence->param = param;
+}
+
XID
present_fence_id(struct present_fence *present_fence)
{
diff --git a/present/present_priv.h b/present/present_priv.h
index 40c88dd0b..500c7c265 100644
--- a/present/present_priv.h
+++ b/present/present_priv.h
@@ -249,6 +249,14 @@ present_fence_destroy(struct present_fence *present_fence);
void
present_fence_set_triggered(struct present_fence *present_fence);
+Bool
+present_fence_check_triggered(struct present_fence *present_fence);
+
+void
+present_fence_set_callback(struct present_fence *present_fence,
+ void (*callback)(void *param),
+ void *param);
+
XID
present_fence_id(struct present_fence *present_fence);
@@ -271,6 +279,13 @@ void
present_destroy_notifies(present_notify_ptr notifies, int num_notifies);
/*
+ * present_redirect.c
+ */
+
+WindowPtr
+present_redirect(ClientPtr client, WindowPtr target);
+
+/*
* present_request.c
*/
int