[PATCH 2/3] EXA: Fix migration avoidance for 1x1 pixmaps.

Maarten Maathuis madman2003 at gmail.com
Mon Dec 28 04:27:52 PST 2009


Why does it help to allocate the sys_ptr up front, why does that avoid
migration (i would except sys_ptr to be allocated when needed)?

Maarten.

2009/12/28 Michel Dänzer <michel at daenzer.net>:
> From: Michel Dänzer <daenzer at vmware.com>
>
> Signed-off-by: Michel Dänzer <daenzer at vmware.com>
> ---
>  exa/exa_accel.c |    4 ++++
>  exa/exa_mixed.c |   18 +++++++++++++++++-
>  2 files changed, 21 insertions(+), 1 deletions(-)
>
> diff --git a/exa/exa_accel.c b/exa/exa_accel.c
> index 0f6e5f7..eea799e 100644
> --- a/exa/exa_accel.c
> +++ b/exa/exa_accel.c
> @@ -1043,6 +1043,7 @@ exaFillRegionSolid (DrawablePtr   pDrawable, RegionPtr pRegion, Pixel pixel,
>            pDrawable->width == 1 && pDrawable->height == 1 &&
>            pDrawable->bitsPerPixel != 24) {
>            ExaPixmapPriv(pPixmap);
> +           RegionPtr pending_damage = DamagePendingRegion(pExaPixmap->pDamage);
>
>            switch (pDrawable->bitsPerPixel) {
>            case 32:
> @@ -1057,6 +1058,9 @@ exaFillRegionSolid (DrawablePtr   pDrawable, RegionPtr pRegion, Pixel pixel,
>
>            REGION_UNION(pScreen, &pExaPixmap->validSys, &pExaPixmap->validSys,
>                         pRegion);
> +           REGION_UNION(pScreen, &pExaPixmap->validFB, &pExaPixmap->validFB,
> +                        pRegion);
> +           REGION_SUBTRACT(pScreen, pending_damage, pending_damage, pRegion);
>        }
>
>        ret = TRUE;
> diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c
> index 155ed47..b262fc7 100644
> --- a/exa/exa_mixed.c
> +++ b/exa/exa_mixed.c
> @@ -94,9 +94,25 @@ exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
>     if (!w || !h) {
>        exaCreateDriverPixmap_mixed(pPixmap);
>        pExaPixmap->use_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
> -    } else
> +    } else {
>        pExaPixmap->use_gpu_copy = FALSE;
>
> +       if (w == 1 && h == 1) {
> +           pExaPixmap->sys_ptr = malloc((pPixmap->drawable.bitsPerPixel + 7) / 8);
> +
> +           /* Set up damage tracking */
> +           pExaPixmap->pDamage = DamageCreate(NULL, NULL,
> +                                              DamageReportNonEmpty, TRUE,
> +                                              pPixmap->drawable.pScreen,
> +                                              pPixmap);
> +
> +           DamageRegister(&pPixmap->drawable, pExaPixmap->pDamage);
> +           /* This ensures that pending damage reflects the current operation. */
> +           /* This is used by exa to optimize migration. */
> +           DamageSetReportAfterOp(pExaPixmap->pDamage, TRUE);
> +       }
> +    }
> +
>     /* During a fallback we must prepare access. */
>     if (pExaScr->fallback_counter)
>        exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_AUX_DEST);
> --
> 1.6.5.7
>
> _______________________________________________
> xorg-devel mailing list
> xorg-devel at lists.x.org
> http://lists.x.org/mailman/listinfo/xorg-devel
>


More information about the xorg-devel mailing list