All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aniket Masule <amasule@codeaurora.org>
To: linux-media@vger.kernel.org, stanimir.varbanov@linaro.org
Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	vgarodia@codeaurora.org, Aniket Masule <amasule@codeaurora.org>
Subject: [PATCH 4/5] media: venus: Add interface for load per core
Date: Tue, 11 Jun 2019 11:35:29 +0530	[thread overview]
Message-ID: <1560233130-27264-5-git-send-email-amasule@codeaurora.org> (raw)
In-Reply-To: <1560233130-27264-1-git-send-email-amasule@codeaurora.org>

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(+)

diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c
index 7bcc1e6..edb653e 100644
--- a/drivers/media/platform/qcom/venus/helpers.c
+++ b/drivers/media/platform/qcom/venus/helpers.c
@@ -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;
diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h
index 34ea503..3677e2e 100644
--- a/drivers/media/platform/qcom/venus/hfi_helper.h
+++ b/drivers/media/platform/qcom/venus/hfi_helper.h
@@ -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;
diff --git a/drivers/media/platform/qcom/venus/hfi_parser.h b/drivers/media/platform/qcom/venus/hfi_parser.h
index 3e931c7..264e6dd 100644
--- a/drivers/media/platform/qcom/venus/hfi_parser.h
+++ b/drivers/media/platform/qcom/venus/hfi_parser.h
@@ -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
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


  parent reply	other threads:[~2019-06-11  6:06 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 ` Aniket Masule [this message]
2019-06-17  9:05   ` [PATCH 4/5] media: venus: Add interface for load per core 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
  -- 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 4/5] media: venus: Add interface for load per core 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=1560233130-27264-5-git-send-email-amasule@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.