From 02f5b95ce6ebfac7b0e8a9bfd7628de3c5b1f127 Mon Sep 17 00:00:00 2001 From: Chinmay Sawarkar Date: Tue, 30 Jul 2019 22:03:26 -0700 Subject: [PATCH] msm: vidc: Do not vote bw on ftb Parameter that affect BW change during ETB and EBD. During FTB BW calculation and voting is redundant. Change-Id: I418d422f614670c2543a19709b36b3f39fd0d0e1 Signed-off-by: Chinmay Sawarkar --- msm/vidc/msm_vidc.c | 6 +++--- msm/vidc/msm_vidc_clocks.c | 19 +++++++++++-------- msm/vidc/msm_vidc_clocks.h | 2 +- msm/vidc/msm_vidc_common.c | 20 ++++++++++++-------- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/msm/vidc/msm_vidc.c b/msm/vidc/msm_vidc.c index 343d6c83db4c..db2e2b98c74d 100644 --- a/msm/vidc/msm_vidc.c +++ b/msm/vidc/msm_vidc.c @@ -940,7 +940,7 @@ static inline int start_streaming(struct msm_vidc_inst *inst) if (rc) goto fail_start; - msm_comm_scale_clocks_and_bus(inst); + msm_comm_scale_clocks_and_bus(inst, 1); rc = msm_comm_try_state(inst, MSM_VIDC_START_DONE); if (rc) { @@ -1132,7 +1132,7 @@ static void msm_vidc_stop_streaming(struct vb2_queue *q) break; } - msm_comm_scale_clocks_and_bus(inst); + msm_comm_scale_clocks_and_bus(inst, 1); if (rc) dprintk(VIDC_ERR, @@ -1595,7 +1595,7 @@ void *msm_vidc_open(int core_id, int session_type) goto fail_init; } - msm_comm_scale_clocks_and_bus(inst); + msm_comm_scale_clocks_and_bus(inst, 1); inst->debugfs_root = msm_vidc_debugfs_init_inst(inst, core->debugfs_root); diff --git a/msm/vidc/msm_vidc_clocks.c b/msm/vidc/msm_vidc_clocks.c index 062116a1e039..2a8f1a2acfbf 100644 --- a/msm/vidc/msm_vidc_clocks.c +++ b/msm/vidc/msm_vidc_clocks.c @@ -1034,7 +1034,7 @@ int msm_comm_scale_clocks(struct msm_vidc_inst *inst) return 0; } -int msm_comm_scale_clocks_and_bus(struct msm_vidc_inst *inst) +int msm_comm_scale_clocks_and_bus(struct msm_vidc_inst *inst, bool do_bw_calc) { struct msm_vidc_core *core; struct hfi_device *hdev; @@ -1048,11 +1048,14 @@ int msm_comm_scale_clocks_and_bus(struct msm_vidc_inst *inst) if (msm_comm_scale_clocks(inst)) { dprintk(VIDC_ERR, - "Failed to scale clocks. Performance might be impacted\n"); + "Failed to scale clocks. May impact performance\n"); } - if (msm_comm_vote_bus(core)) { - dprintk(VIDC_ERR, - "Failed to scale DDR bus. Performance might be impacted\n"); + + if (do_bw_calc) { + if (msm_comm_vote_bus(core)) { + dprintk(VIDC_ERR, + "Failed to scale DDR bus. May impact perf\n"); + } } return 0; } @@ -1185,7 +1188,7 @@ void msm_clock_data_reset(struct msm_vidc_inst *inst) msm_dcvs_print_dcvs_stats(dcvs); - rc = msm_comm_scale_clocks_and_bus(inst); + rc = msm_comm_scale_clocks_and_bus(inst, 1); if (rc) dprintk(VIDC_ERR, "%s Failed to scale Clocks and Bus\n", @@ -1390,7 +1393,7 @@ decision_done: (void *)&latency, sizeof(latency)); } - rc = msm_comm_scale_clocks_and_bus(inst); + rc = msm_comm_scale_clocks_and_bus(inst, 1); return rc; } @@ -1723,7 +1726,7 @@ int msm_vidc_decide_core_and_power_mode_iris1(struct msm_vidc_inst *inst) } inst->clk_data.core_id = VIDC_CORE_ID_1; - rc = msm_comm_scale_clocks_and_bus(inst); + rc = msm_comm_scale_clocks_and_bus(inst, 1); msm_print_core_status(core, VIDC_CORE_ID_1); return rc; } diff --git a/msm/vidc/msm_vidc_clocks.h b/msm/vidc/msm_vidc_clocks.h index d3bc4ae9dc34..4872cdaa8754 100644 --- a/msm/vidc/msm_vidc_clocks.h +++ b/msm/vidc/msm_vidc_clocks.h @@ -19,7 +19,7 @@ bool res_is_greater_than_or_equal_to(u32 width, u32 height, u32 ref_width, u32 ref_height); int msm_vidc_get_mbs_per_frame(struct msm_vidc_inst *inst); int msm_vidc_get_fps(struct msm_vidc_inst *inst); -int msm_comm_scale_clocks_and_bus(struct msm_vidc_inst *inst); +int msm_comm_scale_clocks_and_bus(struct msm_vidc_inst *inst, bool do_bw_calc); int msm_comm_init_clocks_and_bus_data(struct msm_vidc_inst *inst); void msm_comm_free_freq_table(struct msm_vidc_inst *inst); int msm_vidc_decide_work_route_iris1(struct msm_vidc_inst *inst); diff --git a/msm/vidc/msm_vidc_common.c b/msm/vidc/msm_vidc_common.c index 56e56f1aff26..cee0f4c83d2b 100644 --- a/msm/vidc/msm_vidc_common.c +++ b/msm/vidc/msm_vidc_common.c @@ -3052,7 +3052,7 @@ core_already_inited: change_inst_state(inst, MSM_VIDC_CORE_INIT); mutex_unlock(&core->lock); - rc = msm_comm_scale_clocks_and_bus(inst); + rc = msm_comm_scale_clocks_and_bus(inst, 1); return rc; fail_core_init: @@ -3082,7 +3082,7 @@ static int msm_vidc_deinit_core(struct msm_vidc_inst *inst) } mutex_unlock(&core->lock); - msm_comm_scale_clocks_and_bus(inst); + msm_comm_scale_clocks_and_bus(inst, 1); mutex_lock(&core->lock); @@ -4454,9 +4454,9 @@ static int msm_comm_qbuf_in_rbr(struct msm_vidc_inst *inst, return -EINVAL; } - rc = msm_comm_scale_clocks_and_bus(inst); + rc = msm_comm_scale_clocks_and_bus(inst, 0); if (rc) - dprintk(VIDC_ERR, "%s: scale clocks failed\n", __func__); + dprintk(VIDC_ERR, "%s: scale clock failed\n", __func__); print_vidc_buffer(VIDC_HIGH|VIDC_PERF, "qbuf in rbr", inst, mbuf); rc = msm_comm_qbuf_to_hfi(inst, mbuf); @@ -4470,6 +4470,7 @@ int msm_comm_qbuf(struct msm_vidc_inst *inst, struct msm_vidc_buffer *mbuf) { int rc = 0; struct v4l2_ctrl *ctrl; + int do_bw_calc = 0; if (!inst || !mbuf) { dprintk(VIDC_ERR, "%s: Invalid arguments\n", __func__); @@ -4491,9 +4492,10 @@ int msm_comm_qbuf(struct msm_vidc_inst *inst, struct msm_vidc_buffer *mbuf) if (rc) return rc; - rc = msm_comm_scale_clocks_and_bus(inst); + do_bw_calc = mbuf->vvb.vb2_buf.type == INPUT_MPLANE; + rc = msm_comm_scale_clocks_and_bus(inst, do_bw_calc); if (rc) - dprintk(VIDC_ERR, "%s: scale clocks failed\n", __func__); + dprintk(VIDC_ERR, "%s: scale clock & bw failed\n", __func__); print_vidc_buffer(VIDC_HIGH|VIDC_PERF, "qbuf", inst, mbuf); ctrl = get_ctrl(inst, V4L2_CID_MPEG_VIDC_SUPERFRAME); @@ -4563,10 +4565,12 @@ int msm_comm_qbufs_batch(struct msm_vidc_inst *inst, { int rc = 0; struct msm_vidc_buffer *buf; + int do_bw_calc = 0; - rc = msm_comm_scale_clocks_and_bus(inst); + do_bw_calc = mbuf->vvb.vb2_buf.type == INPUT_MPLANE; + rc = msm_comm_scale_clocks_and_bus(inst, do_bw_calc); if (rc) - dprintk(VIDC_ERR, "%s: scale clocks failed\n", __func__); + dprintk(VIDC_ERR, "%s: scale clock & bw failed\n", __func__); mutex_lock(&inst->registeredbufs.lock); list_for_each_entry(buf, &inst->registeredbufs.list, list) {