If we call the open method of the Gralloc module with the name value as GRALLOC_HARDWARE_FB0, it will initialize the framebuffer device. The fb_device_open function is called to open the framebuffer device:
status = fb_device_open(module, name, device);
The fb_device_open function is implemented in the framebuffer.cpp file as follows:
int fb_device_open(hw_module_t const* module, const char* name, hw_device_t** device) { int status = -EINVAL; if (!strcmp(name, GRALLOC_HARDWARE_FB0)) { /* initialize our state here */ fb_context_t *dev = (fb_context_t*)malloc(sizeof(*dev)); memset(dev, 0, sizeof(*dev)); /* initialize the procs */ dev->device.common.tag = HARDWARE_DEVICE_TAG; dev->device.common.version = ...