Question

As we know, during a program, it calls functions from the opengl es library (and of course, libegl). I would like to understand this in more detail. That is, what kind of library calls another library and so to the GPU. How do surfaceflinger, garrots interacts with all of this. I know there are a lot of pictures depicting the approximate scheme. But there is no clear tree of calls. I'll be glad to any answer. Maybe there are some useful resources that I could not find.

Was it helpful?

Solution

Your Question is too broad. Still I will try to make some of its clear.

  1. Application will either draw on Canvas or Its an OpenGL ES based app. Canvas based app may or may not use Hardware Rendering. In case of Hardware Rendering and OpenGL app final image is written to a buffer called "Surface" using GPU. Same buffer is written using CPU in case of Canvas and Software Rendering.

  2. There can be multiple such buffers. Which are sent to Surface Flinger for compositing. Surface Flinger again; may or may not use OpenGL(or GPU) for compositing. SurfaceFlinger can also offload this compositing task to HardwareComposer depending upon different various conditions.

  3. GrAlloc is used to allocate contiguous chunk of memory for graphics purpose.

  4. Thus Final composited buffer is sent to LCD Display for final Display.

Edit How OpenGL Works ?

So Open GL is just a soecification. GPU venodors provide implementation of that specification in GPU drivers. LibGLES will hav all function declarations and its Graphics Drivers job to convert libgl calls to GPU instructions.

If you want in depth understanding of Surface Flinger and Hardware Composer read about Android Graphics Architecture on android source code site.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top