[PATCH 1/2] Patch to the Xserver to support AsyncSwap
Axel Davy
davy at clipper.ens.fr
Thu Oct 17 00:33:42 CEST 2013
I should have add a link to the initial patch:
http://lists.x.org/archives/xorg-devel/2011-June/023102.html
<http://lists.x.org/archives/xorg-devel/2011-June/023102.html>
Other versions of the patch are:
_http://lists.x.org/archives/xorg-devel/2012-November/034446.html
<http://lists.x.org/archives/xorg-devel/2012-November/034446.html>
http://lists.x.org/archives/xorg-devel/2013-September/037661.html_
Le 17/10/2013 00:16, Axel Davy a écrit :
> The patch is a modified version of a Chris Wilson patch of 2011.
> It makes the X server call AsyncSwap, defined by the DDX, when
> it does a dri2 swap and swap_interval is 0. It allows the DDX
> to avoid the copy if possible, and reduce tearings.
>
> Signed-off-by: Axel Davy <axel.davy at ens.fr>
> ---
> hw/xfree86/dri2/dri2.c | 36 ++++++++++++++++++++++++------------
> hw/xfree86/dri2/dri2.h | 8 +++++++-
> 2 files changed, 31 insertions(+), 13 deletions(-)
>
> diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
> index 483d630..7b06da9 100644
> --- a/hw/xfree86/dri2/dri2.c
> +++ b/hw/xfree86/dri2/dri2.c
> @@ -118,6 +118,7 @@ typedef struct _DRI2Screen {
> DRI2CreateBufferProcPtr CreateBuffer;
> DRI2DestroyBufferProcPtr DestroyBuffer;
> DRI2CopyRegionProcPtr CopyRegion;
> + DRI2AsyncSwapProcPtr AsyncSwap;
> DRI2ScheduleSwapProcPtr ScheduleSwap;
> DRI2GetMSCProcPtr GetMSC;
> DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC;
> @@ -1107,20 +1108,30 @@ 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);
> -
> pPriv->swapsPending++;
>
> - dri2_copy_region(pDraw, ®ion, pDestBuffer, pSrcBuffer);
> - DRI2SwapComplete(client, pDraw, target_msc, 0, 0, DRI2_BLIT_COMPLETE,
> - func, data);
> + if (ds->AsyncSwap)
> + {
> + (*ds->AsyncSwap)(client, pDraw,
> + pDestBuffer, pSrcBuffer,
> + func, data);
> + DRI2InvalidateDrawableAll(pDraw);
> + }
> + 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);
> + DRI2SwapComplete(client, pDraw, target_msc, 0, 0,
> + DRI2_BLIT_COMPLETE, func, data);
> + }
> return Success;
> }
>
> @@ -1463,6 +1474,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
>
> if (info->version >= 10) {
> ds->AuthMagic = info->AuthMagic3;
> + ds->AsyncSwap = info->AsyncSwap;
> }
> if (info->version >= 8) {
> ds->LegacyAuthMagic2 = info->AuthMagic2;
> diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
> index ed67d01..f376e42 100644
> --- a/hw/xfree86/dri2/dri2.h
> +++ b/hw/xfree86/dri2/dri2.h
> @@ -52,7 +52,12 @@ extern CARD8 dri2_minor;
> typedef DRI2BufferRec DRI2Buffer2Rec, *DRI2Buffer2Ptr;
> typedef void (*DRI2SwapEventPtr) (ClientPtr client, void *data, int type,
> CARD64 ust, CARD64 msc, CARD32 sbc);
> -
> +typedef void (*DRI2AsyncSwapProcPtr)(ClientPtr client,
> + DrawablePtr pDraw,
> + DRI2BufferPtr pDestBuffer,
> + DRI2BufferPtr pSrcBuffer,
> + DRI2SwapEventPtr func,
> + void *data);
> typedef DRI2BufferPtr(*DRI2CreateBuffersProcPtr) (DrawablePtr pDraw,
> unsigned int *attachments,
> int count);
> @@ -257,6 +262,7 @@ typedef struct {
>
> /* added in version 10 */
> DRI2AuthMagic3ProcPtr AuthMagic3;
> + DRI2AsyncSwapProcPtr AsyncSwap;
> } DRI2InfoRec, *DRI2InfoPtr;
>
> extern _X_EXPORT Bool DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20131017/895eee88/attachment.html>
More information about the wayland-devel
mailing list