Introduction Framebuffer is not as intuitive as other guis in Android, and there are many abstract layers. In addition, Gui updates are implemented through opengles. Therefore, it is difficult to figure out the entire process of GUI update. A lecture has been prepared recently, so I spent some research. Here I will take some notes for your reference. The source code is based on the Qualcomm platform, these codes can be downloaded online. Shows the related components of framebuffer:
- Surfaceflinger is a service that is mainly used to synthesize the surface of each window and display it on framebuffer through opengles. Surfaceflinger itself is important and complex. I will write a special article later.
- Displayhardware is an abstraction of display devices, including framebuffer and overlay. It loads the framebuffer and overlay plug-ins and initializes opengles:
mNativeWindow = new FramebufferNativeWindow(); framebuffer_device_t const * fbDev = mNativeWindow->getDevice(); if (hw_get_module(OVERLAY_HARDWARE_MODULE_ID, &module) == 0) { overlay_control_open(module, &mOverlayEngine); } surface = eglCreateWindowSurface(display, config, mNativeWindow.get(), NULL); eglMakeCurrent(display, surface, surface, context);
- Framebuffernativewindow is the abstraction of framebuffer. It loads libgralloc and opens the framebuffer device. Framebuffernativewindow does not directly use framebuffer, but creates two buffers by itself:
- Queuebuffer is used to display a buffer to the screen. It calls FB-> post to display the buffer.
- Dequeuebuffer gets an idle buffer, which is used to draw in the background.
These two functions are called by eglswapbuffers and adjusted: egl_window_surface_v2_t::swapBuffers: nativeWindow->queueBuffer(nativeWindow, buffer); nativeWindow->dequeueBuffer(nativeWindow, &buffer);
- Msm7k/liboverlay is implemented by Overlay. Unlike other platforms, overlay on Qualcomm does not provide a framebuffer device, but is implemented by fb0 IOCTL, IOCTL is divided into two types of operations:
Overlaycontrolchannel is used to set parameters, such as overlay location, width, and height: bool OverlayControlChannel::setPosition(int x, int y, uint32_t w, uint32_t h) { ov.dst_rect.x = x; ov.dst_rect.y = y; ov.dst_rect.w = w; ov.dst_rect.h = h; ioctl(mFD, MSMFB_OVERLAY_SET, &ov);} Overlaydatachannel is used to display overlay. The most important function is queuebuffer: bool OverlayDataChannel::queueBuffer(uint32_t offset) {mOvData.data.offset = offset;ioctl(mFD, MSMFB_OVERLAY_PLAY, odPtr))}
- Msm7k/libgralloc is the abstraction of the display cache, including framebuffer and the buffer of the normal surface.
Framebuffer is only a/dev/graphic/fb0 package, while the surface buffer is a package for/dev/pmem, ashmem, and GPU memory (msm_hw3dm, its goal is to facilitate hardware acceleration. Because DMA transmission uses physical addresses, it requires that the physical addresses exist continuously.
- Msm7k/libcopybit, a 2D acceleration Library, is mainly responsible for stretching, rotating, and merging surface operations. It can be implemented in two ways:
- Copybit. cpp: The implementation of IOCTL (msmfb_b133) based on fb0.
- Copybit_c2d.cpp: Based on the Implementation of kgsl, it only packs libc2d2. So. libc2d2. So should not be open-source.
- Pmem
- Misc/pmem. C: physical memory management, algorithms, and user space interfaces.
- The board-msm7x27.c defines the default size of physical memory:
#define MSM_PMEM_MDP_SIZE 0x1B76000#define MSM_PMEM_ADSP_SIZE 0xB71000#define MSM_PMEM_AUDIO_SIZE 0x5B000#define MSM_FB_SIZE 0x177000#define MSM_GPU_PHYS_SIZE SZ_2M#define PMEM_KERNEL_EBI1_SIZE 0x1C000 Msm_msm7x2x_allocate_memory_regions allocates several blocks of memory for secondary allocation to pmem.
Kernel graphics system layer (kgsl), 3D graphics acceleration driver, under the drivers/GPU/MSM directory of the source code, it is GPU packaging and Provides abstract interfaces to opengles 2.0.
I did not find the relevant code in the kernel.
Msm_fb.c: user interfaces of framebuffer, overlay, and BLAY. Mdp_dma.c: provides two framebuffer update Methods for packaging specific display devices: Mdp_refresh_screen: Scheduled Update. Mdp_dma_pan_update: actively updates data through pan display. Mdp_dma_lcdc.c: Update framebuffer for LCD display devices. Seealso
- Framebuffer in Android
|