DirectFBForRaspbian

De Wiki LOGre
Aller à : navigation, rechercher


Kernel RPI 3.2.27+

Ajouter le depot suivant (/etc/apt/sources.list.d/directfb.list) :

deb http://www.directfb.org/raspbian/ /

Désinstaller la version 1.2.9 non optimisée de libdirectFB

sudo apt-get remove libdirectfb-1.2.9
ATTENTION: ceci va desinstaller libSDL par dépendance (mais tant mieux), il faudra donc recompiler SDL 1.2.15+ avec libdirectFB

Installer la version beta de libdirectFB 1.7 pour RPI (pas sûr qu'il faille tout)

sudo apt-get update
sudo apt-get install libdirectfb-1.7-bin libdirectfb-1.7-system-egl libdirectfb-1.7-gfxdriver-gles2 libdirectfb-1.7-wm-default libdirectfb-1.7-wm-sawman libdirectfb-1.7-dev libdirectfb-1.7

Ajouter ces fichiers (pas sûr que ca serve)

wget http://directfb.org/raspbian/directfbrc
wget http://directfb.org/raspbian/fusiondalerc
wget http://directfb.org/raspbian/linux-one.ko
wget http://directfb.org/raspbian/fusion.ko
sudo cp directfbrc fusiondalerc /etc/

TODO : jouer avec la config directfbrc : http://directfb.org/wiki/index.php/Configuring_DirectFB. Par défaut voici les settings :

mode = 800x600
pixelformat = ARGB
layer-buffer-mode = backvideo
always-indirect
linux-input-force
linux-input-touch-abs
system = egl
wm-fullscreen-updates

Enregister les modules dans le noyau (nécessaire ?)

sudo insmod fusion.ko
sudo insmod linux-one.ko

Ajouter les permissions

sudo chmod 666 /dev/fusion* /dev/one* /dev/input/* /dev/snd/* /dev/vchiq /dev/tty*

src : http://directfb.org/raspbian/README

Kernel 3.6.11+ / DirectFB 1.7.0

Prérequis

* automake
* autoconf
* build-essentials
* libpng
* libjpeg
* ? 

Recompiler le noyau

Recompiler les modules kernel directFB

Recompiler directFB

  • Créer les fichiers pc
mkdir pkgconfig
cd pkgconfig


cat > bcm_host.pc << TILL_END
prefix=/opt/vc
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: bcm_host
Description: Broadcom VideoCore host API library
Version: 1
Libs: -L${libdir} -lbcm_host -lvcos -lvchiq_arm
Cflags: -I${includedir} -I${includedir}/interface/vcos/pthreads -DUSE_VCHIQ_ARM
TILL_END


cat > egl.pc << TILL_END
prefix=/opt/vc
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: EGL
Description: Fake EGL package for RPi
Version: 10
Requires: bcm_host
Libs: -L${libdir} -lEGL
Cflags: -I${includedir}
TILL_END


cat > glesv2.pc << TILL_END
prefix=/opt/vc
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: GLESv2
Description: Fake GL ES 2 package for RPi
Version: 10
Requires: bcm_host
Libs: -L${libdir} -lGLESv2
Cflags: -I${includedir}
TILL_END


cat > gl.pc << TILL_END
prefix=/opt/vc
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: GLESv2
Description: Fake GL ES 2 package for RPi
Version: 10
Requires: bcm_host
Libs: -L${libdir} -lGLESv2
Cflags: -I${includedir}
TILL_END


sudo cp *.pc /usr/lib/pkgconfig 
  • Récupérer les sources
mkdir directfb
cd directfb
git clone git://git.directfb.org/git/directfb/core/flux.git
git clone git://git.directfb.org/git/directfb/core/DirectFB.git

  • Builder Flux (outil de build directFB)
cd flux
./autogen.sh
./configure
make
sudo make install 

  • Configurer directFB
cd DirectFB
./autogen.sh
./configure --prefix=/opt/directfb CFLAGS='-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads' LDFLAGS='-L/opt/vc/lib' LIBS='-lEGL -lGLESv2' \
--disable-x11 --enable-egl --with-gfxdrivers='gles2' --disable-debug --disable-fbdev --disable-devmem --with-inputdrivers='keyboard,linuxinput' \
--enable-multi --enable-one
  • Patcher le code
 diff --git a/src/core/CoreDFB_includes.h b/src/core/CoreDFB_includes.h
index 50d6b0c..1fc2afe 100644
--- a/src/core/CoreDFB_includes.h
+++ b/src/core/CoreDFB_includes.h
@@ -469,13 +469,13 @@ CoreSurface_Lookup( CoreDFB      *core,
      if (ret)
           return (DirectResult) ret;
 
-     if (caller != FUSION_ID_MASTER &&
-         surface->object.identity && surface->object.identity != caller &&
-         surface->object.owner && surface->object.owner != caller)
-     {
-          dfb_surface_unref( surface );
-          return DR_ACCESSDENIED;
-     }
+//     if (caller != FUSION_ID_MASTER &&
+//         surface->object.identity && surface->object.identity != caller &&
+//         surface->object.owner && surface->object.owner != caller)
+//     {
+//          dfb_surface_unref( surface );
+//          return DR_ACCESSDENIED;
+//     }
 
     *ret_surface = surface;
diff --git a/lib/direct/os/linux/glibc/thread.c b/lib/direct/os/linux/glibc/thread.c
index 5dbdc3b..71b2d1c 100644
--- a/lib/direct/os/linux/glibc/thread.c
+++ b/lib/direct/os/linux/glibc/thread.c
@@ -64,6 +64,7 @@ init_once( void )
 {
      /* Create the key for the TSD (thread specific data). */
      pthread_key_create( &thread_key, NULL );
+     pthread_key_create( &thread_key, NULL );
 }
 
 /**********************************************************************************************************************/
diff --git a/src/core/core.c b/src/core/core.c
index c5836a2..02f441d 100644
--- a/src/core/core.c
+++ b/src/core/core.c
@@ -1809,7 +1809,11 @@ core_tls_destroy( void *arg )
 void
 Core_TLS__init( void )
 {
+     direct_tls_register( &core_tls_key, NULL );
+     direct_tls_register( &core_tls_key, NULL );
      direct_tls_register( &core_tls_key, core_tls_destroy );
+     direct_tls_register( &core_tls_key, NULL );
+     direct_tls_register( &core_tls_key, NULL );
 }
 
void
  • Patcher un makefile
vim systems/egl/Makefile
// Dans les CFLAGS enlever les 2 -Werror-implicit-function-declaration
  • Builder directFB
make
sudo make install
#Note : tout est installé dans /opt/directfb

  • copier les fichiers pc dans /usr/lib/pkgconfig/
cp `find . -name "*.pc"` /usr/lib/pkgconfig/
  • Charger les modules noyau
sudo vim /etc/modules

et rajouter

snd-bcm2835
fusion
linux-one

puis

sudo vim /lib/udev/rules.d/91-permissions.rules

et rajouter avant LABEL="permissions_end"

# DirectFB
# sudo chmod 666 /dev/fusion* /dev/one* /dev/input/* /dev/snd/* /dev/vchiq /dev/tty*
KERNEL=="fusion[0-9]*",                 MODE="0666"
KERNEL=="one[0-9]*",                    MODE="0666"
SUBSYSTEM=="vchiq",                     MODE="0666"
KERNEL=="tty[0-9]*",                    MODE="0666"


  • Tester !
/opt/directfb/bin/dfbinfo
/opt/directfb/bin/dfbscreen