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

Commit 2acb6070 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: refactor command mode vsync control logic"

parents e4433fd3 d76a440c
Loading
Loading
Loading
Loading
+13 −15
Original line number Diff line number Diff line
@@ -398,6 +398,7 @@ static int mdss_mdp_cmd_add_vsync_handler(struct mdss_mdp_ctl *ctl,
{
	struct mdss_mdp_cmd_ctx *ctx;
	unsigned long flags;
	bool enable_rdptr = false;

	ctx = (struct mdss_mdp_cmd_ctx *) ctl->priv_data;
	if (!ctx) {
@@ -409,12 +410,14 @@ static int mdss_mdp_cmd_add_vsync_handler(struct mdss_mdp_ctl *ctl,
	if (!handle->enabled) {
		handle->enabled = true;
		list_add(&handle->list, &ctx->vsync_handlers);
		if (!handle->cmd_post_flush)
			ctx->vsync_enabled = 1;

		enable_rdptr = !handle->cmd_post_flush;
		if (enable_rdptr)
			ctx->vsync_enabled++;
	}
	spin_unlock_irqrestore(&ctx->clk_lock, flags);

	if (!handle->cmd_post_flush)
	if (enable_rdptr)
		mdss_mdp_cmd_clk_on(ctx);

	return 0;
@@ -423,11 +426,8 @@ static int mdss_mdp_cmd_add_vsync_handler(struct mdss_mdp_ctl *ctl,
static int mdss_mdp_cmd_remove_vsync_handler(struct mdss_mdp_ctl *ctl,
		struct mdss_mdp_vsync_handler *handle)
{

	struct mdss_mdp_cmd_ctx *ctx;
	unsigned long flags;
	struct mdss_mdp_vsync_handler *tmp;
	int num_rdptr_vsync = 0;

	ctx = (struct mdss_mdp_cmd_ctx *) ctl->priv_data;
	if (!ctx) {
@@ -435,19 +435,17 @@ static int mdss_mdp_cmd_remove_vsync_handler(struct mdss_mdp_ctl *ctl,
		return -ENODEV;
	}


	spin_lock_irqsave(&ctx->clk_lock, flags);
	if (handle->enabled) {
		handle->enabled = false;
		list_del_init(&handle->list);

		if (!handle->cmd_post_flush) {
			if (ctx->vsync_enabled)
				ctx->vsync_enabled--;
			else
				WARN(1, "unbalanced vsync disable");
		}
	list_for_each_entry(tmp, &ctx->vsync_handlers, list) {
		if (!tmp->cmd_post_flush)
			num_rdptr_vsync++;
	}
	if (!num_rdptr_vsync) {
		ctx->vsync_enabled = 0;
		ctx->rdptr_enabled = VSYNC_EXPIRE_TICK;
	}
	spin_unlock_irqrestore(&ctx->clk_lock, flags);
	return 0;