Loading drivers/media/platform/msm/vidc/governors/msm_vidc_dyn_gov.c +16 −18 Original line number Diff line number Diff line /* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -405,15 +405,10 @@ static unsigned long __calculate_decoder(struct vidc_bus_vote_data *d, motion_vector_complexity = FP(integer_part, frac_part, 100); dpb_write_compression_factor = !dpb_compression_enabled ? FP_ONE : __compression_ratio(__lut(width, height, fps), opb_bpp); dpb_write_compression_factor = d->use_dpb_read ? dpb_read_compression_factor : dpb_write_compression_factor; dpb_write_compression_factor = dpb_read_compression_factor; opb_compression_factor = !opb_compression_enabled ? FP_ONE : __compression_ratio(__lut(width, height, fps), opb_bpp); dpb_write_compression_factor; llc_ref_read_l2_cache_enabled = llc_vpss_ds_line_buf_enabled = false; if (d->use_sys_cache) { Loading @@ -425,7 +420,7 @@ static unsigned long __calculate_decoder(struct vidc_bus_vote_data *d, lcu_per_frame = DIV_ROUND_UP(width, lcu_size) * DIV_ROUND_UP(height, lcu_size); bitrate = __lut(width, height, fps)->bitrate; bitrate = (d->bitrate + 1000000 - 1) / 1000000; bins_to_bit_factor = d->work_mode == VIDC_WORK_MODE_1 ? FP_INT(0) : FP_INT(4); Loading Loading @@ -479,7 +474,7 @@ static unsigned long __calculate_decoder(struct vidc_bus_vote_data *d, if (llc_ref_read_l2_cache_enabled) { row_cache_penalty = FP(1, 30, 100); ddr.dpb_read = fp_div(ddr.dpb_read, row_cache_penalty); llc.dpb_read = dpb_total - ddr.dpb_read; llc.dpb_read = dpb_total - ddr.dpb_write - ddr.dpb_read; } opb_factor = dpb_bpp == 8 ? 8 : 4; Loading @@ -499,13 +494,14 @@ static unsigned long __calculate_decoder(struct vidc_bus_vote_data *d, } ddr.total = ddr.vsp_read + ddr.vsp_write + ddr.collocated_read + ddr.collocated_write + ddr.line_buffer_read + ddr.line_buffer_write + ddr.opb_read + ddr.opb_write + ddr.dpb_read + ddr.dpb_write; qsmmu_bw_overhead_factor = FP(1, 3, 100); ddr.total = fp_mult(ddr.total, qsmmu_bw_overhead_factor); llc.total = llc.dpb_read + llc.opb_read; llc.total = llc.dpb_read + llc.opb_read + ddr.total; /* Dump all the variables for easier debugging */ if (debug) { Loading Loading @@ -642,7 +638,8 @@ static unsigned long __calculate_encoder(struct vidc_bus_vote_data *d, b_frames_enabled = d->b_frames_enabled; width = max(d->input_width, BASELINE_DIMENSIONS.width); height = max(d->input_height, BASELINE_DIMENSIONS.height); bitrate = __lut(width, height, fps)->bitrate; bitrate = d->bitrate > 0 ? d->bitrate / 1000000 : __lut(width, height, fps)->bitrate; lcu_per_frame = DIV_ROUND_UP(width, lcu_size) * DIV_ROUND_UP(height, lcu_size); Loading Loading @@ -686,10 +683,11 @@ static unsigned long __calculate_encoder(struct vidc_bus_vote_data *d, input_compression_factor = FP(integer_part, frac_part, 100); /* use input cr if it is valid (not 1), otherwise use lut */ original_compression_factor = original_compression_enabled ? d->use_dpb_read ? dpb_compression_factor : input_compression_factor : FP_ONE; !original_compression_enabled ? FP_ONE : input_compression_factor != FP_ONE ? input_compression_factor : __compression_ratio(__lut(width, height, fps), dpb_bpp); ddr.vsp_read = fp_mult(fp_div(FP_INT(bitrate), FP_INT(8)), bins_to_bit_factor); Loading Loading @@ -743,7 +741,7 @@ static unsigned long __calculate_encoder(struct vidc_bus_vote_data *d, llc_ref_y_read -= ref_y_read; ref_cb_cr_read = fp_mult(ref_cb_cr_bw_factor, dpb_bw_for_1x); ref_cb_cr_read = fp_mult(ref_cb_cr_bw_factor, dpb_bw_for_1x) / 2; ref_cb_cr_read = fp_div(ref_cb_cr_read, dpb_compression_factor); Loading @@ -765,7 +763,7 @@ static unsigned long __calculate_encoder(struct vidc_bus_vote_data *d, ddr.dpb_write = fp_mult(ddr.dpb_write, FP(1, 50, 100)); ddr.dpb_write = fp_div(ddr.dpb_write, input_compression_factor); ddr.dpb_write = fp_div(ddr.dpb_write, dpb_compression_factor); ref_overlap_bw_factor = width <= vertical_tile_width ? FP_INT(0) : FP_INT(1); Loading @@ -787,7 +785,7 @@ static unsigned long __calculate_encoder(struct vidc_bus_vote_data *d, ddr.original_read + ddr.original_write + ddr.dpb_read + ddr.dpb_write; llc.total = llc.dpb_read + llc.line_buffer; llc.total = llc.dpb_read + llc.line_buffer + ddr.total; qsmmu_bw_overhead_factor = FP(1, 3, 100); ddr.total = fp_mult(ddr.total, qsmmu_bw_overhead_factor); Loading drivers/media/platform/msm/vidc/msm_vidc_clocks.c +10 −0 Original line number Diff line number Diff line Loading @@ -260,6 +260,16 @@ int msm_comm_vote_bus(struct msm_vidc_core *core) else vote_data[i].fps = inst->prop.fps; if (inst->session_type == MSM_VIDC_ENCODER) { vote_data[i].bitrate = inst->clk_data.bitrate; /* scale bitrate if operating rate is larger than fps */ if (vote_data[i].fps > inst->prop.fps && inst->prop.fps) { vote_data[i].bitrate = vote_data[i].bitrate / inst->prop.fps * vote_data[i].fps; } } vote_data[i].power_mode = 0; if (!msm_vidc_clock_scaling || is_turbo || inst->clk_data.buffer_counter < DCVS_FTB_WINDOW) Loading drivers/media/platform/msm/vidc/vidc_hfi_api.h +1 −1 Original line number Diff line number Diff line Loading @@ -1404,7 +1404,7 @@ struct vidc_bus_vote_data { enum hal_video_codec codec; enum hal_uncompressed_format color_formats[2]; int num_formats; /* 1 = DPB-OPB unified; 2 = split */ int input_height, input_width, fps; int input_height, input_width, fps, bitrate; int output_height, output_width; int compression_ratio; int complexity_factor; Loading Loading
drivers/media/platform/msm/vidc/governors/msm_vidc_dyn_gov.c +16 −18 Original line number Diff line number Diff line /* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -405,15 +405,10 @@ static unsigned long __calculate_decoder(struct vidc_bus_vote_data *d, motion_vector_complexity = FP(integer_part, frac_part, 100); dpb_write_compression_factor = !dpb_compression_enabled ? FP_ONE : __compression_ratio(__lut(width, height, fps), opb_bpp); dpb_write_compression_factor = d->use_dpb_read ? dpb_read_compression_factor : dpb_write_compression_factor; dpb_write_compression_factor = dpb_read_compression_factor; opb_compression_factor = !opb_compression_enabled ? FP_ONE : __compression_ratio(__lut(width, height, fps), opb_bpp); dpb_write_compression_factor; llc_ref_read_l2_cache_enabled = llc_vpss_ds_line_buf_enabled = false; if (d->use_sys_cache) { Loading @@ -425,7 +420,7 @@ static unsigned long __calculate_decoder(struct vidc_bus_vote_data *d, lcu_per_frame = DIV_ROUND_UP(width, lcu_size) * DIV_ROUND_UP(height, lcu_size); bitrate = __lut(width, height, fps)->bitrate; bitrate = (d->bitrate + 1000000 - 1) / 1000000; bins_to_bit_factor = d->work_mode == VIDC_WORK_MODE_1 ? FP_INT(0) : FP_INT(4); Loading Loading @@ -479,7 +474,7 @@ static unsigned long __calculate_decoder(struct vidc_bus_vote_data *d, if (llc_ref_read_l2_cache_enabled) { row_cache_penalty = FP(1, 30, 100); ddr.dpb_read = fp_div(ddr.dpb_read, row_cache_penalty); llc.dpb_read = dpb_total - ddr.dpb_read; llc.dpb_read = dpb_total - ddr.dpb_write - ddr.dpb_read; } opb_factor = dpb_bpp == 8 ? 8 : 4; Loading @@ -499,13 +494,14 @@ static unsigned long __calculate_decoder(struct vidc_bus_vote_data *d, } ddr.total = ddr.vsp_read + ddr.vsp_write + ddr.collocated_read + ddr.collocated_write + ddr.line_buffer_read + ddr.line_buffer_write + ddr.opb_read + ddr.opb_write + ddr.dpb_read + ddr.dpb_write; qsmmu_bw_overhead_factor = FP(1, 3, 100); ddr.total = fp_mult(ddr.total, qsmmu_bw_overhead_factor); llc.total = llc.dpb_read + llc.opb_read; llc.total = llc.dpb_read + llc.opb_read + ddr.total; /* Dump all the variables for easier debugging */ if (debug) { Loading Loading @@ -642,7 +638,8 @@ static unsigned long __calculate_encoder(struct vidc_bus_vote_data *d, b_frames_enabled = d->b_frames_enabled; width = max(d->input_width, BASELINE_DIMENSIONS.width); height = max(d->input_height, BASELINE_DIMENSIONS.height); bitrate = __lut(width, height, fps)->bitrate; bitrate = d->bitrate > 0 ? d->bitrate / 1000000 : __lut(width, height, fps)->bitrate; lcu_per_frame = DIV_ROUND_UP(width, lcu_size) * DIV_ROUND_UP(height, lcu_size); Loading Loading @@ -686,10 +683,11 @@ static unsigned long __calculate_encoder(struct vidc_bus_vote_data *d, input_compression_factor = FP(integer_part, frac_part, 100); /* use input cr if it is valid (not 1), otherwise use lut */ original_compression_factor = original_compression_enabled ? d->use_dpb_read ? dpb_compression_factor : input_compression_factor : FP_ONE; !original_compression_enabled ? FP_ONE : input_compression_factor != FP_ONE ? input_compression_factor : __compression_ratio(__lut(width, height, fps), dpb_bpp); ddr.vsp_read = fp_mult(fp_div(FP_INT(bitrate), FP_INT(8)), bins_to_bit_factor); Loading Loading @@ -743,7 +741,7 @@ static unsigned long __calculate_encoder(struct vidc_bus_vote_data *d, llc_ref_y_read -= ref_y_read; ref_cb_cr_read = fp_mult(ref_cb_cr_bw_factor, dpb_bw_for_1x); ref_cb_cr_read = fp_mult(ref_cb_cr_bw_factor, dpb_bw_for_1x) / 2; ref_cb_cr_read = fp_div(ref_cb_cr_read, dpb_compression_factor); Loading @@ -765,7 +763,7 @@ static unsigned long __calculate_encoder(struct vidc_bus_vote_data *d, ddr.dpb_write = fp_mult(ddr.dpb_write, FP(1, 50, 100)); ddr.dpb_write = fp_div(ddr.dpb_write, input_compression_factor); ddr.dpb_write = fp_div(ddr.dpb_write, dpb_compression_factor); ref_overlap_bw_factor = width <= vertical_tile_width ? FP_INT(0) : FP_INT(1); Loading @@ -787,7 +785,7 @@ static unsigned long __calculate_encoder(struct vidc_bus_vote_data *d, ddr.original_read + ddr.original_write + ddr.dpb_read + ddr.dpb_write; llc.total = llc.dpb_read + llc.line_buffer; llc.total = llc.dpb_read + llc.line_buffer + ddr.total; qsmmu_bw_overhead_factor = FP(1, 3, 100); ddr.total = fp_mult(ddr.total, qsmmu_bw_overhead_factor); Loading
drivers/media/platform/msm/vidc/msm_vidc_clocks.c +10 −0 Original line number Diff line number Diff line Loading @@ -260,6 +260,16 @@ int msm_comm_vote_bus(struct msm_vidc_core *core) else vote_data[i].fps = inst->prop.fps; if (inst->session_type == MSM_VIDC_ENCODER) { vote_data[i].bitrate = inst->clk_data.bitrate; /* scale bitrate if operating rate is larger than fps */ if (vote_data[i].fps > inst->prop.fps && inst->prop.fps) { vote_data[i].bitrate = vote_data[i].bitrate / inst->prop.fps * vote_data[i].fps; } } vote_data[i].power_mode = 0; if (!msm_vidc_clock_scaling || is_turbo || inst->clk_data.buffer_counter < DCVS_FTB_WINDOW) Loading
drivers/media/platform/msm/vidc/vidc_hfi_api.h +1 −1 Original line number Diff line number Diff line Loading @@ -1404,7 +1404,7 @@ struct vidc_bus_vote_data { enum hal_video_codec codec; enum hal_uncompressed_format color_formats[2]; int num_formats; /* 1 = DPB-OPB unified; 2 = split */ int input_height, input_width, fps; int input_height, input_width, fps, bitrate; int output_height, output_width; int compression_ratio; int complexity_factor; Loading