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

Ian Romanick idr at freedesktop.org
Thu Jul 7 21:34:49 UTC 2016

On 07/07/2016 09:44 AM, Matt Turner wrote:
> 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.

I think it should be possible to elide the __glXFlushRenderBuffer call.
Since the context is being made current, its buffer of rendering
commands must be empty.  Does the attached patch help?

> (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
> ../../../mesa/src/glx/indirect_glx.c:158
> #4  0x00007ffff766278a in MakeContextCurrent (dpy=0x64fc60,
> draw=27262978, read=27262978, gc_user=0x662080) at
> ../../../mesa/src/glx/glxcurrent.c:228
> #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: move-XGetXCBConnection-call.patch
Type: application/pgp-keys
Size: 572 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160707/6b9329e9/attachment.key>

More information about the mesa-dev mailing list