Rendering framebuffer

As we discussed previously in this chapter, the Gralloc module can support two kinds of device: Gralloc devices and framebuffer devices. In the open method of the Gralloc device, it creates a device named GRALLOC_HARDWARE_GPU0 and supports two methods, alloc and free, as we can see in the following snippet. We have discussed both methods in detail earlier in this chapter:

    ...     if (!strcmp(name, GRALLOC_HARDWARE_GPU0)) {         gralloc_context_t *dev;         dev = (gralloc_context_t*)malloc(sizeof(*dev));         /* initialize our state here */         memset(dev, 0, sizeof(*dev));         /* initialize the procs */         dev->device.common.tag = HARDWARE_DEVICE_TAG;         dev->device.common.version = 0;  dev->device.common.module = const_cast<hw_module_t*>(module); ...

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.