davidsu
Posts: 6
Joined: Mon Sep 21, 2015 10:11 am

About SDL2 freeze

Mon Sep 21, 2015 10:27 am

Hello,
I write a game in this board ,
I use SDL2 as my 2D library,
But the game is always random freeze
I use
sudo vcdbg reloc

to dump GPU status

I find "heap corruption detected" in the end of the dump message

How can I find the corrupt position ?
or any other information to help me to solve the problem

the attachment file is the dump message.

sorry about my bad english.

Tks.
Attachments
reloc.zip
(4.71 KiB) Downloaded 81 times
Last edited by davidsu on Wed Oct 14, 2015 7:18 am, edited 1 time in total.

davidsu
Posts: 6
Joined: Mon Sep 21, 2015 10:11 am

Re: About SDL2

Thu Sep 24, 2015 4:02 am

I have some extra information
I use Raspberry Pi 2 with 1G ram,
and resolution 1920x1080 p 60
When it freeze , I use ssh connect to the system and dump some message

It freeze because of "futex_" and in eglSwapBuffers ()

But the same program , when I change config.txt to

hdmi_group=2 (DMT)
hdmi_mode=81 1366x768 60 Hz

It is not freeze ,

I think it is freeze because of egl or driver.

Adn the same program , I disable Loading Message when the png and wav file loading(without use any 2D graphic function) ,
and the resolution is 1920x1080 p 60 ,and It is not freeze too ,



