[AMD][Xwayland] libSDL application sometimes freezes until window is maximized
Since commit d7f1909e (xwayland/glamor/gbm: make wl_drm optional) Since commit 6779ec5b (xwayland: Use window pixmap as a window buffer), a libSDL application I made has started randomly hanging on startup. Likely related to #1627 (closed), but I can't reproduce that one, so new issue.
EDIT: I have found an issue in my testing, this already happened before that commit, currently bisecting to find the real offending commit.
Environment
- sway (git master, commit 88b2abf5) with wlroots (git master, commit cb815e884)
- hyprland (Arch Linux 0.35.0-2) with wlroots (bundled with hyprland, commit 00b869c1)
- Xwayland (git master, commit b3b86ae6)
Symptom
The application (./build/qwertzysynth
) sometimes hangs on startup in SDL_RenderPresent()
until the window is maximized, fullscreened, or resized. The hang is probabilistic, but happens in around 5 / 6 starts of the application.
The hang also does not occur with LIBGL_ALWAYS_SOFTWARE=1 ./build/qwertzysynth
, which leads me to believe the hang is AMD-specific and likely similar to #1627 (closed).
This is the backtrace of the hang:
#0 0x00007ffff78f40bf in __GI___poll (fds=fds@entry=0x7fffffffd3b8, nfds=nfds@entry=1, timeout=timeout@entry=-1)
at ../sysdeps/unix/sysv/linux/poll.c:29
#1 0x00007ffff6a9f20b in poll (__timeout=-1, __nfds=1, __fds=0x7fffffffd3b8) at /usr/include/bits/poll2.h:39
#2 _xcb_conn_wait (c=c@entry=0x55555567d730, vector=vector@entry=0x0, count=count@entry=0x0, cond=<optimized out>)
at /usr/src/debug/libxcb/libxcb-1.16/src/xcb_conn.c:510
#3 0x00007ffff6aa129b in _xcb_conn_wait (count=0x0, vector=0x0, cond=<optimized out>, c=0x55555567d730)
at /usr/src/debug/libxcb/libxcb-1.16/src/xcb_conn.c:476
#4 xcb_wait_for_special_event (c=0x55555567d730, se=0x55555598e4f0) at /usr/src/debug/libxcb/libxcb-1.16/src/xcb_in.c:806
#5 0x00007ffff18ee3bf in dri3_wait_for_event_locked () at ../mesa-23.3.5/src/loader/loader_dri3_helper.c:591
#6 dri3_wait_for_event_locked () at ../mesa-23.3.5/src/loader/loader_dri3_helper.c:572
#7 0x00007ffff18ee5f0 in dri3_find_back () at ../mesa-23.3.5/src/loader/loader_dri3_helper.c:748
#8 0x00007ffff18eecf1 in dri3_get_buffer () at ../mesa-23.3.5/src/loader/loader_dri3_helper.c:2053
#9 0x00007ffff18ef017 in loader_dri3_get_buffers () at ../mesa-23.3.5/src/loader/loader_dri3_helper.c:2274
#10 0x00007fffe9cd0c6b in dri_image_drawable_get_buffers () at ../mesa-23.3.5/src/gallium/frontends/dri/dri2.c:325
#11 0x00007fffe9cd0de1 in dri2_allocate_textures () at ../mesa-23.3.5/src/gallium/frontends/dri/dri2.c:497
#12 0x00007fffe9cb73a4 in dri_st_framebuffer_validate () at ../mesa-23.3.5/src/gallium/frontends/dri/dri_drawable.c:79
#13 0x00007fffe9d8da1e in st_framebuffer_validate () at ../mesa-23.3.5/src/mesa/state_tracker/st_manager.c:239
#14 0x00007fffe9d8f6a2 in st_manager_validate_framebuffers () at ../mesa-23.3.5/src/mesa/state_tracker/st_manager.c:1246
#15 0x00007fffe9fee917 in st_update_framebuffer_state () at ../mesa-23.3.5/src/mesa/state_tracker/st_atom_framebuffer.c:120
#16 0x00007fffe9d81586 in st_validate_state () at ../mesa-23.3.5/src/mesa/state_tracker/st_util.h:129
#17 prepare_draw () at ../mesa-23.3.5/src/mesa/state_tracker/st_draw.c:88
#18 st_draw_gallium () at ../mesa-23.3.5/src/mesa/state_tracker/st_draw.c:141
#19 0x00007fffe9f13ec2 in _mesa_draw_arrays () at ../mesa-23.3.5/src/mesa/main/draw.c:1199
#20 0x00007fffe9f735b9 in _mesa_unmarshal_DrawArraysUserBuf () at ../mesa-23.3.5/src/mesa/main/glthread_draw.c:400
#21 0x00007fffe9d2d852 in glthread_unmarshal_batch () at ../mesa-23.3.5/src/mesa/main/glthread.c:139
#22 0x00007fffe9d353c2 in _mesa_glthread_finish () at ../mesa-23.3.5/src/mesa/main/glthread.c:399
#23 _mesa_glthread_finish () at ../mesa-23.3.5/src/mesa/main/glthread.c:364
#24 0x00007fffe9cb9820 in dri_flush () at ../mesa-23.3.5/src/gallium/frontends/dri/dri_drawable.c:494
#25 0x00007ffff18ef90f in loader_dri3_swap_buffers_msc.constprop.0 () at ../mesa-23.3.5/src/loader/loader_dri3_helper.c:1039
#26 0x00007ffff18db7bb in glXSwapBuffers () at ../mesa-23.3.5/src/glx/glxcmds.c:677
#27 0x00007ffff7e8d44a in X11_GL_SwapWindow (_this=<optimized out>, window=<optimized out>)
at /usr/src/debug/sdl2/SDL2-2.30.0/src/video/x11/SDL_x11opengl.c:1009
#28 0x00007ffff7df1cde in SDL_RenderPresent_REAL (renderer=0x5555559aa960)
at /usr/src/debug/sdl2/SDL2-2.30.0/src/render/SDL_render.c:4255
#29 SDL_RenderPresent_REAL (renderer=0x5555559aa960) at /usr/src/debug/sdl2/SDL2-2.30.0/src/render/SDL_render.c:4241
#30 0x00007ffff7e5f2cc in SDL_UpdateWindowTexture (unused=<optimized out>, window=<optimized out>, rects=0x7fffffffdd20,
numrects=<optimized out>) at /usr/src/debug/sdl2/SDL2-2.30.0/src/video/SDL_video.c:367
#31 0x00007ffff7e59a51 in SDL_UpdateWindowSurface_REAL (window=0x5555556e1d40)
at /usr/src/debug/sdl2/SDL2-2.30.0/src/video/SDL_video.c:2772
#32 0x00007ffff7df1cde in SDL_RenderPresent_REAL (renderer=0x555556047260)
at /usr/src/debug/sdl2/SDL2-2.30.0/src/render/SDL_render.c:4255
#33 SDL_RenderPresent_REAL (renderer=0x555556047260) at /usr/src/debug/sdl2/SDL2-2.30.0/src/render/SDL_render.c:4241
#34 0x0000555555562c6f in Render::render (this=0x555555654690 <app+16>) at /home/yrlf/Programming/cpp/qwertzysynth/src/render.cpp:22
#35 0x000055555555d856 in App::run (this=0x555555654680 <app>) at /home/yrlf/Programming/cpp/qwertzysynth/src/app.cpp:39
#36 0x0000555555561457 in main (argc=1, argv=0x7fffffffdf68) at /home/yrlf/Programming/cpp/qwertzysynth/src/main.cpp:12
#37 0x00007ffff781ecd0 in __libc_start_call_main (main=main@entry=0x5555555613df <main(int, char**)>, argc=argc@entry=1,
argv=argv@entry=0x7fffffffdf68) at ../sysdeps/nptl/libc_start_call_main.h:58
#38 0x00007ffff781ed8a in __libc_start_main_impl (main=0x5555555613df <main(int, char**)>, argc=1, argv=0x7fffffffdf68,
init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdf58) at ../csu/libc-start.c:360
#39 0x0000555555559715 in _start ()