From: amasule@codeaurora.org
To: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org, vgarodia@codeaurora.org
Subject: Re: [PATCH 5/5] media: venus: Update core selection
Date: Thu, 20 Jun 2019 16:29:12 +0530 [thread overview]
Message-ID: <5bbd61de30e4fe687773f04dd0816751@codeaurora.org> (raw)
In-Reply-To: <8f2e1cf4-9d9c-088b-740f-d8bf1c9028df@linaro.org>
On 2019-06-17 14:37, Stanimir Varbanov wrote:
> Hi Aniket,
>
> On 6/11/19 9:05 AM, 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@codeaurora.org>
>> ---
>> drivers/media/platform/qcom/venus/helpers.c | 50
>> +++++++++++++++++++++++++----
>> drivers/media/platform/qcom/venus/helpers.h | 2 +-
>> drivers/media/platform/qcom/venus/vdec.c | 5 +--
>> drivers/media/platform/qcom/venus/venc.c | 4 ++-
>> 4 files changed, 51 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/media/platform/qcom/venus/helpers.c
>> b/drivers/media/platform/qcom/venus/helpers.c
>> index edb653e..38d617b 100644
>> --- a/drivers/media/platform/qcom/venus/helpers.c
>> +++ b/drivers/media/platform/qcom/venus/helpers.c
>> @@ -497,6 +497,16 @@ static int load_scale_clocks(struct venus_inst
>> *inst)
>> return scale_clocks_vpu4(inst);
>> }
>>
>> +int set_core_usage(struct venus_inst *inst, u32 usage)
>> +{
>> + const u32 ptype = HFI_PROPERTY_CONFIG_VIDEOCORES_USAGE;
>> + struct hfi_videocores_usage_type cu;
>> +
>> + cu.video_core_enable_mask = usage;
>> +
>> + return hfi_session_set_property(inst, ptype, &cu);
>> +}
>> +
>> static void fill_buffer_desc(const struct venus_buffer *buf,
>> struct hfi_buffer_desc *bd, bool response)
>> {
>> @@ -800,19 +810,47 @@ 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)
>> +int venus_helper_decide_core(struct venus_inst *inst, u32 cores_max)
>
> I think venus_helper_set_core is better?
>
Sure Stan.
>> {
>> - const u32 ptype = HFI_PROPERTY_CONFIG_VIDEOCORES_USAGE;
>> - struct hfi_videocores_usage_type cu;
>> + struct venus_core *core = inst->core;
>> + u32 min_core_id = 0, core0_load = 0, core1_load = 0;
>> + unsigned long min_load, max_freq, cur_inst_load;
>> + int ret;
>>
>> if (!IS_V4(inst->core))
>> return 0;
>>
>> - cu.video_core_enable_mask = usage;
>> + core0_load = load_per_core(core, VIDC_CORE_ID_1);
>> + core1_load = load_per_core(core, VIDC_CORE_ID_2);
>>
>> - return hfi_session_set_property(inst, ptype, &cu);
>> + min_core_id = core0_load < core1_load ? VIDC_CORE_ID_1 :
>> VIDC_CORE_ID_2;
>> + min_load = min(core0_load, core1_load);
>> +
>> + if (cores_max < VIDC_CORE_ID_1) {
>> + min_core_id = VIDC_CORE_ID_1;
>> + min_load = core0_load;
>> + }
>
> could you please move that fragment just after IS_V4 check and return
> an
> error if cores_max < VIDC_CORE_ID_1.
>
Instead of "if cores_max < VIDC_CORE_ID_1", we need to check if
cores_max < VIDC_CORE_ID_2
and set core the single core as minimum load core. I can't return after
this check immidiately
as it needs to be checked whether load can be accommodated or not.
>> +
>> + cur_inst_load = load_per_instance(inst) *
>> + inst->clk_data.codec_data->vpp_cycles;
>> + max_freq = core->res->freq_tbl[0].freq;
>> +
>> + if ((cur_inst_load + min_load) > max_freq) {
>> + dev_warn(core->dev, "HW is overloaded, needed: %lu max: %lu\n",
>> + cur_inst_load, max_freq);
>> + return -EINVAL;
>> + }
>> +
>> + ret = set_core_usage(inst, min_core_id);
>> +
>> + if (ret)
>> + return ret;
>> +
>> + inst->clk_data.core_id = min_core_id;
>> +
>> + return 0;
>> }
>> -EXPORT_SYMBOL_GPL(venus_helper_set_core_usage);
>> +EXPORT_SYMBOL_GPL(venus_helper_decide_core);
>>
>> int venus_helper_init_codec_data(struct venus_inst *inst)
>> {
>> diff --git a/drivers/media/platform/qcom/venus/helpers.h
>> b/drivers/media/platform/qcom/venus/helpers.h
>> index f9360a8..c41ceb3 100644
>> --- a/drivers/media/platform/qcom/venus/helpers.h
>> +++ b/drivers/media/platform/qcom/venus/helpers.h
>> @@ -42,7 +42,7 @@ 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_data(struct venus_inst *inst);
>> -int venus_helper_set_core_usage(struct venus_inst *inst, u32 usage);
>> +int venus_helper_decide_core(struct venus_inst *inst, u32 cores_max);
>> int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int
>> input_bufs,
>> unsigned int output_bufs,
>> unsigned int output2_bufs);
>> diff --git a/drivers/media/platform/qcom/venus/vdec.c
>> b/drivers/media/platform/qcom/venus/vdec.c
>> index 51795fd..9f988ba 100644
>> --- a/drivers/media/platform/qcom/venus/vdec.c
>> +++ b/drivers/media/platform/qcom/venus/vdec.c
>> @@ -544,14 +544,15 @@ static int vdec_output_conf(struct venus_inst
>> *inst)
>> u32 height = inst->out_height;
>> u32 out_fmt, out2_fmt;
>> bool ubwc = false;
>> - u32 ptype;
>> + u32 ptype, cores_max;
>> int ret;
>>
>> ret = venus_helper_set_work_mode(inst, VIDC_WORK_MODE_2);
>> if (ret)
>> return ret;
>>
>> - ret = venus_helper_set_core_usage(inst, VIDC_CORE_ID_1);
>> + cores_max = core_num_max(inst);
>
> please move core_max calculation in the venus_helper_decide_core() here
> and below.
>
Yes Stan.
>> + ret = venus_helper_decide_core(inst, cores_max);
>> if (ret)
>> return ret;
>>
>> diff --git a/drivers/media/platform/qcom/venus/venc.c
>> b/drivers/media/platform/qcom/venus/venc.c
>> index 792cdce..ed39efd 100644
>> --- a/drivers/media/platform/qcom/venus/venc.c
>> +++ b/drivers/media/platform/qcom/venus/venc.c
>> @@ -654,13 +654,15 @@ static int venc_set_properties(struct venus_inst
>> *inst)
>> struct hfi_quantization quant;
>> struct hfi_quantization_range quant_range;
>> u32 ptype, rate_control, bitrate, profile = 0, level = 0;
>> + u32 cores_max;
>> int ret;
>>
>> ret = venus_helper_set_work_mode(inst, VIDC_WORK_MODE_2);
>> if (ret)
>> return ret;
>>
>> - ret = venus_helper_set_core_usage(inst, VIDC_CORE_ID_2);
>> + cores_max = core_num_max(inst);
>> + ret = venus_helper_decide_core(inst, cores_max);
>> if (ret)
>> return ret;
>>
>>
next prev parent reply other threads:[~2019-06-20 10:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-11 6:05 [PATCH v2 0/5] media: venus: Update clock scaling and core selection Aniket Masule
2019-06-11 6:05 ` [PATCH 1/5] media: venus: Add codec data table Aniket Masule
2019-06-17 8:37 ` Stanimir Varbanov
2019-06-20 8:11 ` amasule
2019-06-11 6:05 ` [PATCH 2/5] media: venus: Initialize codec data Aniket Masule
2019-06-17 8:37 ` Stanimir Varbanov
2019-06-20 8:13 ` amasule
2019-06-11 6:05 ` [PATCH 3/5] media: venus: Update clock scaling Aniket Masule
2019-06-17 8:58 ` Stanimir Varbanov
2019-06-20 8:28 ` amasule
2019-06-11 6:05 ` [PATCH 4/5] media: venus: Add interface for load per core Aniket Masule
2019-06-17 9:05 ` Stanimir Varbanov
2019-06-11 6:05 ` [PATCH 5/5] media: venus: Update core selection Aniket Masule
2019-06-17 9:07 ` Stanimir Varbanov
2019-06-20 10:59 ` amasule [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-05-30 13:58 [PATCH 0/5] media: venus: Update clock scaling and " Aniket Masule
2019-05-30 13:58 ` [PATCH 5/5] media: venus: Update " Aniket Masule
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5bbd61de30e4fe687773f04dd0816751@codeaurora.org \
--to=amasule@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=stanimir.varbanov@linaro.org \
--cc=vgarodia@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.