Adam Jackson <[email protected]> writes: > Ugh the GLX code. __GLX_MAX_CONTEXT_PROPS is 3 because glxproto.h is > just a pile of ancient runes, so when the server begins sending more > than 3 context properties this code refuses to work _at all_. > > This extension is pretty obscure, so this probably isn't a big deal (if > it was we'd need to hack the server side to send fewer properties unless > the client seemed to be "new enough"). And we're probably not going to > ever have tremendous numbers of context properties. So bump the number > we'll accept in a reply out to 32 (since we still want to avoid overflow > etc.) and copy in just the ones we know about, as since these will be > indirect contexts the client library probably needs to be explicitly > aware of any new context state. > > Signed-off-by: Adam Jackson <[email protected]> > --- > src/glx/glxcmds.c | 18 ++++++++++++------ > 1 file changed, 12 insertions(+), 6 deletions(-) > > diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c > index 29b94b8810..fd917671eb 100644 > --- a/src/glx/glxcmds.c > +++ b/src/glx/glxcmds.c > @@ -1395,6 +1395,16 @@ GLX_ALIAS(Display *, glXGetCurrentDisplayEXT, (void), > (), > glXGetCurrentDisplay) > > #ifndef GLX_USE_APPLEGL > + > +/* > + * This is just a random large number, so that the server can start sending > + * more properties and we won't arbitrarily reject it, but we still won't > save > + * any attributes we don't know about, since the correct usage of an imported > + * (and thus indirect) context almost certainly requires explicit awareness > in > + * libGL of any extensions in use. Right now we know about 5, 32 should be > + * plenty of headroom. > + */ > +#define MAX_CONTEXT_PROPS 32 > _GLX_PUBLIC GLXContext > glXImportContextEXT(Display *dpy, GLXContextID contextID) > { > @@ -1403,11 +1413,7 @@ glXImportContextEXT(Display *dpy, GLXContextID > contextID) > xGLXQueryContextReply reply; > CARD8 opcode; > struct glx_context *ctx; > - > - /* This GLX implementation knows about 5 different properties, so > - * allow the server to send us one of each. > - */ > - int propList[5 * 2], *pProp, nPropListBytes; > + int propList[MAX_CONTEXT_PROPS * 2], *pProp, nPropListBytes; > int numProps; > int i, renderType; > XID share; > @@ -1471,7 +1477,7 @@ glXImportContextEXT(Display *dpy, GLXContextID > contextID) > > _XReply(dpy, (xReply *) & reply, 0, False); > > - if (reply.n <= __GLX_MAX_CONTEXT_PROPS) > + if (reply.n <= MAX_CONTEXT_PROPS) > nPropListBytes = reply.n * 2 * sizeof propList[0]; > else > nPropListBytes = 0;
Instead of magic numbers, couldn't we just malloc the proplist here and free it after the loop?
signature.asc
Description: PGP signature
_______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
