[PATCH] dri2: Pass AsyncSwap [swap_interval=0] requests to the drivers

Simon Farnsworth simon.farnsworth at onelan.co.uk
Tue Feb 21 02:43:40 PST 2012


On Tuesday 21 February 2012 09:55:43 Chris Wilson wrote:
> Currently, the midlayer dri2 code intercepts swap_interval=0 (ala
> vblank_mode=0) SwapBuffers and converts it to a CopyRegion request.
> This prevents the backend from doing anything meaningful in this case
> and typically ends up being vsync'ed since the drivers cannot distinguish
> it from a regular CopyRegion request.
> 
> v2: Only invalidate the drawable on the behest of the backend, so that
> existing behaviour of not invalidating for async blit copies is
> preserved, suggested by Simon Farnsworh. And rebase for the intervening
> 12 months since v1.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Jesse Barnes <jbarnes at virtuousgeek.org>
> Cc: Kristian Høgsberg <krh at bitplanet.net>
> Cc: Ville Syrjälä <ville.syrjala at nokia.com>
> Cc: Dave Airlie <airlied at redhat.com>
> Cc: Michel Dänzer <michel at daenzer.net>
> Cc: Simon Farnsworth <simon.farnsworth at onelan.co.uk>

One tiny nit-pick:

> ---
>  hw/xfree86/dri2/dri2.c |   46 
+++++++++++++++++++++++++++++++++-------------
>  hw/xfree86/dri2/dri2.h |   22 +++++++++++++++++++++-
>  2 files changed, 54 insertions(+), 14 deletions(-)
> 
> diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
> index 5cc9068..05b7cb3 100644
> --- a/hw/xfree86/dri2/dri2.c
> +++ b/hw/xfree86/dri2/dri2.c

<snip>

> @@ -876,20 +900,11 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw,
> CARD64 target_msc,
> 
>      /* Old DDX or no swap interval, just blit */

This comment is now misleading - the driver might not blit, but could do
(for example) a asynchronous buffer swap.

>     if (!ds->ScheduleSwap || !pPriv->swap_interval) {
> -       BoxRec box;
> -       RegionRec region;
> -
> -       box.x1 = 0;
> -       box.y1 = 0;
> -       box.x2 = pDraw->width;
> -       box.y2 = pDraw->height;
> -       RegionInit(&region, &box, 0);
> -
>         pPriv->swapsPending++;
> -
> -       (*ds->CopyRegion)(pDraw, &region, pDestBuffer, pSrcBuffer);
> -       DRI2SwapComplete(client, pDraw, target_msc, 0, 0, 
DRI2_BLIT_COMPLETE,
> -                        func, data);
> +       if ((*ds->AsyncSwap)(client, pDraw,
> +                            pDestBuffer, pSrcBuffer,
> +                            func, data))
> +           DRI2InvalidateDrawable(pDraw);
>         return Success;
>      }

<snip>

Everything else looks good to me, so:

Reviewed-by: Simon Farnsworth <simon.farnsworth at onelan.co.uk>
-- 
Simon Farnsworth
Software Engineer
ONELAN Ltd
http://www.onelan.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.x.org/archives/xorg-devel/attachments/20120221/ba8cc2d4/attachment-0001.pgp>


More information about the xorg-devel mailing list