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

Commit 8d47975f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: Scale clocks on V4L2_CID_MPEG_VIDC_SET_PERF_LEVEL"

parents cb841578 989972b7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2553,7 +2553,7 @@ static int try_set_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
	case V4L2_CID_MPEG_VIDC_SET_PERF_LEVEL:
		switch (ctrl->val) {
		case V4L2_CID_MPEG_VIDC_PERF_LEVEL_NOMINAL:
			inst->flags &= ~VIDC_TURBO;
			inst->flags |= VIDC_NOMINAL;
			break;
		case V4L2_CID_MPEG_VIDC_PERF_LEVEL_TURBO:
			inst->flags |= VIDC_TURBO;
+38 −0
Original line number Diff line number Diff line
@@ -71,6 +71,11 @@ static inline bool is_thumbnail_session(struct msm_vidc_inst *inst)
	return !!(inst->flags & VIDC_THUMBNAIL);
}

static inline bool is_nominal_session(struct msm_vidc_inst *inst)
{
	return !!(inst->flags & VIDC_NOMINAL);
}

enum multi_stream msm_comm_get_stream_output_mode(struct msm_vidc_inst *inst)
{
	if (inst->session_type == MSM_VIDC_DECODER) {
@@ -1710,6 +1715,8 @@ int msm_comm_scale_clocks_load(struct msm_vidc_core *core, int num_mbs_per_sec)
	int rc = 0;
	struct hfi_device *hdev;
	struct msm_vidc_inst *inst = NULL;
	bool is_nominal = false;
	struct msm_vidc_platform_resources *res;

	if (!core) {
		dprintk(VIDC_ERR, "%s Invalid args: %p\n", __func__, core);
@@ -1717,6 +1724,8 @@ int msm_comm_scale_clocks_load(struct msm_vidc_core *core, int num_mbs_per_sec)
	}

	hdev = core->device;
	res = &core->resources;

	if (!hdev) {
		dprintk(VIDC_ERR, "%s Invalid device handle: %p\n",
			__func__, hdev);
@@ -1735,11 +1744,40 @@ int msm_comm_scale_clocks_load(struct msm_vidc_core *core, int num_mbs_per_sec)
				get_hal_codec_type(codec),
				get_hal_domain(inst->session_type));

		if (is_nominal_session(inst))
			is_nominal = true;
	}
	mutex_unlock(&core->lock);

	dprintk(VIDC_INFO, "num_mbs_per_sec = %d codecs_enabled 0x%x\n",
			num_mbs_per_sec, codecs_enabled);

	if (is_nominal && num_mbs_per_sec) {
		struct load_freq_table *table = res->load_freq_tbl;
		u32 table_size = res->load_freq_tbl_size;
		u32 low_freq = table[table_size - 1].freq;
		int i;

		/*
		* Parse the load frequency table from highest index and
		* whenever there is a change in frequency detected, it is
		* assumed as nominal frequency  Check the current load
		* against the load corresponding to nominal frequency and
		* update num_mbs_per_sec accordingly.
		*/
		for (i = table_size - 1; i >= 0; i--) {
			if (table[i].freq > low_freq) {
				if (num_mbs_per_sec < table[i].load) {
					num_mbs_per_sec = table[i].load;
					dprintk(VIDC_DBG,
						"updated num_mbs_per_sec: %d\n",
						num_mbs_per_sec);
				}
				break;
			}
		}
	}

	rc = call_hfi_op(hdev, scale_clocks,
		hdev->hfi_device_data, num_mbs_per_sec, codecs_enabled);
	if (rc)
+1 −0
Original line number Diff line number Diff line
@@ -224,6 +224,7 @@ enum msm_vidc_modes {
	VIDC_SECURE = 1 << 0,
	VIDC_TURBO = 1 << 1,
	VIDC_THUMBNAIL = 1 << 2,
	VIDC_NOMINAL = 1 << 3,
};

struct msm_vidc_core_capability {