1 DirectFB porting to uCLinux/EM8620L platform
1.1 Development Environment
1.1.1 EM8620L target platform environment
1.1.2 x86 host machine environment
1.2 Install DirectFB
1.2.1 Prepare libraries used in DirectFB
- Extract each source code
- Make a directory to hold all libs and includes
# mkdir DFB
# cd DFB
# mkdir lib
# mkdir include
- create libjpeg
# cd jpeg-6b
# CC=arm-elf-gcc CXX=arm-elf-g++ AR=arm-elf-ar \
RANLIB=arm-elf-ranlib LD=arm-elf-ld ./configure \
--target arm-elf-linux --host x86-pc-linux \
--disable-shared --enable-static
Edit Makefile
Change Line 39 from
LIBTOOL = ./libtool to LIBTOOL = libtool
Replace all "--mode" with "--tag" in Makefile
# make libjpeg.a
# cp libjpeg.a ../DFB/lib/
# cp jpeglib.h ../DFB/include/
- create zlib
# CC=arm-elf-gcc CXX=arm-elf-g++ AR=arm-elf-ar \
RANLIB=arm-elf-ranlib LD=arm-elf-ld ./configure
modify Makefile for cross compile
line 30 : AR=arm-elf-ar to AR=arm-elf-ar cr
# make
# cp libjz.a ../DFB/lib/
# cp ../zlib-1.1.4/zconf.h ../DFB/include/
# cp zlib.h ../DFB/include/
- create libpng
# cp scripts/makefile.linux Makefile
modify Makefile for cross compile
line 11 : change "gcc" to "arm-elf-gcc"
line 39 : change "ranlib" to "arm-elf-ranlib"
line 59 : change "ar" to "arm-elf-ar"
line 20&21
ZLIBLIB=../DFB/lib
ZLIBINC=../DFB/include
# make libpng.a
# cp libpng.a ../DFB/lib/
# cp png.h ../DFB/include/
- create freetype
# CC=arm-elf-gcc CXX=arm-elf-g++ AR=arm-elf-ar \
RANLIB=arm-elf-ranlib LD=arm-elf-ld \
./configure
# make
# cp objs/.libs/libfreetype.a ../DFB/lib/
# cp -r include/* ../DFB/include
- Cross Compile DirectFB for uCLinux
# CFLAGS=-I/home/RMT/Project/Develop/DFB/include \
LDFLAGS=-L/home/RMT/Project/Develop/DFB/lib \
CC=arm-elf-gcc CXX=arm-elf-g++ AR=arm-elf-ar \
RANLIB=arm-elf-ranlib LD=arm-elf-ld \
./configure --target arm-elf-linux --host x86-pc-linux \
--disable-shared --enable-static --disable-sdl \
--with-gfxdrivers=none --with-inputdrivers=none \
--prefix=/home/RMT/Project/DFB
# LD=arm-elf-ld make
# make install
# export PKG_CONFIG_PATH=(your pkgconfig):$PKG_CONFIG_PATH
Now all DFB libs and includes are in /home/RMT/Project/DFB
1.2.2 Prepare Demo software
Through previous steps, you have installed DirectFB to EM8620L uCLinux environment. To confirm everything created and installed properly use DirectFB demo program. You can download these demo program from DirectFB project website, that name is "DirectFB-examples". We used version 0.9.18. You can download from following Web site.
As we faced some problem compiling these demo program for SH-4 Linux, we installed to x86 Linux first, then retarget to SH-4 Linux using following step.
1.2.4 Benchmark program
Demo program named df_dok is DirectFB benchmark. If you run this without any options, it automatically runs set of benchmark program using graphics acceleration capability, and display result as graph. We use this benchmark score to tune DirectFB library for SM501.
1.2.5 Cross compiling
Like other Linux application program, DirectFB is designed to compile only on x86 Linux. We struggled this time to compile DirectFB for SH-4 Linux and finally we success this cross porting. However we think this is a kind of handwork way. When you try to run demo program on non-x86 Linux, x86 reference looks mandatory. I suggest you start DirectFB implementation from x86 Linux.
1.3 Writing DirectFB driver
1.3.1 Graphics driver detection procedure
Graphics chip drivers are located under /usr/local/lib/directfb-0.9.20/gfxdrivers There is no special installation procedure to add your own driver. DirectFB checks all drivers in driver_probe routine. When DirectFB detect correct driver in this process, DirectFB enables this driver. If driver does not works then move to next driver check, if all drivers does not much, DirectFB runs software mode without dedicated graphics driver. We have tentatively modified this process force to use SM501 driver.
1.3.2 Enabling hardware graphics acceleration capability
Drawing routine set command parameters to use 2D acceleration capability. Graphic driver returns TRUE or FALSE as return-value. If FALSE returned, DirectFB thinks hardware acceleration does not built-in, and use whole software drawing. Not all drawing routine has this acceleration detection mechanism, it is sure to define in CheckState routine. You can write your own driver as you like except command parameters and return value.