LCD亮屏时间分析

1、添加log,打印亮灭屏期间lcd大概花的时间
fbmem.c中
int fb_blank(struct fb_info *info, int blank)
{	
	struct fb_event event;
	int ret = -EINVAL, early_ret;

 	if (blank > FB_BLANK_POWERDOWN)
 		blank = FB_BLANK_POWERDOWN;
	pr_err("[0000]%s:LCD power on/off start! blank=%d\n",__func__,blank);  //lcd 开始进入亮屏准备
	event.info = info;
	event.data = ␣

	early_ret = fb_notifier_call_chain(FB_EARLY_EVENT_BLANK, &event);

	if (info->fbops->fb_blank)
 		ret = info->fbops->fb_blank(blank, info);

	if (!ret)
		fb_notifier_call_chain(FB_EVENT_BLANK, &event);
	else {
		/*
		 * if fb_blank is failed then revert effects of
		 * the early blank event.
		 */
		if (!early_ret)
			fb_notifier_call_chain(FB_R_EARLY_EVENT_BLANK, &event);
	}
	pr_err("[0000]%s:LCD power on/off end! blank=%d\n",__func__,blank);   //lcd 开始亮屏准备结束,包括(上电、RESET、下init code)

 	return ret;
}

2、log分析
从lk进入kernel(未重新亮灭屏):从log看基本不占用时间,因为lk阶段已经上过电,下过 init code
[   19.523849] [0000]fb_blank:LCD power on/off start! blank=0
[   19.523859] [FTS_TS/I]fb_notifier_callback:FB event:16,blank:0
[   19.523862] [FTS_TS/I]fb_notifier_callback:resume: event = 16, not care
[   19.523862] 
[   19.523867] mdss_fb_blank: [0000]mdss_fb_blank:enter mode: 0,mfd->op_enable:1
[   19.523879] mdss_fb_blank_sub: [0000]mdss_fb_blank_sub:enter
[   19.523879] mdss_fb_blank_sub: unblank called. cur pwr state=1          //cur pwr state=1  power on 状态
[   19.523906] mdss_fb_blank_unblank: [0000]mdss_fb_blank_unblank:enter
[   19.523914] mdss_fb_blank_sub: [0000]mdss_fb_blank_sub:exit
[   19.523914] mdss_fb_blank: [0000]mdss_fb_blank:exit mode: 0,mfd->op_enable:1
[   19.523923] [FTS_TS/I]fb_notifier_callback:FB event:9,blank:0
[   19.523960] [FTS_TS]fts_ts_resume: Enter
[   19.523964] [FTS_TS]fts_ts_resume:Already in awake state
[   19.523966] [0000]fb_blank:LCD power on/off end! blank=0

进入kernel之后重新灭屏再亮屏: 大概用了217ms,从log来看时间基本花在 event=2(MDSS_EVENT_LINK_READY)72ms;event=2(MDSS_EVENT_UNBLANK)142ms
event=2(MDSS_EVENT_LINK_READY)72ms:qcom,mdss-dsi-reset-sequence = <1 20>, <0 2>, <1 20>; reset:42ms
event=2(MDSS_EVENT_UNBLANK)142ms: 05 01 00 00 78 00 02 11 00 和 05 01 00 00 14 00 02 29 00 :delay(11+29)120+20=140ms
[   25.124997] [0000]fb_blank:LCD power on/off start! blank=0
[   25.125005] [FTS_TS/I]fb_notifier_callback:FB event:16,blank:0
[   25.125009] [FTS_TS/I]fb_notifier_callback:resume: event = 16, not care
[   25.125009] 
[   25.125013] mdss_fb_blank: [0000]mdss_fb_blank:enter mode: 0,mfd->op_enable:1
[   25.125025] mdss_fb_blank_sub: [0000]mdss_fb_blank_sub:enter
[   25.125025] mdss_fb_blank_sub: unblank called. cur pwr state=0
[   25.125278] mdss_fb_blank_unblank: [0000]mdss_fb_blank_unblank:enter
[   25.125284] mdss_mdp_overlay_on: [0000]mdss_mdp_overlay_on:enter
[   25.125288] mdss_mdp_ctl_intf_event: [0000]mdss_mdp_ctl_intf_event:enter
[   25.125294] [0000]mdss_dsi_event_handler:enter,event=1
[   25.125298] [0000]mdss_dsi_event_handler:exit,event=1
[   25.125688] mdss_mdp_ctl_intf_event: [0000]mdss_mdp_ctl_intf_event:exit
[   25.125692] mdss_mdp_ctl_intf_event: [0000]mdss_mdp_ctl_intf_event:enter
[   25.125698] [0000]mdss_dsi_event_handler:enter,event=22
[   25.125701] [0000]mdss_dsi_event_handler:exit,event=22
[   25.126473] mdss_mdp_ctl_intf_event: [0000]mdss_mdp_ctl_intf_event:exit
[   25.126473] mdss_mdp_video_display: [wangqilin]mdss_mdp_video_display:kickoff ctl=0
[   25.126498] mdss_mdp_ctl_intf_event: [0000]mdss_mdp_ctl_intf_event:enter
[   25.126507] [0000]mdss_dsi_event_handler:enter,event=2
[   25.126508] mdss_mdp_parse_panel_id_kernel: mdss_mdp_parse_panel_id_kernel panel_id :3
[   25.126511] mdss_dsi_panel_power_on vsp vsn on after reset
[   25.168719] mdss_dsi_panel_power_on log for calculate time
[   25.197055] init: Received control message 'interface_start' for '[email protected]::ICameraProvider/legacy/0' from pid: 430 (/system/bin/hwservicemanager)
[   25.199339] [0000]mdss_dsi_event_handler:exit from mdss_dsi_on,event=2
[   25.199344] [0000]mdss_dsi_event_handler:exit,event=2
[   25.199349] mdss_mdp_ctl_intf_event: [0000]mdss_mdp_ctl_intf_event:exit
[   25.199349] mdss_mdp_video_display: [wangqilin]mdss_mdp_video_display:33333
[   25.199356] mdss_mdp_ctl_intf_event: [0000]mdss_mdp_ctl_intf_event:enter
[   25.199362] [0000]mdss_dsi_event_handler:enter,event=3
[   25.199365] [0000]mdss_dsi_event_handler:enter,case,event=3
[   25.199385] [0000]mdss_dsi_unblank:enter
[   25.199386] ----------------mdss_dsi_panel_on------------
[   25.341888] [0000]mdss_dsi_unblank:exit
[   25.341893] [0000]mdss_dsi_event_handler:exit,event=3
[   25.342434] mdss_mdp_ctl_intf_event: [0000]mdss_mdp_ctl_intf_event:exit
[   25.342435] mdss_mdp_video_display: [wangqilin]mdss_mdp_video_display:44444
[   25.342442] mdss_mdp_ctl_intf_event: [0000]mdss_mdp_ctl_intf_event:enter
[   25.342448] [0000]mdss_dsi_event_handler:enter,event=4
[   25.342451] [0000]mdss_dsi_event_handler:exit,event=4
[   25.342454] mdss_mdp_ctl_intf_event: [0000]mdss_mdp_ctl_intf_event:exit
[   25.342457] mdss_mdp_ctl_intf_event: [0000]mdss_mdp_ctl_intf_event:enter
[   25.342473] [0000]mdss_dsi_event_handler:enter,event=5
[   25.342476] [0000]mdss_dsi_event_handler:exit,event=5
[   25.342530] mdss_mdp_ctl_intf_event: [0000]mdss_mdp_ctl_intf_event:exit
[   25.342537] mdss_mdp_overlay_on: [0000]mdss_mdp_overlay_on:exit
[   25.342675] mdss_fb_blank_unblank: [0000]mdss_fb_blank_unblank:mfd->idle_time=0
[   25.342685] mdss_fb_blank_unblank: [0000]mdss_fb_blank_unblank:exit
[   25.342691] mdss_fb_blank_sub: [0000]mdss_fb_blank_sub:exit
[   25.342692] mdss_fb_blank: [0000]mdss_fb_blank:exit mode: 0,mfd->op_enable:1
[   25.342703] [FTS_TS/I]fb_notifier_callback:FB event:9,blank:0
[   25.342726] [0000]fb_blank:LCD power on/off end! blank=0

