[PATCH] Remove static MAXSCREENS limit from Xext/shm.c.

Keith Packard keithp at keithp.com
Thu Oct 1 15:08:22 PDT 2009


Excerpts from Jamey Sharp's message of Wed Sep 30 22:29:39 -0700 2009:
> ---
> Somebody at XDC today said that getting rid of the static MAXSCREENS
> limit from the X server would be a Good Thing, and it looked like doing
> that to Xext/shm.c would be pretty easy, so I tried it.

Thanks for giving this a try. The canonical way to do this is to
allocate a screen private index and then allocate memory per-screen
instead of globally, but your patch is simpler and easier to review.

Check out mi/misprite.c and see the pattern of the form:

static int miSpriteScreenKeyIndex;
static DevPrivateKey miSpriteScreenKey = &miSpriteScreenKeyIndex;

miSpriteInitialize:

    pScreenPriv = xalloc (sizeof (miSpriteScreenRec));
	...
    dixSetPrivate(&pScreen->devPrivates, miSpriteScreenKey, pScreenPriv);
	
Then, functions which need per-screen info do:

    pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey);

You then wrap CloseScreen (in the usual way) and free your private
structure there.

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: not available
Url : http://lists.x.org/archives/xorg-devel/attachments/20091001/1cdb3e7c/attachment.pgp 


More information about the xorg-devel mailing list