LeMaker Guitar:GPU hardware acceleration

From BananaPro/Pi
Jump to: navigation, search

Other languages:
English • ‎中文(简体)‎

Description

PowerVR is a division of Imagination Technologies (formerly VideoLogic) that develops hardware and software for 2D and 3D rendering, and for video encoding, decoding, associated image processing and OpenGL ES, OpenCL acceleration.

PowerVR SGX544MP GPU provides the best game experience and Full HD displays, supports industry standard API-OpenGL-ES1.1 and 2.0.
Texture support:

  • Cube Map
  • Projected Textures
  • Non square Textures
  • Volume Textures
  • Texture Arrays

Texture Formats:

  • RGB 8888, 565, 1555,1565
  • Mono chromatic 8, 16, 16f, 32f,32int
  • Dual channel 8:8, 16:16, 16f:16f
  • Compressed Textures PVR-TC1, PVR-TC2, ETC1
  • Programmable support for all YUV formats

Resolution Support:

  • Frame buffer max size = 4096*4096
  • Texture max size = 4096*4096
  • Max volume extent = 2048
  • Max texture repeat = 8192


Install GPU acceleration lib for Guitar

Step 1: Download and unzip the archive file

wget http://mirror.lemaker.org/GPU_For_LeMaker_Guitar_201603.tar.gz
tar -xvf GPU_For_LeMaker_Guitar_201603.tar.gz

Step 2: Install the software package

cd GPU_For_LeMaker_Guitar_201603
sudo chown -R root:root ./*
sudo ./install.sh

Step 3: Replace X, Xorg

cd /usr/bin
sudo mv X X.original
sudo mv Xorg Xorg.original
sudo ln -sf /usr/local/XSGX/bin/X X
sudo ln -sf /usr/local/XSGX/bin/Xorg Xorg
sudo cp /usr/local/XSGX/etc/xorg.conf  /etc/

Step 4: Check the modules dependency

sudo depmod

Step 5:Add lib path

sudo vi /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
/usr/local/XSGX/lib
/usr/lib
 
sudo ldconfig

Step 6: Check whether the GPU started

lsmod
Module                  Size  Used by
...
pvrsrvkm              336156  6 
drm                   225379  6 pvrsrvkm
...

If you can find pvrsrvkm and drm dirver modules, and the Used of the modules are not 0, and the graphical user interface runs normally, the GPU hardware acceleration works normally!

Test OpenGL ES

We can use glmark2-es tool to test OpenGL ES.
Step 1: Install some necessary libraries

sudo apt-get install libgegl-0.2-0 libgfortran3 libgimp2.0 libgl1-mesa-dev libgles2-mesa-dev libglew-dev libglew1.10 libglib2.0-bin libglib2.0-data libglib2.0-dev libglu1-mesa-dev 
sudo apt-get install libpng-dev
sudo apt-get install libx11-dev
sudo apt-get install pkg-config
sudo apt-get install libjpeg-dev

Step 2: compile and install glmark2

sudo git clone https://github.com/LeMaker/glmark2.git
cd glmark2
sudo ./waf configure --with-flavors=x11-gl,x11-glesv2
sudo ./waf
sudo ./waf install

Step 3: Replace some libraries

sudo cp /usr/lib/libEGL.so* /usr/lib/arm-linux-gnueabihf/ -a
sudo cp /usr/lib/libGLES*  /usr/lib/arm-linux-gnueabihf/ -a

Step 4: Run glmark2-es2 on Lemuntu command terminal

glmark2-es2

Glmark.png


Test OpenCL

Step 1: Install OpenGL_test tool.

sudo apt-get install unzip
wget http://mirror.lemaker.org/OpenCL_test.zip
unzip OpenCL_test.zip

Step 2: Run ocl_filter_test.

cd OpenCL_test/
cp *.so /usr/lib/ 
chmod 755 *_test
./ocl_filter_test
OpenCL Filter Test(s) (SGX_DDK_Linux_XOrg sgxddk MAIN@3625561,release,omap_linux) at Tue Dec  8 10:16:31 2015
(00) *************************************************************************************
Runs a 1x1 copyimage filter on an image using texture samples
******************************************************************************************
copy1x1 --> passed
copy1x1: Test took 0.21 seconds (Compute: 0.01 seconds) to run 1 iterations:
copy1x1: Filter dims(1,1)       Image dims(512,512) size(1.00MB)        Pixelreads(0.26 million)
copy1x1: F/s(76.92)     s/F(0.01)       MB/s(76.92)     s/MB(0.01)      Pixelreads/s(20.09 million)
(01) *************************************************************************************
Runs a 3x3 copyimage filter on an image using texture samples
******************************************************************************************
copy3x3 --> passed
copy3x3: Test took 0.22 seconds (Compute: 0.01 seconds) to run 1 iterations:
copy3x3: Filter dims(3,3)       Image dims(512,512) size(1.00MB)        Pixelreads(2.33 million)
copy3x3: F/s(90.91)     s/F(0.01)       MB/s(90.91)     s/MB(0.01)      Pixelreads/s(211.98 million)
(02) *************************************************************************************
Runs a 5x5 copyimage filter on an image using memory reads
******************************************************************************************
...

Step 3: Run ocl_unit_test.

./ocl_unit_test
OpenCL Unit Test(s) (SGX_DDK_Linux_XOrg sgxddk MAIN@3625561,release,omap_linux) at Tue Dec  8 10:20:02 2015
00******************************************************************************
Platform Test:
        Checks that an OpenCL compatible platform is present
        for the unit test to run.
********************************************************************************
Verify_Platform: Enumerating 1 platforms
Verify_Platform: CL_PLATFORM_PROFILE    EMBEDDED_PROFILE
Verify_Platform: CL_PLATFORM_VERSION    OpenCL 1.1 
Verify_Platform: CL_PLATFORM_NAME       PowerVR SGX
Verify_Platform: CL_PLATFORM_VENDOR     Imagination Technologies
Verify_Platform: CL_PLATFORM_EXTENSIONS 'cl_khr_byte_addressable_store'
platform --> passed
platform: Test took 0.03 seconds to run:
platform: Verify 0.03s (100.00)%
01******************************************************************************
Device Test:
        Checks that an OpenCL compatible device is present
        for the unit test to run.
********************************************************************************
Verify_Device: Enumerating 1 devices
Verify_Device: CL_DEVICE_TYPE       CL_DEVICE_TYPE_GPU
Verify_Device: CL_DEVICE_NAME       PowerVR SGX 544
Verify_Device: CL_DEVICE_VENDORI    Imagination Technologies
Verify_Device: CL_DRIVER_VERSION    1.1
Verify_Device: CL_DEVICE_PROFILE    EMBEDDED_PROFILE
Verify_Device: CL_DEVICE_VERSION    OpenCL 1.1 
Verify_Device: CL_DEVICE_EXTENSIONS cl_khr_byte_addressable_store cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics
device --> passed
device: Test took 0.00 seconds to run:
device: Verify 0.00s (100.00)%
02******************************************************************************
Addition Kernel:
        Performs an online compilation of an integer addition kernel
        and verifies that the output buffer is correct.
********************************************************************************
Compute_Add: Online compilation test with 4096 instances running source:
<source>
__kernel void AdditionKernel(__global int* a, __global int* b)
{
        int ith = get_global_id(0);
        a[ith] = a[ith] + b[ith];
}
...


References

1、https://en.wikipedia.org/wiki/PowerVR#Series_5_.28SGX.29
2、http://community.imgtec.com/developers/powervr/