Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b790e666 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: Update VSP cycle count calculation"

parents 9a0f48dd 557ca136
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -3058,6 +3058,8 @@ int msm_venc_set_entropy_mode(struct msm_vidc_inst *inst)
		sizeof(entropy));
	if (rc)
		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
	else
		inst->entropy_mode = entropy.entropy_mode;

	return rc;
}
+1 −0
Original line number Diff line number Diff line
@@ -1604,6 +1604,7 @@ void *msm_vidc_open(int core_id, int session_type)
	inst->dpb_extra_binfo = NULL;
	inst->all_intra = false;
	inst->max_filled_len = 0;
	inst->entropy_mode = HFI_H264_ENTROPY_CABAC;

	for (i = SESSION_MSG_INDEX(SESSION_MSG_START);
		i <= SESSION_MSG_INDEX(SESSION_MSG_END); i++) {
+40 −22
Original line number Diff line number Diff line
@@ -724,11 +724,10 @@ static unsigned long msm_vidc_calc_freq_iris2(struct msm_vidc_inst *inst,
	u32 vpp_cycles_per_mb;
	u32 mbs_per_second;
	struct msm_vidc_core *core = NULL;
	int i = 0;
	struct allowed_clock_rates_table *allowed_clks_tbl = NULL;
	u64 rate = 0, fps;
	u32 fps;
	struct clock_data *dcvs = NULL;
	u32 operating_rate, vsp_factor_num = 10, vsp_factor_den = 5;
	u32 operating_rate, vsp_factor_num = 1, vsp_factor_den = 1;
	u32 base_cycles = 0;

	core = inst->core;
	dcvs = &inst->clk_data;
@@ -763,18 +762,34 @@ static unsigned long msm_vidc_calc_freq_iris2(struct msm_vidc_inst *inst,
		if (inst->clk_data.work_route > 1)
			vpp_cycles += vpp_cycles / 100;

		vsp_cycles = mbs_per_second * inst->clk_data.entry->vsp_cycles;

		/* VSP */
		/* bitrate is based on fps, scale it using operating rate */
		operating_rate = inst->clk_data.operating_rate >> 16;
		if (operating_rate > (inst->clk_data.frame_rate >> 16) &&
			(inst->clk_data.frame_rate >> 16)) {
			vsp_factor_num *= operating_rate;
			vsp_factor_den *= inst->clk_data.frame_rate >> 16;
			vsp_factor_num = operating_rate;
			vsp_factor_den = inst->clk_data.frame_rate >> 16;
		}
		vsp_cycles += ((u64)inst->clk_data.bitrate * vsp_factor_num) /
		vsp_cycles = ((u64)inst->clk_data.bitrate * vsp_factor_num) /
				vsp_factor_den;

		base_cycles = inst->clk_data.entry->vsp_cycles;
		if (inst->entropy_mode == HFI_H264_ENTROPY_CABAC) {
			vsp_cycles = (vsp_cycles * 135) / 100;
		} else {
			base_cycles = 0;
			vsp_cycles = vsp_cycles / 2;
			/* VSP FW Overhead 1.05 */
			vsp_cycles = (vsp_cycles * 21) / 20;
		}

		if (inst->clk_data.work_mode == HFI_WORKMODE_1)
			vsp_cycles = vsp_cycles * 3;

		vsp_cycles += mbs_per_second * base_cycles;

	} else if (inst->session_type == MSM_VIDC_DECODER) {
		/* VPP */
		vpp_cycles = mbs_per_second * inst->clk_data.entry->vpp_cycles /
				inst->clk_data.work_route;
		/* 21 / 20 is minimum overhead factor */
@@ -783,10 +798,23 @@ static unsigned long msm_vidc_calc_freq_iris2(struct msm_vidc_inst *inst,
		if (inst->clk_data.work_route > 1)
			vpp_cycles += vpp_cycles * 59 / 1000;

		vsp_cycles = mbs_per_second * inst->clk_data.entry->vsp_cycles;
		/* VSP */
		base_cycles = inst->clk_data.entry->vsp_cycles;
		vsp_cycles = fps * filled_len * 8;
		if (inst->entropy_mode == HFI_H264_ENTROPY_CABAC) {
			vsp_cycles = (vsp_cycles * 135) / 100;
		} else {
			base_cycles = 0;
			vsp_cycles = vsp_cycles / 2;
			/* VSP FW Overhead 1.05 */
			vsp_cycles = vsp_cycles * 21 / 20;
		}

		if (inst->clk_data.work_mode == HFI_WORKMODE_1)
			vsp_cycles = vsp_cycles * 3;

		vsp_cycles += mbs_per_second * base_cycles;

		/* vsp perf is about 0.5 bits/cycle */
		vsp_cycles += ((fps * filled_len * 8) * 10) / 5;
	} else {
		s_vpr_e(inst->sid, "%s: Unknown session type\n", __func__);
		return msm_vidc_max_freq(inst->core, inst->sid);
@@ -795,16 +823,6 @@ static unsigned long msm_vidc_calc_freq_iris2(struct msm_vidc_inst *inst,
	freq = max(vpp_cycles, vsp_cycles);
	freq = max(freq, fw_cycles);

	allowed_clks_tbl = core->resources.allowed_clks_tbl;
	for (i = core->resources.allowed_clks_tbl_size - 1; i >= 0; i--) {
		rate = allowed_clks_tbl[i].clock_rate;
		if (rate >= freq)
			break;
	}

	if (i < 0)
		i = 0;

	s_vpr_p(inst->sid, "%s: inst %pK: filled len %d required freq %llu\n",
		__func__, inst, filled_len, freq);

+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@
#include <linux/of_fdt.h>

int msm_vidc_debug = VIDC_ERR | VIDC_PRINTK |
	FW_HIGH | FW_ERROR | FW_FATAL | FW_FTRACE;
	FW_ERROR | FW_FATAL | FW_FTRACE;
EXPORT_SYMBOL(msm_vidc_debug);

bool msm_vidc_lossless_encode = !true;
+9 −9
Original line number Diff line number Diff line
@@ -78,15 +78,15 @@ static struct msm_vidc_codec_data lito_codec_data[] = {

/* Update with Kona data */
static struct msm_vidc_codec_data kona_codec_data[] =  {
	CODEC_ENTRY(V4L2_PIX_FMT_H264, MSM_VIDC_ENCODER, 0, 675, 320),
	CODEC_ENTRY(V4L2_PIX_FMT_HEVC, MSM_VIDC_ENCODER, 0, 675, 320),
	CODEC_ENTRY(V4L2_PIX_FMT_VP8, MSM_VIDC_ENCODER, 0, 675, 320),
	CODEC_ENTRY(V4L2_PIX_FMT_TME, MSM_VIDC_ENCODER, 0, 540, 540),
	CODEC_ENTRY(V4L2_PIX_FMT_MPEG2, MSM_VIDC_DECODER, 0, 200, 200),
	CODEC_ENTRY(V4L2_PIX_FMT_H264, MSM_VIDC_DECODER, 0, 200, 200),
	CODEC_ENTRY(V4L2_PIX_FMT_HEVC, MSM_VIDC_DECODER, 0, 200, 200),
	CODEC_ENTRY(V4L2_PIX_FMT_VP8, MSM_VIDC_DECODER, 0, 200, 200),
	CODEC_ENTRY(V4L2_PIX_FMT_VP9, MSM_VIDC_DECODER, 0, 200, 200),
	CODEC_ENTRY(V4L2_PIX_FMT_H264, MSM_VIDC_ENCODER, 25, 675, 320),
	CODEC_ENTRY(V4L2_PIX_FMT_HEVC, MSM_VIDC_ENCODER, 25, 675, 320),
	CODEC_ENTRY(V4L2_PIX_FMT_VP8, MSM_VIDC_ENCODER, 25, 675, 320),
	CODEC_ENTRY(V4L2_PIX_FMT_TME, MSM_VIDC_ENCODER, 25, 540, 540),
	CODEC_ENTRY(V4L2_PIX_FMT_MPEG2, MSM_VIDC_DECODER, 25, 200, 200),
	CODEC_ENTRY(V4L2_PIX_FMT_H264, MSM_VIDC_DECODER, 25, 200, 200),
	CODEC_ENTRY(V4L2_PIX_FMT_HEVC, MSM_VIDC_DECODER, 25, 200, 200),
	CODEC_ENTRY(V4L2_PIX_FMT_VP8, MSM_VIDC_DECODER, 25, 200, 200),
	CODEC_ENTRY(V4L2_PIX_FMT_VP9, MSM_VIDC_DECODER, 25, 200, 200),
};

/* Update with SM6150 data */