��һ���������������ں������Ĺ����г��ֵģ�����һ����̬�Ļ��档�ڶ���������������init���������Ĺ����г��ֵģ���Ҳ��һ����̬�Ļ��档������������������ϵͳ���������Ĺ����г��ֵģ�����һ����̬�Ļ��档��������һ�����棬���Ƕ�����һ����Ϊ֡��������frame buffer�����fb����Ӳ���豸�Ͻ�����Ⱦ�ġ������������Ǿͷֱ���������������������fb����ʾ�ġ�
1. ��һ�������������ʾ����
Androidϵͳ�ĵ�һ������������ʵ��Linux�ں˵��������档��Ĭ������£���������Dz�����ֵģ����������ڱ����ں˵�ʱ������������������ѡ�
CONFIG_FRAMEBUFFER_CONSOLE
CONFIG_LOGO
��һ������ѡ���ʾ�ں�֧��֡����������̨������Ӧ�����ò˵���Ϊ��Device Drivers ---> Graphics support ---> Console display driver support ---> Framebuffer Console support���ڶ�������ѡ���ʾ�ں��������Ĺ����У���Ҫ��ʾLOGO������Ӧ�����ò˵���Ϊ��Device Drivers ---> Graphics support ---> Bootup logo������Android�ں˱���ѡ����Բο���Ubuntu�����ء�����Ͱ�װAndroid�����ں�Դ���루Linux Kernel��һ�ġ�
֡������Ӳ���豸���ں�����һ����Ӧ����������ģ��fbmem����ʵ�����ļ�kernel/goldfish/drivers/video/fbmem.c�У����ij�ʼ������������ʾ��
- /**
- * fbmem_init - init frame buffer subsystem
- *
- * Initialize the frame buffer subsystem.
- *
- * NOTE: This function is _only_ to be called by drivers/char/mem.c.
- *
- */
- static int __init
- fbmem_init(void)
- {
- proc_create("fb", 0, NULL, &fb_proc_fops);
- if (register_chrdev(FB_MAJOR,"fb",&fb_fops))
- printk("unable to get major %d for fb devs\n", FB_MAJOR);
- fb_class = class_create(THIS_MODULE, "graphics");
- if (IS_ERR(fb_class)) {
- printk(KERN_WARNING "Unable to create fb class; errno = %ld\n", PTR_ERR(fb_class));
- fb_class = NULL;
- }
- return 0;
- }
ģ��fbmem���˻�ִ��������ʼ������֮�⣬���ᵼ��һ������register_framebuffer��
- EXPORT_SYMBOL(register_framebuffer);
- /**
- * register_framebuffer - registers a frame buffer device
- * @fb_info: frame buffer info structure
- *
- * Registers a frame buffer device @fb_info.
- *
- * Returns negative errno on error, or zero for success.
- *
- */
- int
- register_framebuffer(struct fb_info *fb_info)
- {
- int i;
- struct fb_event event;
- ......
- if (num_registered_fb == FB_MAX)
- return -ENXIO;
- ......
- num_registered_fb++;
- for (i = 0 ; i < FB_MAX; i++)
- if (!registered_fb[i])
- break;
- fb_info->node = i;
- mutex_init(&fb_info->lock);
- fb_info->dev = device_create(fb_class, fb_info->device,
- MKDEV(FB_MAJOR, i), NULL, "fb%d", i);
- if (IS_ERR(fb_info->dev)) {
- /* Not fatal */
- printk(KERN_WARNING "Unable to create device for framebuffer %d; errno = %ld\n", i, PTR_ERR(fb_info->dev));
- fb_info->dev = NULL;
- } else
- fb_init_device(fb_info);
- ......
- registered_fb[i] = fb_info;
- event.info = fb_info;
- fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event);
- return 0;
- }
����֪������Linux�ں��У�ÿһ��Ӳ���豸����һ�����豸�ź�һ�����豸�ţ���������Ψһ�ر�ʶһ��Ӳ���豸������֡������Ӳ���豸��˵�����ǵ����豸�Ŷ���ΪFB_MAJOR��29���������豸������ע���˳���йأ����ǵ�ֵ���ε���0��1��2�ȡ�
ÿһ����ע���֡������Ӳ���豸��/dev/graphicsĿ¼�¶���һ����Ӧ���豸�ļ�fb�����У���ʾһ�����豸�š����磬��һ����ע���֡������Ӳ���豸��/dev/graphicsĿ¼�¶���һ����Ӧ���豸�ļ�fb0���û��ռ��Ӧ�ó���ͨ������豸�ļ��Ϳ��Բ���֡������Ӳ���豸�ˣ�����Ҫ��ʾ�Ļ�����Ⱦ��֡������Ӳ���豸��ȥ��
�����������ͨ�����ú���fb_notifier_call_chain��֪ͨ֡����������̨����һ���µ�֡�������豸��ע�ᵽ�ں������ˡ�
֡����������̨���ں��ж�Ӧ����������ģ��Ϊfbcon����ʵ�����ļ�kernel/goldfish/drivers/video/console/fbcon.c�У����ij�ʼ������������ʾ��
- static struct notifier_block fbcon_event_notifier = {
- .notifier_call = fbcon_event_notify,
- };
- ......
- static int __init fb_console_init(void)
- {
- int i;
- acquire_console_sem();
- fb_register_client(&fbcon_event_notifier);
- fbcon_device = device_create(fb_class, NULL, MKDEV(0, 0), NULL,
- "fbcon");
- if (IS_ERR(fbcon_device)) {
- printk(KERN_WARNING "Unable to create device "
- "for fbcon; errno = %ld\n",
- PTR_ERR(fbcon_device));
- fbcon_device = NULL;
- } else
- fbcon_init_device();
- for (i = 0; i < MAX_NR_CONSOLES; i++)
- con2fb_map[i] = -1;
- release_console_sem();
- fbcon_start();
- return 0;
- }
����������˻���ú���device_create������һ�����Ϊgraphics���豸fbcon֮�⣬������ú���fb_register_client������֡������Ӳ���豸��ע���¼��������ɺ���fbcon_event_notify��ʵ�ֵģ�������ʾ��
- static int fbcon_event_notify(struct notifier_block *self,
- unsigned long action, void *data)
- {
- struct fb_event *event = data;
- struct fb_info *info = event->info;
- ......
- int ret = 0;
- ......
- switch(action) {
- ......
- case FB_EVENT_FB_REGISTERED:
- ret = fbcon_fb_registered(info);
- break;
- ......
- }
- done:
- return ret;
- }
֡������Ӳ���豸��ע���¼��������ɺ���fbcon_fb_registered�������ģ�����ʵ��������ʾ��
- static int fbcon_fb_registered(struct fb_info *info)
- {
- int ret = 0, i, idx = info->node;
- fbcon_select_primary(info);
- if (info_idx == -1) {
- for (i = first_fb_vc; i <= last_fb_vc; i++) {
- if (con2fb_map_boot[i] == idx) {
- info_idx = idx;
- break;
- }
- }
- if (info_idx != -1)
- ret = fbcon_takeover(1);
- } else {
- for (i = first_fb_vc; i <= last_fb_vc; i++) {
- if (con2fb_map_boot[i] == idx)
- set_con2fb_map(i, idx, 0);
- }
- }
- return ret;
- }
��Linux�ں��У�ÿһ������̨��ÿһ��֡������Ӳ���豸����һ����0��ʼ�ı�ţ����ǵij�ʼ��Ӧ��ϵ������ȫ������con2fb_map_boot�С�����̨��֡������Ӳ���豸�ij�ʼ��Ӧ��ϵ�ǿ���ͨ�������ں�������������ʼ���ġ���ģ��fbcon�У���������һ��ȫ������con2fb_map��Ҳ������ӳ�����̨��֡������Ӳ���豸�Ķ�Ӧ��ϵ��������ӳ����ǿ���̨��֡������Ӳ���豸��ʵ�ʶ�Ӧ��ϵ��
ȫ�ֱ���first_fb_vc��last_fb_vc��ȫ������con2fb_map_boot��con2fb_map������ֵ������ָ��ϵͳ��ǰ���õĿ���̨��ŷ�Χ������Ҳ�ǿ���ͨ�������ں�������������ʼ���ġ�ȫ�ֱ���first_fb_vc��Ĭ��ֵ����0����ȫ�ֱ���last_fb_vc��Ĭ��ֵ����MAX_NR_CONSOLES - 1��
ȫ�ֱ���info_idx��ʾϵͳ��ǰ��ʹ�õ�֡������Ӳ���ı�š��������ֵ����-1����ô��˵��ϵͳ��ǰ��û�����úõ�ǰ��ʹ�õ�֡������Ӳ���豸������������£�����fbcon_fb_registered�ͻ���ȫ������con2fb_map_boot�м���Ƿ����һ������̨����뵱ǰ��ע���֡������Ӳ���豸�ı��idx��Ӧ��������ڵĻ�����ô�ͻὫ��ǰ��ע���֡������Ӳ���豸���idx������ȫ�ֱ���info_idx�С�������������ú���fbcon_takeover����ʼ��ϵͳ��ʹ�õĿ���̨���ڵ��ú���fbcon_takeover��ʱ����ȥ�IJ���Ϊ1����ʾҪ��ʾ��һ���������档
���ȫ�ֱ���info_idx��ֵ������-1����ô����fbcon_fb_registeredͬ������ȫ������con2fb_map_boot�м���Ƿ����һ������̨����뵱ǰ��ע���֡������Ӳ���豸�ı��idx��Ӧ��������ڵĻ�����ô�ͻ���ú���set_con2fb_map��������ǰ��ע���֡������Ӳ���豸�����̨��ӳ���ϵ������������con2fb_map_boot��con2fb_map��ֵ��
Ϊ�˼���������Ǽ���ϵͳֻ��һ��֡������Ӳ���豸������������ע���ʱ��ȫ�ֱ���info_idx��ֵ�ͻ����-1��������fbcon_fb_registered��ȫ������con2fb_map_boot�з�����һ������̨�ı�������֡������Ӳ���豸�ı��idx��Ӧʱ���������ͻ���ú���fbcon_takeover������ϵͳ��ʹ�õĿ���̨��
����fbcon_takeover��ʵ��������ʾ��
- static int fbcon_takeover(int show_logo)
- {
- int err, i;
- if (!num_registered_fb)
- return -ENODEV;
- if (!show_logo)
- logo_shown = FBCON_LOGO_DONTSHOW;
- for (i = first_fb_vc; i <= last_fb_vc; i++)
- con2fb_map[i] = info_idx;
- err = take_over_console(&fb_con, first_fb_vc, last_fb_vc,
- fbcon_is_default);
- if (err) {
- for (i = first_fb_vc; i <= last_fb_vc; i++) {
- con2fb_map[i] = -1;
- }
- info_idx = -1;
- }
- return err;
- }
�м��forѭ������ǰ���õĿ���̨�ı�Ŷ�ӳ�䵽��ǰ����ע���֡������Ӳ���豸�ı��info_idx��ȥ����ʾ��ǰ���õĿ���̨�뻺����Ӳ���豸��ʵ��ӳ���ϵ��
����take_over_console������ʼ��ϵͳ��ǰ��ʹ�õĿ���̨��������ķ���ֵ������0����ô�ͱ�ʾ��ʼ��ʧ�ܡ�����������£�����forѭ���ͻὫȫ������con2fb_map�ĸ���Ԫ�ص�ֵ����Ϊ-1����ʾϵͳ��ǰ���õĿ���̨��û��ӳ�䵽ʵ�ʵ�֡������Ӳ���豸��ȥ����ʱ��ȫ�ֱ���info_idx��ֵҲ�ᱻ��������Ϊ-1��
���ú���take_over_console����ʼ��ϵͳ��ǰ��ʹ�õĿ���̨��ʵ���Ͼ�����ϵͳע��һϵ�лص��������Ա�ϵͳ����ͨ����Щ�ص�������������ǰ��ʹ�õĿ���̨����Щ�ص�����ʹ�ýṹ��consw��������������ע��Ľṹ��consw����ȫ�ֱ���fb_con��ָ���ģ����Ķ���������ʾ��
- /*
- * The console `switch' structure for the frame buffer based console
- */
- static const struct consw fb_con = {
- .owner = THIS_MODULE,
- .con_startup = fbcon_startup,
- .con_init = fbcon_init,
- .con_deinit = fbcon_deinit,
- .con_clear = fbcon_clear,
- .con_putc = fbcon_putc,
- .con_putcs = fbcon_putcs,
- .con_cursor = fbcon_cursor,
- .con_scroll = fbcon_scroll,
- .con_bmove = fbcon_bmove,
- .con_switch = fbcon_switch,
- .con_blank = fbcon_blank,
- .con_font_set = fbcon_set_font,
- .con_font_get = fbcon_get_font,
- .con_font_default = fbcon_set_def_font,
- .con_font_copy = fbcon_copy_font,
- .con_set_palette = fbcon_set_palette,
- .con_scrolldelta = fbcon_scrolldelta,
- .con_set_origin = fbcon_set_origin,
- .con_invert_region = fbcon_invert_region,
- .con_screen_pos = fbcon_screen_pos,
- .con_getxy = fbcon_getxy,
- .con_resize = fbcon_resize,
- };
������������Ҫ��ע����fbcon_init��fbcon_switch��ʵ�֣�ϵͳ����ͨ��������ʼ�����л�����̨�ġ��ڳ�ʼ���Ĺ����У�������Ƿ���Ҫ����һ��������������ݣ������л�����̨�Ĺ����У�������Ƿ���Ҫ��ʾ��һ��������������ݡ�
����fbcon_init��ʵ��������ʾ��
- static void fbcon_init(struct vc_data *vc, int init)
- {
- struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
- struct fbcon_ops *ops;
- struct vc_data **default_mode = vc->vc_display_fg;
- struct vc_data *svc = *default_mode;
- struct display *t, *p = &fb_display[vc->vc_num];
- int logo = 1, new_rows, new_cols, rows, cols, charcnt = 256;
- int cap;
- if (info_idx == -1 || info == NULL)
- return;
- ......
- if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW ||
- (info->fix.type == FB_TYPE_TEXT))
- logo = 0;
- ......
- if (logo)
- fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows);
- ......
- }
��ǰ���ڳ�ʼ���Ŀ���̨ʹ�ò���vc�������������ij�Ա����vc_num����������ǰ���ڳ�ʼ���Ŀ���̨�ı�š�ͨ��������֮�Ϳ�����ȫ������con2fb_map���ҵ���Ӧ��֡������Ӳ���豸��š�����֡������Ӳ���豸���֮�Ϳ���������һ��ȫ��������registered_fb���ҵ�һ��fb_info�ṹ��info�����������뵱ǰ���ڳ�ʼ���Ŀ���̨����Ӧ��֡������Ӳ���豸��
����vc�ij�Ա����vc_display_fg��������ϵͳ��ǰ�ɼ��Ŀ���̨������һ������Ϊvc_data**��ָ�롣������Ϳ��Կ��������յõ���vc_data�ṹ��svc������������ϵͳ��ǰ�ɼ��Ŀ���̨�ġ�
����logo��ʼ��ʱ������Ϊ1����ʾ��Ҫ��ʾ��һ���������棬������������������£�����ֵ�ᱻ����Ϊ0����ʾ����Ҫ��ʾ�������棺
A. ����vc�ͱ���svcָ��IJ���ͬһ��vc_data�ṹ�壬����ǰ���ڳ�ʼ���Ŀ���̨����ϵͳ��ǰ�ɼ��Ŀ���̨��
B. ȫ�ֱ���logo_shown��ֵ����FBCON_LOGO_DONTSHOW����ϵͳ����Ҫ��ʾ��һ���������档
C. �뵱ǰ���ڳ�ʼ���Ŀ���̨����Ӧ��֡������Ӳ���豸����ʾ��ʽ������Ϊ�ı���ʽ����info->fix.type��ֵ����FB_TYPE_TEXT��
�����յõ��ı���logo��ֵ����1��ʱ�������ͻ���ú���fbcon_prepare_logo����Ҫ��ʾ�ĵ�һ��������������ݡ�
�ں���fbcon_prepare_logo�У���һ�����������������ͨ�����ú���fb_prepare_logo�����ģ�������ʾ��
- static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info,
- int cols, int rows, int new_cols, int new_rows)
- {
- ......
- int logo_height;
- ......
- logo_height = fb_prepare_logo(info, ops->rotate);
- ......
- if (logo_lines > vc->vc_bottom) {
- ......
- } else if (logo_shown != FBCON_LOGO_DONTSHOW) {
- logo_shown = FBCON_LOGO_DRAW;
- ......
- }
- }
�Ӻ���fb_prepare_logo������֮�����Ҫ��ʾ�ĵ�һ������������ռ�õĿ���̨����С�ڵ��ڲ���vc�������Ŀ���̨���������������ȫ�ֱ���logo_show��ֵ������FBCON_LOGO_DONTSHOW����ô��˵��ǰ�����ᵽ�ĵ�һ���������������ʾ�ڿ���̨�С���ʱ��ȫ�ֱ���logo_show��ֵ�ͻᱻ����ΪFBCON_LOGO_DRAW����ʾ��һ���������洦�ڵȴ���Ⱦ��״̬��
����fb_prepare_logoʵ�����ļ�kernel/goldfish/drivers/video/fbmem.c�У�������ʾ��
- int fb_prepare_logo(struct fb_info *info, int rotate)
- {
- int depth = fb_get_color_depth(&info->var, &info->fix);
- unsigned int yres;
- memset(&fb_logo, 0, sizeof(struct logo_data));
- ......
- if (info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
- depth = info->var.blue.length;
- if (info->var.red.length < depth)
- depth = info->var.red.length;
- if (info->var.green.length < depth)
- depth = info->var.green.length;
- }
- if (info->fix.visual == FB_VISUAL_STATIC_PSEUDOCOLOR && depth > 4) {
- /* assume console colormap */
- depth = 4;
- }
- /* Return if no suitable logo was found */
- fb_logo.logo = fb_find_logo(depth);
- ......
- return fb_prepare_extra_logos(info, fb_logo.logo->height, yres);
- }
����fb_find_logoʵ�����ļ�kernel/goldfish/drivers/video/logo/logo.c�ļ��У�������ʾ��
- extern const struct linux_logo logo_linux_mono;
- extern const struct linux_logo logo_linux_vga16;
- extern const struct linux_logo logo_linux_clut224;
- extern const struct linux_logo logo_blackfin_vga16;
- extern const struct linux_logo logo_blackfin_clut224;
- extern const struct linux_logo logo_dec_clut224;
- extern const struct linux_logo logo_mac_clut224;
- extern const struct linux_logo logo_parisc_clut224;
- extern const struct linux_logo logo_sgi_clut224;
- extern const struct linux_logo logo_sun_clut224;
- extern const struct linux_logo logo_superh_mono;
- extern const struct linux_logo logo_superh_vga16;
- extern const struct linux_logo logo_superh_clut224;
- extern const struct linux_logo logo_m32r_clut224;
- static int nologo;
- module_param(nologo, bool, 0);
- MODULE_PARM_DESC(nologo, "Disables startup logo");
- /* logo's are marked __initdata. Use __init_refok to tell
- * modpost that it is intended that this function uses data
- * marked __initdata.
- */
- const struct linux_logo * __init_refok fb_find_logo(int depth)
- {
- const struct linux_logo *logo = NULL;
- if (nologo)
- return NULL;
- if (depth >= 1) {
- #ifdef CONFIG_LOGO_LINUX_MONO
- /* Generic Linux logo */
- logo = &logo_linux_mono;
- #endif
- #ifdef CONFIG_LOGO_SUPERH_MONO
- /* SuperH Linux logo */
- logo = &logo_superh_mono;
- #endif
- }
- if (depth >= 4) {
- #ifdef CONFIG_LOGO_LINUX_VGA16
- /* Generic Linux logo */
- logo = &logo_linux_vga16;
- #endif
- #ifdef CONFIG_LOGO_BLACKFIN_VGA16
- /* Blackfin processor logo */
- logo = &logo_blackfin_vga16;
- #endif
- #ifdef CONFIG_LOGO_SUPERH_VGA16
- /* SuperH Linux logo */
- logo = &logo_superh_vga16;
- #endif
- }
- if (depth >= 8) {
- #ifdef CONFIG_LOGO_LINUX_CLUT224
- /* Generic Linux logo */
- logo = &logo_linux_clut224;
- #endif
- #ifdef CONFIG_LOGO_BLACKFIN_CLUT224
- /* Blackfin Linux logo */
- logo = &logo_blackfin_clut224;
- #endif
- #ifdef CONFIG_LOGO_DEC_CLUT224
- /* DEC Linux logo on MIPS/MIPS64 or ALPHA */
- logo = &logo_dec_clut224;
- #endif
- #ifdef CONFIG_LOGO_MAC_CLUT224
- /* Macintosh Linux logo on m68k */
- if (MACH_IS_MAC)
- logo = &logo_mac_clut224;
- #endif
- #ifdef CONFIG_LOGO_PARISC_CLUT224
- /* PA-RISC Linux logo */
- logo = &logo_parisc_clut224;
- #endif
- #ifdef CONFIG_LOGO_SGI_CLUT224
- /* SGI Linux logo on MIPS/MIPS64 and VISWS */
- logo = &logo_sgi_clut224;
- #endif
- #ifdef CONFIG_LOGO_SUN_CLUT224
- /* Sun Linux logo */
- logo = &logo_sun_clut224;
- #endif
- #ifdef CONFIG_LOGO_SUPERH_CLUT224
- /* SuperH Linux logo */
- logo = &logo_superh_clut224;
- #endif
- #ifdef CONFIG_LOGO_M32R_CLUT224
- /* M32R Linux logo */
- logo = &logo_m32r_clut224;
- #endif
- }
- return logo;
- }
- EXPORT_SYMBOL_GPL(fb_find_logo);
ȫ�ֱ���nologo��һ������Ϊ����������ģ�����������Ĭ��ֵ����0����ʾҪ��ʾ��һ���������档����������£�����fb_find_logo�ͻ���ݲ���depth��ֵ�Լ���ͬ�ı���ѡ����ѡ���һ��������������ݣ����ұ����ڱ���logo�з��ظ������ߡ�
��һ��ִ�����֮��һ��������������ݾͱ�����ģ��fbmem��ȫ�ֱ���fb_logo�ij�Ա����logo���ˡ���ʱ�����̨�ij�ʼ������Ҳ�����ˣ�������ϵͳ�ͻ�ִ���л�����̨�IJ�����ǰ���ᵽ����ϵͳִ���л�����̨�IJ�����ʱ��ģ��fbcon�еĺ���fbcon_switch�ͻᱻ���á��ڵ��õĹ����У��ͻ�ִ����ʾ��һ����������IJ�����
����fbcon_switchʵ�����ļ�kernel/goldfish/drivers/video/console/fbcon.c�У���ʾ��һ����������Ĺ���������ʾ��
- static int fbcon_switch(struct vc_data *vc)
- {
- struct fb_info *info, *old_info = NULL;
- struct fbcon_ops *ops;
- struct display *p = &fb_display[vc->vc_num];
- struct fb_var_screeninfo var;
- int i, prev_console, charcnt = 256;
- ......
- if (logo_shown == FBCON_LOGO_DRAW) {
- logo_shown = fg_console;
- /* This is protected above by initmem_freed */
- fb_show_logo(info, ops->rotate);
- ......
- return 0;
- }
- return 1;
- }
����fb_show_logoʵ�����ļ�kernel/goldfish/drivers/video/fbmem.c�У�������ʾ��
- int fb_show_logo(struct fb_info *info, int rotate)
- {
- int y;
- y = fb_show_logo_line(info, rotate, fb_logo.logo, 0,
- num_online_cpus());
- ......
- return y;
- }
����fb_show_logo_lineҲ��ʵ�����ļ�kernel/goldfish/drivers/video/fbmem.c�У�������ʾ��
- static int fb_show_logo_line(struct fb_info *info, int rotate,
- const struct linux_logo *logo, int y,
- unsigned int n)
- {
- u32 *palette = NULL, *saved_pseudo_palette = NULL;
- unsigned char *logo_new = NULL, *logo_rotate = NULL;
- struct fb_image image;
- /* Return if the frame buffer is not mapped or suspended */
- if (logo == NULL || info->state != FBINFO_STATE_RUNNING ||
- info->flags & FBINFO_MODULE)
- return 0;
- image.depth = 8;
- image.data = logo->data;
- if (fb_logo.needs_cmapreset)
- fb_set_logocmap(info, logo);
- if (fb_logo.needs_truepalette ||
- fb_logo.needs_directpalette) {
- palette = kmalloc(256 * 4, GFP_KERNEL);
- if (palette == NULL)
- return 0;
- if (fb_logo.needs_truepalette)
- fb_set_logo_truepalette(info, logo, palette);
- else
- fb_set_logo_directpalette(info, logo, palette);
- saved_pseudo_palette = info->pseudo_palette;
- info->pseudo_palette = palette;
- }
- if (fb_logo.depth <= 4) {
- logo_new = kmalloc(logo->width * logo->height, GFP_KERNEL);
- if (logo_new == NULL) {
- kfree(palette);
- if (saved_pseudo_palette)
- info->pseudo_palette = saved_pseudo_palette;
- return 0;
- }
- image.data = logo_new;
- fb_set_logo(info, logo, logo_new, fb_logo.depth);
- }
- image.dx = 0;
- image.dy = y;
- image.width = logo->width;
- image.height = logo->height;
- if (rotate) {
- logo_rotate = kmalloc(logo->width *
- logo->height, GFP_KERNEL);
- if (logo_rotate)
- fb_rotate_logo(info, logo_rotate, &image, rotate);
- }
- fb_do_show_logo(info, &image, rotate, n);
- kfree(palette);
- if (saved_pseudo_palette != NULL)
- info->pseudo_palette = saved_pseudo_palette;
- kfree(logo_new);
- kfree(logo_rotate);
- return logo->height;
- }
����fb_do_show_logoҲ��ʵ�����ļ�kernel/goldfish/drivers/video/fbmem.c�У�������ʾ��
- static void fb_do_show_logo(struct fb_info *info, struct fb_image *image,
- int rotate, unsigned int num)
- {
- unsigned int x;
- if (rotate == FB_ROTATE_UR) {
- for (x = 0;
- x < num && image->dx + image->width <= info->var.xres;
- x++) {
- info->fbops->fb_imageblit(info, image);
- image->dx += image->width + 8;
- }
- } else if (rotate == FB_ROTATE_UD) {
- for (x = 0; x < num && image->dx >= 0; x++) {
- info->fbops->fb_imageblit(info, image);
- image->dx -= image->width + 8;
- }
- } else if (rotate == FB_ROTATE_CW) {
- for (x = 0;
- x < num && image->dy + image->height <= info->var.yres;
- x++) {
- info->fbops->fb_imageblit(info, image);
- image->dy += image->height + 8;
- }
- } else if (rotate == FB_ROTATE_CCW) {
- for (x = 0; x < num && image->dy >= 0; x++) {
- info->fbops->fb_imageblit(info, image);
- image->dy -= image->height + 8;
- }
- }
- }
����info��������Ҫ��Ⱦ��֡������Ӳ���豸�����ij�Ա����fbopsָ����һϵ�лص���������������֡������Ӳ���豸�����У��ص�����fb_imageblit����������ָ����֡������Ӳ���豸��Ⱦָ����ͼ��ġ�
���ˣ���һ�������������ʾ���̾ͷ�������ˡ�
2. �ڶ��������������ʾ����
���ڵڶ���������������init���������Ĺ�������ʾ�ģ���ˣ����Ǿʹ�init���̵���ں���main��ʼ�����ڶ��������������ʾ���̡�
init���̵���ں���mainʵ�����ļ�system/core/init/init.c�У�������ʾ��
- int main(int argc, char **argv)
- {
- int fd_count = 0;
- struct pollfd ufds[4];
- ......
- int property_set_fd_init = 0;
- int signal_fd_init = 0;
- int keychord_fd_init = 0;
- if (!strcmp(basename(argv[0]), "ueventd"))
- return ueventd_main(argc, argv);
- ......
- queue_builtin_action(console_init_action, "console_init");
- ......
- for(;;) {
- int nr, i, timeout = -1;
- execute_one_command();
- restart_processes();
- if (!property_set_fd_init && get_property_set_fd() > 0) {
- ufds[fd_count].fd = get_property_set_fd();
- ufds[fd_count].events = POLLIN;
- ufds[fd_count].revents = 0;
- fd_count++;
- property_set_fd_init = 1;
- }
- if (!signal_fd_init && get_signal_fd() > 0) {
- ufds[fd_count].fd = get_signal_fd();
- ufds[fd_count].events = POLLIN;
- ufds[fd_count].revents = 0;
- fd_count++;
- signal_fd_init = 1;
- }
- if (!keychord_fd_init && get_keychord_fd() > 0) {
- ufds[fd_count].fd = get_keychord_fd();
- ufds[fd_count].events = POLLIN;
- ufds[fd_count].revents = 0;
- fd_count++;
- keychord_fd_init = 1;
- }
- if (process_needs_restart) {
- timeout = (process_needs_restart - gettime()) * 1000;
- if (timeout < 0)
- timeout = 0;
- }
- if (!action_queue_empty() || cur_action)
- timeout = 0;
- ......
- nr = poll(ufds, fd_count, timeout);
- if (nr <= 0)
- continue;
- for (i = 0; i < fd_count; i++) {
- if (ufds[i].revents == POLLIN) {
- if (ufds[i].fd == get_property_set_fd())
- handle_property_set_fd();
- else if (ufds[i].fd == get_keychord_fd())
- handle_keychord();
- else if (ufds[i].fd == get_signal_fd())
- handle_signal();
- }
- }
- }
- return 0;
- }
ueventd��������ʲô�õ��أ�������������uevent�¼��ģ�����������ϵͳ�豸�ġ���ǰ�����������֪��������������ں���Ϊueventd_main��ʵ����system/core/init/ueventd.c�С�ueventd���̻�ͨ��һ��socket�ӿ������ں�ͨ�ţ��Ա���Լ��ϵͳ�豸�¼������磬��ǰ����Ubuntu��ΪAndroidϵͳ��дLinux�ں���������һ���У� ���ǵ���device_create������������һ������Ϊ��hello�����ַ��豸����ʱ���ں˾ͻ���ǰ���ᵽ��socket����һ���豸�����¼���ueventd����ͨ�����socket���������豸�����¼�֮�ͻ�/devĿ¼�´���һ������Ϊ��hello�����豸�ļ��������û��ռ��Ӧ�ó���Ϳ���ͨ���豸�ļ�/dev/hello������������hello����ͨ���ˡ�
��������������һ������queue_builtin_action����init�����е�һ����ִ��action����������һ�����Ƶ��ڡ�console_init����action�����action��Ӧ��ִ�к���Ϊconsole_init_action��������������ʾ�ڶ�����������ġ�
����queue_builtin_actionʵ�����ļ�system/core/init/init_parser.c�ļ��У�������ʾ��
- static list_declare(action_list);
- static list_declare(action_queue);
- void queue_builtin_action(int (*func)(int nargs, char **args), char *name)
- {
- struct action *act;
- struct command *cmd;
- act = calloc(1, sizeof(*act));
- act->name = name;
- list_init(&act->commands);
- cmd = calloc(1, sizeof(*cmd));
- cmd->func = func;
- cmd->args[0] = name;
- list_add_tail(&act->commands, &cmd->clist);
- list_add_tail(&action_list, &act->alist);
- action_add_queue_tail(act);
- }
- void action_add_queue_tail(struct action *act)
- {
- list_add_tail(&action_queue, &act->qlist);
- }
�ص�init���̵���ں���main�У����init���̻���뵽һ������ѭ����ȥ�����������ѭ���У�init���̻�������������飺
A. ���ú���execute_one_command�����action_queue�б��Ƿ�Ϊ�ա������Ϊ�յĻ�����ôinit���̾ͻὫ�������б�ͷ�е�action�Ƴ�������ִ��������Ƴ���action������ǰ�����ǽ�һ������Ϊ��console_init����action���ӵ���action_queue�б��У���ˣ����������ѭ���У����action�ͻᱻִ�У�������console_init_action�ᱻ���á�
B. ���ú���restart_processes�����ϵͳ���Ƿ��н�����Ҫ�������������ű�/init.rc�У����ǿ���ָ��һ���������˳�֮����Զ���������������������£�����restart_processes�ͻ����Ƿ������Ҫ���������Ľ��̣�������ڵĻ�����ô�ͻὫ����������������
C. ����ϵͳ���Ա仯�¼��������ǵ��ú���property_set���ı�һ��ϵͳ����ֵʱ��ϵͳ�ͻ�ͨ��һ��socket��ͨ�����ú���get_property_set_fd���Ի�������ļ�������������init���̷���һ������ֵ�ı��¼�֪ͨ��init���̽��յ��������ֵ�ı��¼�֮�ͻ���ú���handle_property_set_fd��������Ӧ�Ĵ����������ڷ��������������������ʾ����ʱ�����Ǿͻῴ����SurfaceFlinger�������ͨ���ġ�ctl.start���͡�ctl.stop������ֵ��������ֹͣ��������������ġ�
D. ����һ�ֳ�Ϊ��chorded keyboard���ļ��������¼�����������Ϊchorded keyboard���ļ����豸ͨ����ͬ��識������������ͬ��������߲���������Ӧ���豸�ļ�Ϊ/dev/keychord�����ǿ���ͨ�����ú���get_keychord_fd���������豸���ļ����������Ա���Լ�����������¼������ҵ��ú���handle_keychord������Щ�����¼����д�����
E. ���ս�ʬ���̡�����֪������Linux�ں��У���������̲��ȴ��ӽ��̽������˳�����ô���ӽ��̽�����ʱ�ͻ���һ����ʬ���̣��Ӷ�ռ��ϵͳ����Դ��Ϊ�˻�����Щ��ʬ���̣�init���̻ᰲװһ��SIGCHLD�źŽ�����������Щ�������Ѿ��˳��˵��ӽ����˳���ʱ���ں˾ͻᷢ��һ��SIGCHLD�źŸ�init���̡�init���̿���ͨ��һ��socket��ͨ�����ú���get_signal_fd���Ի�������ļ����������������յ���SIGCHLD�źŶ�ȡ���������ҵ��ú���handle_signal���Խ��յ���SIGCHLD�źŽ��д�������������Щ�Ѿ�����˽�ʬ���ӽ��̡�
ע�⣬���ں��������¼����ǿ���ͨ���ļ��������������ģ���ˣ�init���̵���ں���mainʹ��poll������ͬʱ��ѯ���ǣ��Ա�������Ч�ʡ�
���������Ǿ��ص��������console_init_action��ʵ�֣��Ա�����˽�ڶ��������������ʾ���̣�
- static int console_init_action(int nargs, char **args)
- {
- int fd;
- char tmp[PROP_VALUE_MAX];
- if (console[0]) {
- snprintf(tmp, sizeof(tmp), "/dev/%s", console);
- console_name = strdup(tmp);
- }
- fd = open(console_name, O_RDWR);
- if (fd >= 0)
- have_console = 1;
- close(fd);
- if( load_565rle_image(INIT_IMAGE_FILE) ) {
- fd = open("/dev/tty0", O_WRONLY);
- if (fd >= 0) {
- const char *msg;
- msg = "\n"
- "\n"
- "\n"
- "\n"
- "\n"
- "\n"
- "\n" // console is 40 cols x 30 lines
- "\n"
- "\n"
- "\n"
- "\n"
- "\n"
- "\n"
- "\n"
- " A N D R O I D ";
- write(fd, msg, strlen(msg));
- close(fd);
- }
- }
- return 0;
- }
A. ��ʼ������̨��init������������ʱ������ں˵������������������ļ�/proc/cmdline�У�����������ں˵����������а�������һ������Ϊ��androidboot.console�������ԣ���ô�ͻὫ������Ե�ֵ�������ַ�����console�С��������ǾͿ���ͨ���豸�ļ�/dev/������ϵͳ�Ŀ���̨������ں˵���������û�а�������Ϊ��androidboot.console�������ԣ���ôĬ�Ͼ�ͨ���豸�ļ�/dev/console������ϵͳ�Ŀ���̨������ܹ��ɹ��ش��豸�ļ�/dev/����/dev/console����ô��˵��ϵͳ֧�ַ��ʿ���̨����ˣ�ȫ�ֱ���have_console�ľͻᱻ����Ϊ1��
B. ��ʾ�ڶ����������档��ʾ�ڶ�������������ͨ�����ú���load_565rle_image��ʵ�ֵġ��ڵ��ú���load_565rle_image��ʱ��ָ���Ŀ��������ļ�ΪINIT_IMAGE_FILE��INIT_IMAGE_FILE��һ���꣬������system/core/init/init.h�ļ��У�������ʾ��
- #define INIT_IMAGE_FILE "/initlogo.rle"
���ڶ���������������������ļ�/initlogo.rle��ָ���ġ�����ļ�/initlogo.rle�����ڣ���������ʾ���Ĺ����г����쳣����ô����load_565rle_image�ķ���ֵ�ͻ����-1����ʱ����console_init_action�����ı��ķ�ʽ����ʾ�ڶ����������棬������Ϊ0�Ŀ���̨��/dev/tty0�������ANDROID����7���ַ���
����load_565rle_imageʵ�����ļ�system/core/init/logo.c�У�������ʾ��
- /* 565RLE image format: [count(2 bytes), rle(2 bytes)] */
- int load_565rle_image(char *fn)
- {
- struct FB fb;
- struct stat s;
- unsigned short *data, *bits, *ptr;
- unsigned count, max;
- int fd;
- if (vt_set_mode(1))
- return -1;
- fd = open(fn, O_RDONLY);
- if (fd < 0) {
- ERROR("cannot open '%s'\n", fn);
- goto fail_restore_text;
- }
- if (fstat(fd, &s) < 0) {
- goto fail_close_file;
- }
- data = mmap(0, s.st_size, PROT_READ, MAP_SHARED, fd, 0);
- if (data == MAP_FAILED)
- goto fail_close_file;
- if (fb_open(&fb))
- goto fail_unmap_data;
- max = fb_width(&fb) * fb_height(&fb);
- ptr = data;
- count = s.st_size;
- bits = fb.bits;
- while (count > 3) {
- unsigned n = ptr[0];
- if (n > max)
- break;
- android_memset16(bits, ptr[1], n << 1);
- bits += n;
- max -= n;
- ptr += 2;
- count -= 4;
- }
- munmap(data, s.st_size);
- fb_update(&fb);
- fb_close(&fb);
- close(fd);
- unlink(fn);
- return 0;
- fail_unmap_data:
- munmap(data, s.st_size);
- fail_close_file:
- close(fd);
- fail_restore_text:
- vt_set_mode(0);
- return -1;
- }
�������Ƚ�����̨����ʾ��ʽ����Ϊͼ�η�ʽ������ͨ�����ú���vt_set_mode��ʵ�ֵģ�������ʾ��
- static int vt_set_mode(int graphics)
- {
- int fd, r;
- fd = open("/dev/tty0", O_RDWR | O_SYNC);
- if (fd < 0)
- return -1;
- r = ioctl(fd, KDSETMODE, (void*) (graphics ? KD_GRAPHICS : KD_TEXT));
- close(fd);
- return r;
- }
�ص�����load_565rle_image�У���ǰ��ĵ��ù��̿���֪��������fn��ֵ���ڡ�/initlogo.rle������ָ��Ŀ���豸�ϵ�initlogo.rle�ļ�������load_565rle_image���ȵ��ú���open������ļ������ҽ���õ��ļ������������ڱ���fd�У������ٵ��ú���fstat���������ļ��Ĵ�С��������Щ��Ϣ֮����load_565rle_image�Ϳ��Ե��ú���mmap�����ļ�/initlogo.rleӳ�䵽init���̵ĵ�ַ�ռ����ˣ��Ա���Զ�ȡ�������ݡ�
���ļ�/initlogo.rleӳ�䵽init���̵ĵ�ַ�ռ�֮�������ٵ��ú���fb_open�����豸�ļ�/dev/graphics/fb0��ǰ���ڽ��ܵ�һ�������������ʾ�������ᵽ���豸�ļ�/dev/graphics/fb0����������ϵͳ��֡������Ӳ���豸�ģ���ˣ������豸�ļ�/dev/graphics/fb0֮�����ǾͿ��Խ��ļ�/initlogo.rle�����������֡������Ӳ���豸��ȥ�ˡ�
����fb_open��ʵ��������ʾ��
- static int fb_open(struct FB *fb)
- {
- fb->fd = open("/dev/graphics/fb0", O_RDWR);
- if (fb->fd < 0)
- return -1;
- if (ioctl(fb->fd, FBIOGET_FSCREENINFO, &fb->fi) < 0)
- goto fail;
- if (ioctl(fb->fd, FBIOGET_VSCREENINFO, &fb->vi) < 0)
- goto fail;
- fb->bits = mmap(0, fb_size(fb), PROT_READ | PROT_WRITE,
- MAP_SHARED, fb->fd, 0);
- if (fb->bits == MAP_FAILED)
- goto fail;
- return 0;
- fail:
- close(fb->fd);
- return -1;
- }
���˻��֡������Ӳ���豸�Ĺ̶���Ϣ�Ϳɱ���Ϣ֮�⣬����fb_open���Ὣ�豸�ļ�/dev/graphics/fb0������ӳ�䵽init���̵ĵ�ַ�ռ���������init���̾Ϳ���ͨ��ӳ��õ��������ַ������֡������Ӳ���豸�������ˡ�
�ص�����load_565rle_image�У��������ֱ�ʹ�ú�fb_width��fb_height�������Ļ��ʹ�õĵķֱ��ʣ�����Ļ�Ŀ��Ⱥ߶ȡ���fb_width��fb_height�Ķ���������ʾ��
- #define fb_width(fb) ((fb)->vi.xres)
- #define fb_height(fb) ((fb)->vi.yres)
�������Ƿֱ�õ����ļ�initlogo.rle��֡������Ӳ���豸��init�����е�������ʵ�ַ�Լ���С���������ǾͿ��Խ��ļ�initlogo.rle������д�뵽֡������Ӳ���豸��ȥ���Ա���Խ��ڶ�������������ʾ����������ͨ������load_565rle_image�е�whileѭ����ʵ�ֵġ�
�ļ�initlogo.rle����ĵڶ������������ͼ���ʽ��565rle�ġ�rle��ȫ����run-length encoding������Ϊ�γ̱�������г̳��ȱ��룬������ʹ��4���ֽ�������һ�������ľ�����ͬ��ɫֵ�����С���rle565��ʽ��ǰ��2���ֽ��������������еĸ�����������2���ֽ���������һ���������ɫ�����У���ɫ��RGBֵ�ֱ�ռ5λ��6λ��5λ��������565rleͼ���ʽ֮�����ǾͿ������⺯��load_565rle_image�е�whileѭ����ʵ�����ˡ���ÿһ��ѭ���У��������δ��ļ�initlogo.rle�ж���4���ֽڣ����У�ǰ�����ֽڵ����ݱ����ڱ���n�У�������2���ֽڵ���������д�뵽֡������Ӳ���豸��ȥ������2���ֽڸպþͿ���ʹ��һ�����Ŷ���������������ˣ�����load_565rle_imageͨ�����ú���android_memset16�������ļ�initlogo.rle�ж�ȡ��������ɫֵд�뵽֡������Ӳ���豸��ȥ��
����android_memset16��ʵ��������ʾ��
- void android_memset16(void *_ptr, unsigned short val, unsigned count)
- {
- unsigned short *ptr = _ptr;
- count >>= 1;
- while(count--)
- *ptr++ = val;
- }
����val����������д���ֵ����������������У����ֵ��Ϊ���ļ�initlogo.rle�ж�ȡ��������ɫֵ��
����count����������д��ĵ�ַ�ij��ȣ��������ֽ�Ϊ��λ�ġ������ڽ�����val��ֵд�뵽����ptr�������ĵ�ַ��ȥʱ���������Ŷ�����Ϊ��λ�ģ�������2���ֽ�Ϊ��λ�ģ���ˣ�����android_memset16�ڽ�����valд�뵽��ַptr��ȥ֮ǰ�����ȻὫ����count��ֵ����2����Ӧ�ĵأ��ں���load_565rle_image�У���Ҫ��������ͬ��ɫֵ�����еĸ�������2֮���ٵ��ú���android_memset16��
�ص�����load_565rle_image�У����ļ�/initlogo.rle������д�뵽֡������Ӳ���豸ȥ֮�ڶ�����������Ϳ�����ʾ�����ˡ�����������load_565rle_image�ͻ���ú���munmap��ע���ļ�/initlogo.rle��init�����е�ӳ�䣬���ҵ��ú���close���ر��ļ�/initlogo.rle���ر����ļ�/initlogo.rle֮������ú���unlink��ɾ��Ŀ���豸�ϵ�/initlogo.rle�ļ���ע�⣬��ֻ��ɾ����Ŀ���豸�ϵ�/initlogo.rle�ļ���������ɾ��ramdiskӳ���е�initlogo.rle�ļ�����ˣ�ÿ�ιػ�����֮��ϵͳ�������½�ramdiskӳ���е�initlogo.rle�ļ���װ��Ŀ���豸�ϵĸ�Ŀ¼���������Ϳ�����ÿ�ο�����ʱ���ܽ�����ʾ������
������Ҫע���ļ�/initlogo.rle��init�����е�ӳ��ر��ļ�/initlogo.rle֮�⣬����Ҫע���ļ�/dev/graphics/fb0��init�����е�ӳ���Լ��ر��ļ�/dev/graphics/fb0������ͨ������fb_close������ʵ�ֵģ�������ʾ��
- static void fb_close(struct FB *fb)
- {
- munmap(fb->bits, fb_size(fb));
- close(fb->fd);
- }
- static void fb_update(struct FB *fb)
- {
- fb->vi.yoffset = 1;
- ioctl(fb->fd, FBIOPUT_VSCREENINFO, &fb->vi);
- fb->vi.yoffset = 0;
- ioctl(fb->fd, FBIOPUT_VSCREENINFO, &fb->vi);
- }
֡�������Ĵ�С��������ֱ��ʾ����ģ���ˣ����ǾͿ�����֡������д�����Ļ��С��Ҫ�������ֵ��������������������ֵ�Ϳ�������˫���塣������Ȼ������ӷֱ��ʺ�����ֱ��ʷֱ���800 x 600��1600 x 600����ô���ǾͿ����Ƚ�ǰһ��ͼ�������д�뵽֡��������ǰ��800 x 600��������ȥ�������ٽ���һ��ͼ�������д�뵽֡�������ĺ���800 x 600�������С�ͨ���ֱ���������֡������Ӳ���豸��fb_var_screeninfo�ṹ��ij�Ա����yoffset��ֵ����Ϊ0��800���Ϳ���ƽ������ʾ����ͼ��
������֡������Ӳ���豸�Ŀ��ӷֱ��Ժ�����ֱ���֮����fb_update��ʵ�����Ϳ��Ժܺõ������ˡ�
���ˣ��ڶ��������������ʾ���̾ͷ�������ˡ�
3. �����������������ʾ����
������������������Ӧ�ó���bootanimation��������ʾ�ġ�Ӧ�ó���bootanimation�������ű�init.rc�б����ó���һ������������ʾ��
- service bootanim /system/bin/bootanimation
- user graphics
- group graphics
- disabled
- oneshot
��ǰ��Androidϵͳ����Zygote�������̵�Դ�������һ�Ŀ���֪����Zygote�����������Ĺ����У��ὫSystem������������������ǰ��AndroidӦ�ó���װ����Դ�������һ���ֿ���֪����System�����������Ĺ��̣�Step 3���У������SurfaceFlinger��ľ�̬��Ա����instantiate������SurfaceFlinger����Sytem����������SurfaceFlinger����Ĺ����У����Ȼᴴ��һ��SurfaceFlingerʵ����Ȼ���ٽ����ʵ��ע�ᵽService Manager��ȥ����ע��Ĺ��̣�ǰ�洴����SurfaceFlingerʵ���ᱻһ��spָ�����á���ǰ��Androidϵͳ������ָ�루������ָ�롢ǿָ�����ָ�룩��ʵ��ԭ������һ������֪������һ�������һ�α�����ָ�����õ�ʱ���������ij�Ա����onFirstRef�ͻᱻ���á�����SurfaceFlinger��д�˸���RefBase�ij�Ա����onFirstRef����ˣ���ע��SurfaceFlinger����Ĺ����У��������SurfaceFlinger��ij�Ա����onFirstRef���ڵ��õĹ��̣��ͻᴴ��һ���߳��������������������档
SurfaceFlinger��ʵ�����ļ�frameworks/base/services/surfaceflinger/SurfaceFlinger.cpp �У����ij�Ա����onFirstRef��ʵ��������ʾ��
- void SurfaceFlinger::onFirstRef()
- {
- run("SurfaceFlinger", PRIORITY_URGENT_DISPLAY);
- // Wait for the main thread to be done with its initialization
- mReadyToRunBarrier.wait();
- }
ע�⣬SurfaceFlinger��ij�Ա����onFirstRef����System���̵����߳��е��õģ�����Ҫ�ȴ�ǰ�洴�����߳�������֮���ټ�����ǰִ�У����ͨ������SurfaceFlinger��ij�Ա����mReadytoRunBarrier��������һ��Barrier����ij�Ա����wait��ʵ�ֵġ�ÿһ��Barrier�������ʶ���װ��һ������������Condition Variable��������������������ͬ���̵߳ġ�
�����������Ǽ�������SurfaceFlinger��ij�Ա����readyToRun��ʵ�֣�������ʾ��
- status_t SurfaceFlinger::readyToRun()
- {
- LOGI( "SurfaceFlinger's main thread ready to run. "
- "Initializing graphics H/W...");
- ......
- mReadyToRunBarrier.open();
- /*
- * We're now ready to accept clients...
- */
- // start boot animation
- property_set("ctl.start", "bootanim");
- return NO_ERROR;
- }
ǰ�洴�����߳�����SurfaceFlinger�����̡߳�����߳���������ʱ����豸����Ļ�Լ�OpenGL����г�ʼ������ʼ�����֮���žͻ����SurfaceFlinger��ij�Ա����mReadyToRunBarrier��������һ��Barrier����ij�Ա����open������System���̵����̣߳��Ա������Լ�����ǰִ�С����SurfaceFlinger��ij�Ա����readyToRun�ij�Ա��������ú���property_set����ϵͳ���ԡ�ctl.start����ֵ����Ϊ��bootanim������ʾҪ��Ӧ�ó���bootanimation�����������Ա������ʾ�������������档
������������
����ת�ԣ�http://blog.csdn.net/luoshengyang/article/details/7691321
- �������
- Android����������ndk-stack���ndk�����ж�̬��.so���������� (3077�����)
- Android��������θı�RadioButton����ͼƬ�����ֵ����λ�� (3591�����)
- android��������֮ADT��װ��ж�أ����� (127�����)
- Android����֮ListViewҳüҳ��Ч��VS android�������� (108�����)
- 1¥ ������ ������ 2015-2-16 23:34:37
- ���������£�������и�ɻ�. ������
- 2¥ ������� ������ 2015-7-1 11:14:01
- �����£�����һ���Ѫ.��ֹ����Ϣ��nolinkok@163.com ������� http://www.hbbuxiugangwang.com/