drisw crashes on calling NULL putImage on EGL surfaceless platform (pbuffer EGLSurface)
With wayland/weston!344 (merged) I want to start testing Weston's GL-renderer in Gitlab CI with llvmpipe. That merge request hooks up the test, and the test succeeds on i965 classic driver, but crashes on llvmpipe.
Weston's headless backend uses the EGL surfaceless platform, and it expects to be able to eglSwapBuffers()
on a pbuffer EGLSurface
. The crash happens on eglMakeCurrent()
though.
The crash occurs on Mesa master branch of today, and I am not aware of any Mesa version where it works.
To test, get wayland/weston!344 (merged), build it (default configuration should be fine), and in the build directory execute the one failing test like this:
LIBGL_ALWAYS_SOFTWARE=1 ./tests/test-subsurface-shot -f 2
It prints some logging output and then segfaults.
The segfault is in drisw.c
put_image()
where it attempts to call loader->putImage()
but the function pointer is NULL
.
Backtrace:
#0 0x0000000000000000 in ()
#1 0x00007ffff4b43cd4 in put_image (dPriv=0x5555556056f0, data=0x7ffff0525040, width=320, height=256)
at ../../git/mesa/src/gallium/state_trackers/dri/drisw.c:63
#2 0x00007ffff4b440d9 in drisw_put_image (drawable=0x5555557eb660, data=0x7ffff0525040, width=320, height=256)
at ../../git/mesa/src/gallium/state_trackers/dri/drisw.c:172
#3 0x00007ffff4b930b2 in dri_sw_displaytarget_display (ws=0x5555555dc520, dt=0x555555823cb0, context_private=0x5555557eb660, box=0x0)
at ../../git/mesa/src/gallium/winsys/sw/dri/dri_sw_winsys.c:280
#4 0x00007ffff4b95073 in llvmpipe_flush_frontbuffer
(_screen=0x5555555e0b10, resource=0x55555583f1a0, level=0, layer=0, context_private=0x5555557eb660, sub_box=0x0)
at ../../git/mesa/src/gallium/drivers/llvmpipe/lp_screen.c:703
#5 0x00007ffff4b4420c in drisw_present_texture (dPriv=0x5555556056f0, ptex=0x55555583f1a0, sub_box=0x0)
at ../../git/mesa/src/gallium/state_trackers/dri/drisw.c:207
#6 0x00007ffff4b44274 in drisw_copy_to_front (dPriv=0x5555556056f0, ptex=0x55555583f1a0)
at ../../git/mesa/src/gallium/state_trackers/dri/drisw.c:224
#7 0x00007ffff4b444da in drisw_flush_frontbuffer (ctx=0x555555607f10, drawable=0x5555557eb660, statt=ST_ATTACHMENT_FRONT_LEFT)
at ../../git/mesa/src/gallium/state_trackers/dri/drisw.c:295
#8 0x00007ffff4b4a602 in dri_st_framebuffer_flush_front (stctx=0x5555557e45f0, stfbi=0x5555557eb660, statt=ST_ATTACHMENT_FRONT_LEFT)
at ../../git/mesa/src/gallium/state_trackers/dri/dri_drawable.c:127
#9 0x00007ffff4c19db4 in st_manager_flush_frontbuffer (st=0x5555557e45f0) at ../../git/mesa/src/mesa/state_tracker/st_manager.c:1156
#10 0x00007ffff4c3191d in st_glFlush (ctx=0x555555665320) at ../../git/mesa/src/mesa/state_tracker/st_cb_flush.c:102
#11 0x00007ffff4ce6707 in _mesa_flush (ctx=0x555555665320) at ../../git/mesa/src/mesa/main/context.c:1879
#12 0x00007ffff4ce688f in _mesa_Flush () at ../../git/mesa/src/mesa/main/context.c:1917
#13 0x00007ffff5b0595e in dri2_gl_flush () at ../../git/mesa/src/egl/drivers/dri2/egl_dri2.c:112
#14 0x00007ffff5b086e4 in dri2_make_current (drv=
0x55555558f350, disp=0x55555558ed20, dsurf=0x5555557eb340, rsurf=0x5555557eb340, ctx=0x5555555dcd00)
at ../../git/mesa/src/egl/drivers/dri2/egl_dri2.c:1602
#15 0x00007ffff5af7e93 in eglMakeCurrent (dpy=0x55555558ed20, draw=0x5555557eb340, read=0x5555557eb340, ctx=0x5555555dcd00)
at ../../git/mesa/src/egl/main/eglapi.c:884
#16 0x00007ffff5b43d51 in use_output (output=0x5555557eae40) at ../../git/weston/libweston/renderer-gl/gl-renderer.c:701
#17 0x00007ffff5b465f8 in gl_renderer_repaint_output (output=0x5555557eae40, output_damage=0x7fffffffd5e0)
at ../../git/weston/libweston/renderer-gl/gl-renderer.c:1389
#18 0x00007ffff7f816d4 in headless_output_repaint (output_base=0x5555557eae40, damage=0x7fffffffd5e0, repaint_data=0x0)
at ../../git/weston/libweston/backend-headless/headless.c:131
#19 0x00007ffff7b6273b in weston_output_repaint (output=0x5555557eae40, repaint_data=0x0) at ../../git/weston/libweston/compositor.c:2724
#20 0x00007ffff7b62b58 in weston_output_maybe_repaint (output=0x5555557eae40, now=0x7fffffffd6d0, repaint_data=0x0)
at ../../git/weston/libweston/compositor.c:2791
#21 0x00007ffff7b62e80 in output_repaint_timer_handler (data=0x555555587840) at ../../git/weston/libweston/compositor.c:2858
#22 0x00007ffff7b244ab in wl_event_source_timer_dispatch (source=0x555555587ee0, ep=<optimized out>) at src/event-loop.c:236
--Type <RET> for more, q to quit, c to continue without paging--up
#23 0x00007ffff7b24af2 in wl_event_loop_dispatch (loop=0x55555557e5e0, timeout=timeout@entry=-1) at src/event-loop.c:641
#24 0x00007ffff7b2378a in wl_display_run (display=0x555555581000) at src/wayland-server.c:1350
#25 0x00007ffff7fafafb in wet_main (argc=1, argv=0x55555557fd30) at ../../git/weston/compositor/main.c:3360
#26 0x0000555555563269 in execute_compositor (setup=0x7fffffffddd0, data=0x555555585f08)
at ../../git/weston/tests/weston-test-fixture-compositor.c:278
#27 0x0000555555565370 in weston_test_harness_execute_as_client (harness=0x555555585ef0, setup=0x7fffffffddd0)
at ../../git/weston/tests/weston-test-runner.c:446
#28 0x000055555555bbaf in fixture_setup (harness=0x555555585ef0, arg=0x555555568014 <renderers+4>)
at ../../git/weston/tests/subsurface-shot-test.c:53
#29 0x000055555555bc23 in fixture_setup_run_ (harness=0x555555585ef0, arg_=0x555555568014 <renderers+4>)
at ../../git/weston/tests/subsurface-shot-test.c:55
#30 0x0000555555565701 in main (argc=3, argv=0x7fffffffdf88) at ../../git/weston/tests/weston-test-runner.c:576
(gdb) up
#1 0x00007ffff4b43cd4 in put_image (dPriv=0x5555556056f0, data=0x7ffff0525040, width=320, height=256)
at ../../git/mesa/src/gallium/state_trackers/dri/drisw.c:63
63 loader->putImage(dPriv, __DRI_SWRAST_IMAGE_OP_SWAP,
(gdb) print loader->putImage
$1 = (void (*)(__DRIdrawable *, int, int, int, int, int, char *, void *)) 0x0