diff options
author | Vinay Kalia <vinaykalia@google.com> | 2022-06-23 22:29:16 +0000 |
---|---|---|
committer | Vinay Kalia <vinaykalia@google.com> | 2022-06-30 22:04:48 +0000 |
commit | 71f6ca8d99bb9b573359e91b435ba34a1288cbce (patch) | |
tree | 9ebe72c87ab4596c7c5a7d08c3ee8c4a460c0b2e | |
parent | 9a4469b98e3697f9f8adb531db708e4d673bdc70 (diff) | |
download | gchips-71f6ca8d99bb9b573359e91b435ba34a1288cbce.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
Signed-off-by: Vinay Kalia <vinaykalia@google.com>
Change-Id: I8da4eed15df9d76950095c3d1e2c03120363fa46
-rw-r--r-- | bigo.c | 11 | ||||
-rw-r--r-- | bigo_pm.c | 26 | ||||
-rw-r--r-- | bigo_priv.h | 3 |
3 files changed, 40 insertions, 0 deletions
@@ -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; @@ -17,6 +17,8 @@ #include "bigo_pm.h" #include "bigo_io.h" +#define LARGE_LOAD_MIF_FLOOR 1539000 + static inline u32 bigo_get_total_load(struct bigo_core *core) { struct bigo_inst *inst; @@ -41,6 +43,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; @@ -111,6 +136,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 0eb29cb..e951229 100644 --- a/bigo_priv.h +++ b/bigo_priv.h @@ -55,6 +55,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; @@ -132,6 +133,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); |