diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/glx/dri2.c | 46 | ||||
-rw-r--r-- | src/glx/dri2.h | 4 | ||||
-rw-r--r-- | src/glx/dri2_glx.c | 37 |
3 files changed, 21 insertions, 66 deletions
diff --git a/src/glx/dri2.c b/src/glx/dri2.c index 21b9c21a85c..96c2ae87aed 100644 --- a/src/glx/dri2.c +++ b/src/glx/dri2.c @@ -618,52 +618,6 @@ Bool DRI2GetMSC(Display *dpy, XID drawable, CARD64 *ust, CARD64 *msc, } #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) { diff --git a/src/glx/dri2.h b/src/glx/dri2.h index bfd9910f792..fe7c24e40ac 100644 --- a/src/glx/dri2.h +++ b/src/glx/dri2.h @@ -92,10 +92,6 @@ DRI2SwapBuffers(Display *dpy, XID drawable, CARD64 target_msc, CARD64 divisor, 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); diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 1cfa275c27a..60dc0354ca5 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -452,23 +452,32 @@ dri2DrawableGetMSC(struct glx_screen *psc, __GLXDRIdrawable *pdraw, #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 @@ -493,8 +502,6 @@ dri2WaitForSBC(__GLXDRIdrawable *pdraw, int64_t target_sbc, int64_t *ust, return 0; } -#endif /* X_DRI2WaitMSC */ - /** * dri2Throttle - Request driver throttling * @@ -1143,9 +1150,7 @@ dri2CreateScreen(int screen, struct glx_display * priv) #ifdef X_DRI2GetMSC psp->getDrawableMSC = dri2DrawableGetMSC; #endif -#ifdef X_DRI2WaitMSC psp->waitForMSC = dri2WaitForMSC; -#endif psp->waitForSBC = dri2WaitForSBC; #ifdef X_DRI2SwapInterval psp->setSwapInterval = dri2SetSwapInterval; |