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

Commit 6cdd3e70 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: enable low power mode based on firmware capability"

parents 605f892d f977ef61
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -453,7 +453,9 @@ enum hal_capability get_hal_cap_type(u32 capability_type)
	case HFI_CAPABILITY_HIER_P_HYBRID_NUM_ENH_LAYERS:
		hal_cap = HAL_CAPABILITY_HIER_P_HYBRID_NUM_ENH_LAYERS;
		break;

	case HFI_CAPABILITY_MBS_PER_SECOND_POWERSAVE:
		hal_cap = HAL_CAPABILITY_MBS_PER_SECOND_POWER_SAVE;
		break;
	default:
		dprintk(VIDC_DBG, "%s: unknown capablity %#x\n",
			__func__, capability_type);
@@ -524,6 +526,9 @@ static inline void copy_cap_prop(
	case HFI_CAPABILITY_HIER_P_HYBRID_NUM_ENH_LAYERS:
		out = &capability->hier_p_hybrid;
		break;
	case HFI_CAPABILITY_MBS_PER_SECOND_POWERSAVE:
		out = &capability->mbs_per_sec_power_save;
		break;
	default:
		dprintk(VIDC_DBG, "%s: unknown capablity %#x\n",
			__func__, in->capability_type);
+45 −1
Original line number Diff line number Diff line
@@ -1575,6 +1575,50 @@ static int set_bitrate_for_each_layer(struct msm_vidc_inst *inst,
	return rc;
}

static inline int msm_venc_power_save_mode_enable(struct msm_vidc_inst *inst)
{
	u32 rc = 0;
	u32 prop_id = 0, power_save_min = 0, power_save_max = 0, inst_load = 0;
	void *pdata = NULL;
	struct hfi_device *hdev = NULL;
	enum hal_perf_mode venc_mode;
	enum load_calc_quirks quirks = LOAD_CALC_IGNORE_TURBO_LOAD |
		LOAD_CALC_IGNORE_THUMBNAIL_LOAD;

	if (!inst || !inst->core || !inst->core->device) {
		dprintk(VIDC_ERR, "%s invalid parameters\n", __func__);
		return -EINVAL;
	}

	inst_load = msm_comm_get_inst_load(inst, quirks);
	power_save_min = inst->capability.mbs_per_sec_power_save.min;
	power_save_max = inst->capability.mbs_per_sec_power_save.max;

	if (!power_save_min || !power_save_max)
		return rc;

	hdev = inst->core->device;
	if (inst_load >= power_save_min && inst_load <= power_save_max) {
		prop_id = HAL_CONFIG_VENC_PERF_MODE;
		venc_mode = HAL_PERF_MODE_POWER_SAVE;
		pdata = &venc_mode;
		rc = call_hfi_op(hdev, session_set_property,
				(void *)inst->session, prop_id, pdata);
		if (rc) {
			dprintk(VIDC_ERR,
				"%s: Failed to set power save mode for inst: %p\n",
				__func__, inst);
			goto fail_power_mode_set;
		}
		inst->flags |= VIDC_LOW_POWER;
		msm_dcvs_enc_set_power_save_mode(inst, true);
		dprintk(VIDC_INFO, "Power Save Mode set for inst: %p\n", inst);
	}

fail_power_mode_set:
	return rc;
}

static inline int start_streaming(struct msm_vidc_inst *inst)
{
	int rc = 0;
@@ -1583,7 +1627,7 @@ static inline int start_streaming(struct msm_vidc_inst *inst)
		dprintk(VIDC_ERR, "%s invalid parameters\n", __func__);
		return -EINVAL;
	}

	msm_venc_power_save_mode_enable(inst);
	if (inst->capability.pixelprocess_capabilities &
		HAL_VIDEO_ENCODER_SCALING_CAPABILITY)
		rc = msm_vidc_check_scaling_supported(inst);
+3 −1
Original line number Diff line number Diff line
@@ -897,7 +897,7 @@ static void print_cap(const char *type,
		struct hal_capability_supported *cap)
{
	dprintk(VIDC_DBG,
		"%-16s: %-8d %-8d %-8d\n",
		"%-24s: %-8d %-8d %-8d\n",
		type, cap->min, cap->max, cap->step_size);
}

@@ -998,6 +998,8 @@ static void handle_session_init_done(enum hal_command_response cmd, void *data)
	print_cap("scale_y", &inst->capability.scale_y);
	print_cap("hier_p", &inst->capability.hier_p);
	print_cap("ltr_count", &inst->capability.ltr_count);
	print_cap("mbs_per_sec_low_power",
		&inst->capability.mbs_per_sec_power_save);

	signal_session_msg_receipt(cmd, inst);
	put_inst(inst);
+2 −0
Original line number Diff line number Diff line
@@ -890,6 +890,7 @@ enum hal_capability {
	HAL_CAPABILITY_HIER_B_NUM_ENH_LAYERS,
	HAL_CAPABILITY_LCU_SIZE,
	HAL_CAPABILITY_HIER_P_HYBRID_NUM_ENH_LAYERS,
	HAL_CAPABILITY_MBS_PER_SECOND_POWER_SAVE,
	HAL_UNUSED_CAPABILITY = 0x10000000,
};

@@ -1280,6 +1281,7 @@ struct msm_vidc_capability {
	struct hal_capability_supported hier_b;
	struct hal_capability_supported lcu_size;
	struct hal_capability_supported hier_p_hybrid;
	struct hal_capability_supported mbs_per_sec_power_save;
	struct hal_profile_level_supported profile_level;
	struct hal_uncompressed_format_supported uncomp_format;
	struct hal_interlace_format_supported HAL_format;
+1 −0
Original line number Diff line number Diff line
@@ -436,6 +436,7 @@ struct hfi_bitrate {
#define HFI_CAPABILITY_HIER_B_NUM_ENH_LAYERS	(HFI_COMMON_BASE + 0x13)
#define HFI_CAPABILITY_LCU_SIZE				(HFI_COMMON_BASE + 0x14)
#define HFI_CAPABILITY_HIER_P_HYBRID_NUM_ENH_LAYERS	(HFI_COMMON_BASE + 0x15)
#define HFI_CAPABILITY_MBS_PER_SECOND_POWERSAVE		(HFI_COMMON_BASE + 0x16)

struct hfi_capability_supported {
	u32 capability_type;