glx: Replace DRI2GetMSC custom protocol with XCB.
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
This commit is contained in:
@@ -585,39 +585,6 @@ void DRI2SwapBuffers(Display *dpy, XID drawable, CARD64 target_msc,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef X_DRI2GetMSC
|
|
||||||
Bool DRI2GetMSC(Display *dpy, XID drawable, CARD64 *ust, CARD64 *msc,
|
|
||||||
CARD64 *sbc)
|
|
||||||
{
|
|
||||||
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
|
|
||||||
xDRI2GetMSCReq *req;
|
|
||||||
xDRI2MSCReply rep;
|
|
||||||
|
|
||||||
XextCheckExtension (dpy, info, dri2ExtensionName, False);
|
|
||||||
|
|
||||||
LockDisplay(dpy);
|
|
||||||
GetReq(DRI2GetMSC, req);
|
|
||||||
req->reqType = info->codes->major_opcode;
|
|
||||||
req->dri2ReqType = X_DRI2GetMSC;
|
|
||||||
req->drawable = drawable;
|
|
||||||
|
|
||||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
|
||||||
UnlockDisplay(dpy);
|
|
||||||
SyncHandle();
|
|
||||||
return False;
|
|
||||||
}
|
|
||||||
|
|
||||||
*ust = vals_to_card64(rep.ust_lo, rep.ust_hi);
|
|
||||||
*msc = vals_to_card64(rep.msc_lo, rep.msc_hi);
|
|
||||||
*sbc = vals_to_card64(rep.sbc_lo, rep.sbc_hi);
|
|
||||||
|
|
||||||
UnlockDisplay(dpy);
|
|
||||||
SyncHandle();
|
|
||||||
|
|
||||||
return True;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef X_DRI2SwapInterval
|
#ifdef X_DRI2SwapInterval
|
||||||
void DRI2SwapInterval(Display *dpy, XID drawable, int interval)
|
void DRI2SwapInterval(Display *dpy, XID drawable, int interval)
|
||||||
{
|
{
|
||||||
|
@@ -89,9 +89,6 @@ extern void
|
|||||||
DRI2SwapBuffers(Display *dpy, XID drawable, CARD64 target_msc, CARD64 divisor,
|
DRI2SwapBuffers(Display *dpy, XID drawable, CARD64 target_msc, CARD64 divisor,
|
||||||
CARD64 remainder, CARD64 *count);
|
CARD64 remainder, CARD64 *count);
|
||||||
|
|
||||||
extern Bool
|
|
||||||
DRI2GetMSC(Display *dpy, XID drawable, CARD64 *ust, CARD64 *msc, CARD64 *sbc);
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
DRI2SwapInterval(Display *dpy, XID drawable, int interval);
|
DRI2SwapInterval(Display *dpy, XID drawable, int interval);
|
||||||
|
|
||||||
|
@@ -432,26 +432,24 @@ dri2CreateDrawable(struct glx_screen *base, XID xDrawable,
|
|||||||
return &pdraw->base;
|
return &pdraw->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef X_DRI2GetMSC
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
dri2DrawableGetMSC(struct glx_screen *psc, __GLXDRIdrawable *pdraw,
|
dri2DrawableGetMSC(struct glx_screen *psc, __GLXDRIdrawable *pdraw,
|
||||||
int64_t *ust, int64_t *msc, int64_t *sbc)
|
int64_t *ust, int64_t *msc, int64_t *sbc)
|
||||||
{
|
{
|
||||||
CARD64 dri2_ust, dri2_msc, dri2_sbc;
|
xcb_connection_t *c = XGetXCBConnection(pdraw->psc->dpy);
|
||||||
int ret;
|
xcb_dri2_get_msc_cookie_t get_msc_cookie;
|
||||||
|
xcb_dri2_get_msc_reply_t *get_msc_reply;
|
||||||
|
|
||||||
ret = DRI2GetMSC(psc->dpy, pdraw->xDrawable,
|
get_msc_cookie = xcb_dri2_get_msc_unchecked(c, pdraw->xDrawable);
|
||||||
&dri2_ust, &dri2_msc, &dri2_sbc);
|
get_msc_reply = xcb_dri2_get_msc_reply(c, get_msc_cookie, NULL);
|
||||||
*ust = dri2_ust;
|
*ust = merge_counter(get_msc_reply->ust_hi, get_msc_reply->ust_lo);
|
||||||
*msc = dri2_msc;
|
*msc = merge_counter(get_msc_reply->msc_hi, get_msc_reply->msc_lo);
|
||||||
*sbc = dri2_sbc;
|
*sbc = merge_counter(get_msc_reply->sbc_hi, get_msc_reply->sbc_lo);
|
||||||
|
free(get_msc_reply);
|
||||||
|
|
||||||
return ret;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
dri2WaitForMSC(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
|
dri2WaitForMSC(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
|
||||||
int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc)
|
int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc)
|
||||||
@@ -1147,18 +1145,14 @@ dri2CreateScreen(int screen, struct glx_display * priv)
|
|||||||
psp->getSwapInterval = NULL;
|
psp->getSwapInterval = NULL;
|
||||||
|
|
||||||
if (pdp->driMinor >= 2) {
|
if (pdp->driMinor >= 2) {
|
||||||
#ifdef X_DRI2GetMSC
|
|
||||||
psp->getDrawableMSC = dri2DrawableGetMSC;
|
psp->getDrawableMSC = dri2DrawableGetMSC;
|
||||||
#endif
|
|
||||||
psp->waitForMSC = dri2WaitForMSC;
|
psp->waitForMSC = dri2WaitForMSC;
|
||||||
psp->waitForSBC = dri2WaitForSBC;
|
psp->waitForSBC = dri2WaitForSBC;
|
||||||
#ifdef X_DRI2SwapInterval
|
#ifdef X_DRI2SwapInterval
|
||||||
psp->setSwapInterval = dri2SetSwapInterval;
|
psp->setSwapInterval = dri2SetSwapInterval;
|
||||||
psp->getSwapInterval = dri2GetSwapInterval;
|
psp->getSwapInterval = dri2GetSwapInterval;
|
||||||
#endif
|
#endif
|
||||||
#if defined(X_DRI2GetMSC) && defined(X_DRI2WaitMSC) && defined(X_DRI2SwapInterval)
|
|
||||||
__glXEnableDirectExtension(&psc->base, "GLX_OML_sync_control");
|
__glXEnableDirectExtension(&psc->base, "GLX_OML_sync_control");
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DRI2 suports SubBuffer through DRI2CopyRegion, so it's always
|
/* DRI2 suports SubBuffer through DRI2CopyRegion, so it's always
|
||||||
|
Reference in New Issue
Block a user