Android, Skia, and hardware accelerated graphics

10,596

Solution 1

They clearly intended for Skia to be accelerated by something, but it never actually happened. PixelFlinger and libagl also look a lot like an early version of OpenGL, but were never actually accelerated either.

The big disruption was the 2.0 version of OpenGL ES. Most of its power lies in its shading language and there was no straightforward way to exploit that through Skia. ICS was really a major re-design where they abandoned Skia to use OpenGL ES 2.0 instead - with all it's GLSL capabilities.

They also badly needed the improved support for FBOs in 2.0. It is the basis of the new TextureView and VideoView classes.

It's also important that over 99% of all Android devices now have OpenGL ES 2.0 acceleration. For an example of how they exposed GLSL to the Canvas API in ICS, take a look at the Effects class.

Solution 2

According to this: Hardware Accelerated 2D Rendering for Android (slides 36 - 39)

Android uses a Display List to efficiently draw views, that's why it can't use the OpenGL backend of Skia directly.

Solution 3

Apparently, things are changing (again) with Android-O. (also discussed here)

Skia in Android-O

Share:
10,596
mlepage
Author by

mlepage

Updated on June 04, 2022

Comments

  • mlepage
    mlepage almost 2 years

    This page http://source.android.com/devices/graphics.html says:

    Prior to Android 3.0, Canvas used the Skia 2D drawing library to draw, which could not take advantage of hardware acceleration. Introduced in Android 3.0, hardware acceleration for Canvas APIs uses a new drawing library called OpenGLRenderer that translates Canvas operations to OpenGL operations so that they can execute on the GPU.

    However, the Skia page http://code.google.com/p/skia/ says Skia can back end onto OpenGL.

    Further, this Skia FAQ https://sites.google.com/site/skiadocs/user-documentation/faq says: "SkGLCanvas has been written to direct its drawing calls to OpenGL."

    So I am wondering, is there a particular reason Android doesn't simply use Skia backing onto OpenGL to obtain hardware accelerated graphics? (Maybe a distinction between OpenGL and OpenGL ES?)

  • mlepage
    mlepage about 10 years
    OK thanks, I would have thought Skia became hardware accelerated but maybe it was easier to add the GLES2 acceleration without Skia.