pi@raspberrypi ~/crush $ uname -a
Linux raspberrypi 4.1.7-v7+ #815 SMP PREEMPT Thu Sep 17 18:34:33 BST 2015 armv7l GNU/Linux
pi@raspberrypi ~/crush $ ps -al
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
4 S 1000 2331 2318 0 80 0 - 1570 wait tty1 00:00:00 bash
4 S 0 2351 2331 0 80 0 - 1150 poll_s tty1 00:00:00 sudo
4 S 0 2352 2351 0 80 0 - 1071 wait tty1 00:00:00 run.sh
4 S 0 2353 2352 39 80 0 - 24105 futex_ tty1 00:00:43 S.SB00.1
0 R 1000 2383 2364 0 80 0 - 1038 - pts/0 00:00:00 ps
pi@raspberrypi ~/crush $ cd sb_game/
pi@raspberrypi ~/crush/sb_game $ sudo ./dd.sh
(gdb) attach 2353
Attaching to process 2353
Reading symbols from /home/pi/crush/sb_game/Build/ENG.S.SB00.1/Release/S.SB00.1...done.
Reading symbols from /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so
Reading symbols from /home/pi/crush/agos/Target/S.ENG/0.0/Release/libGameOSAllegro.0.1.so...done.
Loaded symbols for /home/pi/crush/agos/Target/S.ENG/0.0/Release/libGameOSAllegro.0.1.so
Reading symbols from /home/pi/crush/agos/Target/S.ENG/0.0/Release/libGameOSMain.0.1.so...done.
Loaded symbols for /home/pi/crush/agos/Target/S.ENG/0.0/Release/libGameOSMain.0.1.so
Reading symbols from /home/pi/crush/agos/Target/S.ENG/0.0/Release/libGameOSRand.0.1.so...done.
Loaded symbols for /home/pi/crush/agos/Target/S.ENG/0.0/Release/libGameOSRand.0.1.so
Reading symbols from /home/pi/crush/agos/Target/S.ENG/0.0/Release/libGameOSSys.0.1.so...done.
Loaded symbols for /home/pi/crush/agos/Target/S.ENG/0.0/Release/libGameOSSys.0.1.so
Reading symbols from /home/pi/crush/agos/Target/S.ENG/0.0/Release/libGameOSDriver.0.1.so...done.
Loaded symbols for /home/pi/crush/agos/Target/S.ENG/0.0/Release/libGameOSDriver.0.1.so
Reading symbols from /usr/local/lib/libSDL2-2.0.so.0...done.
Loaded symbols for /usr/local/lib/libSDL2-2.0.so.0
Reading symbols from /lib/arm-linux-gnueabihf/libpthread.so.0...(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
[New Thread 0x730c3460 (LWP 2358)]
[New Thread 0x73959460 (LWP 2357)]
[New Thread 0x74159460 (LWP 2356)]
[New Thread 0x74959460 (LWP 2355)]
[New Thread 0x75159460 (LWP 2354)]
Loaded symbols for /lib/arm-linux-gnueabihf/libpthread.so.0
Reading symbols from /usr/local/lib/libSDL2_image-2.0.so.0...done.
Loaded symbols for /usr/local/lib/libSDL2_image-2.0.so.0
Reading symbols from /usr/local/lib/libSDL2_ttf-2.0.so.0...done.
Loaded symbols for /usr/local/lib/libSDL2_ttf-2.0.so.0
Reading symbols from /usr/local/lib/libSDL2_mixer-2.0.so.0...done.
Loaded symbols for /usr/local/lib/libSDL2_mixer-2.0.so.0
Reading symbols from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
Reading symbols from /lib/arm-linux-gnueabihf/libm.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/arm-linux-gnueabihf/libm.so.6
Reading symbols from /lib/arm-linux-gnueabihf/librt.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/arm-linux-gnueabihf/librt.so.1
Reading symbols from /lib/arm-linux-gnueabihf/libgcc_s.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/arm-linux-gnueabihf/libgcc_s.so.1
Reading symbols from /lib/arm-linux-gnueabihf/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/arm-linux-gnueabihf/libc.so.6
Reading symbols from /opt/vc/lib/libbcm_host.so...(no debugging symbols found)...done.
Loaded symbols for /opt/vc/lib/libbcm_host.so
Reading symbols from /lib/arm-linux-gnueabihf/libdl.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/arm-linux-gnueabihf/libdl.so.2
Reading symbols from /lib/ld-linux-armhf.so.3...(no debugging symbols found)...done.
Loaded symbols for /lib/ld-linux-armhf.so.3
Reading symbols from /usr/lib/arm-linux-gnueabihf/libfreetype.so.6...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/arm-linux-gnueabihf/libfreetype.so.6
Reading symbols from /lib/arm-linux-gnueabihf/libz.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/arm-linux-gnueabihf/libz.so.1
Reading symbols from /lib/arm-linux-gnueabihf/libpng12.so.0...(no debugging symbols found)...done.
Loaded symbols for /lib/arm-linux-gnueabihf/libpng12.so.0
Reading symbols from /opt/vc/lib/libvcos.so...done.
Loaded symbols for /opt/vc/lib/libvcos.so
Reading symbols from /opt/vc/lib/libvchiq_arm.so...(no debugging symbols found)...done.
Loaded symbols for /opt/vc/lib/libvchiq_arm.so
Reading symbols from /lib/arm-linux-gnueabihf/libudev.so.0...(no debugging symbols found)...done.
Loaded symbols for /lib/arm-linux-gnueabihf/libudev.so.0
Reading symbols from /usr/lib/arm-linux-gnueabihf/libjpeg.so.8...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/arm-linux-gnueabihf/libjpeg.so.8
Reading symbols from /opt/vc/lib/libGLESv2.so...(no debugging symbols found)...done.
Loaded symbols for /opt/vc/lib/libGLESv2.so
Reading symbols from /opt/vc/lib/libEGL.so...(no debugging symbols found)...done.
Loaded symbols for /opt/vc/lib/libEGL.so
0x755b4770 in sem_wait@@GLIBC_2.4 ()
from /lib/arm-linux-gnueabihf/libpthread.so.0
(gdb) back
#0 0x755b4770 in sem_wait@@GLIBC_2.4 ()
from /lib/arm-linux-gnueabihf/libpthread.so.0
#1 0x730cf538 in eglSwapBuffers () from /opt/vc/lib/libEGL.so
#2 0x75693f2c in SDL_EGL_SwapBuffers (_this=<optimized out>,
egl_surface=<optimized out>) at /home/pi/SDL2-2.0.3/src/video/SDL_egl.c:461
#3 0x756a0770 in SDL_GL_SwapWindow_REAL (window=0x11572b8)
at /home/pi/SDL2-2.0.3/src/video/SDL_video.c:3010
#4 0x7563c484 in SDL_RenderPresent_REAL (renderer=<optimized out>)
at /home/pi/SDL2-2.0.3/src/render/SDL_render.c:1800
#5 0x756292a0 in SDL_RenderPresent (a=<optimized out>)
at /home/pi/SDL2-2.0.3/src/dynapi/SDL_dynapi_procs.h:381
#6 0x757399d0 in vsync () at allegro/c/allegro.cpp:916
#7 0x00040790 in WaitVsync () at shell/c/main.cpp:583
#8 0x00040bb8 in vSystemProcessBlitUnit () at shell/c/main.cpp:793
#9 0x0000d06c in vStartGame (ptr=0x0) at main/c/game_main.cpp:932
#10 0x0000d11c in main (argc=1, argv=0x7e9fd7d4) at main/c/game_main.cpp:947
(gdb)

