summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVinay Kalia <vinaykalia@google.com>2022-06-23 22:29:16 +0000
committerRuofei Ma <ruofeim@google.com>2022-09-14 14:10:25 -0700
commit6f9b65f19e49653b2e435728de61b0b282c9563e (patch)
treef33e554180f0a8b4ccd04adb0d2869f8281c3c99
parentbe445d7480a01fa245eedb65ec3ae525b0da5637 (diff)
downloadgchips-6f9b65f19e49653b2e435728de61b0b282c9563e.tar.gz
bigocean: Fix MIF floor for heavier loads
For 10-bit content at max resolutio and fps, the effective load is more than the max defined load. Fix the MIF floor for such heavy load usecases to prevent framedrops. bug: 233707844 bug: 237706931 Signed-off-by: Vinay Kalia <vinaykalia@google.com> Change-Id: I6582546fdefd5da356a9b3b5c2ae9f4e860663ec (cherry picked from commit 71f6ca8d99bb9b573359e91b435ba34a1288cbce)
-rw-r--r--bigo.c11
-rw-r--r--bigo_pm.c25
-rw-r--r--bigo_priv.h3
3 files changed, 39 insertions, 0 deletions
diff --git a/bigo.c b/bigo.c
index c4bc747..4496d77 100644
--- a/bigo.c
+++ b/bigo.c
@@ -36,6 +36,7 @@
#define DEFAULT_FPS 60
#define BIGO_SMC_ID 0xd
#define BIGO_MAX_INST_NUM 16
+#define BIGO_HBD_BIT BIT(17)
static int bigo_worker_thread(void *data);
@@ -147,6 +148,7 @@ static int bigo_open(struct inode *inode, struct file *file)
inst->height = DEFAULT_WIDTH;
inst->width = DEFAULT_HEIGHT;
inst->fps = DEFAULT_FPS;
+ inst->bpp = 1;
inst->core = core;
inst->job.regs_size = core->regs_size;
inst->job.regs = kzalloc(core->regs_size, GFP_KERNEL);
@@ -377,12 +379,21 @@ static long bigo_unlocked_ioctl(struct file *file, unsigned int cmd,
struct bigo_ioc_regs desc;
struct bigo_job *job = &inst->job;
long ret;
+ u32 hbd;
+ u32 bpp;
if (copy_regs_from_user(core, &desc, user_desc, job)) {
pr_err("Failed to copy regs from user\n");
return -EFAULT;
}
+ hbd = (((u32*)job->regs)[3]) & BIGO_HBD_BIT;
+ bpp = hbd ? 2:1;
+ if (bpp != inst->bpp) {
+ inst->bpp = bpp;
+ bigo_update_qos(core);
+ }
+
if(enqueue_prioq(core, inst)) {
pr_err("Failed enqueue frame\n");
return -EFAULT;
diff --git a/bigo_pm.c b/bigo_pm.c
index 9038d38..3d36a0b 100644
--- a/bigo_pm.c
+++ b/bigo_pm.c
@@ -18,6 +18,7 @@
#include "bigo_io.h"
#define BIGW_A0_CSR_PROG_FREQ 166000
+#define LARGE_LOAD_MIF_FLOOR 1539000
static inline u32 bigo_get_total_load(struct bigo_core *core)
{
@@ -43,6 +44,29 @@ static inline u32 bigo_get_total_load(struct bigo_core *core)
return load;
}
+static inline void update_mif_floor(struct bigo_core *core)
+{
+ struct bigo_inst *inst;
+ u32 load = 0;
+ u32 curr_load = 0;
+
+ if (!list_empty(&core->instances)) {
+ list_for_each_entry(inst, &core->instances, list) {
+ curr_load = inst->width * inst->height * inst->fps * inst->bpp / 1024;
+ load += curr_load;
+ }
+ }
+
+ if (load > core->pm.max_load) {
+ if (!exynos_pm_qos_request_active(&core->pm.qos_req_mif))
+ exynos_pm_qos_add_request(&core->pm.qos_req_mif, PM_QOS_BUS_THROUGHPUT, LARGE_LOAD_MIF_FLOOR);
+ else
+ exynos_pm_qos_update_request(&core->pm.qos_req_mif, LARGE_LOAD_MIF_FLOOR);
+ } else if (exynos_pm_qos_request_active(&core->pm.qos_req_mif)) {
+ exynos_pm_qos_remove_request(&core->pm.qos_req_mif);
+ }
+}
+
static inline u32 bigo_get_target_freq(struct bigo_core *core, u32 load)
{
struct bigo_opp *opp;
@@ -117,6 +141,7 @@ void bigo_update_qos(struct bigo_core *core)
if (rc)
pr_warn("%s: failed to scale bandwidth: %d\n", __func__, rc);
+ update_mif_floor(core);
bigo_scale_freq(core);
mutex_unlock(&core->lock);
}
diff --git a/bigo_priv.h b/bigo_priv.h
index f2ded9a..1d875f4 100644
--- a/bigo_priv.h
+++ b/bigo_priv.h
@@ -54,6 +54,7 @@ struct bigo_bw {
struct power_manager {
int bwindex;
struct exynos_pm_qos_request qos_bigo;
+ struct exynos_pm_qos_request qos_req_mif;
struct list_head opps;
struct list_head bw;
u32 max_load;
@@ -131,6 +132,8 @@ struct bigo_inst {
u32 hw_cycles[AVG_CNT];
struct completion job_comp;
struct bigo_job job;
+ /* bytes per pixel */
+ u32 bpp;
};
inline void set_curr_inst(struct bigo_core *core, struct bigo_inst *inst);