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

Cyril Brulebois kibi at debian.org
Sat Mar 26 19:41:04 PDT 2011


(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>

> -#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.)

KiBi.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110327/4104a25f/attachment.pgp>


More information about the xorg-devel mailing list