Allocating and releasing the graphic buffer

So far in this chapter, we have discussed loading the Gralloc module and the open method provided by the Gralloc module. Let's now review the points when the upper layer loads, initializes, and uses the Gralloc module:

  • For example, the Gralloc module is used mostly by SurfaceFlinger. SurfaceFlinger uses Gralloc; when it creates an instance of FramebufferNativeWindow, in the FramebufferNativeWindow constructor, it will call hw_get_module to get an instance of hw_module_t.
  • In the hw_module_t data structure, it has a field called methods with data type hw_module_methods_t. In hw_module_methods_t, it has an open method that returns a hw_device_t data structure.
  • With hw_device_t, SurfaceFlinger can ...

Get Android System Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.