Because of the 2nd patch in my patch series, (see below) we have to make sure that my additions to struct _DRI2Drawable and the init code in DRI2CreateDrawable for last_swap_msc and last_swap_ust don't get lost due to your "make target_sbc signed" patches. Other than that, stuff seems to fit together.

Anyway, no hurry. Just drop me a line when you're ready. I'll pull from you and recheck, once you think all our patches fit together again.

-mario

---
 hw/xfree86/dri2/dri2.c |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index baf0df8..7f40d28 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -64,6 +64,8 @@ typedef struct _DRI2Drawable {
     CARD64              swap_count;
     CARD64              target_sbc; /* -1 means no SBC wait outstanding */
     CARD64              last_swap_target; /* most recently queued swap target 
*/
+    CARD64              last_swap_msc; /* msc at completion of most recent 
swap */
+    CARD64              last_swap_ust; /* ust at completion of most recent 
swap */
     int                         swap_limit; /* for N-buffering */
 } DRI2DrawableRec, *DRI2DrawablePtr;

@@ -142,6 +144,8 @@ DRI2CreateDrawable(DrawablePtr pDraw)
     pPriv->swap_interval = 1;
     pPriv->last_swap_target = -1;
     pPriv->swap_limit = 1; /* default to double buffering */
+    pPriv->last_swap_msc = 0;
+    pPriv->last_swap_ust = 0;

     if (pDraw->type == DRAWABLE_WINDOW)
     {
@@ -518,6 +522,9 @@ DRI2SwapComplete(ClientPtr client, DrawablePtr pDraw, int frame,
     if (swap_complete)
swap_complete(client, swap_data, type, ust, frame, pPriv- >swap_count);

+    pPriv->last_swap_msc = frame;
+    pPriv->last_swap_ust = ust;
+
     DRI2WakeClient(client, pDraw, frame, tv_sec, tv_usec);
 }

@@ -714,8 +721,22 @@ DRI2WaitSBC(ClientPtr client, DrawablePtr pDraw, CARD64 target_sbc,
     if (pPriv == NULL)
        return BadDrawable;

-    if (pPriv->swap_count >= target_sbc)
-       return Success;
+    /* target_sbc == 0 means to block until all pending swaps are
+     * finished. Recalculate target_sbc to get that behaviour.
+     */
+    if (target_sbc == 0)
+        target_sbc = pPriv->swap_count + pPriv->swapsPending;
+
+    /* If current swap count already >= target_sbc,
+     * return immediately with (ust, msc, sbc) triplet of
+     * most recent completed swap.
+     */
+    if (pPriv->swap_count >= target_sbc) {
+        *sbc = pPriv->swap_count;
+        *msc = pPriv->last_swap_msc;
+        *ust = pPriv->last_swap_ust;
+        return Success;
+    }

     pPriv->target_sbc = target_sbc;
     DRI2BlockClient(client, pDraw);
--
1.6.6




_______________________________________________
xorg-devel mailing list
[email protected]
http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to