diff options
author | Keith Packard <keithp@keithp.com> | 2013-01-23 11:54:40 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-01-23 11:54:40 -0800 |
commit | cbb1ae08d328e273109e5ae1ad5c25ee23a3d80e (patch) | |
tree | 9e66a7a0bc3d19dfaf8c57a2dfda5ea16cd4c8c6 | |
parent | 70b127c9f1c53bdb42f078265e67f76b464deae2 (diff) |
Use new SwapImmediate function instead of dri2_copy_regionswap-pages
This allows the DDX to provide a more efficient immediate swap
implementation (like SwapPages)
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | hw/xfree86/dri2/dri2.c | 32 | ||||
-rw-r--r-- | hw/xfree86/dri2/dri2.h | 14 |
2 files changed, 35 insertions, 11 deletions
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 40963c3b0..bdb0aca75 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -134,6 +134,7 @@ typedef struct _DRI2Screen { DRI2CreateBuffer2ProcPtr CreateBuffer2; DRI2DestroyBuffer2ProcPtr DestroyBuffer2; DRI2CopyRegion2ProcPtr CopyRegion2; + DRI2SwapImmediateProcPtr SwapImmediate; } DRI2ScreenRec; static void @@ -1123,19 +1124,26 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, /* Old DDX or no swap interval, just blit */ if (!ds->ScheduleSwap || !pPriv->swap_interval || pPriv->prime_id) { - BoxRec box; - RegionRec region; - - box.x1 = 0; - box.y1 = 0; - box.x2 = pDraw->width; - box.y2 = pDraw->height; - RegionInit(®ion, &box, 0); + int type; pPriv->swapsPending++; - dri2_copy_region(pDraw, ®ion, pDestBuffer, pSrcBuffer); - DRI2SwapComplete(client, pDraw, target_msc, 0, 0, DRI2_BLIT_COMPLETE, + if (ds->SwapImmediate) { + type = (*ds->SwapImmediate)(pDraw, pDestBuffer, pSrcBuffer); + } else { + BoxRec box; + RegionRec region; + + box.x1 = 0; + box.y1 = 0; + box.x2 = pDraw->width; + box.y2 = pDraw->height; + RegionInit(®ion, &box, 0); + + dri2_copy_region(pDraw, ®ion, pDestBuffer, pSrcBuffer); + type = DRI2_BLIT_COMPLETE; + } + DRI2SwapComplete(client, pDraw, target_msc, 0, 0, type, func, data); return Success; } @@ -1504,6 +1512,10 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) ds->CopyRegion2 = info->CopyRegion2; } + if (info->version >= 10) { + ds->SwapImmediate = info->SwapImmediate; + } + /* * if the driver doesn't provide an AuthMagic function or the info struct * version is too low, call through LegacyAuthMagic diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h index 1e7afddbd..1b82c974c 100644 --- a/hw/xfree86/dri2/dri2.h +++ b/hw/xfree86/dri2/dri2.h @@ -203,9 +203,18 @@ typedef int (*DRI2GetParamProcPtr) (ClientPtr client, CARD64 *value); /** + * \brief Immediately swap or copy back to front + * + * The return value is the DRI2 type of swap performed + */ +typedef int (*DRI2SwapImmediateProcPtr) (DrawablePtr pDrawable, + DRI2BufferPtr front, + DRI2BufferPtr back); + +/** * Version of the DRI2InfoRec structure defined in this header */ -#define DRI2INFOREC_VERSION 9 +#define DRI2INFOREC_VERSION 10 typedef struct { unsigned int version; /**< Version of this struct */ @@ -252,6 +261,9 @@ typedef struct { DRI2CreateBuffer2ProcPtr CreateBuffer2; DRI2DestroyBuffer2ProcPtr DestroyBuffer2; DRI2CopyRegion2ProcPtr CopyRegion2; + + /* added in version 10 */ + DRI2SwapImmediateProcPtr SwapImmediate; } DRI2InfoRec, *DRI2InfoPtr; extern _X_EXPORT Bool DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info); |