作者 QQ: 35327864,msn: fgwf1@hotmail.com,mail: agooou@gmail.com
1,下载QT源码 (移植过程参考http://doc.qt.nokia.com/latest/qt-embeddedlinux-directfb.html)
2,修改mkspecs/qws/linux-mips-g++/下的qmake.conf
#
# qmake configuration for building with mipsel-linux-g++
#
include(../../common/g++.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)
# modifications to g++.conf
QMAKE_CC = mipsel-linux-gcc
QMAKE_CXX = mipsel-linux-g++
QMAKE_CFLAGS += -g -EL -Wa,-mips32r2 -march=24kf -mtune=24kf -I/home/lancer/smp865x/sdk/cs_rootfs_1.2.12/cross_rootfs/include
QMAKE_CXXFLAGS += -g -fexceptions -EL -Wa,-mips32r2 -march=24kf -mtune=24kf -I/home/lancer/smp865x/sdk/cs_rootfs_1.2.12/cross_rootfs/include
QMAKE_LINK = mipsel-linux-g++ -L/home/lancer/smp865x/sdk/cs_rootfs_1.2.12/cross_rootfs/lib -L/home/lancer/smp865x/sdk/cs_rootfs_1.2.12/build_mipsel/root/usr/local/tangox/mrua/lib -Wl,-rpath-link -Wl,/home/lancer/smp865x/sdk/cs_rootfs_1.2.12/build_mipsel/root/usr/local/tangox/dcchd/lib
QMAKE_LINK_SHLIB = mipsel-linux-g++ -L/home/lancer/smp865x/sdk/cs_rootfs_1.2.12/cross_rootfs/lib -L/home/lancer/smp865x/sdk/cs_rootfs_1.2.12/build_mipsel/root/usr/local/tangox/mrua/lib -Wl,-rpath-link -Wl,/home/lancer/smp865x/sdk/cs_rootfs_1.2.12/build_mipsel/root/usr/local/tangox/dcchd/lib
QT_CFLAGS_DIRECTFB = -I/home/lancer/smp865x/sdk/dcchd_SMP865x_3_9_2_black.mips/directfb/include/directfb -D_REENTRANT
QT_LIBS_DIRECTFB = -L/home/lancer/smp865x/sdk/dcchd_SMP865x_3_9_2_black.mips/directfb/lib -ldirectfb -lfusion -ldirect -lpthread
# modifications to linux.conf
QMAKE_AR = mipsel-linux-ar cqs
QMAKE_OBJCOPY = mipsel-linux-objcopy
QMAKE_STRIP = mipsel-linux-strip
load(qt_config)
3,修改src/plugins/gfxdrivers/directfb/directfb.pro的内容
应该将将这部分的修改放到qmake.conf的QT_CFLAGS_DIRECTFB和QT_LIBS_DIRECTFB中,但我试过有点问题,这两个变量好像被修改成系统的/usr/lib/directfb了,所以我直接修改在directfb.pro里。
其中用到了一个libtangox.so,这是我对smp865x的sdk的抽象,包含directfb的初始化等。注意包含此库的路径。
内容为:
TARGET = qdirectfbscreen
include(../../qpluginbase.pri)
include($$QT_SOURCE_TREE/src/gui/embedded/directfb.pri)
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/gfxdrivers
target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers
INSTALLS += target
SOURCES += qdirectfbscreenplugin.cpp
#QMAKE_CXXFLAGS += $$QT_CFLAGS_DIRECTFB
#LIBS += $$QT_LIBS_DIRECTFB
QMAKE_CXXFLAGS += -DLITTLE_ENDIAN=1 -DBYTE_ORDER=LITTLE_ENDIAN -DCROSS_COMPILING=1 -D__mips__ -D_REENTRANT -DEM86XX_CHIP=EM86XX_CHIPID_TANGO3 -DEM86XX_REVISION=3 -DXBOOT2_SMP865X=1 -DEM86XX_MODE=EM86XX_MODEID_STANDALONE -DWITH_XLOADED_UCODE=1 -DNO_DTSXLL_DECODE -DDTSHD_CAPABLE_IF_ANY -DDECODER_DOWNMIX -DNO_REENCODE -DNO_DTSHD_8CH_ABOVE=48000 -DNO_TrueHD_192K_ABOVE=6 -DNO_TrueHD_96K_ABOVE=8 -DNO_MC_DOWNSAMPLE_ABOVE=48000 -DNO_MIX_ABOVE=48000 -DNO_BM_ABOVE=48000 -DDMIX_IF_NO_BM -DSTC_OFFSET_MS=200 -DPRIORITY_BOOST=-5 -DALLOC_AND_RELEASE_IN_PLAY -DAUDIO_RECCCS_HACK -DPCMX_HACK_FILL_INCOMPLETE_CHUNKS -DCRT_SCALER=DispCRTMultiScaler -DGFX_SCALER=DispGFXMultiScaler -DHDMI_CHECK_PRIORITY_BOOST=-15 -DALLOW_NON_JFIF -DHACK_NO_DISPLAY_STOP_CONFIRMATION -DHACK_ENABLE_STEREO_SURROUND_SUPPORT -DHACK_NO_CSS_IF_CPM_IS_ZERO -DNO_BLUE_SUPPORT -DNO_AACSONLINE -DUSE_LIBSAMPLES_V2 -DWITH_RMHDMI=1 -DNO_CRT_SCALER -DMMAP_DRAM1_SIZE=0 -DMMAP_DRAM0_SIZE=98 -DMMAP_CPS_SIZE=0 -D_FILE_OFFSET_BITS=64 -DALLOW_OS_CODE -D_REENTRANT -DWITH_THREADS=1 -DRMPLATFORM=RMPLATFORMID_TANGO3 -D_GNU_SOURCE=1 -D_REENTRANT -DTIXML_USE_STL -rdynamic -ldl -EL -Wa,-mips32r2 -march=24kf -mtune=24kf -mhard-float -mglibc -mocteon-useun -falign-arrays -mfix-r4000 -fPIC -Wall -W -Wcast-align -Wchar-subscripts -Wreturn-type -Wformat -Wformat-security -Wno-format-y2k -Wundef -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings -Wno-unused-parameter -Wno-parentheses -fvisibility-inlines-hidden -fPIC -g -I/home/lancer/git/DigitalSignage/Sources -I/home/lancer/git/DigitalSignage/Sources/uci -I/home/lancer/git/DigitalSignage/Sources/fwupdate -I/home/lancer/git/DigitalSignage/Sources/tinyxml -I/home/lancer/git/DigitalSignage/Sources/xmlconfig -I/home/lancer/git/DigitalSignage/Sources/xmlmessage -I/home/lancer/git/DigitalSignage/Sources/libsocket -I/home/lancer/git/DigitalSignage/Sources/libutils -I/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/directfb/include/directfb -I/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/directfb/include/directfb-internal -I/opt/smp865x_sdk/mrua_SMP8654F_3_9_2_dev.mips/MRUA_src -I/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/dcchd -I/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/core -I/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/brd -I/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/mono -I/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/dvdvr -I/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/curacao -I/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/dtv -I/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/config/single_bank -I/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/config/default -I/opt/smp865x_sdk/cs_rootfs_1.2.12/cross_rootfs/include -I/opt/smp865x_sdk/flashlite3_SMP8654_3_8_0-1.mips/include
LIBS += -rdynamic -ldl -EL -Wa,-mips32r2 -march=24kf -mtune=24kf -mhard-float -mglibc -mocteon-useun -falign-arrays -mfix-r4000 -fPIC -Wall -W -Wcast-align -Wchar-subscripts -Wreturn-type -Wformat -Wformat-security -Wno-format-y2k -Wundef -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings -Wno-unused-parameter -Wno-parentheses -fvisibility-inlines-hidden -L/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/directfb/lib -L/opt/smp865x_sdk/mrua_SMP8654F_3_9_2_dev.mips/MRUA_src/lib -L/opt/smp865x_sdk/cs_rootfs_1.2.12/cross_rootfs/lib -lfusion -ldirect -ldirectfb -lrmcw -lllad -lrua -ldcc -lrmcpputils -lrmcore -lrmvdemux -lrmmpegsystemindex -lrmmpegsystemindexcreator -lrmwmaprodecodercore -lrmwmaprodecoder -lrmrtk86 -lrmscc -lrmdrm -lrmwmdrmndstub -lrmwmdrmstub -lrmhttp -lrmavicore -lrmriff -lrmzlib -lrmmpeg4framework -lrmmp4core -lrmdescriptordecoder -lrmmp4 -lrmmp4api -lrmasfdemuxcore -lrmasfdemux -lrmdetector3 -lrmdetector3api -lrmsubidx -lrmtextsubs -lrmdvbsubs -lrmfontrender -lrmsofttxt -lrmstreamingprotocols -lrmmkvdemux -lrmdtcpapi -lrmlibplay -lrmmm -lrmfp -lrmpthreadw -lrmdetector -lrmdetectorapi -lndsp -lrmcdfs_t -lrmdisplay -lrmvideoout -laudiooutports -ldisplayoutports -lrmi2c -lrmedid -lruai2c -lrmcec -lrmsha1 -lrmhdmi -lruahdmi -lrmhsi -lruahsi -lsamples_t -lrmoutput -lruaoutput -lruaoutputdebugger -lpng -ljpeg -lungif -lm -lz /opt/smp865x_sdk/flashlite3_SMP8654_3_8_0-1.mips/lib/libAELoader.a /opt/smp865x_sdk/flashlite3_SMP8654_3_8_0-1.mips/lib/libAEModule.a -lfusion -ldirect -ldirectfb -lrmcw -lllad -lrua -ldcc -lrmcpputils -lrmcore -lrmvdemux -lrmmpegsystemindex -lrmmpegsystemindexcreator -lrmwmaprodecodercore -lrmwmaprodecoder -lrmrtk86 -lrmscc -lrmdrm -lrmwmdrmndstub -lrmwmdrmstub -lrmhttp -lrmavicore -lrmriff -lrmzlib -lrmmpeg4framework -lrmmp4core -lrmdescriptordecoder -lrmmp4 -lrmmp4api -lrmasfdemuxcore -lrmasfdemux -lrmdetector3 -lrmdetector3api -lrmsubidx -lrmtextsubs -lrmdvbsubs -lrmfontrender -lrmsofttxt -lrmstreamingprotocols -lrmmkvdemux -lrmdtcpapi -lrmlibplay -lrmmm -lrmfp -lrmpthreadw -lrmdetector -lrmdetectorapi -lndsp -lrmcdfs_t -lrmdisplay -lrmvideoout -laudiooutports -ldisplayoutports -lrmi2c -lrmedid -lruai2c -lrmcec -lrmsha1 -lrmhdmi -lruahdmi -lrmhsi -lruahsi -lsamples_t -lrmoutput -lruaoutput -lruaoutputdebugger -lpng -ljpeg -lungif -lm -lz /opt/smp865x_sdk/flashlite3_SMP8654_3_8_0-1.mips/lib/libAELoader.a /opt/smp865x_sdk/flashlite3_SMP8654_3_8_0-1.mips/lib/libAEModule.a -Wl,-rpath,/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/core:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/mono:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/dvdvr:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/brd:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/curacao:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/curacao/lib:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/dtv:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/dtv/acap:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/dtv/tuner:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/dtv/capture:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/dtv/network:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/dcchd:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/directfb/lib:/opt/smp865x_sdk/mrua_SMP8654F_3_9_2_dev.mips/MRUA_src/lib:/opt/smp865x_sdk/cs_rootfs_1.2.12/cross_rootfs/lib
QMAKE_CXXFLAGS += -I/home/lancer/git/DigitalSignage/Projects/WindTwo/tangox
LIBS += -L/home/lancer/git/DigitalSignage/build/SMP865X.WindTwo.3.9.2/lib -ltangox
DEFINES += $$QT_DEFINES_DIRECTFB
contains(gfx-plugins, directfb):DEFINES += QT_QWS_DIRECTFB
4,修改src/gui/embedded/directfb.pri文件
根据不同的平台,对directfb的支持做修改,在smp865x的3.9.2版本中取消如下之前的#
DEFINES += QT_NO_DIRECTFB_WM
DEFINES += QT_NO_DIRECTFB_MOUSE
DEFINES += QT_NO_DIRECTFB_KEYBOARD
5,配置qt并编译
./configure -opensource -confirm-license -embedded mips -xplatform qws/linux-mips-g++ -debug -webkit-debug -nomake examples -nomake tools -nomake docs -no-qt3support -multimedia -gstreamer -no-phonon-backend -plugin-gfx-directfb
新的:
./configure -opensource -confirm-license -embedded mips -xplatform qws/linux-mips-g++ -debug -nomake examples -nomake tools -nomake docs -no-qt3support -plugin-gfx-directfb
然后make
make install 到/usr/local/Trolltech/QtEmbedded-4.7.3-mips/中
6,开发板上运行
首先配置好环境变量LD_LIBRARY_PATH,注意包含sdk路径,libtangox.so路径,qt库路径。
然后到QtEmbedded-4.7.3-mips/demos下去运行
./affine -qws -display directfb
到这一步后,界面上能显示出东西。但鼠标键盘不能操作,并且CPU占用率很高,还有显示的东西有点问题,跟PC上不一样,圆弧角的矩形不能很好的接合。
7,继续调试鼠标,键盘。
之前第四步中,我们修改了directfb.pri文件,加了QT_NO_DIRECTFB_MOUSE和QT_NO_DIRECTFB_KEYBOARD两个宏,指示QT不使用directfb的鼠标和键盘。但在smp865x平台的directfb配置上已经默认将鼠标键盘的支持加进去了,启动directfb后自然就截获了设备,使得外部不能再使用这些设备。
解决方法有2个。一个是在sdk中修改directfb的配置,不将鼠标键盘支持加进去。另一个方法,directfb维持不动,修改QT配置,支持directfb的鼠标键盘,即修改directfb.pri,注释掉QT_NO_DIRECTFB_MOUSE和QT_NO_DIRECTFB_KEYBOARD两个宏。
方法一:修改sdk的dcchd中的directfb,使之不使用linux_input。
cd到目录sdk/dcchd_SMP865x_3_9_2_black.mips/directfb/install/dfb-smp86xx
运行grep "linux_input.o" ./ -r
./smp863x/Makefile.smp863x:# inputdrivers/linux_input/linux_input.o \
./smp863x-multilib/Makefile.smp863x:# inputdrivers/linux_input/linux_input.o \
去掉上面两个文件中的linux_input.o
重新编译,这样qt就可以直接使用linux_input而不用通过directfb了。
方法二:修改QT,(没搞定,懒得搞了)
8,QT加速
到这一步前,测试程序都已经能运行了,界面也有显示,鼠标键盘也可以操作,窗口也能正常关闭退出。但是,痛苦的是,极其慢,你要退出程序,得费半天劲才能点中那个“X”。
分析其原因,我们发现此时QT用的paint engine是raster,也就是纯软件画图。这还不算,每次都画在一个缓冲区,还得在拷贝到directfb的primary surface。这个过程真的是极其慢。
之后经过搜索,找到了 http://doc.trolltech.com/4.7/qt-embedded-accel.html (Adding an Accelerated Graphics Driver to Qt for Embedded Linux)。这个指导了在4.7下怎么进行QT加速。
(这部分内容收费,呵呵)
1,下载QT源码 (移植过程参考http://doc.qt.nokia.com/latest/qt-embeddedlinux-directfb.html)
2,修改mkspecs/qws/linux-mips-g++/下的qmake.conf
#
# qmake configuration for building with mipsel-linux-g++
#
include(../../common/g++.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)
# modifications to g++.conf
QMAKE_CC = mipsel-linux-gcc
QMAKE_CXX = mipsel-linux-g++
QMAKE_CFLAGS += -g -EL -Wa,-mips32r2 -march=24kf -mtune=24kf -I/home/lancer/smp865x/sdk/cs_rootfs_1.2.12/cross_rootfs/include
QMAKE_CXXFLAGS += -g -fexceptions -EL -Wa,-mips32r2 -march=24kf -mtune=24kf -I/home/lancer/smp865x/sdk/cs_rootfs_1.2.12/cross_rootfs/include
QMAKE_LINK = mipsel-linux-g++ -L/home/lancer/smp865x/sdk/cs_rootfs_1.2.12/cross_rootfs/lib -L/home/lancer/smp865x/sdk/cs_rootfs_1.2.12/build_mipsel/root/usr/local/tangox/mrua/lib -Wl,-rpath-link -Wl,/home/lancer/smp865x/sdk/cs_rootfs_1.2.12/build_mipsel/root/usr/local/tangox/dcchd/lib
QMAKE_LINK_SHLIB = mipsel-linux-g++ -L/home/lancer/smp865x/sdk/cs_rootfs_1.2.12/cross_rootfs/lib -L/home/lancer/smp865x/sdk/cs_rootfs_1.2.12/build_mipsel/root/usr/local/tangox/mrua/lib -Wl,-rpath-link -Wl,/home/lancer/smp865x/sdk/cs_rootfs_1.2.12/build_mipsel/root/usr/local/tangox/dcchd/lib
QT_CFLAGS_DIRECTFB = -I/home/lancer/smp865x/sdk/dcchd_SMP865x_3_9_2_black.mips/directfb/include/directfb -D_REENTRANT
QT_LIBS_DIRECTFB = -L/home/lancer/smp865x/sdk/dcchd_SMP865x_3_9_2_black.mips/directfb/lib -ldirectfb -lfusion -ldirect -lpthread
# modifications to linux.conf
QMAKE_AR = mipsel-linux-ar cqs
QMAKE_OBJCOPY = mipsel-linux-objcopy
QMAKE_STRIP = mipsel-linux-strip
load(qt_config)
3,修改src/plugins/gfxdrivers/directfb/directfb.pro的内容
应该将将这部分的修改放到qmake.conf的QT_CFLAGS_DIRECTFB和QT_LIBS_DIRECTFB中,但我试过有点问题,这两个变量好像被修改成系统的/usr/lib/directfb了,所以我直接修改在directfb.pro里。
其中用到了一个libtangox.so,这是我对smp865x的sdk的抽象,包含directfb的初始化等。注意包含此库的路径。
内容为:
TARGET = qdirectfbscreen
include(../../qpluginbase.pri)
include($$QT_SOURCE_TREE/src/gui/embedded/directfb.pri)
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/gfxdrivers
target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers
INSTALLS += target
SOURCES += qdirectfbscreenplugin.cpp
#QMAKE_CXXFLAGS += $$QT_CFLAGS_DIRECTFB
#LIBS += $$QT_LIBS_DIRECTFB
QMAKE_CXXFLAGS += -DLITTLE_ENDIAN=1 -DBYTE_ORDER=LITTLE_ENDIAN -DCROSS_COMPILING=1 -D__mips__ -D_REENTRANT -DEM86XX_CHIP=EM86XX_CHIPID_TANGO3 -DEM86XX_REVISION=3 -DXBOOT2_SMP865X=1 -DEM86XX_MODE=EM86XX_MODEID_STANDALONE -DWITH_XLOADED_UCODE=1 -DNO_DTSXLL_DECODE -DDTSHD_CAPABLE_IF_ANY -DDECODER_DOWNMIX -DNO_REENCODE -DNO_DTSHD_8CH_ABOVE=48000 -DNO_TrueHD_192K_ABOVE=6 -DNO_TrueHD_96K_ABOVE=8 -DNO_MC_DOWNSAMPLE_ABOVE=48000 -DNO_MIX_ABOVE=48000 -DNO_BM_ABOVE=48000 -DDMIX_IF_NO_BM -DSTC_OFFSET_MS=200 -DPRIORITY_BOOST=-5 -DALLOC_AND_RELEASE_IN_PLAY -DAUDIO_RECCCS_HACK -DPCMX_HACK_FILL_INCOMPLETE_CHUNKS -DCRT_SCALER=DispCRTMultiScaler -DGFX_SCALER=DispGFXMultiScaler -DHDMI_CHECK_PRIORITY_BOOST=-15 -DALLOW_NON_JFIF -DHACK_NO_DISPLAY_STOP_CONFIRMATION -DHACK_ENABLE_STEREO_SURROUND_SUPPORT -DHACK_NO_CSS_IF_CPM_IS_ZERO -DNO_BLUE_SUPPORT -DNO_AACSONLINE -DUSE_LIBSAMPLES_V2 -DWITH_RMHDMI=1 -DNO_CRT_SCALER -DMMAP_DRAM1_SIZE=0 -DMMAP_DRAM0_SIZE=98 -DMMAP_CPS_SIZE=0 -D_FILE_OFFSET_BITS=64 -DALLOW_OS_CODE -D_REENTRANT -DWITH_THREADS=1 -DRMPLATFORM=RMPLATFORMID_TANGO3 -D_GNU_SOURCE=1 -D_REENTRANT -DTIXML_USE_STL -rdynamic -ldl -EL -Wa,-mips32r2 -march=24kf -mtune=24kf -mhard-float -mglibc -mocteon-useun -falign-arrays -mfix-r4000 -fPIC -Wall -W -Wcast-align -Wchar-subscripts -Wreturn-type -Wformat -Wformat-security -Wno-format-y2k -Wundef -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings -Wno-unused-parameter -Wno-parentheses -fvisibility-inlines-hidden -fPIC -g -I/home/lancer/git/DigitalSignage/Sources -I/home/lancer/git/DigitalSignage/Sources/uci -I/home/lancer/git/DigitalSignage/Sources/fwupdate -I/home/lancer/git/DigitalSignage/Sources/tinyxml -I/home/lancer/git/DigitalSignage/Sources/xmlconfig -I/home/lancer/git/DigitalSignage/Sources/xmlmessage -I/home/lancer/git/DigitalSignage/Sources/libsocket -I/home/lancer/git/DigitalSignage/Sources/libutils -I/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/directfb/include/directfb -I/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/directfb/include/directfb-internal -I/opt/smp865x_sdk/mrua_SMP8654F_3_9_2_dev.mips/MRUA_src -I/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/dcchd -I/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/core -I/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/brd -I/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/mono -I/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/dvdvr -I/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/curacao -I/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/dtv -I/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/config/single_bank -I/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/config/default -I/opt/smp865x_sdk/cs_rootfs_1.2.12/cross_rootfs/include -I/opt/smp865x_sdk/flashlite3_SMP8654_3_8_0-1.mips/include
LIBS += -rdynamic -ldl -EL -Wa,-mips32r2 -march=24kf -mtune=24kf -mhard-float -mglibc -mocteon-useun -falign-arrays -mfix-r4000 -fPIC -Wall -W -Wcast-align -Wchar-subscripts -Wreturn-type -Wformat -Wformat-security -Wno-format-y2k -Wundef -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings -Wno-unused-parameter -Wno-parentheses -fvisibility-inlines-hidden -L/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/directfb/lib -L/opt/smp865x_sdk/mrua_SMP8654F_3_9_2_dev.mips/MRUA_src/lib -L/opt/smp865x_sdk/cs_rootfs_1.2.12/cross_rootfs/lib -lfusion -ldirect -ldirectfb -lrmcw -lllad -lrua -ldcc -lrmcpputils -lrmcore -lrmvdemux -lrmmpegsystemindex -lrmmpegsystemindexcreator -lrmwmaprodecodercore -lrmwmaprodecoder -lrmrtk86 -lrmscc -lrmdrm -lrmwmdrmndstub -lrmwmdrmstub -lrmhttp -lrmavicore -lrmriff -lrmzlib -lrmmpeg4framework -lrmmp4core -lrmdescriptordecoder -lrmmp4 -lrmmp4api -lrmasfdemuxcore -lrmasfdemux -lrmdetector3 -lrmdetector3api -lrmsubidx -lrmtextsubs -lrmdvbsubs -lrmfontrender -lrmsofttxt -lrmstreamingprotocols -lrmmkvdemux -lrmdtcpapi -lrmlibplay -lrmmm -lrmfp -lrmpthreadw -lrmdetector -lrmdetectorapi -lndsp -lrmcdfs_t -lrmdisplay -lrmvideoout -laudiooutports -ldisplayoutports -lrmi2c -lrmedid -lruai2c -lrmcec -lrmsha1 -lrmhdmi -lruahdmi -lrmhsi -lruahsi -lsamples_t -lrmoutput -lruaoutput -lruaoutputdebugger -lpng -ljpeg -lungif -lm -lz /opt/smp865x_sdk/flashlite3_SMP8654_3_8_0-1.mips/lib/libAELoader.a /opt/smp865x_sdk/flashlite3_SMP8654_3_8_0-1.mips/lib/libAEModule.a -lfusion -ldirect -ldirectfb -lrmcw -lllad -lrua -ldcc -lrmcpputils -lrmcore -lrmvdemux -lrmmpegsystemindex -lrmmpegsystemindexcreator -lrmwmaprodecodercore -lrmwmaprodecoder -lrmrtk86 -lrmscc -lrmdrm -lrmwmdrmndstub -lrmwmdrmstub -lrmhttp -lrmavicore -lrmriff -lrmzlib -lrmmpeg4framework -lrmmp4core -lrmdescriptordecoder -lrmmp4 -lrmmp4api -lrmasfdemuxcore -lrmasfdemux -lrmdetector3 -lrmdetector3api -lrmsubidx -lrmtextsubs -lrmdvbsubs -lrmfontrender -lrmsofttxt -lrmstreamingprotocols -lrmmkvdemux -lrmdtcpapi -lrmlibplay -lrmmm -lrmfp -lrmpthreadw -lrmdetector -lrmdetectorapi -lndsp -lrmcdfs_t -lrmdisplay -lrmvideoout -laudiooutports -ldisplayoutports -lrmi2c -lrmedid -lruai2c -lrmcec -lrmsha1 -lrmhdmi -lruahdmi -lrmhsi -lruahsi -lsamples_t -lrmoutput -lruaoutput -lruaoutputdebugger -lpng -ljpeg -lungif -lm -lz /opt/smp865x_sdk/flashlite3_SMP8654_3_8_0-1.mips/lib/libAELoader.a /opt/smp865x_sdk/flashlite3_SMP8654_3_8_0-1.mips/lib/libAEModule.a -Wl,-rpath,/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/core:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/mono:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/dvdvr:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/brd:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/curacao:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/curacao/lib:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/dtv:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/dtv/acap:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/dtv/tuner:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/dtv/capture:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/dtv/network:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/dcchd/dcchd:/opt/smp865x_sdk/dcchd_SMP865x_3_9_2_black.mips/directfb/lib:/opt/smp865x_sdk/mrua_SMP8654F_3_9_2_dev.mips/MRUA_src/lib:/opt/smp865x_sdk/cs_rootfs_1.2.12/cross_rootfs/lib
QMAKE_CXXFLAGS += -I/home/lancer/git/DigitalSignage/Projects/WindTwo/tangox
LIBS += -L/home/lancer/git/DigitalSignage/build/SMP865X.WindTwo.3.9.2/lib -ltangox
DEFINES += $$QT_DEFINES_DIRECTFB
contains(gfx-plugins, directfb):DEFINES += QT_QWS_DIRECTFB
4,修改src/gui/embedded/directfb.pri文件
根据不同的平台,对directfb的支持做修改,在smp865x的3.9.2版本中取消如下之前的#
DEFINES += QT_NO_DIRECTFB_WM
DEFINES += QT_NO_DIRECTFB_MOUSE
DEFINES += QT_NO_DIRECTFB_KEYBOARD
5,配置qt并编译
./configure -opensource -confirm-license -embedded mips -xplatform qws/linux-mips-g++ -debug -webkit-debug -nomake examples -nomake tools -nomake docs -no-qt3support -multimedia -gstreamer -no-phonon-backend -plugin-gfx-directfb
新的:
./configure -opensource -confirm-license -embedded mips -xplatform qws/linux-mips-g++ -debug -nomake examples -nomake tools -nomake docs -no-qt3support -plugin-gfx-directfb
然后make
make install 到/usr/local/Trolltech/QtEmbedded-4.7.3-mips/中
6,开发板上运行
首先配置好环境变量LD_LIBRARY_PATH,注意包含sdk路径,libtangox.so路径,qt库路径。
然后到QtEmbedded-4.7.3-mips/demos下去运行
./affine -qws -display directfb
到这一步后,界面上能显示出东西。但鼠标键盘不能操作,并且CPU占用率很高,还有显示的东西有点问题,跟PC上不一样,圆弧角的矩形不能很好的接合。
7,继续调试鼠标,键盘。
之前第四步中,我们修改了directfb.pri文件,加了QT_NO_DIRECTFB_MOUSE和QT_NO_DIRECTFB_KEYBOARD两个宏,指示QT不使用directfb的鼠标和键盘。但在smp865x平台的directfb配置上已经默认将鼠标键盘的支持加进去了,启动directfb后自然就截获了设备,使得外部不能再使用这些设备。
解决方法有2个。一个是在sdk中修改directfb的配置,不将鼠标键盘支持加进去。另一个方法,directfb维持不动,修改QT配置,支持directfb的鼠标键盘,即修改directfb.pri,注释掉QT_NO_DIRECTFB_MOUSE和QT_NO_DIRECTFB_KEYBOARD两个宏。
方法一:修改sdk的dcchd中的directfb,使之不使用linux_input。
cd到目录sdk/dcchd_SMP865x_3_9_2_black.mips/directfb/install/dfb-smp86xx
运行grep "linux_input.o" ./ -r
./smp863x/Makefile.smp863x:# inputdrivers/linux_input/linux_input.o \
./smp863x-multilib/Makefile.smp863x:# inputdrivers/linux_input/linux_input.o \
去掉上面两个文件中的linux_input.o
重新编译,这样qt就可以直接使用linux_input而不用通过directfb了。
方法二:修改QT,(没搞定,懒得搞了)
8,QT加速
到这一步前,测试程序都已经能运行了,界面也有显示,鼠标键盘也可以操作,窗口也能正常关闭退出。但是,痛苦的是,极其慢,你要退出程序,得费半天劲才能点中那个“X”。
分析其原因,我们发现此时QT用的paint engine是raster,也就是纯软件画图。这还不算,每次都画在一个缓冲区,还得在拷贝到directfb的primary surface。这个过程真的是极其慢。
之后经过搜索,找到了 http://doc.trolltech.com/4.7/qt-embedded-accel.html (Adding an Accelerated Graphics Driver to Qt for Embedded Linux)。这个指导了在4.7下怎么进行QT加速。
(这部分内容收费,呵呵)