Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7a6bc7a2 authored by Ujwal Patel's avatar Ujwal Patel
Browse files

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 831a828a.

Change-Id: Ie35194b1e11ae90ff886b1be22cf02c842a76d1a
Signed-off-by: default avatarUjwal Patel <ujwalp@codeaurora.org>
parent 1498b039
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -1205,6 +1205,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);
@@ -1219,6 +1221,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);

@@ -1244,6 +1247,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);