3、函数调用关系和总结
以下载init code为例,dump_stack()打印函数调用栈信息如下:
[  112.993696] Call trace:
[  112.993716] [<00000000a8f39f29>] dump_backtrace+0x0/0x2b8
[  112.993726] [<00000000082c0393>] show_stack+0x20/0x28
[  112.993736] [<00000000bea63e18>] dump_stack+0xb8/0xf4
[  112.993748] [<000000006ea2414e>] mdss_dsi_panel_on+0x84/0x198   //下载init code
[  112.993760] [<0000000053b292b1>] mdss_dsi_unblank.part.26+0x228/0x3f4
[  112.993769] [<0000000095d69571>] mdss_dsi_event_handler+0x180/0x1390
[  112.993780] [<00000000acaf0189>] mdss_mdp_ctl_intf_event.part.40+0x80/0x14c
[  112.993790] [<00000000006d814f>] mdss_mdp_ctl_intf_event+0x5c/0x60
[  112.993800] [<00000000e1c5df8f>] mdss_mdp_video_display+0x190/0x440
[  112.993809] [<00000000290f3643>] mdss_mdp_display_commit+0x5cc/0x13ac
[  112.993819] [<00000000df183268>] mdss_mdp_overlay_kickoff+0x370/0x19bc
[  112.993827] [<000000007c75d7fb>] mdss_mdp_overlay_on+0x268/0x278
[  112.993837] [<0000000057a5d605>] mdss_fb_blank_unblank.part.74+0x248/0x380
[  112.993848] [<00000000790793d6>] mdss_fb_blank_sub.isra.75+0x338/0x4b8
[  112.993858] [<000000002a6e669e>] mdss_fb_blank+0x124/0x2a0
[  112.993867] [<000000009fafb8a4>] fb_blank+0x88/0xfc              //fbmem.c
[  112.993876] [<00000000ec90db8a>] do_fb_ioctl+0x2ac/0x6f4
[  112.993884] [<00000000e4ccfb9b>] fb_ioctl+0x54/0x64              //用户空间与kernel交互接口 ioctl
[  112.993896] [<0000000065987d3c>] do_vfs_ioctl+0xd0/0xdb4
[  112.993905] [<00000000d4063d81>] SyS_ioctl+0x90/0xa4
[  112.993914] [<00000000753d3699>] el0_svc_naked+0x34/0x38

总结:
1)kernel阶段一次亮屏大概会经历以下event事件的调用过程
mdss_dsi_event_handler :event事件调用顺序
MDSS_EVENT_RESET = 1,
MDSS_EVENT_RESUME = 10
MDSS_EVENT_REGISTER_RECOVERY_HANDLER = 22
MDSS_EVENT_LINK_READY = 2
MDSS_EVENT_UNBLANK = 3
MDSS_EVENT_PANEL_ON = 4
MDSS_EVENT_POST_PANEL_ON = 5,

2)时间分解:217ms=42(reset)+140(11\29延时)+35(其他)
所以优化时间主要是reset和11 29的延时是否可以优化

你可能感兴趣的:(BSP)