davidsu
Posts: 6
Joined: Mon Sep 21, 2015 10:11 am

Re: About SDL2

Thu Oct 08, 2015 8:05 am

More information about my problem,
some times the screen will not show all of the image(see attach)
and freeze.
the OS still working , and I can ssh to the OS,
but it can not run this program again , only reboot can resolve it

anyone have any idea ???

Please help me.
Attachments
破圖_01.jpg
the freeze screen
破圖_01.jpg (52.72 KiB) Viewed 2283 times
原圖_01.jpg
original picture
原圖_01.jpg (53.85 KiB) Viewed 2283 times

davidsu
Posts: 6
Joined: Mon Sep 21, 2015 10:11 am

Re: About SDL2

Wed Oct 14, 2015 6:56 am

I have a small program will repeat the "freeze problem"

I follow the step of this link to install SDL2 https://solarianprogrammer.com/2015/01/ ... ted-sdl-2/

This is my config.txt , I changed gpu_mem to 640

--------------------------------------------------------------------------------

# For more options and information see
# http://www.raspberrypi.org/documentatio ... fig-txt.md
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Additional overlays and parameters are documented /boot/overlays/README

gpu_mem=640

------------------------------------------------------------------------------------------


about my source program ,
It can compile with

"g++ -std=c++0x -Wall -pedantic sdl2_test.cpp -o sdl2_test `sdl2-config --cflags --libs` -lSDL2_image"

1.please tar -zxvf test_sdl_logo.tar.gz to the same folder of the program

2.please put a png file with resolution (1920*1080) file to the same folder and rename to 1.png

then run the program , it will freeze after 30 sec.

if anyone have any idea please help me,thank you everybody.
Attachments
test_sdl_logo.tar.gz
two image file when loading
(60.03 KiB) Downloaded 68 times
test_sdl_freeze.tar.gz
c source program
(3.88 KiB) Downloaded 68 times

davidsu
Posts: 6
Joined: Mon Sep 21, 2015 10:11 am

Re: About SDL2 freeze

Thu Oct 15, 2015 2:54 am

Additional information ,
I follow the step of this link https://github.com/raspberrypi/userland/issues/254
I found some assert message , but it is occur before freeze.

pi@raspberrypi ~ $ sudo vcdbg log assert
001336.074: assert( source ) failed; ../../../../../middleware/confzilla/cp_front_fdt.c::cp_front_fdt_load_builtin line 115
002040.266: assert( card not initialised ) failed; ../../../../../filesystem/media/sdcard/sdcard.c::sdhost_close line 1045
pi@raspberrypi ~ $

Return to “Graphics programming”