如何给Qt添加DdirectFB、如何实现DirectFB的硬件加速。
先搞清楚概念,这个问题要分三步走,
一)
移植DirectFB,运行测试程序,移植成功
二)
移植Qt,重新编译,打开DirectFB选项,编写Qt测试代码,测试通过
三)
开启DirectFB硬件加速的硬件支持,这个不知道要不要改DirectFB源代码,还是GPU与DirectFB无缝连接,如果是硬件库与DirectFB之间采用的是标准接口的话,就不用修改DFB源代码了。有待确认
在这个过程中遇到的问题
其一)
编译DirectFB-examples时的链接库问题,已在上一篇说过
其二)
编译Qt打开DirectFB .configure 时找不到DirectFB,解决如下:
发生问题:
"The DirectFB screen driver functionality test failed!
> You might need to modify the include and library search paths by editing
> QT_CFLAGS_DIRECTFB and QT_LIBS_DIRECTFB in
> /home/yhk/qt-embedded-linux-opensource-src-4.5.2/mkspecs/qws/linux-
> mips-g++."
开始没有成功的原因在于,修改了这个文件中的2个变量是错误的,也就是说这个变量不是真正的需要的路径,应该这样弄
运行这两条命令,得到正确的路径赋值给变量
[dcarr <at> hobbit:/]$ pkg-config --libs directfb
(10-29 16:41)
-ldirectfb -lfusion -ldirect -lpthread
[dcarr <at> hobbit:/]$ pkg-config --cflags directfb
(10-29 16:41)
-D_REENTRANT -I/usr/include/directfb
即:
QT_CFLAGS_DIRECTFB = -D_REENTRANT -I/usr/include/directfb
QT_LIBS_DIRECTFB = -ldirectfb -lfusion -ldirect -lpthread
填写具体的参数
下面附上搜索的这篇文章
//********************************************************************************
http://cache.baidu.com/c?m=9f65cb4a8c8507ed4fece763104c8c711923d030678197027fa3c215cc79111a143ab6f9707e45548d98297a51f11409f7ab7025681e22b69d9f894ddeb9c52e248c2432211cd74046851ca59b4732c157ca1cb6f10da2e7b0649ce88884c854229c08452dd1b6df0a1714bb2ea15466b4fa8e48640950e1a96725e859067dd87f11f01ca4bc61305cc7bdca5c3d857d91270697de61e3654ce245&p=8b2a9211978011a052a8f86d45&user=baidu&fm=sc&query=the+directfb+screen+driver+functionality+test+failed%21&qid=87f1516005370e16&p1=2
//********************************************************************************
【转】 Install and Using DirectFB with Qt
2010-05-24 10:49
转载自 DavidChiu
最终编辑 DavidChiu
Using DirectFB with Qt
DirectFB is centered around Surfaces which is the equivalent of a QPaintDevice. In the Qt/DirectFB plugin, DirectFB maps onto either a QPixmap or a QWindowSurface which essentially means that drawing onto QPixmap or a QWidget can be accelerated and drawing onto any other paint device (e.g. QImage) cannot.
Configure
When configuring Qt there are two options, from which you can choose:
./configure -plugin-gfx-directfb
./configure -qt-gfx-directfb
With either mode, Qt will try the following to look for the DirectFB includes/libs.
* Use pkg-config
* Use directfb-config
* Check in your qmake.conf
Often the values returned from pkg-config/directfb-config indicates the locations of the libs/headers on the target rootfs, rather than their location on your host. The safest option is usually to explicitly populate these variables in your qmake.conf like this:
QT_CFLAGS_DIRECTFB = /opt/toolchain/gcc4.3_mipsel_linux/usr/include/directfb -D_REENTRANT
QT_LIBS_DIRECTFB = -L/opt/toolchain/gcc4.3_mipsel_linux/usr/lib/-ldirect -ldirectfb -lfusion
Note: While DirectFB supports a multi-process setup through a kernel-extension called Fusion this setup is not well tested with Qt.
./configure -opensource -prefix /home/stb/qt -embedded -arch mips -xplatform qws/linux-mips-g++ -plugin-gfx-directfb -qt-gfx-linuxfb
[root@BuildServer stb]# pkg-config --libs directfb
-L/home/stb/dfb/lib -ldirectfb -lfusion -ldirect -lpthread -ldl
[root@BuildServer stb]# pkg-config --cflags directfb
-D_REENTRANT -I/home/stb/dfb/include/directfb
QT_CFLAGS_DIRECTFB = /home/stb/Broadcom/nexus/lib/directfb/src/DirectFB-1.0.0/build.97405B0/opt/dfb/include/directfb -D_REENTRANT
QT_LIBS_DIRECTFB = -L/home/stb/Broadcom/nexus/lib/directfb/src/DirectFB-1.0.0/build.97405B0/opt/dfb/lib/-ldirect -ldirectfb -lfusion
You might need to modify the include and library search paths by editing
QT_CFLAGS_DIRECTFB and QT_LIBS_DIRECTFB in
/home/stb/qt-everywhere-opensource-src-4.6.2/mkspecs/qws/linux-mips-g++.
Qt is now configured for building. Just run 'gmake'.
Once everything is built, you must run 'gmake install'.
Qt will be installed into /home/stb/qt
To reconfigure, run 'gmake confclean' and 'configure'.
解决方法的来源:
Good morning,
On Thu, Oct 29, 2009 at 07:44:08AM +0100, ext Youngwhan Kim James wrote:
> I'm about to complile QT-embedded-4.5.2 with plugin-gfx-directfb.
> I'd edit a directfb.pro file: all deleted comments about DEFINE fields.
> but, if I do "./configure -embedded armv6 -plugin-gfx-directfb,
> occurred following message:
>
> "The DirectFB screen driver functionality test failed!
> You might need to modify the include and library search paths by editing
> QT_CFLAGS_DIRECTFB and QT_LIBS_DIRECTFB in
> /home/yhk/qt-embedded-linux-opensource-src-4.5.2/mkspecs/qws/linux-
> armv6-g++."
> How can I configure?
You are configuring correctly, you have to edit the qmake.conf in:
/home/yhk/qt-embedded-linux-opensource-src-4.5.2/mkspecs/qws/linux-armv6-g++
and correctly define QT_CFLAGS_DIRECTFB and QT_LIBS_DIRECTFB. Qt needs to
know where to look for the directfb libraries for your target, and what
flags to pass your compiler (include paths, defines, etc) when building the
driver. Both of these variables are expected to be in a similar format to
that returned by pkgconfig, so for example:
[dcarr <at> hobbit:/]$ pkg-config --libs directfb
(10-29 16:41)
-ldirectfb -lfusion -ldirect -lpthread
[dcarr <at> hobbit:/]$ pkg-config --cflags directfb
(10-29 16:41)
-D_REENTRANT -I/usr/include/directfb
Your vars would be:
QT_CFLAGS_DIRECTFB = -D_REENTRANT -I/usr/include/directfb
QT_LIBS_DIRECTFB = -ldirectfb -lfusion -ldirect -lpthread
if compiling for your host systems directfb on Ubuntu.
I hope that this helps.
Yours sincerely,
Donald