}
#endif
-#ifdef X_DRI2WaitMSC
-static void
-load_msc_req(xDRI2WaitMSCReq *req, CARD64 target, CARD64 divisor,
- CARD64 remainder)
-{
- req->target_msc_hi = target >> 32;
- req->target_msc_lo = target & 0xffffffff;
- req->divisor_hi = divisor >> 32;
- req->divisor_lo = divisor & 0xffffffff;
- req->remainder_hi = remainder >> 32;
- req->remainder_lo = remainder & 0xffffffff;
-}
-
-Bool DRI2WaitMSC(Display *dpy, XID drawable, CARD64 target_msc, CARD64 divisor,
- CARD64 remainder, CARD64 *ust, CARD64 *msc, CARD64 *sbc)
-{
- XExtDisplayInfo *info = DRI2FindDisplay(dpy);
- xDRI2WaitMSCReq *req;
- xDRI2MSCReply rep;
-
- XextCheckExtension (dpy, info, dri2ExtensionName, False);
-
- LockDisplay(dpy);
- GetReq(DRI2WaitMSC, req);
- req->reqType = info->codes->major_opcode;
- req->dri2ReqType = X_DRI2WaitMSC;
- req->drawable = drawable;
- load_msc_req(req, target_msc, divisor, remainder);
-
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
-
- *ust = ((CARD64)rep.ust_hi << 32) | (CARD64)rep.ust_lo;
- *msc = ((CARD64)rep.msc_hi << 32) | (CARD64)rep.msc_lo;
- *sbc = ((CARD64)rep.sbc_hi << 32) | (CARD64)rep.sbc_lo;
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return True;
-}
-#endif
-
#ifdef X_DRI2SwapInterval
void DRI2SwapInterval(Display *dpy, XID drawable, int interval)
{
extern Bool
DRI2GetMSC(Display *dpy, XID drawable, CARD64 *ust, CARD64 *msc, CARD64 *sbc);
-extern Bool
-DRI2WaitMSC(Display *dpy, XID drawable, CARD64 target_msc, CARD64 divisor,
- CARD64 remainder, CARD64 *ust, CARD64 *msc, CARD64 *sbc);
-
extern void
DRI2SwapInterval(Display *dpy, XID drawable, int interval);
#endif
-
-#ifdef X_DRI2WaitMSC
-
static int
dri2WaitForMSC(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc)
{
- CARD64 dri2_ust, dri2_msc, dri2_sbc;
- int ret;
-
- ret = DRI2WaitMSC(pdraw->psc->dpy, pdraw->xDrawable, target_msc, divisor,
- remainder, &dri2_ust, &dri2_msc, &dri2_sbc);
- *ust = dri2_ust;
- *msc = dri2_msc;
- *sbc = dri2_sbc;
+ xcb_connection_t *c = XGetXCBConnection(pdraw->psc->dpy);
+ xcb_dri2_wait_msc_cookie_t wait_msc_cookie;
+ xcb_dri2_wait_msc_reply_t *wait_msc_reply;
+ uint32_t target_msc_hi, target_msc_lo;
+ uint32_t divisor_hi, divisor_lo;
+ uint32_t remainder_hi, remainder_lo;
+
+ split_counter(target_msc, &target_msc_hi, &target_msc_lo);
+ split_counter(divisor, &divisor_hi, &divisor_lo);
+ split_counter(remainder, &remainder_hi, &remainder_lo);
+
+ wait_msc_cookie = xcb_dri2_wait_msc_unchecked(c, pdraw->xDrawable,
+ target_msc_hi, target_msc_lo,
+ divisor_hi, divisor_lo,
+ remainder_hi, remainder_lo);
+ wait_msc_reply = xcb_dri2_wait_msc_reply(c, wait_msc_cookie, NULL);
+ *ust = merge_counter(wait_msc_reply->ust_hi, wait_msc_reply->ust_lo);
+ *msc = merge_counter(wait_msc_reply->msc_hi, wait_msc_reply->msc_lo);
+ *sbc = merge_counter(wait_msc_reply->sbc_hi, wait_msc_reply->sbc_lo);
+ free(wait_msc_reply);
- return ret;
+ return 0;
}
static int
return 0;
}
-#endif /* X_DRI2WaitMSC */
-
/**
* dri2Throttle - Request driver throttling
*
#ifdef X_DRI2GetMSC
psp->getDrawableMSC = dri2DrawableGetMSC;
#endif
-#ifdef X_DRI2WaitMSC
psp->waitForMSC = dri2WaitForMSC;
-#endif
psp->waitForSBC = dri2WaitForSBC;
#ifdef X_DRI2SwapInterval
psp->setSwapInterval = dri2SetSwapInterval;