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

Commit 1b94f950 authored by Benjamin Chan's avatar Benjamin Chan Committed by Narendra Muppalla
Browse files

msm: sde: Avoid VBIF programming when SDE rotator is still busy



Whenever the rotation commit parameters have format or fps change, it is
required to program the OT in the VBIF, but only safe to do so when the
rotator is in IDLE state. The change is to make sure the correct fps is
used to lookup the OT, and issue panic when trying to program VBIF when
rotator is no in IDLE state.

CRs-Fixed: 1109943
Change-Id: I592df0f65b4c80fe8bf8eeb5cafffd369c41fcc2
Signed-off-by: default avatarBenjamin Chan <bkchan@codeaurora.org>
Signed-off-by: default avatarNarendra Muppalla <NarendraM@codeaurora.org>
parent 652ee8ea
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012, 2015-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012, 2015-2017, 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
@@ -30,6 +30,7 @@
#include "sde_rotator_base.h"
#include "sde_rotator_util.h"
#include "sde_rotator_trace.h"
#include "sde_rotator_debug.h"

static inline u64 fudge_factor(u64 val, u32 numer, u32 denom)
{
@@ -217,6 +218,8 @@ static u32 get_ot_limit(u32 reg_off, u32 bit_off,

exit:
	SDEROT_DBG("ot_lim=%d\n", ot_lim);
	SDEROT_EVTLOG(params->width, params->height, params->fmt, params->fps,
			ot_lim);
	return ot_lim;
}

@@ -228,6 +231,7 @@ void sde_mdp_set_ot_limit(struct sde_mdp_set_ot_params *params)
		params->reg_off_vbif_lim_conf;
	u32 bit_off_vbif_lim_conf = (params->xin_id % 4) * 8;
	u32 reg_val;
	u32 sts;
	bool forced_on;

	ot_lim = get_ot_limit(
@@ -238,6 +242,16 @@ void sde_mdp_set_ot_limit(struct sde_mdp_set_ot_params *params)
	if (ot_lim == 0)
		goto exit;

	if (params->rotsts_base && params->rotsts_busy_mask) {
		sts = readl_relaxed(params->rotsts_base);
		if (sts & params->rotsts_busy_mask) {
			SDEROT_ERR(
				"Rotator still busy, should not modify VBIF\n");
			SDEROT_EVTLOG_TOUT_HANDLER(
				"rot", "vbif_dbg_bus", "panic");
		}
	}

	trace_rot_perf_set_ot(params->num, params->xin_id, ot_lim);

	forced_on = force_on_xin_clk(params->bit_off_mdp_clk_ctrl,
@@ -263,6 +277,7 @@ void sde_mdp_set_ot_limit(struct sde_mdp_set_ot_params *params)
		force_on_xin_clk(params->bit_off_mdp_clk_ctrl,
			params->reg_off_mdp_clk_ctrl, false);

	SDEROT_EVTLOG(params->num, params->xin_id, ot_lim);
exit:
	return;
}
+2 −0
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@ struct sde_mdp_set_ot_params {
	u32 reg_off_vbif_lim_conf;
	u32 reg_off_mdp_clk_ctrl;
	u32 bit_off_mdp_clk_ctrl;
	char __iomem *rotsts_base;
	u32 rotsts_busy_mask;
};

enum sde_bus_vote_type {
+4 −2
Original line number Diff line number Diff line
@@ -1237,14 +1237,16 @@ static int sde_rotator_calc_perf(struct sde_rot_mgr *mgr,

	perf->rdot_limit = sde_mdp_get_ot_limit(
			config->input.width, config->input.height,
			config->input.format, max_fps, true);
			config->input.format, config->frame_rate, true);
	perf->wrot_limit = sde_mdp_get_ot_limit(
			config->input.width, config->input.height,
			config->input.format, max_fps, false);
			config->input.format, config->frame_rate, false);

	SDEROT_DBG("clk:%lu, rdBW:%d, wrBW:%d, rdOT:%d, wrOT:%d\n",
			perf->clk_rate, read_bw, write_bw, perf->rdot_limit,
			perf->wrot_limit);
	SDEROT_EVTLOG(perf->clk_rate, read_bw, write_bw, perf->rdot_limit,
			perf->wrot_limit);
	return 0;
}

+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2012, 2015-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012, 2015-2017, 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
@@ -350,7 +350,7 @@ static int sde_mdp_src_addr_setup(struct sde_mdp_pipe *pipe,

static void sde_mdp_set_ot_limit_pipe(struct sde_mdp_pipe *pipe)
{
	struct sde_mdp_set_ot_params ot_params;
	struct sde_mdp_set_ot_params ot_params = {0,};

	ot_params.xin_id = pipe->xin_id;
	ot_params.num = pipe->num;
+1 −1
Original line number Diff line number Diff line
@@ -402,7 +402,7 @@ static int sde_mdp_wb_wait4comp(struct sde_mdp_ctl *ctl, void *arg)

static void sde_mdp_set_ot_limit_wb(struct sde_mdp_writeback_ctx *ctx)
{
	struct sde_mdp_set_ot_params ot_params;
	struct sde_mdp_set_ot_params ot_params = {0,};

	ot_params.xin_id = ctx->xin_id;
	ot_params.num = ctx->wb_num;
Loading