I'm working with an Omega2+ (580MHz MIPS CPU, 128MB DDR2 RAM, running LEDE 17.01) on integrating DirectFB on top an already working fbdev
. The goal is to get a working media player (dfbplay
..).
I'm writing this here because this is LEDE/OpenWrt related and there are probably a few embedded developers here who may have done similiar stuff. The DirectFB support website is dead and issues on their github haven't received comments from the developers in years.
fbdev
support was compiled in through a modified kernel build detailed in (link see below). This is working fine and I can write programs interacting with /dev/fb0
, which is in turn an ILI9341 320x240 SPI display.
insmod /root/modules/fbtft_device.ko custom name="fb_ili9341" busnum=32766 cs=1 speed=96666000 mode=0x06 fps=100 txbuflen=3145728 buswidth=8 bgr=1 gpios=reset:2,dc:3 width=240 height=320 verbose=3 rotate=90 debug=2 #$((1<<5))
Since I couldn't find a Makefile
for OpenWRT/LEDE which uses the most recent DirectFB source, I cross-compiled DirectFB with the OnionIoT/source
toolchain and the following configure
call:
./configure --host=mipsel-openwrt-linux --disable-osx --disable-x11 --enable-debug-support --disable-network \
--disable-mmx --disable-sse --enable-fbdev --disable-sdl --disable-vnc --with-inputdrivers=linuxinput --with-gfxdrivers=none \
--disable-wayland --disable-egl-united --disable-png --disable-x11 --disable-video4linux --disable-x11vdpau \
--without-tools --prefix="/home/max/DirectFB/install_dir/" --exec-prefix="/home/max/DirectFB/install_dir/" \
--disable-multi --disable-multicore --enable-debug --with-tests
I couldn't compile the vanilla source on the gcc-musl toolchain, so I had to apply patches fixing code related to sigval_t
and mutexes (no PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
on musl). The applied patches are here.
This made DirectFB compile, however unfunctional. Executing any of the programs or tests results in the program hanging up. I then have to kill it with Ctrl+C
.
My .directfbrx
is
root@Omega-C465:~# cat .directfbrc
system=fbdev
module-dir=/usr/lib/directfb-1.8-0/
fbdev=/dev/fb0
mode=320x240
depth=16
pixelformat=RGB16
fatal-level=NONE
debug
no-hardware
The output of the program is, with debug enabled:
root@Omega-C465:~# ./dfbshow logo.bmp
DirectFB::Init() okay
(-) [(null) 7197.160,223] ( 3176) Direct/Trace: load_symbols( (null) )
(-) [(null) 7197.161,129] ( 3176) Direct/Trace: not running 'nm -nC /root/dfbshow', enable via 'nm-for-trace' option
(-) [(null) 7197.161,864] ( 3176) Direct/Main: direct_initialize() called... (from (null))
(-) [dfbshow 7197.162,587] ( 3176) Direct/Main: ...first reference, initializing now.
(-) [dfbshow 7197.163,248] ( 3176) Direct/Signals: Initializing...
(-) [dfbshow 7197.163,997] ( 3176) Direct/Thread: direct_thread_create( CRITICAL, 0x77057304(0), 'SigHandler' )
(-) [dfbshow 7197.164,721] ( 3176) Direct/Thread/Init: -> locking...
(-) [dfbshow 7197.165,394] ( 3176) Direct/Thread/Init: -> creating handle...
(-) [dfbshow 7197.166,060] ( 3176) Direct/Thread/Init: -> OTHER (-20) [0;0]
(-) [dfbshow 7197.166,811] ( 3176) Direct/Thread/Init: -> waiting...
(-) [SigHandler 7197.167,280] ( 3178) Direct/Thread/Init: direct_thread_main( 0x7708d518 )
(-) [SigHandler 7197.167,704] ( 3178) Direct/Thread/Init: -> starting...
(-) [SigHandler 7197.168,808] ( 3178) Direct/Thread/Init: -> tid 3178
(-) [SigHandler 7197.169,313] ( 3178) Direct/Signals: Blocking all signals from now on!
(-) [SigHandler 7197.169,688] ( 3178) Direct/Thread/Init: -> locking...
(-) [SigHandler 7197.170,830] ( 3178) Direct/Thread/Init: -> signalling...
(-) [SigHandler 7197.171,364] ( 3178) Direct/Thread/Init: -> unlocking...
(*) Direct/Thread: Started 'SigHandler' (3178) [CRITICAL - OTHER/0] <85288>...
(-) [dfbshow 7197.171,839] ( 3176) Direct/Thread/Init: -> ...thread is running.
(-) [dfbshow 7197.171,902] ( 3176) Direct/Thread/Init: -> unlocking...
(-) [dfbshow 7197.171,951] ( 3176) Direct/Thread/Init: -> returning 0x7708d518
~~~~~~~~~~~~~~~~~~~~~~~~~~| DirectFB 1.8.0 |~~~~~~~~~~~~~~~~~~~~~~~~~~
(c) 2012-2015 DirectFB integrated media GmbH
(c) 2001-2015 The world wide DirectFB Open Source Community
(c) 2000-2004 Convergence (integrated media) GmbH
----------------------------------------------------------------
(-) [dfbshow 7197.172,123] ( 3176) IDirectFB: IDirectFB_Construct( 0x77090f08 )
(-) [dfbshow 7197.172,187] ( 3176) DirectFB/Core: dfb_core_create...
(-) [dfbshow 7197.172,255] ( 3176) Direct/Trace: load_symbols( (null) )
(-) [dfbshow 7197.172,441] ( 3176) Direct/Trace: not running 'nm -nC /root/dfbshow', enable via 'nm-for-trace' option
(-) [dfbshow 7197.172,543] ( 3176) Direct/Main: direct_initialize() called... (from (null))
(-) [dfbshow 7197.172,596] ( 3176) Direct/Main: ...2 references now.
(*) DirectFB/Core: Single Application Core. (2018-08-19 18:44) [ DEBUG ]
(-) [dfbshow 7197.172,790] ( 3176) Core/System: 0x774c9040()
(-) [dfbshow 7197.172,854] ( 3176) Direct/Modules: direct_modules_explore_directory( 'systems' )
(-) [dfbshow 7197.173,013] ( 3176) Direct/Modules: lookup_by_file()
(-) [dfbshow 7197.173,082] ( 3176) Direct/Modules: -> allocated entry 0x7708d5c8
(-) [dfbshow 7197.173,148] ( 3176) Direct/Modules: open_module()
(-) [dfbshow 7197.173,199] ( 3176) Direct/Modules: open_module( 0x7708d5c8 'libdirectfb_devmem.so', 0 refs )
(-) [dfbshow 7197.173,273] ( 3176) Direct/Modules: Loading '/usr/lib/directfb-1.8-0//systems/libdirectfb_devmem.so'...
(-) [dfbshow 7197.174,118] ( 3176) Direct/Modules: Registering 'devmem' ('systems')...
(-) [dfbshow 7197.174,275] ( 3176) Direct/Modules: ...registered as 0x7708d5c8
(-) [dfbshow 7197.174,338] ( 3176) Direct/Modules: -> dlopen returned 0x76e54840
(-) [dfbshow 7197.174,397] ( 3176) Direct/Modules: lookup_by_file()
(-) [dfbshow 7197.174,457] ( 3176) Direct/Modules: -> allocated entry 0x417058
(-) [dfbshow 7197.174,517] ( 3176) Direct/Modules: open_module()
(-) [dfbshow 7197.174,566] ( 3176) Direct/Modules: open_module( 0x417058 'libdirectfb_dummy.so', 0 refs )
(-) [dfbshow 7197.174,640] ( 3176) Direct/Modules: Loading '/usr/lib/directfb-1.8-0//systems/libdirectfb_dummy.so'...
(-) [dfbshow 7197.175,475] ( 3176) Direct/Modules: Registering 'dummy' ('systems')...
(-) [dfbshow 7197.175,635] ( 3176) Direct/Modules: ...registered as 0x417058
(-) [dfbshow 7197.175,698] ( 3176) Direct/Modules: -> dlopen returned 0x76e54930
(-) [dfbshow 7197.175,759] ( 3176) Direct/Modules: lookup_by_file()
(-) [dfbshow 7197.175,818] ( 3176) Direct/Modules: -> allocated entry 0x76e54a68
(-) [dfbshow 7197.176,312] ( 3176) Direct/Modules: open_module()
(-) [dfbshow 7197.176,403] ( 3176) Direct/Modules: open_module( 0x76e54a68 'libdirectfb_fbdev.so', 0 refs )
(-) [dfbshow 7197.176,528] ( 3176) Direct/Modules: Loading '/usr/lib/directfb-1.8-0//systems/libdirectfb_fbdev.so'...
(-) [dfbshow 7197.178,604] ( 3176) Direct/Modules: Registering 'fbdev' ('systems')...
(-) [dfbshow 7197.178,773] ( 3176) Direct/Modules: ...registered as 0x76e54a68
(-) [dfbshow 7197.178,833] ( 3176) Direct/Modules: -> dlopen returned 0x76fee640
(-) [dfbshow 7197.178,925] ( 3176) Core/System: module 0x76e54a68
(-) [dfbshow 7197.178,981] ( 3176) Core/System: name 'fbdev'
(-) [dfbshow 7197.179,032] ( 3176) Core/System: refs 0
(-) [dfbshow 7197.179,084] ( 3176) Core/System: loaded 1
(-) [dfbshow 7197.179,135] ( 3176) Core/System: disabled 0
(-) [dfbshow 7197.179,187] ( 3176) Core/System: dynamic 1
(-) [dfbshow 7197.179,237] ( 3176) Core/System: file 'libdirectfb_fbdev.so'
(-) [dfbshow 7197.179,292] ( 3176) Direct/Modules: direct_module_ref( 0x76e54a68 'fbdev', 0 refs, loaded 1, dynamic 1, disabled 0 )
(-) [dfbshow 7197.179,484] ( 3176) Direct/Modules: -> refs 1, funcs 0x76de7438
(-) [dfbshow 7197.179,545] ( 3176) Core/System: module 0x417058
(-) [dfbshow 7197.179,594] ( 3176) Core/System: name 'dummy'
(-) [dfbshow 7197.179,647] ( 3176) Core/System: refs 0
(-) [dfbshow 7197.179,697] ( 3176) Core/System: loaded 1
(-) [dfbshow 7197.179,748] ( 3176) Core/System: disabled 0
(-) [dfbshow 7197.179,799] ( 3176) Core/System: dynamic 1
(-) [dfbshow 7197.179,849] ( 3176) Core/System: file 'libdirectfb_dummy.so'
(-) [dfbshow 7197.179,903] ( 3176) Direct/Modules: direct_module_ref( 0x417058 'dummy', 0 refs, loaded 1, dynamic 1, disabled 0 )
(-) [SigHandler 7197.183,829] ( 3178) Direct/Thread/Init: -> running...
(-) [SigHandler 7197.184,012] ( 3178) Direct/Signals: handle_signals() -> waiting for a signal...
(-) [dfbshow 7197.179,971] ( 3176) Direct/Modules: -> refs 1, funcs 0x76dfe484
(-) [dfbshow 7197.185,501] ( 3176) Direct/Modules: direct_module_unref( 0x417058 'dummy', 1 refs, loaded 1, dynamic 1, disabled 0 )
(-) [dfbshow 7197.186,221] ( 3176) Direct/Modules: unload_module()
(-) [dfbshow 7197.186,915] ( 3176) Direct/Modules: unload_module( 0x417058 'libdirectfb_dummy.so', 0 refs )
(-) [dfbshow 7197.187,361] ( 3176) Core/System: module 0x7708d5c8
(-) [dfbshow 7197.187,728] ( 3176) Core/System: name 'devmem'
(-) [dfbshow 7197.188,080] ( 3176) Core/System: refs 0
(-) [dfbshow 7197.188,416] ( 3176) Core/System: loaded 1
(-) [dfbshow 7197.188,857] ( 3176) Core/System: disabled 0
(-) [dfbshow 7197.189,199] ( 3176) Core/System: dynamic 1
(-) [dfbshow 7197.189,541] ( 3176) Core/System: file 'libdirectfb_devmem.so'
(-) [dfbshow 7197.189,898] ( 3176) Direct/Modules: direct_module_ref( 0x7708d5c8 'devmem', 0 refs, loaded 1, dynamic 1, disabled 0 )
(-) [dfbshow 7197.190,438] ( 3176) Direct/Modules: -> refs 1, funcs 0x76e1b628
(-) [dfbshow 7197.190,816] ( 3176) Direct/Modules: direct_module_unref( 0x7708d5c8 'devmem', 1 refs, loaded 1, dynamic 1, disabled 0 )
(-) [dfbshow 7197.191,219] ( 3176) Direct/Modules: unload_module()
(-) [dfbshow 7197.191,335] ( 3176) Direct/Modules: unload_module( 0x7708d5c8 'libdirectfb_devmem.so', 0 refs )
(-) [dfbshow 7197.191,795] ( 3176) Direct/Trace: load_symbols( (null) )
(-) [dfbshow 7197.192,071] ( 3176) Direct/Trace: not running 'nm -nC /root/dfbshow', enable via 'nm-for-trace' option
(-) [dfbshow 7197.192,478] ( 3176) Direct/Main: direct_initialize() called... (from (null))
(-) [dfbshow 7197.193,014] ( 3176) Direct/Main: ...3 references now.
(-) [dfbshow 7197.193,183] ( 3176) Fusion/Skirmish: fusion_skirmish_init( 0x76e54034, 'Fusion Arenas' )
(-) [dfbshow 7197.193,296] ( 3176) Direct/Thread: direct_thread_create( MESSAGING, 0x7709f4c0(0x76fee7d8), 'Fusion Dispatch' )
(-) [dfbshow 7197.193,800] ( 3176) Direct/Thread/Init: -> locking...
(-) [dfbshow 7197.193,924] ( 3176) Direct/Thread/Init: -> creating handle...
(-) [dfbshow 7197.194,004] ( 3176) Direct/Thread/Init: -> OTHER (-15) [0;0]
(-) [dfbshow 7197.194,286] ( 3176) Direct/Thread/Init: -> waiting...
(-) [Fusion Dispatch 7197.194,858] ( 3179) Direct/Thread/Init: direct_thread_main( 0x76e546a8 )
(-) [Fusion Dispatch 7197.195,291] ( 3179) Direct/Thread/Init: -> starting...
(-) [Fusion Dispatch 7197.195,644] ( 3179) Direct/Thread/Init: -> tid 3179
(-) [Fusion Dispatch 7197.195,990] ( 3179) Direct/Signals: Blocking all signals from now on!
(-) [Fusion Dispatch 7197.196,354] ( 3179) Direct/Thread/Init: -> locking...
(-) [Fusion Dispatch 7197.196,712] ( 3179) Direct/Thread/Init: -> signalling...
(-) [Fusion Dispatch 7197.197,205] ( 3179) Direct/Thread/Init: -> unlocking...
(*) Direct/Thread: Started 'Fusion Dispatch' (3179) [MESSAGING - OTHER/0] <85288>...
(-) [dfbshow 7197.197,688] ( 3176) Direct/Thread/Init: -> ...thread is running.
(-) [dfbshow 7197.197,749] ( 3176) Direct/Thread/Init: -> unlocking...
(-) [dfbshow 7197.197,798] ( 3176) Direct/Thread/Init: -> returning 0x76e546a8
(-) [dfbshow 7197.197,855] ( 3176) Direct/Signals: Adding handler 0x7728d7d8 for signal -1 with context 0x76fee738...
(-) [dfbshow 7197.197,947] ( 3176) DirectFB/Core: Initializing...
(-) [dfbshow 7197.198,076] ( 3176) DirectFB/Core: ICore_Real::Initialize()
(-) [dfbshow 7197.198,183] ( 3176) Fusion/Object: fusion_object_pool_create( 'GraphicsState Pool' )
(-) [dfbshow 7197.198,256] ( 3176) Fusion/Skirmish: fusion_skirmish_init( 0x76feec18, 'GraphicsState Pool' )
(-) [dfbshow 7197.198,363] ( 3176) Fusion/Object: fusion_object_pool_create( 'Layer Context Pool' )
(-) [dfbshow 7197.198,436] ( 3176) Fusion/Skirmish: fusion_skirmish_init( 0x76feed48, 'Layer Context Pool' )
(-) [dfbshow 7197.198,527] ( 3176) Fusion/Object: fusion_object_pool_create( 'Layer Region Pool' )
(-) [dfbshow 7197.198,599] ( 3176) Fusion/Skirmish: fusion_skirmish_init( 0x76feee78, 'Layer Region Pool' )
(-) [dfbshow 7197.198,695] ( 3176) Fusion/Object: fusion_object_pool_create( 'Palette Pool' )
(-) [dfbshow 7197.198,770] ( 3176) Fusion/Skirmish: fusion_skirmish_init( 0x4173b8, 'Palette Pool' )
(-) [dfbshow 7197.198,862] ( 3176) Fusion/Object: fusion_object_pool_create( 'Surface Pool' )
(-) [dfbshow 7197.198,934] ( 3176) Fusion/Skirmish: fusion_skirmish_init( 0x4174a8, 'Surface Pool' )
(-) [dfbshow 7197.199,023] ( 3176) Fusion/Object: fusion_object_pool_create( 'Surface Allocation Pool' )
(-) [dfbshow 7197.199,097] ( 3176) Fusion/Skirmish: fusion_skirmish_init( 0x4175b8, 'Surface Allocation Pool' )
(-) [dfbshow 7197.199,181] ( 3176) Fusion/Object: fusion_object_pool_create( 'Surface Buffer Pool' )
(-) [dfbshow 7197.199,248] ( 3176) Fusion/Skirmish: fusion_skirmish_init( 0x4176e8, 'Surface Buffer Pool' )
(-) [dfbshow 7197.199,338] ( 3176) Fusion/Object: fusion_object_pool_create( 'Surface Client Pool' )
(-) [dfbshow 7197.199,410] ( 3176) Fusion/Skirmish: fusion_skirmish_init( 0x417818, 'Surface Client Pool' )
(-) [dfbshow 7197.199,495] ( 3176) Fusion/Object: fusion_object_pool_create( 'Window Pool' )
(-) [dfbshow 7197.199,562] ( 3176) Fusion/Skirmish: fusion_skirmish_init( 0x417948, 'Window Pool' )
(-) [dfbshow 7197.199,646] ( 3176) DirectFB/Task: TaskManager_Initialise()
(-) [dfbshow 7197.199,702] ( 3176) DirectFB/Task: TaskManager::Initialise()
(-) [dfbshow 7197.199,764] ( 3176) Core/Parts: Going to initialize 'clipboard_core' core...
(-) [dfbshow 7197.199,831] ( 3176) Core/Clipboard: dfb_clipboard_core_initialize( 0x76fee738, 0x417a68, 0x417a80 )
(-) [dfbshow 7197.199,898] ( 3176) Fusion/Skirmish: fusion_skirmish_init( 0x417a84, 'Clipboard Core' )
(-) [dfbshow 7197.199,964] ( 3176) DirectFB/Core: core_arena_add_shared_field( 'clipboard_core' -> 0x417a80 )
(-) [dfbshow 7197.202,723] ( 3176) Core/Parts: Going to initialize 'colorhash_core' core...
(-) [dfbshow 7197.202,853] ( 3176) Core/ColorHash: dfb_colorhash_core_initialize( 0x76fee738, 0x417b88, 0x417bc0 )
(-) [dfbshow 7197.203,059] ( 3176) DirectFB/Core: core_arena_add_shared_field( 'colorhash_core' -> 0x417bc0 )
(-) [dfbshow 7197.203,202] ( 3176) Core/Parts: Going to initialize 'surface_core' core...
(-) [dfbshow 7197.203,324] ( 3176) Core/SurfaceCore: dfb_surface_core_initialize( 0x76fee738, 0xb92c08, 0xb92c20 )
(-) [dfbshow 7197.203,443] ( 3176) Core/SurfacePool: dfb_surface_pool_initialize2( 0x7751844c )
(-) [dfbshow 7197.203,589] ( 3176) Core/SurfacePool: init_pool( 0xb92c40, 0x7751844c )
(-) [dfbshow 7197.203,720] ( 3176) Fusion/Skirmish: fusion_skirmish_init( 0xb92c44, 'System Memory' )
(-) [dfbshow 7197.203,848] ( 3176) Core/SurfacePool: => [0] 0xb92c40 - 'System Memory' [0] (0), 0x7751844c
(-) [dfbshow 7197.203,972] ( 3176) Core/SurfacePool: dfb_surface_pool_initialize2( 0x7751849c )
(-) [dfbshow 7197.204,088] ( 3176) Core/SurfacePool: init_pool( 0xb92dc0, 0x7751849c )
(-) [Fusion Dispatch 7197.202,584] ( 3179) Direct/Thread/Init: -> running...
(-) [Fusion Dispatch 7197.204,234] ( 3179) Fusion/Main/Dispatch: event_dispatcher_loop() running...
(-) [dfbshow 7197.204,908] ( 3176) Core/PreAlloc: preallocInitPool()
(-) [dfbshow 7197.205,005] ( 3176) Fusion/Skirmish: fusion_skirmish_init( 0xb92dc4, 'Preallocated Memory' )
(-) [dfbshow 7197.205,161] ( 3176) Core/SurfacePool: -> [0] 0xb92c40 - 'System Memory' [0] (0), 0x7751844c
(-) [dfbshow 7197.206,305] ( 3176) Core/SurfacePool: => [1] 0xb92dc0 - 'Preallocated Memory' [1] (0), 0x7751849c
(-) [dfbshow 7197.206,457] ( 3176) Core/SurfPoolBridge: dfb_surface_pool_bridge_initialize( 0x775184ec, 0xb92c08 )
(-) [dfbshow 7197.206,568] ( 3176) Core/SurfPoolBridge: init_bridge( 0xb92f40, 0x775184ec )
(-) [dfbshow 7197.206,672] ( 3176) Core/PreAlloc/Bridge: preallocInitPoolBridge()
(-) [dfbshow 7197.206,756] ( 3176) Fusion/Skirmish: fusion_skirmish_init( 0xb92f44, 'PreAlloc Pool Bridge' )
(-) [dfbshow 7197.206,859] ( 3176) Core/SurfPoolBridge: => [0] 0xb92f40 - 'PreAlloc Pool Bridge' [0] (0), 0x775184ec
(-) [dfbshow 7197.206,966] ( 3176) Direct/Signals: Adding handler 0x77337a64 for signal -2 with context 0xb92c08...
(-) [dfbshow 7197.207,074] ( 3176) DirectFB/Core: core_arena_add_shared_field( 'surface_core' -> 0xb92c20 )
(-) [dfbshow 7197.207,192] ( 3176) Core/Parts: Going to initialize 'system_core' core...
(-) [dfbshow 7197.207,295] ( 3176) Core/System: dfb_system_core_initialize( 0x76fee738, 0x417cb8, 0x417cd0 )
(-) [dfbshow 7197.207,414] ( 3176) DirectFB/Core: core_arena_add_shared_field( 'fbdev' -> 0x775242c0 )
(-) [dfbshow 7197.208,402] ( 3176) FBDev/VT: dfb_vt_initialize()
(-) [dfbshow 7197.208,706] ( 3176) FBDev/VT: vt_get_fb( 1 )
(-) [dfbshow 7197.208,846] ( 3176) FBDev/VT: -> -1
(-) [dfbshow 7197.208,921] ( 3176) FBDev/VT: vt_set_fb( 1, -1 )
It then hangs there forever.
Killing it results in a segfault and the kernel complaining.
Kernel log
[ 7246.860202] do_page_fault(): sending SIGSEGV to SigHandler for invalid read access from 000000ac
[ 7246.869193] epc = 770b8988 in libfusion-1.8.so.0.0.0[77092000+44000]
[ 7246.875703] ra = 770a964c in libfusion-1.8.so.0.0.0[77092000+44000]
So now I have a DirectFB which compiles but hangs up. The vt_get_fb( 1 ) => -1
is the first suspicious thing I'll have to investigate.
Have any of you encountered a similiar situation or might point me in the right direction for debugging? Chances are someone knowns DirectFB on in an embedded environment better than me as a first-user.