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

Commit 058e7466 authored by Ramakant Singh's avatar Ramakant Singh
Browse files

msm: mdss: Acquire mutex only when needed in overlay_set in mdp3



Acquiring of mutex only needed in case of new request. Hence
acquiring in that case.

Change-Id: I176efcee8b232c95dd3ba6447c00323bd9434a3d
Signed-off-by: default avatarRamakant Singh <ramaka@codeaurora.org>
parent 9322fbee
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -828,13 +828,15 @@ static int mdp3_overlay_set(struct msm_fb_data_type *mfd,
	stride = req->src.width * ppp_bpp(req->src.format);
	format = mdp3_ctrl_get_source_format(req->src.format);

	mutex_lock(&mdp3_session->lock);

	if (mdp3_session->overlay.id != req->id)
		pr_err("overlay was not released, continue to recover\n");

	mdp3_session->overlay = *req;
	/*
	 * A change in overlay structure will always come with
	 * MSMFB_NEW_REQUEST for MDP3
	*/
	if (req->id == MSMFB_NEW_REQUEST) {
		mutex_lock(&mdp3_session->lock);
		if (dma->source_config.stride != stride ||
				dma->source_config.format != format) {
			dma->source_config.format = format;
@@ -843,11 +845,11 @@ static int mdp3_overlay_set(struct msm_fb_data_type *mfd,
				mdp3_ctrl_get_pack_pattern(req->src.format);
			dma->update_src_cfg = true;
		}
		mdp3_session->overlay = *req;
		mdp3_session->overlay.id = 1;
		req->id = 1;
	}

		mutex_unlock(&mdp3_session->lock);
	}

	return rc;
}