Commit 4ebf9693 authored by Aniket Masule's avatar Aniket Masule Committed by Mauro Carvalho Chehab
Browse files

media: venus: introduce core selection



Presently the core (vcodec pipelines) assignment is static. Here we
introduce dynamic load balancing across the cores depending on the
current session load. The load on earch core is calculated and core
with minimum load is assigned to given instance. This will be
applicable on Venus v4 with more than one vcodec cores.

Signed-off-by: default avatarAniket Masule <amasule@codeaurora.org>
Co-developed-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 7482a983
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -181,6 +181,8 @@ struct venus_core {
	struct delayed_work work;
	struct venus_caps caps[MAX_CODEC_NUM];
	unsigned int codecs_count;
	unsigned int core0_usage_count;
	unsigned int core1_usage_count;
};

struct vdec_controls {
@@ -380,6 +382,7 @@ struct venus_inst {
	const struct hfi_inst_ops *ops;
	u32 session_type;
	union hfi_get_property hprop;
	unsigned int core_acquired: 1;
};

#define IS_V1(core)	((core)->res->hfi_version == HFI_VERSION_1XX)
+2 −15
Original line number Diff line number Diff line
@@ -723,21 +723,6 @@ int venus_helper_set_work_mode(struct venus_inst *inst, u32 mode)
}
EXPORT_SYMBOL_GPL(venus_helper_set_work_mode);

int venus_helper_set_core_usage(struct venus_inst *inst, u32 usage)
{
	const u32 ptype = HFI_PROPERTY_CONFIG_VIDEOCORES_USAGE;
	struct hfi_videocores_usage_type cu;

	inst->clk_data.core_id = usage;
	if (!IS_V4(inst->core))
		return 0;

	cu.video_core_enable_mask = usage;

	return hfi_session_set_property(inst, ptype, &cu);
}
EXPORT_SYMBOL_GPL(venus_helper_set_core_usage);

int venus_helper_init_codec_freq_data(struct venus_inst *inst)
{
	const struct codec_freq_data *data;
@@ -1112,6 +1097,8 @@ void venus_helper_vb2_stop_streaming(struct vb2_queue *q)
	else
		inst->streamon_cap = 0;

	venus_pm_release_core(inst);

	mutex_unlock(&inst->lock);
}
EXPORT_SYMBOL_GPL(venus_helper_vb2_stop_streaming);
+0 −1
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@ int venus_helper_set_output_resolution(struct venus_inst *inst,
				       u32 buftype);
int venus_helper_set_work_mode(struct venus_inst *inst, u32 mode);
int venus_helper_init_codec_freq_data(struct venus_inst *inst);
int venus_helper_set_core_usage(struct venus_inst *inst, u32 usage);
int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs,
			      unsigned int output_bufs,
			      unsigned int output2_bufs);
+1 −0
Original line number Diff line number Diff line
@@ -550,6 +550,7 @@ struct hfi_bitrate {
#define HFI_CAPABILITY_LCU_SIZE				0x14
#define HFI_CAPABILITY_HIER_P_HYBRID_NUM_ENH_LAYERS	0x15
#define HFI_CAPABILITY_MBS_PER_SECOND_POWERSAVE		0x16
#define HFI_CAPABILITY_MAX_VIDEOCORES			0x2b

struct hfi_capability {
	u32 capability_type;
+5 −0
Original line number Diff line number Diff line
@@ -107,4 +107,9 @@ static inline u32 frate_step(struct venus_inst *inst)
	return cap_step(inst, HFI_CAPABILITY_FRAMERATE);
}

static inline u32 core_num_max(struct venus_inst *inst)
{
	return cap_max(inst, HFI_CAPABILITY_MAX_VIDEOCORES);
}

#endif
Loading