Android GUI system Surfaceflinger (2) Gralloc and framebuffer

Source: Internet
Author: User
Tags file system linux

1.1 Gralloc and Framebuffer

It is believed that those who have done Linux development are not too unfamiliar with framebuffer, it is a hardware-independent display abstraction layer provided by the kernel system. It is called buffer because it is also part of the system's storage space and is a buffer that contains the on-screen display information. Thus, in the Linux system of "Everything is a file", Framebuffer is seen as the "Avatar" of the terminal Monitor. It provides a unified and convenient operation interface to the upper layer with the help of the file system, so that user-space programs can adapt to a variety of screens without modification-no matter which manufacturer or model of these screens are compatible with the framebuffer interior.

In the Android system, the device file node provided by Framebuffer is/dev/graphics/fb*. Because of the theoretical support of multiple screen display, FB by number sequence, that is, fb0, FB1 and so on. One of the first fb0 is the primary display screen, which must exist. The following is a screenshot of a device's FB device:

Figure 11?2 FB Node

Based on the knowledge learned in the previous chapters, Android subsystems are usually not implemented directly based on the Linux driver, but are indirectly referenced by the HAL layer to the underlying architecture, as well as in the display system--it uses the HAL layer to manipulate the frame buffer, and the intermediary task is to complete the gralloc, Here are some aspects to introduce.

Loading of <1> Gralloc

The gralloc corresponding module is loaded at construction time by the Framebuffernativewindow (one of Opengles's local windows, which is described in detail in the following section), namely:

Hw_get_module (hwc_hardware_module_id, &mmodule);

We've seen this hw_get_module function many times before, and it's the entrance to the upper load Hal Library, where the module ID is named:

#define GRALLOC_HARDWARE_MODULE_ID "Gralloc"

According to Hw_get_module, it looks for a library that matches the ID value in the following path:

#define HAL_LIBRARY_PATH1 "/SYSTEM/LIB/HW"

#define HAL_LIBRARY_PATH2 "/VENDOR/LIB/HW"

There are several forms of Lib library name:

Gralloc. [ro.hardware].so

Gralloc. [ro.product.board].so

Gralloc. [ro.board.platform].so

Gralloc. [ro.arch].so

Or when the file name of the system attribute is not present, the default is used:

Gralloc.default.so

Finally, this library is the implementation of the original Android ecosystem, located in hardware/libhardware/modules/gralloc/, which is made up of gralloc.cpp, Framebuffer.cpp and mapper.cpp three primary source file compilation builds.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.