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

Commit b0a48d3b authored by Vikash Garodia's avatar Vikash Garodia
Browse files

msm: vidc: Select video core based on capability



Video hardware may have disabled a video core out of
the available cores. The same is being published by
the video firmware in supported capabilities.
Select and configure the video session on the enabled
video hardware core based on the published capability.

CRs-Fixed: 2117620
Change-Id: Ibe25c1843b65ecd11415f054bcfa3d9fe24efe91
Signed-off-by: default avatarVikash Garodia <vgarodia@codeaurora.org>
parent 93ccf8ae
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -1106,6 +1106,16 @@ int msm_vidc_decide_core_and_power_mode(struct msm_vidc_inst *inst)
	lp_cycles = inst->session_type == MSM_VIDC_ENCODER ?
			inst->clk_data.entry->low_power_cycles :
			inst->clk_data.entry->vpp_cycles;
	/*
	 * Incase there is only 1 core enabled, mark it as the core
	 * with min load. This ensures that this core is selected and
	 * video session is set to run on the enabled core.
	 */
	if (inst->capability.max_video_cores.max <= VIDC_CORE_ID_1) {
		min_core_id = min_lp_core_id = VIDC_CORE_ID_1;
		min_load = core0_load;
		min_lp_load = core0_lp_load;
	}

	current_inst_load = msm_comm_get_inst_load(inst, LOAD_CALC_NO_QUIRKS) *
		inst->clk_data.entry->vpp_cycles;
@@ -1129,7 +1139,8 @@ int msm_vidc_decide_core_and_power_mode(struct msm_vidc_inst *inst)
		V4L2_CID_MPEG_VIDC_VIDEO_HYBRID_HIERP_MODE);

	/* Try for preferred core based on settings. */
	if (inst->session_type == MSM_VIDC_ENCODER && hier_mode) {
	if (inst->session_type == MSM_VIDC_ENCODER && hier_mode &&
		inst->capability.max_video_cores.max >= VIDC_CORE_ID_3) {
		if (current_inst_load / 2 + core0_load <= max_freq &&
			current_inst_load / 2 + core1_load <= max_freq) {
			if (inst->clk_data.work_mode == VIDC_WORK_MODE_2) {
@@ -1140,7 +1151,8 @@ int msm_vidc_decide_core_and_power_mode(struct msm_vidc_inst *inst)
		}
	}

	if (inst->session_type == MSM_VIDC_ENCODER && hier_mode) {
	if (inst->session_type == MSM_VIDC_ENCODER && hier_mode &&
		inst->capability.max_video_cores.max >= VIDC_CORE_ID_3) {
		if (current_inst_lp_load / 2 +
				core0_lp_load <= max_freq &&
			current_inst_lp_load / 2 +