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

Commit 8ff5fe2f authored by Praneeth Paladugu's avatar Praneeth Paladugu Committed by Chinmay Sawarkar
Browse files

msm: vidc: Update mbs per second calculation



When operating rate is less than fps, the behavior
is undefined. For better user experience use the
max value of fps and operating rate to scale the
clocks.

CRs-Fixed: 959695
Change-Id: If04e459b1f27093d431a91dabd6b8ba3f4813067
Signed-off-by: default avatarPraneeth Paladugu <ppaladug@codeaurora.org>
parent 626b2bb0
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -245,7 +245,8 @@ enum multi_stream msm_comm_get_stream_output_mode(struct msm_vidc_inst *inst)
static int msm_comm_get_mbs_per_sec(struct msm_vidc_inst *inst)
{
	int output_port_mbs, capture_port_mbs;
	int fps, rc;
	int rc;
	u32 fps;
	struct v4l2_control ctrl;

	output_port_mbs = NUM_MBS_PER_FRAME(inst->prop.width[OUTPUT_PORT],
@@ -257,6 +258,11 @@ static int msm_comm_get_mbs_per_sec(struct msm_vidc_inst *inst)
	rc = msm_comm_g_ctrl(inst, &ctrl);
	if (!rc && ctrl.value) {
		fps = (ctrl.value >> 16) ? ctrl.value >> 16 : 1;
		/*
		 * Check if operating rate is less than fps.
		 * If Yes, then use fps to scale the clocks
		*/
		fps = max(fps, inst->prop.fps);
		return max(output_port_mbs, capture_port_mbs) * fps;
	} else
		return max(output_port_mbs, capture_port_mbs) * inst->prop.fps;