大家好,我是刚接触硬件的,所以,对很多概念都不是特别懂,但是,公司安排对RK3288的GPU的能力进行深入挖掘,提高产品性能,但是之前没有接触过硬件的东西所以存在如下疑问:
(1) 要在RK3288 T760上能够使用GPU需要怎么做, 在网上看到有的人说要安装Mali提供的kernel Device Driver (Source Mali Midgard GPU Kernel Drivers:developer.arm.com/.../midgard-kernel)和 User Device Driver(Mali GPU User-Space Binary Drivers: https://developer.arm.com/products/software/mali-drivers/user-space),如果要安装,应该如何安装呢?
(2) 如何获取Mali-Opencl-SDK,在官网上没有找到,在CSDN中下载了如下的一个版本(http://download.csdn.net/download/heiheiya/6432711 ) ,里面的编译器如何选择, 我再这个网站上(https://www.linaro.org/downloads/)看到,binaries版本有很多种,如下图所示, 我应该选哪一个呢,能不能直接在rk3288上直接用g++/gcc进行编译
(3)综上,实际上就是如何一步一步实现Opencl编程
您好,谢谢您的回复,您的意思是指,我下载一个opencl的头文件,在工程中包含头文件,就可以了吗?小白问的问题可能比较笨。 还有,https://developer.arm.com/graphics 里面关于opencl的SDK的都直接转跳到computer libirary去了
对的,写OpenCL应用开发者不需要做太多事情,主要是应用头文件和链接的时候指定好库。但是具体的平台细节Rockchip那边可能更清楚一些,我们提供OpenCL的驱动给他们,他们会集成到他们整个芯片环境,让开发者使用。在ttps://developer.arm.com/graphics 里面我们现在提供了compute library,这个主要是为想在Mali GPU上使用compute的开发者提供的基于Mali的一些优化库。
您好,我下载了一个opencl的库,并且进行简单验证,代码如下:
#include "CL/cl.h"#include <stdio.h> #include <stdlib.h> #include <memory.h> int main(){ printf("helle opencl \n"); cl_platform_id *platform = NULL; cl_uint num_platforms = 0; cl_int err; err = clGetPlatformIDs(10,NULL,&num_platforms); if(err < 0) { platform = NULL; perror("Couldn't find any platforms.\n"); return -1; } platform = (cl_platform_id *)malloc(sizeof(cl_platform_id) * num_platforms); if(platform == NULL) { perror("Assign Memory Failed. \n"); return -1; } err = clGetPlatformIDs(num_platforms, platform, NULL); if(err < 0) { platform = NULL; perror("Couldn't find any platforms.\n"); return -1; } return 0; }
编译出现如下问题:
我通过如下方式查找库的路径,发现没有libOpenClL这个库,结果如下图所示,我能够如何获取这个库呢?
libOpenCIL库是系统提供的,建议和你所用芯片公司咨询,芯片公司在发布系统的时候应该会集成相应的库和环境。
论坛中查找到这个方法,但是一些东西不是特别明白,见下面的中括号内容(供应商提供的就是这个文档):
Test OpenGL ES Linux support on Firefly-RK3288 Development Board ════════════════════════════════════════════════════════════════ Introduction ──────────── Firefly-RK3288 development board is equipped with the powerful Mali T764 GPU. Lately, ARM has released the binary user-space fbdev driver. We, the Firefly team, have taken a first stab at it. Environment: - Firefly-RK3288 development board with latest dual boot firmware installed. - 64 bit Ubuntu Linux (12.04 or later) host pc. Kernel ────── First, we need to update the mali kernel driver. Download Linux kernel driver TX041-SW-99002-r5p1-00rel0.tgz in [http://malideveloper.arm.com/develop-for-mali/drivers/open-source-mali-t6xx-gpu-kernel-device-drivers/] The porting process involves: replace the old driver files with new ones, apply the kds patch, fix the compiling errors and update the config file. To make life easier, we've packaged all the files into firefly-mali-driver-TX011-SW-99002-r5p1-00rel0.tar.gz . ╭──── │ cd /path/to/your/firefly/sdk 【是否指的是firefly-mali-driver-TX011-SW-99002-r5p1-00rel0.tar.gz,但是好像和现在在官网下载的TX011-SW-99002-r19p0-01rel0的文档结构不对应】 │ ls kernel # kernel directory should be here │ tar xzf /path/to/firefly-mali-driver-TX011-SW-99002-r5p1-00rel0.tar.gz ╰──── Then compile it: ╭──── │ cd kernel │ make firefly-rk3288-linux_defconfig │ make -j8 firefly-rk3288.img │ make modules ╰──── The compiled mali module is located at drivers/gpu/arm/midgard/. Copy mali_kbase.ko to your board: ╭──── │ scp drivers/gpu/arm/midgard/mali_kbase.ko root@BOARD_IP:/system/lib/modules/ ╰──── (Why `/system/lib/modules/' ? Just because /etc/rc.local willl insmod it automatically.) Then follow the steps described in [http://wiki.t-firefly.com/index.php/Firefly-RK3288/Build_kernel/en] , to pack zImage and initrd to linux-boot.img . Flash linux-boot.img to recovery partition of the board. User-space drivers ────────────────── Download mali-t76x_r5p0-06rel0_linux_1+fbdev.tar.gz in: [http://malideveloper.arm.com/develop-for-mali/features/mali-t6xx-gpu-user-space-drivers/] Then install it to the board: ╭──── │ cat /path/to/mali-t76x_r5p0-06rel0_linux_1+fbdev.tar.gz \ │ | ssh root@BOARD_IP tar --strip-components=1 -xzf - -C /usr/lib ╰──── Compile Mali OpenGL ES SDK demos ──────────────────────────────── Download Mali_OpenGL_ES_SDK_v2.4.4.71fdbd_Linux_x64.tar.gz in [http://malideveloper.arm.com/develop-for-mali/sdks/opengl-es-sdk-for-linux/] Please choose Linux X64 archive. To build the SDK demos, you need a cross compile toolchain. If you have not installed yet, try this linaro toolchain: [http://releases.linaro.org/14.09/components/toolchain/binaries/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux.tar.xz] (Extract it to /opt) You also need to install cmake (sudo apt-get install cmake). ╭──── │ tar xzf /path/to/Mali_OpenGL_ES_SDK_v2.4.4.71fdbd_Linux_x64.tar.gz │ cd Mali_OpenGL_ES_SDK_v2.4.4 │ mkdir build-arm │ cd build-arm │ export TOOLCHAIN_ROOT=/opt/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf- │ cmake -DTARGET=arm .. │ make install │ cd .. │ # bin_arm contains all the result files │ scp -r bin_arm root@BOARD_IP:/root ╰──── Set 32bit framebuffer ───────────────────── Before running demos, the fbdev should be in 32 bit mode. Run following commands on the board: ╭──── │ sudo -s │ cat << EOF >/etc/init/fbset.conf │ # fbset - run fbset to set truecolor fbmo │ description "run fbset before lightdm" │ start on startup and started udev or starting lightdm │ task │ script │ [ -x /bin/fbset ] && /bin/fbset -a -nonstd 1 -depth 32 -rgba "8/0,8/8,8/16,8/24" │ end script │ EOF │ cat << EOF >/etc/X11/xorg.conf │ Section "Screen" │ Identifier "Default Screen" │ DefaultDepth 24 │ EndSection │ EOF ╰──── Then reboot the device. Run demos ───────── Before running demos, make sure you have: 1. Flashed the new Linux kernel. 2. Updated mali_kbase.ko 3. Installed Mali user drivers 4. Uploaded Mali demos 5. Configured 32bit framebuffer Then open a terminal, run one of the demo: ╭──── │ sudo -i │ cd bin_arm/opengles_30/skybox │ ./skybox ╰──── Enjoy! Video ──────
Hit1989 said:recovery
【是否指的是firefly-mali-driver-TX011-SW-99002-r5p1-00rel0.tar.gz,但是好像和现在在官网下载的TX011-SW-99002-r19p0-01rel0的文档结构不对应】
这两个的版本号不一样,一个是R5P1, 一个是R19P0。