Re: [PATCH v4 4/4] media: venus: Update core selection
From: Stanimir Varbanov
Date: Mon Jul 15 2019 - 12:01:02 EST
Hi,
On 7/2/19 5:46 PM, Aniket Masule wrote:
> Present core assignment is static. Introduced load balancing
> across the cores. Load on earch core is calculated and core
> with minimum load is assigned to given instance.
>
> Signed-off-by: Aniket Masule <amasule@xxxxxxxxxxxxxx>
> ---
> drivers/media/platform/qcom/venus/helpers.c | 69 +++++++++++++++++++++++---
> drivers/media/platform/qcom/venus/helpers.h | 2 +-
> drivers/media/platform/qcom/venus/hfi_helper.h | 1 +
> drivers/media/platform/qcom/venus/hfi_parser.h | 5 ++
> drivers/media/platform/qcom/venus/vdec.c | 2 +-
> drivers/media/platform/qcom/venus/venc.c | 2 +-
> 6 files changed, 72 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c
> index 5726d86..321e9f7 100644
> --- a/drivers/media/platform/qcom/venus/helpers.c
> +++ b/drivers/media/platform/qcom/venus/helpers.c
> @@ -26,6 +26,7 @@
> #include "helpers.h"
> #include "hfi_helper.h"
> #include "hfi_venus_io.h"
> +#include "hfi_parser.h"
>
> struct intbuf {
> struct list_head list;
> @@ -331,6 +332,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))
if (inst->clk_data.core_id != core_id)
I guess will be more readable?
> + continue;
> +
> + mbs_per_sec = load_per_instance(inst);
> + load = mbs_per_sec * inst->clk_data.codec_freq_data->vpp_freq;
> + }
> + mutex_unlock(&core->lock);
> +
> + return load;
> +}
> +
<cut>
--
regards,
Stan