[code小心得]DirectFB 1.7 x86 on ubuntu


大家好  

這次紀錄一下關於在 ubuntu 12.04上面跑 DirectFB  1.7

DirectFB  這個套件,很多裝置上都有用到。最多的大概是在player上巴。



先用apt指令  把x11和 png  jpeg font的相關lib補足

sudo apt-get install libpng12-dev libjpeg62-dev libfreetype6-dev libsysfs-dev libsdl1.2-dev x11proto-xext-dev libxext-dev


接著把linux-fusion裝起來
wget http://www.directfb.org/downloads/Core/linux-fusion/linux-fusion-9.0.2.tar.gz 
tar -xvf linux-fusion-9.0.2.tar.gz 
cd linux-fusion-9.0.2 
make 
sudo make install
接著把DirtectFB 裝起來 這邊使用1.7 version,且安裝到/opt/dfb路徑,x11必要因為環境關係

wget http://www.directfb.org/downloads/Core/DirectFB-1.7/DirectFB-1.7.0.tar.gz 

tar -xvf DirectFB-1.7.0.tar.gz 
cd DirectFB-1.7.0 
./autogen.sh --enable-multi --enable-one --enable-network --enable-sawman --enable-fusionsound --enable-fusiondale --enable-x11 --with-graphicsdrivers=none --prefix=/opt/dfb 
make 
sudo make install


要使用之前,先將相關環境變數補上

export LD_LIBRARY_PATH=/opt/dfb/lib/ 
export PKG_CONFIG_PATH=/opt/dfb/lib/pkgconfig/ 
export PATH=/opt/dfb/bin:$PATH
配置x11的環境

cat > ~/.directfbrc <<EOF 
mode=1024x768 
pixelformat=ARGB
system=x11 
wm=sawman 
EOF
可以設定利用udev的幫助每次開機時自動掛載fusion節點,或是

每次使用時再,自行modprobe driver 例如下方所示
sudo depmod -a 
sudo modprobe fusion 
sudo modprobe linux-one
先執行 dfbinfo 看看是否正常

dai@dai-VirtualBox:/opt/dfb/bin$ sudo ./dfbinfo
(*) Direct/Thread: Started 'SigHandler' (2576) [CRITICAL - OTHER/0] <8392704>...

   ~~~~~~~~~~~~~~~~~~~~~~~~~~| DirectFB 1.7.0 |~~~~~~~~~~~~~~~~~~~~~~~~~~
        (c) 2012-2013  DirectFB integrated media GmbH
        (c) 2001-2013  The world wide DirectFB Open Source Community
        (c) 2000-2004  Convergence (integrated media) GmbH
      ----------------------------------------------------------------

(*) DirectFB/Core: Multi Application Core. (2013-10-30 03:42)
(*) Direct/Memcpy: Using libc memcpy()
(*) Fusion/SHM: Using MADV_REMOVE (3.8.0.0 >= 2.6.19.2)
(*) Fusion/SHM: Shared root (0) is 2232 bytes [0x1000 @ 0x523000000000]
(*) Direct/Thread: Started 'Fusion Dispatch' (2577) [MESSAGING - OTHER/0] <8392704>...
(*) Direct/Thread: Started 'Fusion Deferred' (2578) [MESSAGING - OTHER/0] <8392704>...
OpenGL Warning: Failed to connect to host. Make sure 3D acceleration is enabled for this VM.
libGL error: failed to load driver: vboxvideo
libGL error: Try again with LIBGL_DEBUG=verbose for more details.
(*) GLX/Surfaces: Using visual 0xfa (24bit) and 0xe4 (32bit)
(!!!)  *** ONCE [Joystick sends JS_EVENT_INIT events, make sure it has been calibrated using 'jscal -c'
] *** [joystick.c:103 in joystick_handle_event()]
(*) Direct/Thread: Started 'Joystick Input' (2585) [INPUT - OTHER/0] <8392704>...
(*) DirectFB/Input: Joystick 0.9 (directfb.org)
(*) DirectFB/Input: Hot-plug detection enabled with Input Hub Driver
(*) Direct/Thread: Started 'X11 Input' (2586) [INPUT - OTHER/0] <8392704>...
(*) DirectFB/Input: X11 Input 0.1 (directfb.org)
(*) DirectFB/Genefx: MMX detected and enabled
(*) DirectFB/Graphics: OpenGL Acceleration - Gallium 0.4 on llvmpipe (LLVM 3.2, 128 bits) 0.5 (Denis Oliver Kropp)
(*) DirectFB/Core/WM: SaWMan 0.2 (directfb.org)
(*) Direct/Thread: Started 'Genefx' (2587) [DEFAULT - OTHER/0] <8392704>...
(*) SaWMan: Initializing stack 0x5230010ad400 for tier 0x5230024d4000, 0x0, layer 0, context 0x52300009e000 [647224]...
(*) SaWMan/Init: Layer  0:  1024x768, ARGB, options: 0
(*) SaWMan/Init: Border 0:  1024x768, ARGB, options: 8


Screen (00) X11 Primary Screen              (primary screen)
   Caps: ENCODERS OUTPUTS

   Encoder (0) X11 Encoder
     Type:           DIGITAL
     Caps:           TV_STANDARDS SCANMODE FREQUENCY CONNECTORS RESOLUTION FRAMING
     TV Standards:   DIGITAL
     Output Resolutions: 640_480 720_480 720_576 800_600 1024_768 1152_864 1280_720 1280_768 1280_960 1280_1024 1400_1050 1600_1200 1920_1080 960_540 1440_540
     Output Connectors: COMPONENT HDMI
     Framing:       


   Output (0) X11 Output
     Caps:       RESOLUTION
     Resolutions:
     Signals:   


     Layer (00) X11 Primary Layer               (primary layer)
        Type:    GRAPHICS
        Caps:    SURFACE LR_MONO STEREO

     Layer (01) X11 Secondary Layer          
        Type:    GRAPHICS
        Caps:    SURFACE LR_MONO STEREO

     Layer (02) X11 Tertiary Layer           
        Type:    GRAPHICS
        Caps:    SURFACE LR_MONO STEREO


Input (02) Joystick                        (primary joystick)
   Vendor  ID: 0x0000
   Product ID: 0x0000
   Type: JOYSTICK
   Caps: AXES BUTTONS
   Max. Axis: 1
   Max. Button: 4

Input (00) X11 Input                       (primary keyboard)
   Vendor  ID: 0x0000
   Product ID: 0x0000
   Type: KEYBOARD MOUSE JOYSTICK
   Caps: KEYS AXES BUTTONS
   Min. Keycode: 8
   Max. Keycode: 255
   Max. Axis: 0
   Max. Button: 0

dai@dai-VirtualBox:/opt/dfb/bin$


接著去安裝DirectFB的sample code

下載  解壓縮後
./configure  --enable-x11  --prefix=/opt/dfb
make
sudo make install


就可以嘗試run 看看範例囉

執行的企鵝範例 sudo  ./df_anti  顯示如下














以上介紹到此
感謝收看  下台一鞠躬

留言