Android 3D Emulation Architecture Understanding

Source: Internet
Author: User

Android Emulator provides the user with the GPU on option, which means using the GPU of Host (which is the PC that executes Emulator). Of course, the PC must have the OpenGL driver installed.


In the implementation is to replace the libglesv1_cm.so libglesv2.so, when the system calls GL's function, the call is packaged as a stream, and through the pipe sent to the host side processing, into the conversion to host OpenGL call.

Light is not enough, but also to Libegl, Libgralloc are replaced, because to call the host side of OpenGL must have rendercontext, so to the Android Egl also converted to host XGL call (assuming you use Ubuntu) .


Create

Normally, when an APK process needs to create a window, it calls the EGL function to create the Surface, also calls the Gralloc function to create the memory to hold the raster required by the Surface, and then associate the two, which is completed in this process, but in the Android 3D emulation architecture, Windows cannot be created directly, but must be created by sending commands to host side render to invoke XGL commands .

Surface corresponds to the windowsurface in the 3D Emulation, the raster memory corresponds to Colorbuffer in 3D Emulation.



The FrameBuffer is a virtual FrameBuffer in 3D emulation, and he centrally manages Colorbuffer, Windowsurface, and Rendercontext.


Update

When the APK calls Swapbuffers (that is, the screen that has already been painted, which requires each surface to provide image memory, a surfaceflinger to be processed and displayed on the screen), the ability to imagine that the drawing using OpenGL is over, is now running a series of memory copy, Colorbuffer the image of OpenGL to draw the image read out.

The eglmakecurrent of Elg provides the first surface to draw something, and the second is to read

public boolean eglmakecurrent (Egldisplay display, Eglsurface draw, Eglsurface read, eglcontext context);

The application should use Eglsurface draw when drawing something, this surface is backstage, invisible, just to be able to successfully invoke OpenGL for hardware rendering

Now on the screen, you need to draw the surface raster data to read back, of course, this is provided by eglmakecurrent

Read the surface raster memory for Surfaceflinger operation, the last generated screen image in Framebuffer, can be directly on the screen



At last you're in the emulator, and there's no problem running a racing game.


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.