[Mesa-dev] [PATCH 1/4] glx: Call __glXInitVertexArrayState() with a usable gc.

Matt Turner mattst88 at gmail.com
Thu Jul 7 16:44:01 UTC 2016

On Wed, Jun 29, 2016 at 2:16 PM, Ian Romanick <idr at freedesktop.org> wrote:
> On 06/29/2016 02:04 AM, Colin McDonald wrote:
>> I'm not familiar with the code, other than diving in to fix these
>> indirect multi-texture problems, so you will know much more about it
>> than me.
>> But, my understanding is that __glXInitVertexArrayState needs info
>> from the server, obtained by calls to _indirect_glGetString &
>> __indirect_glGetIntegerv. Those routines need the current context
>> from __glXGetCurrentContext, so __glXSetCurrentContext(gc) must have
>> been called first.
>> I see your point about a "layering violation".  I think that to avoid
>> that would require a more substantial restructuring, so that the
>> indirect layer can run some initialisation code (ie
>> __glXInitVertexArrayState or similar) separate from the bind
>> callback, once a usable context has been setup.
> Maybe...  *If* __glXGetCurrentContext is the only problem, then I think
> a small refactor of __indirect_glGetString could also solve the problem.
>  Just make a new function
> const GLubyte *do_GetString(Display *dpy, struct glx_context *gc,
>                             GLenum name);
> that both __indirect_glGetString and indirect_bind_context call.  It
> might even be worth folding the contents of __glXGetString into the new
> function... though that's probably a follow-up patch.

I tried that (see attached p.patch)... and I get another segfault.

(gdb) bt
#0  0x00007ffff4a97700 in XGetXCBConnection () from /usr/lib64/libX11-xcb.so.1
#1  0x00007ffff7664a3d in __glXFlushRenderBuffer (ctx=0x662080,
pc=0x7ffff7f76010 "") at ../../../mesa/src/glx/glxext.c:987
#2  0x00007ffff769b429 in do_GetString (dpy=0x64fc60, gc=0x662080,
name=7939) at ../../../mesa/src/glx/single2.c:678
#3  0x00007ffff7688d55 in indirect_bind_context (gc=0x662080,
old=0x7ffff78cf6c0 <dummyContext>, draw=27262978, read=27262978) at
#4  0x00007ffff766278a in MakeContextCurrent (dpy=0x64fc60,
draw=27262978, read=27262978, gc_user=0x662080) at
#5  0x00007ffff70c1af0 in fgPlatformOpenWindow () from /usr/lib64/libglut.so.3
#6  0x00007ffff70bbb06 in fgOpenWindow () from /usr/lib64/libglut.so.3
#7  0x00007ffff70ba42b in fgCreateWindow () from /usr/lib64/libglut.so.3
#8  0x00007ffff70bbc00 in glutCreateWindow () from /usr/lib64/libglut.so.3
#9  0x00000000004022c8 in main (argc=1, argv=0x7fffffffe0f8) at arbvparray.c:294

gc->currentDpy is NULL. Sigh. I don't know what any of this code is doing.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.patch
Type: text/x-patch
Size: 1881 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160707/07224a48/attachment.bin>

More information about the mesa-dev mailing list