Arm Mali OPENCL Programming-gpu information detection under Android platform

Source: Internet
Author: User



For the arm Mali GPU, currently supports OpenCL1.1, so we can use OpenCL to speed up our calculations.



There has been no environment for the Mali GPU to be tested for OPENCL programming. Finally got a Mate7, but because  did not provide OpenCL driver (in the second half of the year,  will have OpenCL Drivert to provide, wait and see). The currently tested phone has Meizu MX4 Pro T628 with OpenCL Driver, which is also thanks to Samsung's Orion chip. For Android phones If the phone is a Mali GPU (if it is t6xx the following GPU, ignore it because OPENCL is not supported, for example, P7 uses Mali-450), if you are unsure if there is a driver (BTW: Ask arm staff for driver questions, need to find a chip supplier , instead of arm), you can go to pea pods to download OpenCL info's small software, which basically includes all of the current mobile platform of the GPU detection.



Pulled a bunch of crap, at present my platform is Rui Core's RK3288. For Mali gpu,opencl driver drive corresponding system "/system/vendor/lib/egl/libgles_mali.so".



For the general example, please go here, this is a I wrote about the high-pass platform OpenCL example, modify it can be used. For software compatible with different manufacturers of GPUs, Dlopen loading the OpenCL library in NDK Native code.


1 void*Getclhandle () {2 void*res =NULL; 3res = Dlopen ("/system/vendor/lib/libopencl.so", Rtld_lazy);/*Adreno GPU*/ 4 if(res==NULL) { 5res = Dlopen ("/system/vendor/lib/libpvrocl.so", Rtld_lazy);/*PowerVR GPU*/ 6  } 7 if(res==NULL) { 8res = Dlopen ("/system/vendor/lib/egl/libgles_mali.so", Rtld_lazy);/*Mali GPU*/ 9  } Ten if(res==NULL) {  Oneprintf"No OpenCL Library in your Phone");  A  }  - returnRes;  -}


As above is my way of realization.






Made a small test software, directly compiled into an executable program, ADB push to run on the phone side.


Local_path: = $ (call my-dir)    include $ (clear_vars)    local_module    := OpenCL  local_src_ FILES:= opencl_phone.c opera_init.c  test.c  local_c_includes:= include  include $ (build_executable) 


As above is my example of the Android.mk file. OPENCL_PHONE.C is some processing of the Dlopen OpenCL library. OPERA_INIT.C is the main function of the OpenCL selection platform, device, creation context, etc., test.c.






Transferred from: http://blog.csdn.net/wcj0626/article/details/44930221



Arm Mali OPENCL Programming-gpu Information Detection (RPM) under Android platform


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.