diff options
author | Robin Peng <robinpeng@google.com> | 2022-11-10 11:34:56 +0000 |
---|---|---|
committer | Robin Peng <robinpeng@google.com> | 2022-11-10 11:34:56 +0000 |
commit | e01b5403327b405c2118838f8bf865762b2a05ec (patch) | |
tree | c0f79319557baf15f84749b9a40db9dbfa26afa1 | |
parent | 2e9aa482f67c0ca89f25dd7e411309f36fc74bd1 (diff) | |
parent | ac74f1db5029a1bea6873e4af2cff2191cd5e480 (diff) | |
download | gchips-e01b5403327b405c2118838f8bf865762b2a05ec.tar.gz |
Merge android13-gs-pixel-5.15 into android14-gs-pixel-5.15
Bug: 236259002
Change-Id: I77af4d342251261ffabd3203d172d3ebda43e5ac
Signed-off-by: Robin Peng <robinpeng@google.com>
-rw-r--r-- | bigo.c | 44 | ||||
-rw-r--r-- | bigo_of.c | 7 | ||||
-rw-r--r-- | bigo_pm.c | 2 | ||||
-rw-r--r-- | bigo_priv.h | 9 | ||||
-rw-r--r-- | bigo_slc.c | 26 | ||||
-rw-r--r-- | bigo_slc.h | 6 |
6 files changed, 84 insertions, 10 deletions
@@ -231,8 +231,10 @@ static int bigo_run_job(struct bigo_core *core, struct bigo_job *job) int rc = 0; u32 status = 0; unsigned long flags; + struct bigo_inst* inst; - bigo_bypass_ssmt_pid(core); + inst = container_of(job, struct bigo_inst, job); + bigo_bypass_ssmt_pid(core, inst->is_decoder_usage); bigo_push_regs(core, job->regs); bigo_core_enable(core); ret = wait_for_completion_timeout(&core->frame_done, @@ -398,6 +400,8 @@ static long bigo_unlocked_ioctl(struct file *file, unsigned int cmd, bigo_mark_qos_dirty(core); } + inst->is_decoder_usage = !!(((uint8_t*)job->regs)[BIGO_REG_STAT]&BIGO_STAT_MODE); + if(enqueue_prioq(core, inst)) { pr_err("Failed enqueue frame\n"); return -EFAULT; @@ -665,6 +669,39 @@ static int bigo_worker_thread(void *data) return 0; } +#if IS_ENABLED(CONFIG_EXYNOS_ITMON) +static int bigo_itmon_notifier(struct notifier_block *nb, unsigned long action, + void *nb_data) +{ + struct bigo_core *core; + struct itmon_notifier *itmon_info = nb_data; + int is_bo_itmon = 0; + int ret = NOTIFY_OK; + + core = container_of(nb, struct bigo_core, itmon_nb); + + if (unlikely(!core) || IS_ERR_OR_NULL(itmon_info)) + return ret; + + if ((itmon_info->port && !strncmp("BW", itmon_info->port, 2)) + || (itmon_info->client && !strncmp("BW", itmon_info->client, 2)) + || (itmon_info->dest && !strncmp("BW", itmon_info->dest, 2))) { + is_bo_itmon = 1; + } + + if (!is_bo_itmon) + return ret; + + dev_err(core->dev, "port %s client %s dest %s\n", itmon_info->port, + itmon_info->client, itmon_info->dest); + ret = NOTIFY_BAD; + + BUG(); + + return ret; +} +#endif + static int bigo_probe(struct platform_device *pdev) { int rc = 0; @@ -735,6 +772,11 @@ static int bigo_probe(struct platform_device *pdev) bigo_init_debugfs(core); +#if IS_ENABLED(CONFIG_EXYNOS_ITMON) + core->itmon_nb.notifier_call = bigo_itmon_notifier; + itmon_notifier_chain_register(&core->itmon_nb); +#endif + return rc; err_pt_client: @@ -63,6 +63,13 @@ static int bigo_of_get_resource(struct bigo_core *core) goto err; } + rc = of_property_read_u32(core->dev->of_node, "ip_ver", &core->ip_ver); + if (rc < 0) { + core->ip_ver = 0; + pr_info("ip_ver is not specified, default to A0\n"); + rc = 0; + } + err: return rc; } @@ -99,7 +99,7 @@ static inline void bigo_set_freq(struct bigo_core *core, u32 freq) freq = core->debugfs.set_freq; /* HW bug workaround: see b/215390692 */ - if (freq > BIGW_A0_CSR_PROG_FREQ) + if (core->ip_ver < 1 && freq > BIGW_A0_CSR_PROG_FREQ) freq = BIGW_A0_CSR_PROG_FREQ; if (!exynos_pm_qos_request_active(&core->pm.qos_bigo)) diff --git a/bigo_priv.h b/bigo_priv.h index 892d40b..dcb8ff1 100644 --- a/bigo_priv.h +++ b/bigo_priv.h @@ -15,6 +15,10 @@ #include <linux/platform_device.h> #include <soc/google/exynos_pm_qos.h> +#if IS_ENABLED(CONFIG_EXYNOS_ITMON) +#include <soc/google/exynos-itmon.h> +#endif + #include "uapi/linux/bigo.h" #if IS_ENABLED(CONFIG_SLC_PARTITION_MANAGER) @@ -113,6 +117,10 @@ struct bigo_core { wait_queue_head_t worker; struct bigo_prio_array prioq; u32 qos_dirty; +#if IS_ENABLED(CONFIG_EXYNOS_ITMON) + struct notifier_block itmon_nb; +#endif + u32 ip_ver; }; struct bigo_inst { @@ -136,6 +144,7 @@ struct bigo_inst { /* bytes per pixel */ u32 bpp; bool idle; + bool is_decoder_usage; }; inline void set_curr_inst(struct bigo_core *core, struct bigo_inst *inst); @@ -20,7 +20,15 @@ #define SID_S4_COMP_TILE_COL 20 #define SID_S4_CDEC_TILE_COL 21 -void bigo_bypass_ssmt_pid(struct bigo_core *core) +#define SID_ENC_RD_SERV_S1_RAW_PIX 1 +#define SID_ENC_RD_SERV_REF_CACHE 2 +#define SID_ENC_RD_SERV_COMP_INFO 6 +#define RD_SERV_S4_CDEF_TILE_COL 21 +#define RD_SERV_S4_CDEF_DIR_TILE_COL 26 +#define RD_SERV_S3_TEMPORAL 3 + + +void bigo_bypass_ssmt_pid(struct bigo_core *core, bool dec_mode) { int sid; unsigned int offset; @@ -33,10 +41,18 @@ void bigo_bypass_ssmt_pid(struct bigo_core *core) for (sid = 0; sid < 32; sid++) { offset = sid * 4; - if (sid == SID_S3_TEMPORAL || sid == SID_COMP_INFO || - sid == SID_S4_SECONDARY_COLBUF || sid == SID_S4_COMP_TILE_COL || - sid == SID_S4_CDEC_TILE_COL) { - writel(core->slc.pid, core->slc.ssmt_pid_base + offset); + if (dec_mode) { + if (sid == SID_S3_TEMPORAL || sid == SID_COMP_INFO || + sid == SID_S4_SECONDARY_COLBUF || sid == SID_S4_COMP_TILE_COL || + sid == SID_S4_CDEC_TILE_COL) { + writel(core->slc.pid, core->slc.ssmt_pid_base + offset); + } + } else { + if (sid == SID_ENC_RD_SERV_S1_RAW_PIX || sid == SID_ENC_RD_SERV_REF_CACHE || + sid == SID_ENC_RD_SERV_COMP_INFO || sid == RD_SERV_S4_CDEF_TILE_COL || + sid == RD_SERV_S4_CDEF_DIR_TILE_COL || sid == RD_SERV_S3_TEMPORAL) { + writel(core->slc.pid, core->slc.ssmt_pid_base + offset); + } } writel(0xe, core->slc.ssmt_pid_base + cache_off + offset); writel(0x80000000, core->slc.ssmt_pid_base + rd_alloc_off + offset); @@ -17,14 +17,14 @@ void bigo_pt_client_unregister(struct bigo_core *core); int bigo_pt_client_enable(struct bigo_core *core); void bigo_pt_client_disable(struct bigo_core *core); void bigo_get_cache_info(struct bigo_core *core, struct bigo_cache_info *cinfo); -void bigo_bypass_ssmt_pid(struct bigo_core *core); +void bigo_bypass_ssmt_pid(struct bigo_core *core, bool dec_mode); #else static inline int bigo_pt_client_register(struct device_node *node, struct bigo_core *core) { return 0; } static inline void bigo_pt_client_unregister(struct bigo_core *core) { } static inline int bigo_pt_client_enable(struct bigo_core *core) { return 0; } static inline void bigo_pt_client_disable(struct bigo_core *core) { } static inline void bigo_get_cache_info(struct bigo_core *core, struct bigo_cache_info *cinfo) { } -static inline void bigo_bypass_ssmt_pid(struct bigo_core *core) { } +static inline void bigo_bypass_ssmt_pid(struct bigo_core *core, bool dec_mode) { } #endif -#endif //_BIGO_SLC_H_
\ No newline at end of file +#endif //_BIGO_SLC_H_ |