[PATCH xserver] EXA: Use dixGetPrivate(Addr) instead of dixLookupPrivate.

Michel Dänzer michel at daenzer.net
Mon Mar 28 08:17:38 PDT 2011


On Son, 2011-03-27 at 04:41 +0200, Cyril Brulebois wrote: 
> (Mode I'm-discovering-the-code on)
> 
> Michel Dänzer <michel at daenzer.net> (26/03/2011):
> > From: Michel Dänzer <daenzer at vmware.com>
> > 
> > The latter calls the former, let's cut the middle man and eliminate a branch
> > in a hot path.
> > 
> > Signed-off-by: Michel Dänzer <daenzer at vmware.com>
> 
> Since we have:
>   dixRegisterPrivateKey(&exaScreenPrivateKeyRec, PRIVATE_SCREEN, 0)
>   #define exaScreenPrivateKey (&exaScreenPrivateKeyRec)
> and others with sizeof() instead…
> 
> it looks like we're indeed in the right branch of dixLookupPrivate()'s
> if() in all cases, so that looks fine.
> 
> Reviewed-by: Cyril Brulebois <kibi at debian.org>

Thanks.


> > -#define ExaGetPixmapPriv(p) ((ExaPixmapPrivPtr)dixLookupPrivate(&(p)->devPrivates, exaPixmapPrivateKey))
> > -#define ExaSetPixmapPriv(p,a) dixSetPrivate(&(p)->devPrivates, exaPixmapPrivateKey, a)
> > +#define ExaGetPixmapPriv(p) ((ExaPixmapPrivPtr)dixGetPrivateAddr(&(p)->devPrivates, exaPixmapPrivateKey))
> >  #define ExaPixmapPriv(p)	ExaPixmapPrivPtr pExaPixmap = ExaGetPixmapPriv(p
> 
> (Might be worth noting removing ExaSetPixmapPriv() is intended as it's
> unused, for those who wouldn't be looking at the actual (inexistent)
> callers in the current code. But not a prerequisite to my r-b.)

I didn't feel the need for this, as the patch wouldn't build if it was
used. But I guess it can't hurt to add something.


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


More information about the xorg-devel mailing list