android 显示(display)模块驱动详解(1)

来源:互联网 发布:什么游戏好玩不用网络 编辑:程序博客网 时间:2024/06/03 22:55
高通MSM8909+Android5.1.1启动流程---lk log(splash.img)的生成、烧录和显示


1. LK logo的显示有两种方法
For LK display (boot loader) logo, there are two methods:
a) Read the splash image data from splash.h file.
b) Get the splash image data from Splash Partition.

Solution Statement:

For a), please see the below source codes:

bootable/bootloader/lk/platform/msm_shared/include/splash.h
bootable/bootloader/lk/dev/fbcon/fbcon.c

When fbimg is NULL, LK display data getsfrom imageBuffer_rgb888 arrays.

2. 企鹅界面对应splash.img的生成
device\qcom\common\display\logo\logo_gen.py,生成splash.img的步骤:
The steps to generate a splash.img:
(1) sudo apt-get install python-imaging
(2) python ./logo_gen.pysnapdragon.png
这样就可在当前目录下生成splash.img,图片要求png格式,且且色深为8-bit的RGB或者RGBA格式。
# limit:# the logo png file's format must be:# a Truecolour with alpha: each pixel consists of four samples,# only allow 8-bit depeths: red, green, blue, and alpha.# b Truecolour: each pixel consists of three samples,# only allow 8-bit depeths: red, green, and blue. # description:# struct logo_header {# unsigned char[8]; // "SPLASH!!"# unsigned width; // logo's width,little endian# unsigned height; // logo'sheight, little endian# unsigned char reserved[512-16];# }; # the logo Image layout:# logo_header + BGR RAW Data


参考http://blog.csdn.net/loongembedded/article/details/52153796
参考http://blog.csdn.net/sgmenghuo/article/details/44303107

3. splash.img烧写到分区中
有两种办法:
(1) 用高通烧录工具QFIL在烧录系统的时候一起烧录
(2) 用fastboot烧录:fastboot flash splash splash.img

fastboot相关源代码\system\core\fastboot

4. 从分区中读出splash信息并显示
\bootable\bootloader\lk\app\aboot\aboot.c
aboot_init()--->target_display_init()--->gcdb_display_init()--->msm_display_init()--->display_image_on_screen()
void display_image_on_screen(){ structfbimage default_fbimg, *fbimg; boolflag = true; fbcon_clear(); fbimg= fetch_image_from_partition(); if(!fbimg){ flag= false; fbimg= &default_fbimg; fbimg->header.width= SPLASH_IMAGE_HEIGHT; fbimg->header.height= SPLASH_IMAGE_WIDTH;#if DISPLAY_TYPE_MIPI fbimg->image= (unsigned char *)imageBuffer_rgb888;#else fbimg->image= (unsigned char *)imageBuffer;#endif } fbcon_putImage(fbimg,flag);}


上面先从splash分区中读取logo信息,如果没有,则读取imageBuffer_rgb888[]数组的内容显示。

在msm_display_init()调用display_image_on_screen()之前先调用了fbcon_setup(&(panel->fb))来设置记录了显示屏分辨率、显示地址等信息的全局指针config。

4.1 fbcon_clear()
void fbcon_clear(void){ unsignedcount = config->width * config->height; memset(config->base,BGCOLOR, count * ((config->bpp) / 8));}


这里的config->base的值由#define MIPI_FB_ADDR 0x83200000定义,config全局变量的值主要有fbcon_setup()赋值。

4.2 fetch_image_from_partition()
调用splash_screen_mmc()从splash分区中读取logo信息

struct fbimage* splash_screen_mmc(){ intindex = INVALID_PTN; unsignedlong long ptn = 0; structfbcon_config *fb_display = NULL; structfbimage *logo = &logo_header; index= partition_get_index("splash");//获取splash分区的索引 if(index == 0) { dprintf(CRITICAL,"ERROR: splash Partition table not found\n"); returnNULL; } ptn= partition_get_offset(index);//通过索引获取到偏移地址指针 if(ptn == 0) { dprintf(CRITICAL,"ERROR: splash Partition invalid\n"); returnNULL; } if(mmc_read(ptn, (unsigned int *) logo, sizeof(logo->header))) {//先读取header dprintf(CRITICAL,"ERROR: Cannot read splash image header\n"); returnNULL; } if(splash_screen_check_header(logo)) {//check header dprintf(CRITICAL,"ERROR: Splash image header invalid\n"); returnNULL; } fb_display= fbcon_display();//获取全局指针config if(fb_display) { if((logo->header.width != fb_display->width) || (logo->header.height !=fb_display->height)) { dprintf(CRITICAL,"Logo config doesn't match with fb config. Fall back defaultlogo\n"); returnNULL; } uint8_t*base = (uint8_t *) fb_display->base; if(mmc_read(ptn + sizeof(logo->header), base, ((((logo->header.width* logo->header.height * fb_display->bpp/8) + 511) >> 9) <<9))) { fbcon_clear(); dprintf(CRITICAL,"ERROR: Cannot read splash image from partition\n"); returnNULL; } logo->image= base; } returnlogo;//返回读取到的数据}


转自:https://tieba.baidu.com/p/4755744372

原创粉丝点击