From 1ce4f4c6cff4c036cdb99e5c0bdce7534cabfbfa Mon Sep 17 00:00:00 2001 From: Ujwal Patel Date: Sun, 17 Nov 2013 20:09:16 -0800 Subject: msm: mdss: release all overlay resources on last fb release There are cases where the last frame buffer reference is released from a different pid than the one who originally allocated the resource. In these cases we can still deallocate all resources currently allocated as we know that all references on fb dev have been released. This issue was previously fixed by a42150bd. But later it again resurfaced with 831a828. Change-Id: Ie35194b1e11ae90ff886b1be22cf02c842a76d1a Signed-off-by: Ujwal Patel --- drivers/video/fbdev/msm/mdss_fb.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'drivers') diff --git a/drivers/video/fbdev/msm/mdss_fb.c b/drivers/video/fbdev/msm/mdss_fb.c index ba31fd39e917..85c347251aa1 100644 --- a/drivers/video/fbdev/msm/mdss_fb.c +++ b/drivers/video/fbdev/msm/mdss_fb.c @@ -1206,6 +1206,8 @@ static int mdss_fb_release_all(struct fb_info *info, bool release_all) struct mdss_fb_proc_info *pinfo = NULL, *temp_pinfo = NULL; int ret = 0; int pid = current->tgid; + bool unknown_pid = true; + struct task_struct *task; if (!mfd->ref_cnt) { pr_info("try to close unopened fb %d!\n", mfd->index); @@ -1220,6 +1222,7 @@ static int mdss_fb_release_all(struct fb_info *info, bool release_all) if (!release_all && (pinfo->pid != pid)) continue; + unknown_pid = false; pr_debug("found process entry pid=%d ref=%d\n", pinfo->pid, pinfo->ref_cnt); @@ -1245,6 +1248,20 @@ static int mdss_fb_release_all(struct fb_info *info, bool release_all) } } + if (unknown_pid) { + task = current->group_leader; + pr_debug("unknown process %s pid=%d mfd->ref_cnt=%d\n", + task->comm, pid, mfd->ref_cnt); + + mfd->ref_cnt--; + if (mfd->mdp.release_fnc) { + ret = mfd->mdp.release_fnc(mfd); + if (ret) + pr_err("error releasing fb%d pid=%d\n", + mfd->index, pinfo->pid); + } + } + if (!mfd->ref_cnt) { ret = mdss_fb_blank_sub(FB_BLANK_POWERDOWN, info, mfd->op_enable); -- cgit v1.2.3