[Xquartz-dev] Help requested debugging rgl under XQuartz

Jeremy Huddleston Sequoia jeremyhu at apple.com
Tue Feb 23 12:47:47 PST 2021



> On Feb 23, 2021, at 06:14, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
> 
> On 23/02/2021 12:47 a.m., Jeremy Huddleston Sequoia wrote:
>>> On Feb 22, 2021, at 14:38, Duncan Murdoch <murdoch.duncan at gmail.com <mailto:murdoch.duncan at gmail.com>> wrote:
>>> 
>>> I've made a little bit of progress.
>>> 
>>> The message "error: xp_attach_gl_context returned: 2" comes from the Mesa routine surface_make_current, which calls xp_attach_gl_context.  I haven't found where xp_attach_gl_context is defined.
>> xp_attach_gl_context is in libXplugin (check Xplugin.h in the SDK).
>> 2 is XP_BadValue, which is returned if cgl_ctx is NULL... so I'd suggest looking into why mesa is calling xp_attach_gl_context with a NULL context.
> 
> Thanks, that's helpful.  The context is not NULL, so I need to think of other ways it could be "bad".

Ok, well xp_attach_gl_context is just a wrapper around CGLSetSurface(), which is an internal function to do exactly what we're trying to do here.  If it returns any error, xp_attach_gl_context returns bad value.

Are you able to capture this in the debugger and figure out what the return value from CGLSetSurface() is?  That will tell us what the underlying CGLError is, which might help shed some light on this.

> Here's what I see with LIBGL_DIAGNOSTIC=1.  For a successful open,
> 
> > rgl.open()
> function is no-op
> Debug     ../src/glx/apple/apple_glx_context.c:205 apple_glx_create_context(4295810496): apple_glx_create_context: ac 0x100a10a00 ac->context_obj 0x107cdce00
> 2021-02-23 08:23:00.041711-0500 R[45754:1283995] apple_glx_create_context: ac 0x100a10a00 ac->context_obj 0x107cdce00
> Debug     ../src/glx/apple/apple_glx_drawable.c:342 apple_glx_drawable_create(4295810496): apple_glx_drawable_create: new drawable 0x107ce0e00
> 2021-02-23 08:23:00.042235-0500 R[45754:1283995] apple_glx_drawable_create: new drawable 0x107ce0e00
> Debug     ../src/glx/apple/apple_glx_surface.c:154 create_surface(4295810496): create_surface: created a surface for drawable 0x600066 with uid 621
> 2021-02-23 08:23:00.044773-0500 R[45754:1283995] create_surface: created a surface for drawable 0x600066 with uid 621
> Debug     ../src/glx/apple/apple_glx_surface.c:69 surface_make_current(4295810496): surface_make_current: ac->context_obj 0x107cdce00 s->surface_id 9
> 2021-02-23 08:23:00.044839-0500 R[45754:1283995] surface_make_current: ac->context_obj 0x107cdce00 s->surface_id 9
> Debug     ../src/glx/apple/apple_glx_surface.c:89 surface_make_current(4295810496): surface_make_current: drawable 0x600066
> 2021-02-23 08:23:00.045680-0500 R[45754:1283995] surface_make_current: drawable 0x600066
> ... (more lines deleted)
> 
> After I run quartz(), I see this:
> 
> > rgl.open()
> Debug     ../src/glx/apple/apple_glx_context.c:205 apple_glx_create_context(4295810496): apple_glx_create_context: ac 0x10262bb00 ac->context_obj 0x1058c4800
> 2021-02-23 08:23:35.666675-0500 R[45754:1283995] apple_glx_create_context: ac 0x10262bb00 ac->context_obj 0x1058c4800
> Debug     ../src/glx/apple/apple_glx_drawable.c:342 apple_glx_drawable_create(4295810496): apple_glx_drawable_create: new drawable 0x107648000
> 2021-02-23 08:23:35.667040-0500 R[45754:1283995] apple_glx_drawable_create: new drawable 0x107648000
> Debug     ../src/glx/apple/apple_glx_surface.c:154 create_surface(4295810496): create_surface: created a surface for drawable 0x6000c9 with uid 629
> 2021-02-23 08:23:35.669119-0500 R[45754:1283995] create_surface: created a surface for drawable 0x6000c9 with uid 629
> Debug     ../src/glx/apple/apple_glx_surface.c:69 surface_make_current(4295810496): surface_make_current: ac->context_obj 0x1058c4800 s->surface_id 13
> 2021-02-23 08:23:35.669195-0500 R[45754:1283995] surface_make_current: ac->context_obj 0x1058c4800 s->surface_id 13
> error: xp_attach_gl_context returned: 2
> Debug     ../src/glx/applegl_glx.c:60 applegl_bind_context(4295810496): applegl_bind_context: error YES
> 2021-02-23 08:23:35.669834-0500 R[45754:1283995] applegl_bind_context: error YES
> 
> and then I get my own messages from the failure of glXMakeCurrent().  As far as I can see, everything appears fine until the call to xp_attach_gl_context.
> 
> 
> Everything looks very similar up to the failure of xp_attach_gl_context.  Any idea I why the value returned a few lines earlier from apple_glx_create_context() should be a bad value?
> 
> Duncan Murdoch
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/xquartz-dev/attachments/20210223/84148b6c/attachment.htm>


More information about the Xquartz-dev mailing list