Infinite recursion with xserver and Indirect GLX (specific to a single third-party library)
I'm unsure whether this is a Mesa issue or Xserver: I'm encountering an infinite recursion with the recent changes for xorg/xserver#211 (closed), combined with the examples from https://github.com/irixxxx/igl.
The recursion is entered into when running any of the examples with Xserver's __glXForceCurrent
calling Mesa's driBindContext()
. Mesa then proceeds to dri2_drawable_get_buffers()
which calls Xserver's dri2GetBuffersWithFormat()
which in turn calls Mesa's driBindContext()
thereby initiating or perpetuating the infinite recursion.
Seemingly within Xserver's dri2GetBuffersWithFormat()
function the test on Line 710 of glx/glxdri2.c
always returns falsy causing driBindContext()
to be recalled infinitely because it ends up in the same bit of code as a descendant call, which hits the same falsy condition thereby never returning.
Is it expected that Mesa calls the implementation of dri2GetBuffersWithFormat()
in the Xserver rather than using its own implementation?
To replicate this issue, build the latest changes for xorg/xserver#211 (closed) including the now merged PR xorg/xserver!388 (merged). Once you have the latest Xserver running with indirect GLX enabled e.g. by running with Xorg +iglx
you need to run any of the examples from the GitHub link above with:
cd /path/to/igl/source
export ABI=-m32
# This GCCPREFIX is for Ubuntu and is used by the Makefile to call the 32bit
# toolchain (IGL is meant to only work with 32-bitness) You likely need to
# install the 32bit toolchain from APT to make it available.
export GCCPREFIX=/usr/bin/i686-linux-gnu-
make
make examples
# LIBGL_ALWAYS_INDIRECT isn't strictly necessary as the library will specify
# to use indirect rendering anyway by calling:
#
# glXCreateContext (IGL_DISPLAY, IGL_VISUAL, NULL, False);
LIBGL_ALWAYS_INDIRECT=1 LD_LIBRARY_PATH=$PWD/lib ./examples/demo1
The following is the tail-end of the back-trace I receive from the stack overflow SIGSEGV using GDB:
#87287 0x00007f399ac3ddce in dri2_drawable_get_buffers (count=<synthetic pointer>, atts=0x55d540084c10, drawable=0x55d540db33d0) at ../src/gallium/state_trackers/dri/dri2.c:186
#87288 dri2_allocate_textures (ctx=<optimised out>, drawable=0x55d540db33d0, statts=0x55d540084c10, statts_count=3) at ../src/gallium/state_trackers/dri/dri2.c:402
#87289 0x00007f399ac3f735 in dri_st_framebuffer_validate (stctx=<optimised out>, stfbi=<optimised out>, statts=0x55d540084c10, count=3, out=0x7ffc811ce440) at ../src/gallium/state_trackers/dri/dri_drawable.c:85
#87290 0x00007f399b0cf1aa in st_framebuffer_validate (stfb=0x55d540084740, st=st@entry=0x55d53ebc79b0) at ../src/mesa/state_tracker/st_manager.c:222
#87291 0x00007f399b0cf489 in st_api_make_current (stapi=<optimised out>, streadi=0x55d540db33d0, stdrawi=0x55d540db33d0, stctxi=0x55d53ebc79b0) at ../src/mesa/state_tracker/st_manager.c:1082
#87292 st_api_make_current (stapi=<optimised out>, stctxi=0x55d53ebc79b0, stdrawi=0x55d540db33d0, streadi=0x55d540db33d0) at ../src/mesa/state_tracker/st_manager.c:1057
#87293 0x00007f399ac3f131 in dri_make_current (cPriv=<optimised out>, driDrawPriv=<optimised out>, driReadPriv=<optimised out>) at ../src/gallium/state_trackers/dri/dri_context.c:301
#87294 0x00007f399ac3935a in driBindContext (pcp=<optimised out>, pdp=<optimised out>, prp=<optimised out>) at ../src/mesa/drivers/dri/common/dri_util.c:580
#87295 0x00007f399c540061 in dri2GetBuffersWithFormat (driDrawable=<optimised out>, width=0x55d53e941008, height=0x55d53e94100c, attachments=0x7ffc811ce670, count=2, out_count=0x7ffc811ce640, loaderPrivate=0x55d53f2fd920) at ../../../../glx/glxdri2.c:712
#87296 0x00007f399ac3ddce in dri2_drawable_get_buffers (count=<synthetic pointer>, atts=0x55d540084c10, drawable=0x55d540db33d0) at ../src/gallium/state_trackers/dri/dri2.c:186
#87297 dri2_allocate_textures (ctx=<optimised out>, drawable=0x55d540db33d0, statts=0x55d540084c10, statts_count=3) at ../src/gallium/state_trackers/dri/dri2.c:402
#87298 0x00007f399ac3f735 in dri_st_framebuffer_validate (stctx=<optimised out>, stfbi=<optimised out>, statts=0x55d540084c10, count=3, out=0x7ffc811ce7a0) at ../src/gallium/state_trackers/dri/dri_drawable.c:85
#87299 0x00007f399b0cf1aa in st_framebuffer_validate (stfb=0x55d540084740, st=st@entry=0x55d53ebc79b0) at ../src/mesa/state_tracker/st_manager.c:222
#87300 0x00007f399b0cf489 in st_api_make_current (stapi=<optimised out>, streadi=0x55d540db33d0, stdrawi=0x55d540db33d0, stctxi=0x55d53ebc79b0) at ../src/mesa/state_tracker/st_manager.c:1082
#87301 st_api_make_current (stapi=<optimised out>, stctxi=0x55d53ebc79b0, stdrawi=0x55d540db33d0, streadi=0x55d540db33d0) at ../src/mesa/state_tracker/st_manager.c:1057
#87302 0x00007f399ac3f131 in dri_make_current (cPriv=<optimised out>, driDrawPriv=<optimised out>, driReadPriv=<optimised out>) at ../src/gallium/state_trackers/dri/dri_context.c:301
#87303 0x00007f399ac3935a in driBindContext (pcp=<optimised out>, pdp=<optimised out>, prp=<optimised out>) at ../src/mesa/drivers/dri/common/dri_util.c:580
#87304 0x00007f399c540061 in dri2GetBuffersWithFormat (driDrawable=<optimised out>, width=0x55d53e941008, height=0x55d53e94100c, attachments=0x7ffc811ce9d0, count=2, out_count=0x7ffc811ce9a0, loaderPrivate=0x55d53f2fd920) at ../../../../glx/glxdri2.c:712
#87305 0x00007f399ac3ddce in dri2_drawable_get_buffers (count=<synthetic pointer>, atts=0x55d540084c10, drawable=0x55d540db33d0) at ../src/gallium/state_trackers/dri/dri2.c:186
#87306 dri2_allocate_textures (ctx=<optimised out>, drawable=0x55d540db33d0, statts=0x55d540084c10, statts_count=3) at ../src/gallium/state_trackers/dri/dri2.c:402
#87307 0x00007f399ac3f735 in dri_st_framebuffer_validate (stctx=<optimised out>, stfbi=<optimised out>, statts=0x55d540084c10, count=3, out=0x7ffc811ceb00) at ../src/gallium/state_trackers/dri/dri_drawable.c:85
#87308 0x00007f399b0cf1aa in st_framebuffer_validate (stfb=0x55d540084740, st=st@entry=0x55d53ebc79b0) at ../src/mesa/state_tracker/st_manager.c:222
#87309 0x00007f399b0cf489 in st_api_make_current (stapi=<optimised out>, streadi=0x55d540db33d0, stdrawi=0x55d540db33d0, stctxi=0x55d53ebc79b0) at ../src/mesa/state_tracker/st_manager.c:1082
#87310 st_api_make_current (stapi=<optimised out>, stctxi=0x55d53ebc79b0, stdrawi=0x55d540db33d0, streadi=0x55d540db33d0) at ../src/mesa/state_tracker/st_manager.c:1057
#87311 0x00007f399ac3f131 in dri_make_current (cPriv=<optimised out>, driDrawPriv=<optimised out>, driReadPriv=<optimised out>) at ../src/gallium/state_trackers/dri/dri_context.c:301
#87312 0x00007f399ac3935a in driBindContext (pcp=<optimised out>, pdp=<optimised out>, prp=<optimised out>) at ../src/mesa/drivers/dri/common/dri_util.c:580
#87313 0x00007f399c540061 in dri2GetBuffersWithFormat (driDrawable=<optimised out>, width=0x55d53e941008, height=0x55d53e94100c, attachments=0x7ffc811ced30, count=2, out_count=0x7ffc811ced00, loaderPrivate=0x55d53f2fd920) at ../../../../glx/glxdri2.c:712
#87314 0x00007f399ac3ddce in dri2_drawable_get_buffers (count=<synthetic pointer>, atts=0x55d540084c10, drawable=0x55d540db33d0) at ../src/gallium/state_trackers/dri/dri2.c:186
#87315 dri2_allocate_textures (ctx=<optimised out>, drawable=0x55d540db33d0, statts=0x55d540084c10, statts_count=3) at ../src/gallium/state_trackers/dri/dri2.c:402
#87316 0x00007f399ac3f735 in dri_st_framebuffer_validate (stctx=<optimised out>, stfbi=<optimised out>, statts=0x55d540084c10, count=3, out=0x7ffc811cee60) at ../src/gallium/state_trackers/dri/dri_drawable.c:85
#87317 0x00007f399b0cf1aa in st_framebuffer_validate (stfb=0x55d540084740, st=st@entry=0x55d53ebc79b0) at ../src/mesa/state_tracker/st_manager.c:222
#87318 0x00007f399b0cf489 in st_api_make_current (stapi=<optimised out>, streadi=0x55d540db33d0, stdrawi=0x55d540db33d0, stctxi=0x55d53ebc79b0) at ../src/mesa/state_tracker/st_manager.c:1082
#87319 st_api_make_current (stapi=<optimised out>, stctxi=0x55d53ebc79b0, stdrawi=0x55d540db33d0, streadi=0x55d540db33d0) at ../src/mesa/state_tracker/st_manager.c:1057
#87320 0x00007f399ac3f131 in dri_make_current (cPriv=<optimised out>, driDrawPriv=<optimised out>, driReadPriv=<optimised out>) at ../src/gallium/state_trackers/dri/dri_context.c:301
#87321 0x00007f399ac3935a in driBindContext (pcp=<optimised out>, pdp=<optimised out>, prp=<optimised out>) at ../src/mesa/drivers/dri/common/dri_util.c:580
#87322 0x00007f399c5389f2 in __glXForceCurrent (cl=0x55d53f3a0818, tag=<optimised out>, error=error@entry=0x7ffc811cefa4) at ../../../../glx/glxext.c:638
#87323 0x00007f399c53c6ad in __glXDisp_Flush (cl=<optimised out>, pc=<optimised out>) at ../../../../glx/single2.c:220
#87324 0x000055d53b730a63 in ()
#87325 0x000055d53b5fdee4 in ()
#87326 0x000055d53b601f94 in ()
#87327 0x00007f399c8541e3 in __libc_start_main (main=0x55d53b5eba00, argc=12, argv=0x7ffc811cf188, init=<optimised out>, fini=<optimised out>, rtld_fini=<optimised out>, stack_end=0x7ffc811cf178) at ../csu/libc-start.c:308
#87328 0x000055d53b5eba3e in _start ()