imx6q如何在Qt中使用GPU加速?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx6q如何在Qt中使用GPU加速?

4,701 Views
yz_z
Contributor III

imx6q现在使用的是L4.1.15_2.1.0版本的BSP,Qt4.9.6版本,在编写Qt应用界面显示,特别是做实时曲线图时,程序占用CPU资源比较高,50ms定时刷新界面,都要达到80~90%的CPU占用率。因此想到了要使用GPU加速,降低CPU的占用率。在使用Qt的QOpenGLWidget类进行编写测试程序时,在Ubuntu上可以运行,但是编译arm版本的时候,报错提示:

error: GL/glu.h: No such file or directory。

程序头文件包含的头文件如下:

#include <QWidget>
#include <GL/gl.h>
#include <GL/glu.h>
#include <QOpenGLWidget>
#include "QOpenGLFunctions"

测试程序CPP文件中的部分源码如下:

initializeOpenGLFunctions();
glClearColor(0,0,0,1);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);

在查看文件系统中,或者是编译器中,都没有找到GL/glu.h这个头文件。经在网络上查资料,缺少glut库。但在NXP官网上提供的gpu-viv-bin-mx6q-3.10.17-1.0.2.tar.gz中,也没有找到这个库。而gpu-viv-bin-mx6q-3.10.17-1.0.2.tar.gz中的库文件,在imx6q运行的文件系统include、lib中都存在,可以找到。查看fsl-yocto-L4.1.15_2.0.0-ga文档中i.MX_Graphics_User's_Guide.pdf这份指导文件,介绍了在制2D、3D图过程中,gpu的使用,提供了API接口函数。

同时还有官网提供了fsl-gpu-sdk-2.3.bin。执行解压后,得到测试源码工程文件。

但我该如何在Qt中使用i.MX_Graphics_User's_Guide.pdf文件中提供的API接口函数创建一个使用GPU加速的Qt测试例程,以及fsl-gpu-sdk中的demo进行编译在imx6q linux+Qt中测试呢?

查看了NXP社区论坛,及网络上的一些论坛、博文,对于这方面的完整例程使用几乎找不到。望NXP的技术支持工程师能给予技术指导,提供一些这方面的应用例程。谢谢!

0 Kudos
3 Replies

4,692 Views
jimmychan
NXP TechSupport
NXP TechSupport

In the fsl-yocto-L4.1.15_2.0.0-ga, there is i.MX_Linux_Reference_Manual.pdf. You can refer to the Chapter 5 for the GPU driver and the different GUI setting in details. Basically, you have the GPU drivers and library in your system. You can use the GPU API in your source code. You can also refer to the Chapter 14.10.2 "Yocto project environment setup" in the i.MX_Graphics_User's_Guide.pdf.

0 Kudos

4,688 Views
yz_z
Contributor III

您好!

根据您的提示,我查看i.MX_Linux_Reference_Manual.pdf文档,第5章不是介绍关于GPU驱动及GUI设置的。不知道您说的是哪个版本的文档。但我在看fsl-yocto-L4.1.15_2 .0.0-ga这个里的i.MX_Linux_Reference_Manual.pdf文档第五章是这样的:

NO5.jpg

 在i.MX_Graphics_User's_Guide.pdf中,也并没有找到第14章,该文档总共只有12章,如下所示:

NO14.jpg

 可否提供一下下载链接?我从NXP官网上下载到的fsl_yocto-L4.1.15_2.0.0-ga.tar.gz压缩包中查看到的这两份文档与您所说的并不相同。

0 Kudos

4,660 Views
jimmychan
NXP TechSupport
NXP TechSupport

I think I was referred to another version of the document.

For L4.1.15_2.0.0-ga, the GPU driver in Linux Reference Manual, please refer to Chapter 13.

For the Yocto project env setup in the GPU User's Guide, please refer to Chapter 11.10.2.

0 Kudos