Current location - Training Enrollment Network - Education and training - How to learn the underlying development of android?
How to learn the underlying development of android?
Android underlying development learning:

1. Heterogeneous programming development of CPU+GPU based on Android. At present, there are mainly the following platforms:

1.OpenCL

The underlying API widely used in desktop systems and large-scale parallel computing. Recently, flagship or quasi-flagship chips of mainstream chip manufacturers have started to support OpenCL 1. 1 or 1.2 standards, including chips from Qualcomm, Samsung, MediaTek and Ruixinwei, and all of them can find OpenCL support.

2. Kuda

At present, only NVIDIA's own Tegra K 1 Chip-Level Device (NVIDIA Shield) supports CUDA, so the scope of support is relatively narrow.

3. Rendering script (RS)

The purpose of heterogeneous programming promoted by Google is that the platform helps you choose which processor to run, which means you don't know whether your program runs on CPU or GPU, which is determined by the driver of the system. The idea is wonderful, but the reality is that developers don't buy rs. Everyone thinks that the performance of RS is uncontrollable, the flexibility is too poor, and the lack of documents is also criticized. In addition, the optimization of rs by chip manufacturers is generally at a relatively low level, which leads to the fact that RS is rarely used in practical applications.

Second, due to the popularity of OpenCL, the following parts are only for OpenCL.

Devices and chips that currently support OpenCL

1. GPU supporting OpenCL

Almost all GPUs in Qualcomm, including but not limited to the following GPUs (Adreno 305, 320, 330, 405, 420, 430, 530 ...).

ARM Mali's 6 series and 7 series GPUs, such as T628 and T760.

A relatively new Imagination PowerVR GPU since 20 14, such as G6430.

2. Chips supporting OpenCL. The following is a rough list of major chips that support OpenCL.

Qualcomm 8064, 8974 (Xiaolong 800, 80 1), 8084 (Snapdragon 805), 8994 (Snapdragon 8 10), etc.

Samsung Exynos Orion 5420, 5433 (built-in ARM Mali GPU)

MediaTek MT6752 (built-in ARM Mali T760 GPU)

Ruixinwei RK3288 (built-in ARM Mali GPU)

3. Mobile phones and tablets supporting OpenCL. This is endless. Here are just a few examples for your reference. (Note: Although Google Nexus series mobile phones or tablets support OpenCL in hardware, they basically do not support OpenCL because the driver of OpenCL has been deleted; It is worth noting that according to foreign blog reports, the corresponding OpenCL driver can be pushed back to the device to restart OpenCL support. See maxlv.net's page for details. )

Samsung Galaxy S4, S5, S6, Note 3, Note 4.

LG G2、G3、G4

HTC One M7、M8、M9

Xiaomi uses mobile phones and tablets with Qualcomm chips.

Meizu M 1 Note

TSMC P90HD

Wait, wait, wait. . .

If you are not sure whether the device at hand supports OpenCL, you can use OpenCL-Z Android to detect it. The software can display the detailed information of OpenCL devices and run microbenchmarks to detect the computing power of the devices.

Third, the knowledge that needs to be mastered:

1. Simple GPU basics

2.OpenCL parallel programming

3. Android NDK knowledge

4. Programming of 4.Android JNI interface

5. Simple knowledge of 5.Android program development

Fourth, the steps of development (this is just a simplified version of the steps, only explaining the operation, not explaining it):

1. Write the C/C++ program of OpenCL to realize the core computing code of GPU.

2. Compile the C/C++ code written before with Android NDK. At this stage, you can work in a pure C/C++ environment. You can write the main function to test the realized function, compile the code into executable code (BUILD_EXECUTABLE) with NDK, and then push the executable program to the device to run with ADB. Running an executable program requires the device to have root privileges. If you don't have root permission, you can execute binary code on the device through the tool of Native Program Launcher (Android Active Launcher Github).

3. After the last test, the function is basically normal. Start writing JNI interface.

4. Start writing Android applications and use JNI to encapsulate the native functions. Compile C/C++ code into a dynamic link library.

5. In the Android program, load the dynamic link library compiled in the last step in a static way.

6. Call the corresponding native function where necessary (such as clicking the button event) to realize the corresponding function.