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

Commit 4e53aaae authored by Vikash Garodia's avatar Vikash Garodia
Browse files

msm: vidc: Do not consider clock for inactive session



Video sessions may go into pause state or remain inactive
as per the client requirement. Clock calculation should
ignore the clock required for such session and do not
include it in the total required clock vote.

Change-Id: I41dce9f47208ef33244b754a076550a0b4b830f9
Signed-off-by: default avatarVikash Garodia <vgarodia@codeaurora.org>
parent a2240c40
Loading
Loading
Loading
Loading
+35 −15
Original line number Diff line number Diff line
@@ -727,7 +727,9 @@ int msm_vidc_set_clocks(struct msm_vidc_core *core)
	struct hfi_device *hdev;
	unsigned long freq_core_1 = 0, freq_core_2 = 0, rate = 0;
	unsigned long freq_core_max = 0;
	struct msm_vidc_inst *temp = NULL;
	struct msm_vidc_inst *inst = NULL;
	struct msm_vidc_buffer *temp, *next;
	u32 device_addr, filled_len;
	int rc = 0, i = 0;
	struct allowed_clock_rates_table *allowed_clks_tbl = NULL;
	bool increment, decrement;
@@ -743,15 +745,34 @@ int msm_vidc_set_clocks(struct msm_vidc_core *core)
	mutex_lock(&core->lock);
	increment = false;
	decrement = true;
	list_for_each_entry(temp, &core->instances, list) {
	list_for_each_entry(inst, &core->instances, list) {
		device_addr = 0;
		filled_len = 0;
		mutex_lock(&inst->registeredbufs.lock);
		list_for_each_entry_safe(temp, next,
				&inst->registeredbufs.list, list) {
			if (temp->vvb.vb2_buf.type ==
				V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
				filled_len = max(filled_len,
					temp->vvb.vb2_buf.planes[0].bytesused);
				device_addr = temp->smem[0].device_addr;
			}
		}
		mutex_unlock(&inst->registeredbufs.lock);

		if (temp->clk_data.core_id == VIDC_CORE_ID_1)
			freq_core_1 += temp->clk_data.min_freq;
		else if (temp->clk_data.core_id == VIDC_CORE_ID_2)
			freq_core_2 += temp->clk_data.min_freq;
		else if (temp->clk_data.core_id == VIDC_CORE_ID_3) {
			freq_core_1 += temp->clk_data.min_freq;
			freq_core_2 += temp->clk_data.min_freq;
		if (!filled_len || !device_addr) {
			dprintk(VIDC_DBG, "%s no input for session %x\n",
				__func__, hash32_ptr(inst->session));
			continue;
		}

		if (inst->clk_data.core_id == VIDC_CORE_ID_1)
			freq_core_1 += inst->clk_data.min_freq;
		else if (inst->clk_data.core_id == VIDC_CORE_ID_2)
			freq_core_2 += inst->clk_data.min_freq;
		else if (inst->clk_data.core_id == VIDC_CORE_ID_3) {
			freq_core_1 += inst->clk_data.min_freq;
			freq_core_2 += inst->clk_data.min_freq;
		}

		freq_core_max = max_t(unsigned long, freq_core_1, freq_core_2);
@@ -765,7 +786,7 @@ int msm_vidc_set_clocks(struct msm_vidc_core *core)
			break;
		}

		if (temp->clk_data.turbo_mode) {
		if (inst->clk_data.turbo_mode) {
			dprintk(VIDC_PROF,
				"Found an instance with Turbo request\n");
			freq_core_max = msm_vidc_max_freq(core);
@@ -773,10 +794,10 @@ int msm_vidc_set_clocks(struct msm_vidc_core *core)
			break;
		}
		/* increment even if one session requested for it */
		if (temp->clk_data.dcvs_flags & MSM_VIDC_DCVS_INCR)
		if (inst->clk_data.dcvs_flags & MSM_VIDC_DCVS_INCR)
			increment = true;
		/* decrement only if all sessions requested for it */
		if (!(temp->clk_data.dcvs_flags & MSM_VIDC_DCVS_DECR))
		if (!(inst->clk_data.dcvs_flags & MSM_VIDC_DCVS_DECR))
			decrement = false;
	}

@@ -907,7 +928,7 @@ int msm_comm_scale_clocks(struct msm_vidc_inst *inst)
	if (!filled_len || !device_addr) {
		dprintk(VIDC_DBG, "%s no input for session %x\n",
			__func__, hash32_ptr(inst->session));
		goto no_clock_change;
		return 0;
	}

	freq = call_core_op(inst->core, calc_freq, inst, filled_len);
@@ -925,7 +946,6 @@ int msm_comm_scale_clocks(struct msm_vidc_inst *inst)

	msm_vidc_set_clocks(inst->core);

no_clock_change:
	return 0;
}