[PATCH] miext/damage: Only wrap into the GC ops chain if there's a listener (v2.1)

Chris Wilson chris at chris-wilson.co.uk
Fri Jan 6 11:08:50 PST 2012


On Fri,  6 Jan 2012 13:46:38 -0500, Adam Jackson <ajax at redhat.com> wrote:
> Before:
> 40000000 trep @   0.0009 msec (1148346.9/sec): PutImage 10x10 square
> 60000000 trep @   0.0005 msec (2091666.1/sec): ShmPutImage 10x10 square
> 
> After:
> 40000000 trep @   0.0008 msec (1191807.5/sec): PutImage 10x10 square
> 60000000 trep @   0.0005 msec (2180983.0/sec): ShmPutImage 10x10 square
> 
> v2: Bump drawable serial number on damage register/unregister to trigger
>     ValidateGC, otherwise a Damage created after the GC was validated
>     would never be called, and a Damage destroyed on a validated GC
>     would probably crash the next GC draw.  Spotted by Aaron Plattner.
> v2.1: Actually include the above change.
> 
> Reviewed-by: Eric Anholt <eric at anholt.net>
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  miext/damage/damage.c |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/miext/damage/damage.c b/miext/damage/damage.c
> index d791211..37599dd 100644
> --- a/miext/damage/damage.c
> +++ b/miext/damage/damage.c
> @@ -437,9 +437,13 @@ damageValidateGC(GCPtr         pGC,
>  		 unsigned long changes,
>  		 DrawablePtr   pDrawable)
>  {
> +    drawableDamage(pDrawable);
>      DAMAGE_GC_FUNC_PROLOGUE (pGC);
>      (*pGC->funcs->ValidateGC)(pGC, changes, pDrawable);
> -    pGCPriv->ops = pGC->ops;  /* just so it's not NULL */
> +    if (pDamage)
> +	pGCPriv->ops = pGC->ops;  /* just so it's not NULL */
> +    else
> +	pGCPriv->ops = NULL;

That comment is quite annoying and does not make those macros any less
opaque. How about:

  pGCPriv->ops = pDamage; /* a non-NULL value to enable damage tracking
                             and fixed up in the epilogue to the appropriate
                             wrapped ops */

-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the xorg-devel mailing list