@@ -331,6 +331,24 @@ static u32 load_per_instance(struct venus_inst *inst)
return mbs * inst->fps;
}
+static u32 load_per_core(struct venus_core *core, u32 core_id)
+{
+ struct venus_inst *inst = NULL;
+ u32 mbs_per_sec = 0, load = 0;
+
+ mutex_lock(&core->lock);
+ list_for_each_entry(inst, &core->instances, list) {
+ if (!(inst->clk_data.core_id == core_id))
+ continue;
+
+ mbs_per_sec += load_per_instance(inst);
+ load += mbs_per_sec * inst->clk_data.codec_data->vpp_cycles;
+ }
+ mutex_unlock(&core->lock);
+
+ return load;
+}
+
static u32 load_per_type(struct venus_core *core, u32 session_type)
{
struct venus_inst *inst = NULL;
@@ -559,6 +559,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;
@@ -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
Add and interface to calculate load per core. Also, add an interface to get maximum cores available with video. This interface is preparation for updating core selection. Signed-off-by: Aniket Masule <amasule@codeaurora.org> --- drivers/media/platform/qcom/venus/helpers.c | 18 ++++++++++++++++++ drivers/media/platform/qcom/venus/hfi_helper.h | 1 + drivers/media/platform/qcom/venus/hfi_parser.h | 5 +++++ 3 files changed, 24 insertions(+)