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

Commit d7be24d0 authored by Ingrid Gallardo's avatar Ingrid Gallardo
Browse files

msm: mdss: reuse pipes from cleanup pool



By reusing pipes from cleanup pool, there is no need to
block user client while commit with cleanup is in progress.
This allows async calls from user space during prepare
cycle.

Change-Id: I688196320ed5ffad36b9f09b89fd512035887d6d
Signed-off-by: default avatarIngrid Gallardo <ingridg@codeaurora.org>
parent ad9fe5a4
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -616,6 +616,7 @@ struct mdss_overlay_private {
	struct mutex list_lock;
	struct list_head pipes_used;
	struct list_head pipes_cleanup;
	struct list_head pipes_destroy;
	struct list_head rot_proc_list;
	bool mixer_swap;
	u32 resources_state;
@@ -1030,6 +1031,8 @@ int mdp_pipe_tune_perf(struct mdss_mdp_pipe *pipe,
int mdss_mdp_overlay_setup_scaling(struct mdss_mdp_pipe *pipe);
struct mdss_mdp_pipe *mdss_mdp_pipe_assign(struct mdss_data_type *mdata,
	struct mdss_mdp_mixer *mixer, u32 ndx);
struct mdss_mdp_pipe *mdss_mdp_overlay_pipe_reuse(
	struct msm_fb_data_type *mfd, int pipe_ndx);
void mdss_mdp_pipe_position_update(struct mdss_mdp_pipe *pipe,
		struct mdss_rect *src, struct mdss_rect *dst);
int mdss_mdp_video_addr_setup(struct mdss_data_type *mdata,
+28 −7
Original line number Diff line number Diff line
@@ -928,21 +928,42 @@ static struct mdss_mdp_pipe *__find_layer_in_validate_q(
	return found ? pipe : NULL;
}

static bool __find_pipe_in_list(struct list_head *head,
			int pipe_ndx, struct mdss_mdp_pipe **out_pipe)
{
	struct mdss_mdp_pipe *pipe;

	list_for_each_entry(pipe, head, list) {
		if (pipe_ndx == pipe->ndx) {
			*out_pipe = pipe;
			return true;
		}
	}

	return false;
}

static struct mdss_mdp_pipe *__find_used_pipe(struct msm_fb_data_type *mfd,
		u32 pipe_ndx)
{
	struct mdss_overlay_private *mdp5_data = mfd_to_mdp5_data(mfd);
	struct mdss_mdp_pipe *pipe, *tmp, *used_pipe = NULL;
	struct mdss_mdp_pipe *pipe = NULL;
	bool found;

	mutex_lock(&mdp5_data->list_lock);
	list_for_each_entry_safe(pipe, tmp, &mdp5_data->pipes_used, list) {
		if (pipe->ndx == pipe_ndx) {
			used_pipe = pipe;
			break;
		}

	found = __find_pipe_in_list(&mdp5_data->pipes_used, pipe_ndx, &pipe);

	/* check if the pipe is in the cleanup or destroy list */
	if (!found &&
	   (__find_pipe_in_list(&mdp5_data->pipes_destroy, pipe_ndx, &pipe) ||
	    __find_pipe_in_list(&mdp5_data->pipes_cleanup, pipe_ndx, &pipe))) {
		pr_debug("reuse pipe%d ndx:%d\n", pipe->num, pipe->ndx);
		list_move(&pipe->list, &mdp5_data->pipes_used);
	}

	mutex_unlock(&mdp5_data->list_lock);
	return used_pipe;
	return pipe;
}

/*
+11 −22
Original line number Diff line number Diff line
@@ -1860,9 +1860,7 @@ int mdss_mdp_overlay_kickoff(struct msm_fb_data_type *mfd,
	struct mdss_mdp_ctl *ctl = mfd_to_ctl(mfd);
	int ret = 0;
	int sd_in_pipe = 0;
	bool need_cleanup = false;
	struct mdss_mdp_commit_cb commit_cb;
	LIST_HEAD(destroy_pipes);

	if (!ctl)
		return -ENODEV;
@@ -1937,8 +1935,7 @@ int mdss_mdp_overlay_kickoff(struct msm_fb_data_type *mfd,
		mdss_mdp_mixer_pipe_unstage(pipe, pipe->mixer_left);
		mdss_mdp_mixer_pipe_unstage(pipe, pipe->mixer_right);
		pipe->mixer_stage = MDSS_MDP_STAGE_UNUSED;
		list_move(&pipe->list, &destroy_pipes);
		need_cleanup = true;
		list_move(&pipe->list, &mdp5_data->pipes_destroy);
	}

	ATRACE_BEGIN("sspp_programming");
@@ -1950,25 +1947,16 @@ int mdss_mdp_overlay_kickoff(struct msm_fb_data_type *mfd,

	if (mfd->panel.type == WRITEBACK_PANEL) {
		ATRACE_BEGIN("wb_kickoff");
		if (!need_cleanup) {
		commit_cb.commit_cb_fnc = mdss_mdp_commit_cb;
		commit_cb.data = mfd;
		ret = mdss_mdp_wfd_kickoff(mdp5_data->wfd, &commit_cb);
		} else  {
			ret = mdss_mdp_wfd_kickoff(mdp5_data->wfd, NULL);
		}
		ATRACE_END("wb_kickoff");
	} else {
		ATRACE_BEGIN("display_commit");
		if (!need_cleanup) {
		commit_cb.commit_cb_fnc = mdss_mdp_commit_cb;
		commit_cb.data = mfd;
		ret = mdss_mdp_display_commit(mdp5_data->ctl, NULL,
			&commit_cb);
		} else  {
			ret = mdss_mdp_display_commit(mdp5_data->ctl, NULL,
				NULL);
		}
		ATRACE_END("display_commit");
	}

@@ -1979,7 +1967,7 @@ int mdss_mdp_overlay_kickoff(struct msm_fb_data_type *mfd,
	 */
	mfd->validate_pending = false;

	if ((!need_cleanup) && (!mdp5_data->kickoff_released))
	if (!mdp5_data->kickoff_released)
		mdss_mdp_ctl_notify(ctl, MDP_NOTIFY_FRAME_CTX_DONE);

	if (IS_ERR_VALUE(ret))
@@ -2010,7 +1998,7 @@ int mdss_mdp_overlay_kickoff(struct msm_fb_data_type *mfd,
	mdss_fb_update_notify_update(mfd);
commit_fail:
	ATRACE_BEGIN("overlay_cleanup");
	mdss_mdp_overlay_cleanup(mfd, &destroy_pipes);
	mdss_mdp_overlay_cleanup(mfd, &mdp5_data->pipes_destroy);
	ATRACE_END("overlay_cleanup");
	mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF);
	mdss_mdp_ctl_notify(ctl, MDP_NOTIFY_FRAME_FLUSHED);
@@ -4977,6 +4965,7 @@ int mdss_mdp_overlay_init(struct msm_fb_data_type *mfd)

	INIT_LIST_HEAD(&mdp5_data->pipes_used);
	INIT_LIST_HEAD(&mdp5_data->pipes_cleanup);
	INIT_LIST_HEAD(&mdp5_data->pipes_destroy);
	INIT_LIST_HEAD(&mdp5_data->bufs_pool);
	INIT_LIST_HEAD(&mdp5_data->bufs_chunks);
	INIT_LIST_HEAD(&mdp5_data->bufs_used);