diff options
author | Eric Anholt <[email protected]> | 2012-09-25 12:01:27 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2012-10-09 14:32:03 -0700 |
commit | 8e61b9028ad4f68c9d68fd781b6f44e1f6a266bd (patch) | |
tree | c34613ec8a07b0041d5d52a11e95ac71d5005393 /src/glx/dri2_glx.c | |
parent | 183ab9e14efed2c5483a472ea8feff31fcf6d2a9 (diff) |
glx: Replace DRI2WaitForMSC custom protocol with XCB.
Reviewed-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/glx/dri2_glx.c')
-rw-r--r-- | src/glx/dri2_glx.c | 37 |
1 files changed, 21 insertions, 16 deletions
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; |