Platform/GFX/Gralloc: Difference between revisions

From MozillaWiki
< Platform‎ | GFX
Jump to navigation Jump to search
(Created page with "Everything that we know, and everything that we'd like to know, about Gralloc. = What is Gralloc? = = Allocation and lifetime of Gralloc buffers = == How Gralloc buffers ar...")
 
Line 2: Line 2:


= What is Gralloc? =
= What is Gralloc? =
Gralloc is a type of shared memory that is also shared with the GPU. A Gralloc buffer can be written to directly by regular CPU code, but can also be used as an OpenGL texture.
Gralloc is part of Android, and is also part of B2G.
This is similar to the functionality provided by the EGL_lock_surface extension, but EGL_lock_surface is not widely supported on Android/B2G.
Gralloc buffers are represented by objects of the class android::GraphicBuffer. See [https://android.googlesource.com/platform/frameworks/base/+/742a67127366c376fdf188ff99ba30b27d3bf90c/include/ui/GraphicBuffer.h ui/GraphicBuffer.h].
We only use Gralloc buffers on B2G at the moment, because the locking semantics of Gralloc buffers tend to vary a lot between GPU vendors, and on B2G we can currently at least assume that we only have to deal with Qualcomm drivers. However, this got standardized in Android 4.2. See below.


= Allocation and lifetime of Gralloc buffers =
= Allocation and lifetime of Gralloc buffers =

Revision as of 20:45, 15 May 2013

Everything that we know, and everything that we'd like to know, about Gralloc.

What is Gralloc?

Gralloc is a type of shared memory that is also shared with the GPU. A Gralloc buffer can be written to directly by regular CPU code, but can also be used as an OpenGL texture.

Gralloc is part of Android, and is also part of B2G.

This is similar to the functionality provided by the EGL_lock_surface extension, but EGL_lock_surface is not widely supported on Android/B2G.

Gralloc buffers are represented by objects of the class android::GraphicBuffer. See ui/GraphicBuffer.h.

We only use Gralloc buffers on B2G at the moment, because the locking semantics of Gralloc buffers tend to vary a lot between GPU vendors, and on B2G we can currently at least assume that we only have to deal with Qualcomm drivers. However, this got standardized in Android 4.2. See below.

Allocation and lifetime of Gralloc buffers

How Gralloc buffers are created (non Mozilla-specific)

How we create Gralloc buffers

How we manage the lifetime of Gralloc buffers

Unresolved problems

Gralloc buffers locking

The lock mechanisms used by Gralloc buffers (non Mozilla-specific)

Genlock

How we lock/unlock Gralloc buffers

Drawing to Gralloc buffers

Drawing from Gralloc buffers (binding to GL textures)

Unresolved problems