| Summary: | Wayland clients segfault | ||
|---|---|---|---|
| Product: | Mesa | Reporter: | Scott Moreau <oreaus> |
| Component: | Mesa core | Assignee: | Default DRI bug account <dri-devel> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | medium | ||
| Version: | git | ||
| Hardware: | x86 (IA32) | ||
| OS: | Linux (All) | ||
| Whiteboard: | |||
| i915 platform: | i915 features: | ||
|
Description
Scott Moreau
2012-01-18 19:42:05 UTC
Additionally, I've built mesa with the following configuration: --with-egl-platforms=wayland,drm,x11 --disable-gallium-egl --with-dri-drivers="" --enable-gles1 --enable-gles2 --with-gallium-drivers=r300,swrast --enable-shared-glapi --enable-gbm I've also tried --enable-gallium-egl with the same result, though the bt was using gallium paths. It's hard to see how that commit could break anything. Have you made sure everything was rebuilt to match the new layout of struct gl_framebuffer, e.g. with make clean? Yes, I have a script that builds the entire stack from wayland to mesa, cairo, weston and everything in between. For each component it does git reset --hard origin/master as well as git clean -fdx and installs to a nonstandard prefix. When I first found this bug, I removed the prefix and built the entire stack fresh. I can reliably reproduce the issue or not by toggling between the bad and previous commits respectively. Hi, I can confirm this issue also happens with a r600 card. Here's an example of my backtrace from the weston-desktop-shell client crashing: #0 0x00007ffff4601fba in st_framebuffer_validate.isra.3 () from /home/damien/lib/dri/r600_dri.so #1 0x00007ffff4603469 in st_api_make_current () from /home/damien/lib/dri/r600_dri.so #2 0x00007ffff45bbe8f in driBindContext () from /home/damien/lib/dri/r600_dri.so #3 0x00007ffff71bde90 in dri2_make_current () from /home/damien/lib/libEGL.so.1 #4 0x00007ffff71b6159 in eglMakeCurrent () from /home/damien/lib/libEGL.so.1 #5 0x00007ffff771e58d in cairo_egl_device_create () from /home/damien/lib/libcairo.so.2 #6 0x0000000000409545 in init_egl (d=0x620630) at window.c:2822 #7 display_create (argc=0x7fffffffde0c, argv=0x7fffffffde00, option_entries=<optimized out>) at window.c:2926 #8 0x00000000004040a6 in main (argc=1, argv=0x7fffffffdf58) at desktop-shell.c:672 When I build mesa from commit 21b28d520ff218d165e86aa71dbd02050a3aa0cd (just before the first bad commit), then it works fine. I can also confirm the bad commit, with a different codebase than Wayland (but exactly the same mesa backtrace). I use nouveau. It might be useful if you post the backtrace, what program you're running and give more details about your system etc. Another report from irc: <stfacc> hi, whenever I try to run any wayland client I get a segfault <stfacc> here is the bt http://dpaste.com/691450/ <stfacc> this happens for all clients using cairo (simple-egl works for example) bt paste contents: #0 st_framebuffer_validate (stfb=0x7ffff0acbce0, st=<optimized out>) at state_tracker/st_manager.c:186 #1 0x00007fffefc40e68 in st_api_make_current (stapi=<optimized out>, stctxi=0x7a36e0, stdrawi=<optimized out>, streadi=<optimized out>) at state_tracker/st_manager.c:731 #2 0x00007fffefc0238f in driBindContext (pcp=<optimized out>, pdp=<optimized out>, prp=<optimized out>) at ../../../../src/mesa/drivers/dri/common/dri_util.c:330 #3 0x00007ffff55ac670 in dri2_make_current (drv=0x623120, disp=0x6223a0, dsurf=0x0, rsurf=0x0, ctx=0x62b3c0) at egl_dri2.c:818 #4 0x00007ffff55a5829 in eglMakeCurrent (dpy=0x6223a0, draw=0x0, read=0x0, ctx=0x62b3c0) at eglapi.c:502 #5 0x00007ffff61effcd in _egl_make_current_surfaceless (ctx=<optimized out>) at cairo-egl-context.c:127 #6 cairo_egl_device_create (dpy=0x6223a0, egl=0x62b3c0) at cairo-egl-context.c:160 #7 0x00000000004093f7 in init_egl (d=0x61d200) at window.c:2822 #8 display_create (argc=0x7fffffffdb1c, argv=0x7fffffffdb10, option_entries=<optimized out>) at window.c:2926 #9 0x0000000000404767 in main (argc=1, argv=0x7fffffffdc38) at gears.c:373 Sorry, here are some more details.
ran@ran:~$ uname -sr
Linux 3.2.1-1-ARCH
ran@ran:~$ lspci | grep nVi
01:00.0 VGA compatible controller: nVidia Corporation G94 [GeForce 9600 GT] (rev a1)
ran@ran:~$ glxinfo | grep nouveau -A3
OpenGL vendor string: nouveau
OpenGL renderer string: Gallium 0.4 on NV94
OpenGL version string: 2.1 Mesa 8.0-devel (git-c25e5300)
OpenGL shading language version string: 1.20
Mesa config:
--with-dri-drivers= --with-gallium-drivers=nouveau
--with-egl-platforms=drm,x11 --enable-gallium-egl
--enable-shared-dricore --enable-shared-glapi --enable-egl
--enable-gles2 --enable-glx-tls --enable-xcb --enable-texture-float
And the backtrace:
Core was generated by `./test_terminal'.
Program terminated with signal 11, Segmentation fault.
#0 st_framebuffer_validate (stfb=0x7f89888e1e60, st=<optimized out>) at state_tracker/st_manager.c:186
186 int32_t new_stamp = p_atomic_read(&stfb->iface->stamp);
(gdb) bt
#0 st_framebuffer_validate (stfb=0x7f89888e1e60, st=<optimized out>) at state_tracker/st_manager.c:186
#1 0x00007f8987a5ca28 in st_api_make_current (stapi=<optimized out>, stctxi=0x1588910, stdrawi=<optimized out>, streadi=<optimized out>)
at state_tracker/st_manager.c:731
#2 0x00007f89879b47cf in driBindContext (pcp=<optimized out>, pdp=<optimized out>, prp=<optimized out>)
at ../../../../src/mesa/drivers/dri/common/dri_util.c:330
#3 0x00007f898c1aba60 in dri2_make_current (drv=0x14a4a70, disp=0x149eb20, dsurf=0x0, rsurf=0x0, ctx=0x14a5690) at egl_dri2.c:818
#4 0x00007f898c1a4d39 in eglMakeCurrent (dpy=0x149eb20, draw=0x0, read=0x0, ctx=0x14a5690) at eglapi.c:502
#5 0x00000000004065b2 in context_use (ctx=0x149c700) at src/output_context.c:589
#6 0x0000000000405206 in compositor_use (comp=0x146cf50) at src/output.c:936
#7 0x00000000004039e0 in setup_app (app=0x7fff094f6440) at tests/test_terminal.c:224
#8 0x0000000000403b98 in main (argc=1, argv=0x7fff094f6588) at tests/test_terminal.c:273
This only happens if eglMakeCurrent is called twice, which is the case in my program and in wayland also (e.g. there's a call to eglMakeCurrent followed by a call to cairo_egl_device_create, which also calls eglMakeCurrent).
Since we use the surfaceless extension the first call to st_manager.c:st_api_make_current uses an incomplete buffer as a dummy (I think?), so then:
(gdb) print stfb == &IncompleteFramebuffer
$11 = 1
In the next call the following check at st_manager.c:730 :
if (stdraw && stread) {
passes but:
(gdb) print stfb->iface
$28 = (struct st_framebuffer_iface *) 0x0
So there's a null dereference. I'm not familiar with mesa so I can't help with a (correct) patch.
(In reply to comment #9) > Possible fix: > http://lists.freedesktop.org/archives/mesa-dev/2012-January/018029.html I tested this patch and it solves the issue with weston clients here on r300g. Thanks Alex. The tested patch is committed as 36fb83e4a868e047521b3d5e0edc4d7a77a96aaf, closing. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.