Loading drivers/media/platform/msm/vidc/msm_vidc_clocks.c +34 −12 Original line number Diff line number Diff line Loading @@ -170,6 +170,7 @@ int msm_comm_vote_bus(struct msm_vidc_core *core) struct hfi_device *hdev; struct msm_vidc_inst *inst = NULL; struct vidc_bus_vote_data *vote_data = NULL; bool is_turbo = false; if (!core || !core->device) { dprintk(VIDC_ERR, "%s Invalid args: %pK\n", __func__, core); Loading Loading @@ -211,6 +212,11 @@ int msm_comm_vote_bus(struct msm_vidc_core *core) temp->vvb.vb2_buf.planes[0].bytesused); device_addr = temp->smem[0].device_addr; } if (inst->session_type == MSM_VIDC_ENCODER && (temp->vvb.flags & V4L2_QCOM_BUF_FLAG_PERF_MODE)) { is_turbo = true; } } mutex_unlock(&inst->registeredbufs.lock); Loading Loading @@ -251,7 +257,7 @@ int msm_comm_vote_bus(struct msm_vidc_core *core) vote_data[i].fps = inst->prop.fps; vote_data[i].power_mode = 0; if (!msm_vidc_clock_scaling || if (!msm_vidc_clock_scaling || is_turbo || inst->clk_data.buffer_counter < DCVS_FTB_WINDOW) vote_data[i].power_mode = VIDC_POWER_TURBO; Loading Loading @@ -405,7 +411,7 @@ static int msm_dcvs_scale_clocks(struct msm_vidc_inst *inst) } static void msm_vidc_update_freq_entry(struct msm_vidc_inst *inst, unsigned long freq, u32 device_addr) unsigned long freq, u32 device_addr, bool is_turbo) { struct vidc_freq_data *temp, *next; bool found = false; Loading @@ -429,6 +435,7 @@ static void msm_vidc_update_freq_entry(struct msm_vidc_inst *inst, temp->device_addr = device_addr; list_add_tail(&temp->list, &inst->freqs.list); } temp->turbo = !!is_turbo; exit: mutex_unlock(&inst->freqs.lock); } Loading @@ -448,18 +455,36 @@ void msm_vidc_clear_freq_entry(struct msm_vidc_inst *inst, inst->clk_data.buffer_counter++; } static unsigned long msm_vidc_max_freq(struct msm_vidc_core *core) { struct allowed_clock_rates_table *allowed_clks_tbl = NULL; unsigned long freq = 0; allowed_clks_tbl = core->resources.allowed_clks_tbl; freq = allowed_clks_tbl[0].clock_rate; dprintk(VIDC_PROF, "Max rate = %lu\n", freq); return freq; } static unsigned long msm_vidc_adjust_freq(struct msm_vidc_inst *inst) { struct vidc_freq_data *temp; unsigned long freq = 0; bool is_turbo = false; mutex_lock(&inst->freqs.lock); list_for_each_entry(temp, &inst->freqs.list, list) { freq = max(freq, temp->freq); if (temp->turbo) { is_turbo = true; break; } } mutex_unlock(&inst->freqs.lock); if (is_turbo) { return msm_vidc_max_freq(inst->core); } /* If current requirement is within DCVS limits, try DCVS. */ if (freq < inst->clk_data.load_norm) { Loading Loading @@ -527,17 +552,8 @@ void msm_comm_update_input_cr(struct msm_vidc_inst *inst, mutex_unlock(&inst->input_crs.lock); } static unsigned long msm_vidc_max_freq(struct msm_vidc_core *core) { struct allowed_clock_rates_table *allowed_clks_tbl = NULL; unsigned long freq = 0; allowed_clks_tbl = core->resources.allowed_clks_tbl; freq = allowed_clks_tbl[0].clock_rate; dprintk(VIDC_PROF, "Max rate = %lu\n", freq); return freq; } static unsigned long msm_vidc_calc_freq(struct msm_vidc_inst *inst, u32 filled_len) Loading Loading @@ -744,6 +760,7 @@ int msm_comm_scale_clocks(struct msm_vidc_inst *inst) unsigned long freq = 0; u32 filled_len = 0; u32 device_addr = 0; bool is_turbo = false; if (!inst || !inst->core) { dprintk(VIDC_ERR, "%s Invalid args: Inst = %pK\n", Loading @@ -758,6 +775,11 @@ int msm_comm_scale_clocks(struct msm_vidc_inst *inst) temp->flags & MSM_VIDC_FLAG_DEFERRED) { filled_len = max(filled_len, temp->vvb.vb2_buf.planes[0].bytesused); if (inst->session_type == MSM_VIDC_ENCODER && (temp->vvb.flags & V4L2_QCOM_BUF_FLAG_PERF_MODE)) { is_turbo = true; } device_addr = temp->smem[0].device_addr; } } Loading @@ -770,7 +792,7 @@ int msm_comm_scale_clocks(struct msm_vidc_inst *inst) freq = msm_vidc_calc_freq(inst, filled_len); msm_vidc_update_freq_entry(inst, freq, device_addr); msm_vidc_update_freq_entry(inst, freq, device_addr, is_turbo); freq = msm_vidc_adjust_freq(inst); Loading drivers/media/platform/msm/vidc/msm_vidc_internal.h +1 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,7 @@ struct vidc_freq_data { struct list_head list; u32 device_addr; unsigned long freq; bool turbo; }; struct vidc_input_cr_data { Loading include/uapi/linux/videodev2.h +1 −0 Original line number Diff line number Diff line Loading @@ -1051,6 +1051,7 @@ struct v4l2_buffer { #define V4L2_QCOM_BUF_FLAG_CODECCONFIG 0x00020000 #define V4L2_QCOM_BUF_INPUT_UNSUPPORTED 0x01000000 #define V4L2_QCOM_BUF_FLAG_READONLY 0x04000000 #define V4L2_QCOM_BUF_FLAG_PERF_MODE 0x20000000 /** * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor Loading Loading
drivers/media/platform/msm/vidc/msm_vidc_clocks.c +34 −12 Original line number Diff line number Diff line Loading @@ -170,6 +170,7 @@ int msm_comm_vote_bus(struct msm_vidc_core *core) struct hfi_device *hdev; struct msm_vidc_inst *inst = NULL; struct vidc_bus_vote_data *vote_data = NULL; bool is_turbo = false; if (!core || !core->device) { dprintk(VIDC_ERR, "%s Invalid args: %pK\n", __func__, core); Loading Loading @@ -211,6 +212,11 @@ int msm_comm_vote_bus(struct msm_vidc_core *core) temp->vvb.vb2_buf.planes[0].bytesused); device_addr = temp->smem[0].device_addr; } if (inst->session_type == MSM_VIDC_ENCODER && (temp->vvb.flags & V4L2_QCOM_BUF_FLAG_PERF_MODE)) { is_turbo = true; } } mutex_unlock(&inst->registeredbufs.lock); Loading Loading @@ -251,7 +257,7 @@ int msm_comm_vote_bus(struct msm_vidc_core *core) vote_data[i].fps = inst->prop.fps; vote_data[i].power_mode = 0; if (!msm_vidc_clock_scaling || if (!msm_vidc_clock_scaling || is_turbo || inst->clk_data.buffer_counter < DCVS_FTB_WINDOW) vote_data[i].power_mode = VIDC_POWER_TURBO; Loading Loading @@ -405,7 +411,7 @@ static int msm_dcvs_scale_clocks(struct msm_vidc_inst *inst) } static void msm_vidc_update_freq_entry(struct msm_vidc_inst *inst, unsigned long freq, u32 device_addr) unsigned long freq, u32 device_addr, bool is_turbo) { struct vidc_freq_data *temp, *next; bool found = false; Loading @@ -429,6 +435,7 @@ static void msm_vidc_update_freq_entry(struct msm_vidc_inst *inst, temp->device_addr = device_addr; list_add_tail(&temp->list, &inst->freqs.list); } temp->turbo = !!is_turbo; exit: mutex_unlock(&inst->freqs.lock); } Loading @@ -448,18 +455,36 @@ void msm_vidc_clear_freq_entry(struct msm_vidc_inst *inst, inst->clk_data.buffer_counter++; } static unsigned long msm_vidc_max_freq(struct msm_vidc_core *core) { struct allowed_clock_rates_table *allowed_clks_tbl = NULL; unsigned long freq = 0; allowed_clks_tbl = core->resources.allowed_clks_tbl; freq = allowed_clks_tbl[0].clock_rate; dprintk(VIDC_PROF, "Max rate = %lu\n", freq); return freq; } static unsigned long msm_vidc_adjust_freq(struct msm_vidc_inst *inst) { struct vidc_freq_data *temp; unsigned long freq = 0; bool is_turbo = false; mutex_lock(&inst->freqs.lock); list_for_each_entry(temp, &inst->freqs.list, list) { freq = max(freq, temp->freq); if (temp->turbo) { is_turbo = true; break; } } mutex_unlock(&inst->freqs.lock); if (is_turbo) { return msm_vidc_max_freq(inst->core); } /* If current requirement is within DCVS limits, try DCVS. */ if (freq < inst->clk_data.load_norm) { Loading Loading @@ -527,17 +552,8 @@ void msm_comm_update_input_cr(struct msm_vidc_inst *inst, mutex_unlock(&inst->input_crs.lock); } static unsigned long msm_vidc_max_freq(struct msm_vidc_core *core) { struct allowed_clock_rates_table *allowed_clks_tbl = NULL; unsigned long freq = 0; allowed_clks_tbl = core->resources.allowed_clks_tbl; freq = allowed_clks_tbl[0].clock_rate; dprintk(VIDC_PROF, "Max rate = %lu\n", freq); return freq; } static unsigned long msm_vidc_calc_freq(struct msm_vidc_inst *inst, u32 filled_len) Loading Loading @@ -744,6 +760,7 @@ int msm_comm_scale_clocks(struct msm_vidc_inst *inst) unsigned long freq = 0; u32 filled_len = 0; u32 device_addr = 0; bool is_turbo = false; if (!inst || !inst->core) { dprintk(VIDC_ERR, "%s Invalid args: Inst = %pK\n", Loading @@ -758,6 +775,11 @@ int msm_comm_scale_clocks(struct msm_vidc_inst *inst) temp->flags & MSM_VIDC_FLAG_DEFERRED) { filled_len = max(filled_len, temp->vvb.vb2_buf.planes[0].bytesused); if (inst->session_type == MSM_VIDC_ENCODER && (temp->vvb.flags & V4L2_QCOM_BUF_FLAG_PERF_MODE)) { is_turbo = true; } device_addr = temp->smem[0].device_addr; } } Loading @@ -770,7 +792,7 @@ int msm_comm_scale_clocks(struct msm_vidc_inst *inst) freq = msm_vidc_calc_freq(inst, filled_len); msm_vidc_update_freq_entry(inst, freq, device_addr); msm_vidc_update_freq_entry(inst, freq, device_addr, is_turbo); freq = msm_vidc_adjust_freq(inst); Loading
drivers/media/platform/msm/vidc/msm_vidc_internal.h +1 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,7 @@ struct vidc_freq_data { struct list_head list; u32 device_addr; unsigned long freq; bool turbo; }; struct vidc_input_cr_data { Loading
include/uapi/linux/videodev2.h +1 −0 Original line number Diff line number Diff line Loading @@ -1051,6 +1051,7 @@ struct v4l2_buffer { #define V4L2_QCOM_BUF_FLAG_CODECCONFIG 0x00020000 #define V4L2_QCOM_BUF_INPUT_UNSUPPORTED 0x01000000 #define V4L2_QCOM_BUF_FLAG_READONLY 0x04000000 #define V4L2_QCOM_BUF_FLAG_PERF_MODE 0x20000000 /** * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor Loading