[PATCH 02/13] render: repack PictureRec

Dave Airlie airlied at gmail.com
Tue Nov 23 14:28:30 PST 2010


On Wed, Nov 24, 2010 at 5:45 AM, Adam Jackson <ajax at redhat.com> wrote:
> Eliminate the unused dither field, move filter and stateChanges into the
> bitfield, and reorder elements to pack holes on LP64.
>
> sizeof(PictureRec)      ILP32       LP64
> before:                    84        152
> after:                     72        120
>
> Signed-off-by: Adam Jackson <ajax at redhat.com>

/me likes when things fit into cachelines better.

Reviewed-by: Dave Airlie <airlied at redhat.com>

Dave.

> ---
>  hw/dmx/dmxpict.c    |    2 --
>  render/picture.c    |    6 ++----
>  render/picturestr.h |   15 +++++++--------
>  3 files changed, 9 insertions(+), 14 deletions(-)
>
> diff --git a/hw/dmx/dmxpict.c b/hw/dmx/dmxpict.c
> index 915e767..ab26593 100644
> --- a/hw/dmx/dmxpict.c
> +++ b/hw/dmx/dmxpict.c
> @@ -1011,8 +1011,6 @@ void dmxValidatePicture(PicturePtr pPicture, Mask mask)
>            attribs.poly_edge = pPicture->polyEdge;
>        if (mask & CPPolyMode)
>            attribs.poly_mode = pPicture->polyMode;
> -       if (mask & CPDither)
> -           attribs.dither = pPicture->dither;
>        if (mask & CPComponentAlpha)
>            attribs.component_alpha = pPicture->componentAlpha;
>
> diff --git a/render/picture.c b/render/picture.c
> index 896eaa7..0028cc7 100644
> --- a/render/picture.c
> +++ b/render/picture.c
> @@ -735,13 +735,12 @@ SetPictureToDefaults (PicturePtr    pPicture)
>
>     pPicture->transform = 0;
>
> -    pPicture->dither = None;
>     pPicture->filter = PictureGetFilterId (FilterNearest, -1, TRUE);
>     pPicture->filter_params = 0;
>     pPicture->filter_nparams = 0;
>
>     pPicture->serialNumber = GC_CHANGE_SERIAL_BIT;
> -    pPicture->stateChanges = (1 << (CPLastBit+1)) - 1;
> +    pPicture->stateChanges = -1;
>     pPicture->pSourcePict = 0;
>  }
>
> @@ -1261,7 +1260,7 @@ ChangePicture (PicturePtr pPicture,
>            }
>            break;
>        case CPDither:
> -           pPicture->dither = NEXT_VAL(Atom);
> +           (void) NEXT_VAL(Atom); /* unimplemented */
>            break;
>        case CPComponentAlpha:
>            {
> @@ -1480,7 +1479,6 @@ CopyPicture (PicturePtr   pSrc,
>            pDst->polyMode = pSrc->polyMode;
>            break;
>        case CPDither:
> -           pDst->dither = pSrc->dither;
>            break;
>        case CPComponentAlpha:
>            pDst->componentAlpha = pSrc->componentAlpha;
> diff --git a/render/picturestr.h b/render/picturestr.h
> index 5c6c41e..ae69eef 100644
> --- a/render/picturestr.h
> +++ b/render/picturestr.h
> @@ -151,8 +151,6 @@ typedef struct _Picture {
>     PictFormatShort format;        /* PICT_FORMAT */
>     int                    refcnt;
>     CARD32         id;
> -    PicturePtr     pNext;          /* chain on same drawable */
> -
>     unsigned int    repeat : 1;
>     unsigned int    graphicsExposures : 1;
>     unsigned int    subWindowMode : 1;
> @@ -162,7 +160,11 @@ typedef struct _Picture {
>     unsigned int    clientClipType : 2;
>     unsigned int    componentAlpha : 1;
>     unsigned int    repeatType : 2;
> -    unsigned int    unused : 21;
> +    unsigned int    filter : 3;
> +    unsigned int    stateChanges : CPLastBit;
> +    unsigned int    unused : 18 - CPLastBit;
> +
> +    PicturePtr     pNext;          /* chain on same drawable */
>
>     PicturePtr     alphaMap;
>     DDXPointRec            alphaOrigin;
> @@ -170,9 +172,6 @@ typedef struct _Picture {
>     DDXPointRec            clipOrigin;
>     pointer        clientClip;
>
> -    Atom           dither;
> -
> -    unsigned long   stateChanges;
>     unsigned long   serialNumber;
>
>     RegionPtr      pCompositeClip;
> @@ -181,10 +180,9 @@ typedef struct _Picture {
>
>     PictTransform   *transform;
>
> -    int                    filter;
> +    SourcePictPtr   pSourcePict;
>     xFixed         *filter_params;
>     int                    filter_nparams;
> -    SourcePictPtr   pSourcePict;
>  } PictureRec;
>
>  typedef Bool (*PictFilterValidateParamsProcPtr) (ScreenPtr pScreen, int id,
> @@ -205,6 +203,7 @@ typedef struct {
>  #define PictFilterBest         4
>
>  #define PictFilterConvolution  5
> +/* if you add an 8th filter, expand the filter bitfield above */
>
>  typedef struct {
>     char           *alias;
> --
> 1.7.3.1
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>


More information about the xorg-devel mailing list