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

Jamey Sharp jamey at minilop.net
Thu Oct 1 15:26:47 PDT 2009


On Thu, Oct 1, 2009 at 3:08 PM, Keith Packard <keithp at keithp.com> wrote:
> 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, ...

Hmm. I think that's what I did? I followed the pattern in
miext/damage/damage.c, which looks about the same as the misprite
example you suggested. (Then Daniel suggested I wrap up the
dixLookupPrivate calls in a macro, so I did.)

But ProcPanoramiXShmGetImage seems to need an actual array with at least
as many entries as the number of active screens, which it uses as a
temporary. On the assumption that the X server is single-threaded and
that function doesn't try to call itself, I just allocated that
temporary in ShmExtensionInit. If alloca or plain xalloc/xfree would be
preferred each time that request is processed, I can do that. Or perhaps
there's some better change to get rid of the temporary array entirely?

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

I missed that step. I wondered whether this stuff was supposed to get
freed somewhere...

Jamey


More information about the xorg-devel mailing list