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

Commit a5636d0e authored by Abhinav Kumar's avatar Abhinav Kumar Committed by Gerrit - the friendly Code Review server
Browse files

msm: mdss: add cmd_off_mtx for synchronizing vsync handler and off sequence



At present the ctl->offlock mutex is used for synchronization
between ESD thread and OFF sequence. Using the same mutex
for synchronization between add_vsync_handler() and OFF
sequence was causing unnecessary synchronization between
ESD thread and add_vsyc_handler(). To improve performance
a new mutex, cmd_off_mtx is used for the second case.

CRs-Fixed: 1051864
Change-Id: I7d0b0690672869937d82df68ea9f571023fc88d1
Signed-off-by: default avatarShalini Krishnamoorthi <shakri@codeaurora.org>
parent d48eef6e
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@

static DEFINE_MUTEX(cmd_clk_mtx);

static DEFINE_MUTEX(cmd_off_mtx);

enum mdss_mdp_cmd_autorefresh_state {
	MDP_AUTOREFRESH_OFF,
	MDP_AUTOREFRESH_ON_REQUESTED,
@@ -1284,7 +1286,7 @@ static int mdss_mdp_cmd_add_lineptr_handler(struct mdss_mdp_ctl *ctl,
	unsigned long flags;
	int ret = 0;

	mutex_lock(&ctl->offlock);
	mutex_lock(&cmd_off_mtx);
	ctx = (struct mdss_mdp_cmd_ctx *) ctl->intf_ctx[MASTER_CTX];
	if (!ctx || !ctl->is_master) {
		ret = -EINVAL;
@@ -1312,7 +1314,7 @@ static int mdss_mdp_cmd_add_lineptr_handler(struct mdss_mdp_ctl *ctl,
	if (ctl->mfd->split_mode == MDP_DUAL_LM_DUAL_DISPLAY)
		mutex_unlock(&cmd_clk_mtx);
done:
	mutex_unlock(&ctl->offlock);
	mutex_unlock(&cmd_off_mtx);

	return ret;
}
@@ -1753,7 +1755,7 @@ static int mdss_mdp_cmd_add_vsync_handler(struct mdss_mdp_ctl *ctl,
	bool enable_rdptr = false;
	int ret = 0;

	mutex_lock(&ctl->offlock);
	mutex_lock(&cmd_off_mtx);
	ctx = (struct mdss_mdp_cmd_ctx *) ctl->intf_ctx[MASTER_CTX];
	if (!ctx) {
		pr_err("%s: invalid ctx\n", __func__);
@@ -1790,7 +1792,7 @@ static int mdss_mdp_cmd_add_vsync_handler(struct mdss_mdp_ctl *ctl,
	}

done:
	mutex_unlock(&ctl->offlock);
	mutex_unlock(&cmd_off_mtx);

	return ret;
}
@@ -2962,6 +2964,7 @@ int mdss_mdp_cmd_stop(struct mdss_mdp_ctl *ctl, int panel_power_state)
	MDSS_XLOG(ctx->panel_power_state, panel_power_state);

	mutex_lock(&ctl->offlock);
	mutex_lock(&cmd_off_mtx);
	if (mdss_panel_is_power_off(panel_power_state)) {
		/* Transition to display off */
		send_panel_events = true;
@@ -3081,6 +3084,7 @@ end:
	}

	MDSS_XLOG(ctl->num, atomic_read(&ctx->koff_cnt), XLOG_FUNC_EXIT);
	mutex_unlock(&cmd_off_mtx);
	mutex_unlock(&ctl->offlock);
	pr_debug("%s:-\n", __func__);