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

Commit cc8e3235 authored by Uma Mehta's avatar Uma Mehta Committed by Gerrit - the friendly Code Review server
Browse files

msm: vidc: Cap operating rate between max and min



For Realtime session cap operating rate to max and min
if higher or lower values are set.

Change-Id: Ib278c950072d080e4367cba52a289bb28a11796e
Signed-off-by: default avatarUma Mehta <umamehta@codeaurora.org>
parent 1b577d4d
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2021, 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
@@ -1309,9 +1309,24 @@ int msm_vdec_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
		if (((ctrl->val >> 16) < inst->capability.frame_rate.min ||
			(ctrl->val >> 16) > inst->capability.frame_rate.max) &&
			ctrl->val != INT_MAX) {
			if (!is_realtime_session(inst)) {
				if ((ctrl->val >> 16) <
					inst->capability.frame_rate.min) {
					inst->clk_data.operating_rate =
					inst->capability.frame_rate.min << 16;
				} else {
					inst->clk_data.operating_rate =
					inst->capability.frame_rate.max << 16;
				}
				dprintk(VIDC_DBG,
					"inst(%pK) operating rate capped from %d to %d\n",
					inst, ctrl->val >> 16,
					inst->clk_data.operating_rate >> 16);
			} else {
				dprintk(VIDC_ERR, "Invalid operating rate %u\n",
					(ctrl->val >> 16));
				rc = -ENOTSUPP;
			}
		} else if (ctrl->val == INT_MAX) {
			dprintk(VIDC_DBG,
				"inst(%pK) Request for turbo mode\n", inst);