-Downgraded to SDL2 2.0.4 on the Pi. That implies going back to the BCRM video driver, instead of the modern KMSDRM driver I was using on SDL2 2.0.8 (There's no KMSDRM driver on SDL 2.0.4). No more crashes on exit with latest GZDoom 3.3.1.
-Built and installed latest stable SDL2 2.0.8 on the Pi with BCRM video driver instead of KMSDRM/VC4. No more crashes on exit with latest GZDoom 3.3.1.
Conclussion of this part: On the Raspberry Pi, crashes the on exit only happen with SDL 2.0.8 + KMSDRM.
Then went to X86_64. Latest GZDoom 3.3.1 sources.
-No crashes on exit with default SDL2 2.0.6 installed on Ubuntu 17.10, which runs on X11 driver.
-No chasres on exit with latest stable SDL2 2.0.8 manually built and installed on the same system, running on the X11 driver.
-Crashes EXACTLY the same as the Pi does when running on latest stable SDL2 2.0.8 on the KMSDRM driver.
Final conclussion for now: It's the KMSDRM driver that's making a difference. I am not saying it's the cause, but it's making GZDoom (and ZDoom in fact) crash in every GZDoom/ZDoom version I have tried.
It crashes the same on the Pi or in a X86_64 setup.
Now the funny part is, I did part of the KMSDRM driver myself time ago (it was mostly the work of Sigmaris), and sent it to the SDL2 mailing list to be merged as the only way to have X-less accelerated graphics in SDL2 games, like ZDoom.
But I can't find or start to understand what is going on here. Looking at this GDB session I just did:
Code: Select all
Thread 1 "gzdoom" received signal SIGSEGV, Segmentation fault.
malloc_consolidate (av=av@entry=0x76ba3794 <main_arena>) at malloc.c:4202
4202 malloc.c: No such file or directory.
(gdb) bt
#0 malloc_consolidate (av=av@entry=0x76ba3794 <main_arena>) at malloc.c:4202
#1 0x76ad72e4 in _int_malloc (av=av@entry=0x76ba3794 <main_arena>, bytes=bytes@entry=896) at malloc.c:3488
#2 0x76ad9370 in __GI___libc_malloc (bytes=bytes@entry=896) at malloc.c:2928
#3 0x76ad9d64 in __GI___libc_realloc (oldmem=0x0, bytes=896) at malloc.c:3011
#4 0x00b82c00 in M_Realloc_Dbg (memblock=0x0, size=896, file=0x12605f8 "/home/pi/src/gzdoom-g3.3.1/src/./tarray.h", lineno=470)
at /home/pi/src/gzdoom-g3.3.1/src/m_alloc.cpp:152
#5 0x00cdf528 in TArray<FSectorPortal, FSectorPortal>::DoResize (this=0x13f16e8 <level+232>)
at /home/pi/src/gzdoom-g3.3.1/src/./tarray.h:470
#6 0x00cdf31c in TArray<FSectorPortal, FSectorPortal>::Grow (this=0x13f16e8 <level+232>, amount=2)
at /home/pi/src/gzdoom-g3.3.1/src/./tarray.h:381
#7 0x00cdecdc in TArray<FSectorPortal, FSectorPortal>::Resize (this=0x13f16e8 <level+232>, amount=2)
at /home/pi/src/gzdoom-g3.3.1/src/./tarray.h:390
#8 0x00d5b6ac in P_ClearPortals () at /home/pi/src/gzdoom-g3.3.1/src/portal.cpp:516
#9 0x00d04f80 in P_FreeLevelData () at /home/pi/src/gzdoom-g3.3.1/src/p_setup.cpp:3527
#10 0x00d0750c in P_Shutdown () at /home/pi/src/gzdoom-g3.3.1/src/p_setup.cpp:4267
#11 0x006da8d0 in call_terms () at /home/pi/src/gzdoom-g3.3.1/src/posix/sdl/i_main.cpp:131
#12 0x76a95dd4 in __run_exit_handlers (status=0, listp=0x76ba34ac <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true,
run_dtors=run_dtors@entry=true) at exit.c:83
#13 0x76a95e34 in __GI_exit (status=<optimized out>) at exit.c:105
#14 0x006e0e44 in ST_Endoom () at /home/pi/src/gzdoom-g3.3.1/src/posix/sdl/st_start.cpp:353
#15 0x00ec105c in <lambda()>::operator()(void) const (__closure=0x0) at /home/pi/src/gzdoom-g3.3.1/src/menu/messagebox.cpp:119
#16 0x00ec108c in <lambda()>::_FUN(void) () at /home/pi/src/gzdoom-g3.3.1/src/menu/messagebox.cpp:120
#17 0x00ec0cf0 in AF_DMessageBoxMenu_CallHandler (param=0x1cecae0, defaultparam=..., numparam=1, ret=0x7effda40, numret=0)
at /home/pi/src/gzdoom-g3.3.1/src/menu/messagebox.cpp:57
#18 0x01003374 in VMExec_Checked::Exec (stack=0x76ff44c8, pc=0x1b526b8, ret=0x7effded0, numret=0)
at /home/pi/src/gzdoom-g3.3.1/src/scripting/vm/vmexec.h:702
#19 0x0100341c in VMExec_Checked::Exec (stack=0x76ff44c8, pc=0x1b529b0, ret=0x7effe3cc, numret=1)
at /home/pi/src/gzdoom-g3.3.1/src/scripting/vm/vmexec.h:721
#20 0x0101d988 in VMCall (func=0x26ad25c, params=0x7effe398, numparams=3, results=0x7effe3cc, numresults=1)
at /home/pi/src/gzdoom-g3.3.1/src/scripting/vm/vmframe.cpp:463
---Type <return> to continue, or q <return> to quit---
#21 0x00eb0b08 in DMenu::CallMenuEvent (this=0x2bfc9b0, mkey=6, fromcontroller=false)
at /home/pi/src/gzdoom-g3.3.1/src/menu/menu.cpp:219
#22 0x00eb2f14 in M_Responder (ev=0x13e1b10 <events+96>) at /home/pi/src/gzdoom-g3.3.1/src/menu/menu.cpp:690
#23 0x00b01b6c in D_ProcessEvents () at /home/pi/src/gzdoom-g3.3.1/src/d_main.cpp:304
#24 0x00b11b00 in NetUpdate () at /home/pi/src/gzdoom-g3.3.1/src/d_net.cpp:986
#25 0x00b14db8 in TryRunTics () at /home/pi/src/gzdoom-g3.3.1/src/d_net.cpp:1841
#26 0x00b04124 in D_DoomLoop () at /home/pi/src/gzdoom-g3.3.1/src/d_main.cpp:1066
#27 0x00b09a88 in D_DoomMain () at /home/pi/src/gzdoom-g3.3.1/src/d_main.cpp:2757
#28 0x006db168 in main (argc=3, argv=0x7efff754) at /home/pi/src/gzdoom-g3.3.1/src/posix/sdl/i_main.cpp:263
(gdb) q
I can see I_ShutdownGraphics in src/posix/sdl/hardware.cpp returns with no problems at all, as do all it's subsequent SDL2 calls. I_ShutdownGraphics causes two calls on the SDL2 KMSDRM driver quitting functions: KMSDRM_DestroyWindow and SDL_EGL_DeleteContext. These internal SDL2 KMSDRM functions also return with no problems.
To summarize, I added some simple printfs to those functions beggining and ending:
Code: Select all
***ENTERING I_ShutdownGraphics
****************ENTERING SDL_DeleteContext
****************ENTERING SDL_EGL_DeleteContext
****************SDL_EGL_DeleteContext COMPLETED OK!!!!!!!!
****************SDL_DeleteContext COMPLETED OK!!!!
****************ENTERING SDL_DestroyWindown
****************ENTERING KMSDRM_DestroyWindow
****************KMSDRM_DestroyWindow COMPLETED OK!!!!!
****************SDL_DestroyWindow COMPLETED OK!!!!
***I_ShutdownGraphics COMPLETED OK!!!!!!
I would like to have this fixed, as it's the only way to low-latency ZDoom on low-end systems. Other SDL2 games, except ECWolf, seem to work fine with this SDL2 driver.
Can you please try to build SDL2 2.0.8 with the KMSDRM driver? The errors on quit DO appear on X86_64 as well, as I concluded. It's as easy as doing:
Code: Select all
./configure --enable-video-kmsdrm