[PATCH 1/2] exa: Only call driver finish access hook when needed.

Michel Dänzer michel at daenzer.net
Fri Dec 10 00:58:19 PST 2010


On Don, 2010-12-09 at 21:17 +0100, Maarten Maathuis wrote: 
> - exa classic and mixed don't always access the "driver" pixmap.
> 
> Signed-off-by: Maarten Maathuis <madman2003 at gmail.com>
> ---
>  exa/exa.c        |    3 ++-
>  exa/exa_driver.c |    2 ++
>  2 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/exa/exa.c b/exa/exa.c
> index 8adf847..4790bfa 100644
> --- a/exa/exa.c
> +++ b/exa/exa.c
> @@ -421,7 +421,8 @@ exaFinishAccess(DrawablePtr pDrawable, int index)
>      /* We always hide the devPrivate.ptr. */
>      pPixmap->devPrivate.ptr = NULL;
>  
> -    if (!pExaScr->info->FinishAccess || !exaPixmapHasGpuCopy(pPixmap))
> +    if (!pExaScr->info->FinishAccess || !exaPixmapHasGpuCopy(pPixmap) ||
> +	    !pExaPixmap->use_gpu_copy

This is not correct, ExaDoPrepareAccess() may call the driver
PrepareAccess hook even if !pExaPixmap->use_gpu_copy. The way to know if
the driver hook was called (and succeeded) is to look at
pExaScr->access[i].retval. I think

-    if (!pExaScr->info->FinishAccess || !exaPixmapHasGpuCopy(pPixmap))
+    if (!pExaScr->access[i].retval)

should do the trick.


> diff --git a/exa/exa_driver.c b/exa/exa_driver.c
> index a913cfb..b9903d1 100644
> --- a/exa/exa_driver.c
> +++ b/exa/exa_driver.c
> @@ -115,6 +115,8 @@ exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth,
>      exaSetAccelBlock(pExaScr, pExaPixmap,
>                       w, h, bpp);
>  
> +    pExaPixmap->use_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
> +
>      /* During a fallback we must prepare access. */
>      if (pExaScr->fallback_counter)
>  	exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_AUX_DEST);

Not sure this is really necessary but I guess it doesn't hurt. Should be
a separate patch though.


-- 
Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer


More information about the xorg-devel mailing list