[Bug 261041] mesa-devel: Crash when built with debug symbols. Failed Assertion in __gen_uint_nonzero

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 08 Jan 2022 18:55:01 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=261041

            Bug ID: 261041
           Summary: mesa-devel: Crash when built with debug symbols.
                    Failed Assertion in __gen_uint_nonzero
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: ashafer@badland.io

Updated to mesa-devel 21.3.b.2451 today, and was greeted with the following
crash while trying to start any graphical application (my wayland compositor,
but also while starting X). 

This happens only when building with:
make WITH_DEBUG=yes STRIP= 

Reproduced by just running startxfce4. Building without debug works fine for
me, which explains why the binary package doesn't have this problem.

Here's the backtrace from gdb Xorg:
Assertion failed: (v != 0ull), function __gen_uint_nonzero, file
src/intel/genxml/gen9_pack.h, line 82.

Thread 1 "MainThread" received signal SIGABRT, Aborted.
Sent by thr_kill() from pid 10603 and user 0.
thr_kill () at thr_kill.S:4
warning: Source file is more recent than executable.
4       RSYSCALL(thr_kill)
(gdb) bt
#0  thr_kill () at thr_kill.S:4
#1  0x00000008009f50d4 in __raise (s=s@entry=6) at
/usr/freebsd-src/lib/libc/gen/raise.c:52
#2  0x0000000800aa6769 in abort () at
/usr/freebsd-src/lib/libc/stdlib/abort.c:67
#3  0x00000008009d7ea1 in __assert (func=<optimized out>, file=<optimized out>,
line=<optimized out>, failedexpr=<optimized out>)
    at /usr/freebsd-src/lib/libc/gen/assert.c:51
#4  0x00000008036c6707 in __gen_uint_nonzero (v=0, start=22, end=28) at
src/intel/genxml/gen9_pack.h:82
#5  GFX9_3DSTATE_STENCIL_BUFFER_pack (data=0x0, dst=0x8013e0a54,
values=0x7fffffffe3a0) at src/intel/genxml/gen9_pack.h:6549
#6  isl_gfx9_emit_depth_stencil_hiz_s (dev=0x801213360, batch=0x8013e0a34,
info=0x7fffffffe4e0) at ../src/intel/isl/isl_emit_depth_stencil.c:324
#7  0x0000000803657391 in isl_emit_depth_stencil_hiz_s (dev=0x801213360,
batch=0x8013e0a34, info=0x7fffffffe4e0) at ../src/intel/isl/isl.c:2462
#8  0x0000000803c279a8 in iris_set_framebuffer_state (ctx=0x80aa318b0,
state=0x80aa594d8) at ../src/gallium/drivers/iris/iris_state.c:3181
#9  0x0000000802f2227f in tc_call_set_framebuffer_state (pipe=0x80aa318b0,
call=0x80aa594d0, last=0x80aa59638)
    at ../src/gallium/auxiliary/util/u_threaded_context.c:1064
#10 0x0000000802f219e8 in tc_batch_execute (job=0x80aa593e8, gdata=0x0,
thread_index=0)
    at ../src/gallium/auxiliary/util/u_threaded_context.c:211
#11 0x0000000802f217f2 in _tc_sync (tc=0x80aa58040, info=0x801f39a16 "normal",
func=0x801f10e8a "tc_flush")
    at ../src/gallium/auxiliary/util/u_threaded_context.c:362
#12 0x0000000802f28420 in tc_flush (_pipe=0x80aa58040, fence=0x0, flags=0) at
../src/gallium/auxiliary/util/u_threaded_context.c:2997
#13 0x00000008029ff0f5 in st_flush (st=0x801320c00, fence=0x0, flags=0) at
../src/mesa/state_tracker/st_cb_flush.c:61
#14 0x00000008029ff1da in st_glFlush (ctx=0x80aa99a40, gallium_flush_flags=0)
at ../src/mesa/state_tracker/st_cb_flush.c:95
#15 0x000000080265af4f in _mesa_flush (ctx=0x80aa99a40) at
../src/mesa/main/context.c:1656
#16 0x000000080265b090 in _mesa_Flush () at ../src/mesa/main/context.c:1690
#17 0x0000000801d42893 in shared_dispatch_stub_217 () at
src/mapi/shared-glapi/glapi_mapi_tmp.h:21678
#18 0x0000000801b3a8e9 in  () at /usr/local/lib/xorg/modules/libglamoregl.so
#19 0x0000000801b1824b in  () at
/usr/local/lib/xorg/modules/drivers/modesetting_drv.so
#20 0x0000000801b1771b in  () at
/usr/local/lib/xorg/modules/drivers/modesetting_drv.so
#21 0x00000000002a49de in BlockHandler ()
#22 0x000000000041501a in WaitForSomething ()
#23 0x00000000002994ac in  ()
#24 0x00000000002a3e3c in  ()
#25 0x000000000028c520 in _start ()

uname -a: 
FreeBSD 14.0-CURRENT FreeBSD 14.0-CURRENT #6 main-n251309-fc21aafe5ff2: Sat Dec
 4 00:13:35 EST 2021    
root@mick:/usr/obj/usr/freebsd-src/amd64.amd64/sys/GENERIC-NODEBUG  amd64

Also installed are mesa-dri/mesa-libs at 21.1.8, drm-kmod (aka
drm-current-kmod-5.4.144.g20211012)

It seems someone noticed this on android:
https://gitlab.freedesktop.org/mesa/mesa/-/issues/5653

Sounds like a recent mesa commit might have started tripping the assertions
they added last October? Feels like a mesa issue, but somehow might be
triggered by how we build WITH_DEBUG? Can someone else please verify this to
rule out it being an issue with my local build environment?

-- 
You are receiving this mail because:
You are the assignee for the bug.