[PATCH xserver] EXA: Use dixGetPrivate(Addr) instead of dixLookupPrivate.
Michel Dänzer
michel at daenzer.net
Sat Mar 26 05:10:18 PDT 2011
On Sam, 2011-03-26 at 11:50 +0000, Maarten Maathuis wrote:
> 2011/3/26 Michel Dänzer <michel at daenzer.net>:
> > 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>
> > ---
> > exa/exa_priv.h | 7 +++----
> > 1 files changed, 3 insertions(+), 4 deletions(-)
> >
> > diff --git a/exa/exa_priv.h b/exa/exa_priv.h
> > index e5d90d4..70de4bd 100644
> > --- a/exa/exa_priv.h
> > +++ b/exa/exa_priv.h
> > @@ -228,10 +228,10 @@ extern DevPrivateKeyRec exaPixmapPrivateKeyRec;
> > extern DevPrivateKeyRec exaGCPrivateKeyRec;
> > #define exaGCPrivateKey (&exaGCPrivateKeyRec)
> >
> > -#define ExaGetScreenPriv(s) ((ExaScreenPrivPtr)dixLookupPrivate(&(s)->devPrivates, exaScreenPrivateKey))
> > +#define ExaGetScreenPriv(s) ((ExaScreenPrivPtr)dixGetPrivate(&(s)->devPrivates, exaScreenPrivateKey))
> > #define ExaScreenPriv(s) ExaScreenPrivPtr pExaScr = ExaGetScreenPriv(s)
> >
> > -#define ExaGetGCPriv(gc) ((ExaGCPrivPtr)dixLookupPrivate(&(gc)->devPrivates, exaGCPrivateKey))
> > +#define ExaGetGCPriv(gc) ((ExaGCPrivPtr)dixGetPrivateAddr(&(gc)->devPrivates, exaGCPrivateKey))
> > #define ExaGCPriv(gc) ExaGCPrivPtr pExaGC = ExaGetGCPriv(gc)
> >
> > /*
> > @@ -282,8 +282,7 @@ extern DevPrivateKeyRec exaGCPrivateKeyRec;
> > #define EXA_PIXMAP_SCORE_PINNED 1000
> > #define EXA_PIXMAP_SCORE_INIT 1001
> >
> > -#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)
> >
> > #define EXA_RANGE_PITCH (1 << 0)
>
> This is based on the assumption that the private always exists?
See the dixRegisterPrivateKey() and dixSetPrivate() calls.
I've been running with this patch for a while.
--
Earthling Michel Dänzer | http://www.vmware.com
Libre software enthusiast | Debian, X and DRI developer
More information about the xorg-devel
mailing list