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

Commit 9444b5e5 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: mdss: handle race condition in pingpong done counter"

parents 99c100f9 df9c33ad
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -1019,6 +1019,7 @@ static void mdss_mdp_cmd_pingpong_done(void *arg)
	struct mdss_mdp_cmd_ctx *ctx = ctl->intf_ctx[MASTER_CTX];
	struct mdss_mdp_vsync_handler *tmp;
	ktime_t vsync_time;
	bool sync_ppdone;

	if (!ctx) {
		pr_err("%s: invalid ctx\n", __func__);
@@ -1044,11 +1045,18 @@ static void mdss_mdp_cmd_pingpong_done(void *arg)

	MDSS_XLOG(ctl->num, atomic_read(&ctx->koff_cnt), ctx->current_pp_num);

	/*
	 * check state of sync ctx before decrementing koff_cnt to avoid race
	 * condition. That is, once both koff_cnt have been served and new koff
	 * can be triggered (sctx->koff_cnt could change)
	 */
	sync_ppdone = mdss_mdp_cmd_do_notifier(ctx);

	if (atomic_add_unless(&ctx->koff_cnt, -1, 0)) {
		if (atomic_read(&ctx->koff_cnt))
			pr_err("%s: too many kickoffs=%d!\n", __func__,
			       atomic_read(&ctx->koff_cnt));
		if (mdss_mdp_cmd_do_notifier(ctx)) {
		if (sync_ppdone) {
			atomic_inc(&ctx->pp_done_cnt);
			schedule_work(&ctx->pp_done_work);