[Mesa driver bug] Pure GTK4 and LibAdwaita applications are broken

  1. Pure GTK4 apps like transmission-gtk are broken.

  2. LibAdwaita apps don’t work: Pamac(LibAdwaita version) shows its entry in panel then close itself, EasyEffects launches but stays frozen.

NB: GTK3 apps work fine.

Operating System: Manjaro Linux 
KDE Plasma Version: 5.27.10
KDE Frameworks Version: 5.113.0
Qt Version: 5.15.11
Kernel Version: 6.6.7-4-MANJARO (64-bit)
Graphics Platform: Wayland

After generating a backtrace for pamac(LibAdwaita version):

Core was generated by `/usr/bin/pamac-manager'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
44            return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;                                                                                                        
[Current thread is 1 (Thread 0x7f2df09ca580 (LWP 17459))]
(gdb) bt full
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
        tid = <optimized out>
        ret = 0
        pd = <optimized out>
        old_mask = {__val = {94291712016400}}
        ret = <optimized out>
#1  0x00007f2df2fd68a3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007f2df2f86668 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
        ret = <optimized out>
#3  0x00007f2df2f6e4b8 in __GI_abort () at abort.c:79
        save_stage = 1
        act = {__sigaction_handler = {sa_handler = 0x20, sa_sigaction = 0x20}, sa_mask = {__val = {139834578298884, 0, 140725573816688, 140725573816624, 9512942639200695040, 3221775552, 94293331548216, 2, 4294967291, 3221775552, 139834578305624, 3221775551, 139834578369047, 5, 9512942639200695040, 0}}, sa_flags = 1619531832, sa_restorer = 0x8}
#4  0x00007f2dc54a0b94 in  () at /usr/lib/dri/crocus_dri.so
#5  0x00007f2dc65ee1dc in  () at /usr/lib/dri/crocus_dri.so
#6  0x00007f2dc5a10aef in  () at /usr/lib/dri/crocus_dri.so
#7  0x00007f2dc558f03f in  () at /usr/lib/dri/crocus_dri.so
#8  0x00007f2dc54b9774 in  () at /usr/lib/dri/crocus_dri.so
#9  0x00007f2ddf4dce18 in  () at /usr/lib/libEGL_mesa.so.0
#10 0x00007f2ddf4cda04 in  () at /usr/lib/libEGL_mesa.so.0
#11 0x00007f2ddf4bd376 in  () at /usr/lib/libEGL_mesa.so.0
#12 0x00007f2df3a413eb in gdk_gl_context_real_end_frame (draw_context=<optimized out>, painted=<optimized out>) at ../gtk/gdk/gdkglcontext.c:679
        heap_rects = 0x0
        i = <optimized out>
        rects = 0x7ffd39d695b0
        stack_rects = {1359, 257, 5, 379, -888, -1, -548647718, 32557, -548648800, 32557, 1617371800, 21954, 1617349328, 21954, -335315165, 32557}
        j = <optimized out>
        n_rects = 1
        surface_height = 734
        scale = <optimized out>
        context = <optimized out>
        priv = 0x55c26100f5f0
        surface = <optimized out>
        display = 0x55c2675a9870 [GdkWaylandDisplay]
        egl_surface = 0x55c26293f9b0
#13 0x00007f2df39ee318 in gdk_wayland_gl_context_end_frame (draw_context=0x55c26100f640 [GdkWaylandGLContext], painted=0x7f2de4007d80) at ../gtk/gdk/wayland/gdkglcontext-wayland.c:81
        surface = 0x55c260668820 [GdkWaylandToplevel]
        impl = 0x55c260668820 [GdkWaylandToplevel]
        dx = <optimized out>
        dy = 0
#14 0x00007f2df3a3092b in gdk_draw_context_end_frame (context=0x55c26100f640 [GdkWaylandGLContext]) at ../gtk/gdk/gdkdrawcontext.c:441
--Type <RET> for more, q to quit, c to continue without paging--c
        priv = <optimized out>
        __func__ = "gdk_draw_context_end_frame"
#15 0x00007f2df3a7bbfc in gsk_gl_renderer_render (renderer=0x55c26066b2a0 [GskGLRenderer], root=0x55c2626dc3f0 [GskContainerNode], update_area=<optimized out>)
    at ../gtk/gsk/gl/gskglrenderer.c:318
        self = 0x55c26066b2a0 [GskGLRenderer]
        render_region = 0x55c26276b950
        viewport = {origin = {x = 0, y = 0}, size = {width = 1366, height = 734}}
        job = 0x55c262798b10
        surface = <optimized out>
        clear_framebuffer = <optimized out>
        scale = <optimized out>
        __func__ = "gsk_gl_renderer_render"
#16 0x00007f2df3a591a5 in gsk_renderer_render (renderer=0x55c26066b2a0 [GskGLRenderer], root=0x55c2626dc3f0 [GskContainerNode], region=<optimized out>) at ../gtk/gsk/gskrenderer.c:460
        priv = <optimized out>
        clip = 0x55c2607b5360
        __func__ = "gsk_renderer_render"
#17 0x00007f2df3874af2 in gtk_widget_render (widget=<optimized out>, surface=<optimized out>, region=0x55c267d76ee0) at ../gtk/gtk/gtkwidget.c:11969
        priv = <optimized out>
        snapshot = <optimized out>
        renderer = 0x55c26066b2a0 [GskGLRenderer]
        root = 0x55c2626dc3f0 [GskContainerNode]
        x = 0
        y = 0
#18 0x00007f2df3875a39 in surface_render () at ../gtk/gtk/gtkwindow.c:4800
Python Exception <class 'gdb.error'>: value has been optimized out

It seems to be a driver problem with latest mesa 23.3.1-1, after downgrading:

mesa (1:23.3.1-1 -> 1:23.1.9-1)
lib32-libva-mesa-driver (1:23.3.1-1 -> 1:23.1.9-1)
lib32-mesa (1:23.3.1-1 -> 1:23.1.9-1)

All pure GTK4 and LibAdwaita apps work again.