From: Francisco J. <cur...@ri...> - 2010-01-16 22:00:29
|
It helps to determine if buffers need to be invalidated or not, and it makes sense for e.g. GLX_OML_swap_control. Note that this patch bumps the DRI2InfoRec version and the minimum required dri2proto version. Signed-off-by: Francisco Jerez <cur...@ri...> --- configure.ac | 2 +- glx/glxdri2.c | 9 +++++---- hw/xfree86/dri2/dri2.c | 10 ++++++---- hw/xfree86/dri2/dri2.h | 7 +++++-- hw/xfree86/dri2/dri2ext.c | 4 ++-- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index 8c1085b..85225ba 100644 --- a/configure.ac +++ b/configure.ac @@ -754,7 +754,7 @@ RECORDPROTO="recordproto >= 1.13.99.1" SCRNSAVERPROTO="scrnsaverproto >= 1.1" RESOURCEPROTO="resourceproto" DRIPROTO="xf86driproto >= 2.1.0" -DRI2PROTO="dri2proto >= 2.2" +DRI2PROTO="dri2proto >= 2.3" XINERAMAPROTO="xineramaproto" BIGFONTPROTO="xf86bigfontproto >= 1.2.0" XCALIBRATEPROTO="xcalibrateproto" diff --git a/glx/glxdri2.c b/glx/glxdri2.c index 69fd39b..c5e7b0b 100644 --- a/glx/glxdri2.c +++ b/glx/glxdri2.c @@ -179,13 +179,13 @@ __glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust, wire.type = __glXEventBase + GLX_BufferSwapComplete; switch (type) { - case DRI2_EXCHANGE_COMPLETE: + case DRI2_SWAP_EXCHANGE: wire.event_type = GLX_EXCHANGE_COMPLETE_INTEL; break; - case DRI2_BLIT_COMPLETE: + case DRI2_SWAP_BLIT: wire.event_type = GLX_BLIT_COMPLETE_INTEL; break; - case DRI2_FLIP_COMPLETE: + case DRI2_SWAP_FLIP: wire.event_type = GLX_FLIP_COMPLETE_INTEL; break; default: @@ -216,11 +216,12 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *drawable) __GLXDRIdrawable *priv = (__GLXDRIdrawable *) drawable; __GLXDRIscreen *screen = priv->screen; CARD64 unused; + int type; if (screen->flush) (*screen->flush->flushInvalidate)(priv->driDrawable); - if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused, + if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused, &type, __glXdriSwapEvent, drawable->pDraw) != Success) return FALSE; diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 3f4ed92..65433e9 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -547,7 +547,7 @@ DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable) int DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, CARD64 divisor, CARD64 remainder, CARD64 *swap_target, - DRI2SwapEventPtr func, void *data) + int *type, DRI2SwapEventPtr func, void *data) { ScreenPtr pScreen = pDraw->pScreen; DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); @@ -587,9 +587,10 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, REGION_INIT(pScreen, ®ion, &box, 0); pPriv->swapsPending++; + *type = DRI2_SWAP_BLIT; (*ds->CopyRegion)(pDraw, ®ion, pDestBuffer, pSrcBuffer); - DRI2SwapComplete(client, pDraw, target_msc, 0, 0, DRI2_BLIT_COMPLETE, + DRI2SwapComplete(client, pDraw, target_msc, 0, 0, DRI2_SWAP_BLIT, func, data); return Success; } @@ -623,7 +624,8 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, *swap_target = pPriv->last_swap_target + pPriv->swap_interval; ret = (*ds->ScheduleSwap)(client, pDraw, pDestBuffer, pSrcBuffer, - swap_target, divisor, remainder, func, data); + swap_target, type, divisor, remainder, func, + data); if (!ret) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[DRI2] %s: driver failed to schedule swap\n", __func__); @@ -826,7 +828,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) ds->DestroyBuffer = info->DestroyBuffer; ds->CopyRegion = info->CopyRegion; - if (info->version >= 4) { + if (info->version >= 5) { ds->ScheduleSwap = info->ScheduleSwap; ds->ScheduleWaitMSC = info->ScheduleWaitMSC; ds->GetMSC = info->GetMSC; diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h index dd59297..c0f82ee 100644 --- a/hw/xfree86/dri2/dri2.h +++ b/hw/xfree86/dri2/dri2.h @@ -85,6 +85,7 @@ typedef void (*DRI2WaitProcPtr)(WindowPtr pWin, * \param pDestBuffer current front buffer * \param pSrcBuffer current back buffer * \param target_msc frame count to wait for + * \param type outputs the kind of swap the DDX has chosen * \param divisor divisor for condition equation * \param remainder remainder for division equation * \param func function to call when the swap completes @@ -95,6 +96,7 @@ typedef int (*DRI2ScheduleSwapProcPtr)(ClientPtr client, DRI2BufferPtr pDestBuffer, DRI2BufferPtr pSrcBuffer, CARD64 *target_msc, + int *type, CARD64 divisor, CARD64 remainder, DRI2SwapEventPtr func, @@ -152,7 +154,7 @@ typedef int (*DRI2ScheduleWaitMSCProcPtr)(ClientPtr client, /** * Version of the DRI2InfoRec structure defined in this header */ -#define DRI2INFOREC_VERSION 4 +#define DRI2INFOREC_VERSION 5 typedef struct { unsigned int version; /**< Version of this struct */ @@ -226,7 +228,8 @@ extern _X_EXPORT void DRI2SwapInterval(DrawablePtr pDrawable, int interval); extern _X_EXPORT int DRI2SwapBuffers(ClientPtr client, DrawablePtr pDrawable, CARD64 target_msc, CARD64 divisor, CARD64 remainder, CARD64 *swap_target, - DRI2SwapEventPtr func, void *data); + int *type, DRI2SwapEventPtr func, + void *data); extern _X_EXPORT Bool DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable); extern _X_EXPORT int DRI2GetMSC(DrawablePtr pDrawable, CARD64 *ust, diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c index 3e6b03e..a4ed2ad 100644 --- a/hw/xfree86/dri2/dri2ext.c +++ b/hw/xfree86/dri2/dri2ext.c @@ -374,7 +374,7 @@ ProcDRI2SwapBuffers(ClientPtr client) xDRI2SwapBuffersReply rep; DrawablePtr pDrawable; CARD64 target_msc, divisor, remainder, swap_target; - int status; + int type, status; REQUEST_SIZE_MATCH(xDRI2SwapBuffersReq); @@ -387,7 +387,7 @@ ProcDRI2SwapBuffers(ClientPtr client) remainder = vals_to_card64(stuff->remainder_lo, stuff->remainder_hi); status = DRI2SwapBuffers(client, pDrawable, target_msc, divisor, remainder, - &swap_target, DRI2SwapEvent, pDrawable); + &swap_target, &type, DRI2SwapEvent, pDrawable); if (status != Success) return BadDrawable; -- 1.6.4.4 |