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

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

Merge "msm: vidc: Update cycle count for vpx"

parents daf7def7 4957c0a7
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -255,7 +255,9 @@ static const struct v4l2_file_operations msm_v4l2_vidc_fops = {
	.open = msm_v4l2_open,
	.release = msm_v4l2_close,
	.unlocked_ioctl = video_ioctl2,
#ifdef CONFIG_COMPAT
	.compat_ioctl32 = msm_v4l2_private,
#endif
	.poll = msm_v4l2_poll,
};

+26 −18
Original line number Diff line number Diff line
@@ -602,7 +602,7 @@ static unsigned long msm_vidc_calc_freq_ar50(struct msm_vidc_inst *inst,

		vsp_cycles = mbs_per_second * inst->clk_data.entry->vsp_cycles;
		/* 10 / 7 is overhead factor */
		vsp_cycles += ((fps * filled_len * 8) * 10) / 7;
		vsp_cycles += div_u64((fps * filled_len * 8 * 10), 7);

	} else {
		s_vpr_e(inst->sid, "%s: Unknown session type\n", __func__);
@@ -679,8 +679,8 @@ static unsigned long msm_vidc_calc_freq_iris1(struct msm_vidc_inst *inst,
			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_factor_den;
		vsp_cycles += div_u64(((u64)inst->clk_data.bitrate *
					vsp_factor_num), vsp_factor_den);

	} else if (inst->session_type == MSM_VIDC_DECODER) {
		vpp_cycles = mbs_per_second * inst->clk_data.entry->vpp_cycles /
@@ -691,7 +691,7 @@ static unsigned long msm_vidc_calc_freq_iris1(struct msm_vidc_inst *inst,
		vsp_cycles = mbs_per_second * inst->clk_data.entry->vsp_cycles;

		/* vsp perf is about 0.5 bits/cycle */
		vsp_cycles += ((fps * filled_len * 8) * 10) / 5;
		vsp_cycles += div_u64((fps * filled_len * 8 * 10), 5);

	} else {
		s_vpr_e(inst->sid, "%s: Unknown session type\n", __func__);
@@ -729,6 +729,7 @@ static unsigned long msm_vidc_calc_freq_iris2(struct msm_vidc_inst *inst,
	struct clock_data *dcvs = NULL;
	u32 operating_rate, vsp_factor_num = 1, vsp_factor_den = 1;
	u32 base_cycles = 0;
	u32 codec = 0;

	core = inst->core;
	dcvs = &inst->clk_data;
@@ -758,17 +759,17 @@ static unsigned long msm_vidc_calc_freq_iris2(struct msm_vidc_inst *inst,
		if (msm_comm_g_ctrl_for_id(inst, V4L2_CID_MPEG_VIDEO_B_FRAMES))
			vpp_cycles += vpp_cycles / 4;
		/* 21 / 20 is minimum overhead factor */
		vpp_cycles += max(vpp_cycles / 20, fw_vpp_cycles);
		vpp_cycles += max(div_u64(vpp_cycles, 20), fw_vpp_cycles);
		/* 1.01 is multi-pipe overhead */
		if (inst->clk_data.work_route > 1)
			vpp_cycles += vpp_cycles / 100;
			vpp_cycles += div_u64(vpp_cycles, 100);
		/*
		 * 1080p@480fps usecase needs exactly 338MHz
		 * without any margin left. Hence, adding 2 percent
		 * extra to bump it to next level (366MHz).
		 */
		if (fps == 480)
			vpp_cycles += vpp_cycles * 2 / 100;
			vpp_cycles += div_u64(vpp_cycles * 2, 100);

		/* VSP */
		/* bitrate is based on fps, scale it using operating rate */
@@ -778,17 +779,20 @@ static unsigned long msm_vidc_calc_freq_iris2(struct msm_vidc_inst *inst,
			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_factor_den;
		vsp_cycles = div_u64(((u64)inst->clk_data.bitrate *
					vsp_factor_num), vsp_factor_den);

		codec = get_v4l2_codec(inst);
		base_cycles = inst->clk_data.entry->vsp_cycles;
		if (inst->entropy_mode == HFI_H264_ENTROPY_CABAC) {
			vsp_cycles = (vsp_cycles * 135) / 100;
		if (codec == V4L2_PIX_FMT_VP8 || codec == V4L2_PIX_FMT_VP9) {
			vsp_cycles = div_u64(vsp_cycles * 170, 100);
		} else if (inst->entropy_mode == HFI_H264_ENTROPY_CABAC) {
			vsp_cycles = div_u64(vsp_cycles * 135, 100);
		} else {
			base_cycles = 0;
			vsp_cycles = vsp_cycles / 2;
			vsp_cycles = div_u64(vsp_cycles, 2);
			/* VSP FW Overhead 1.05 */
			vsp_cycles = (vsp_cycles * 21) / 20;
			vsp_cycles = div_u64(vsp_cycles * 21, 20);
		}

		if (inst->clk_data.work_mode == HFI_WORKMODE_1)
@@ -804,18 +808,22 @@ static unsigned long msm_vidc_calc_freq_iris2(struct msm_vidc_inst *inst,
		vpp_cycles += max(vpp_cycles / 20, fw_vpp_cycles);
		/* 1.059 is multi-pipe overhead */
		if (inst->clk_data.work_route > 1)
			vpp_cycles += vpp_cycles * 59 / 1000;
			vpp_cycles += div_u64(vpp_cycles * 59, 1000);

		/* VSP */
		codec = get_v4l2_codec(inst);
		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;

		if (codec == V4L2_PIX_FMT_VP8 || codec == V4L2_PIX_FMT_VP9) {
			vsp_cycles = div_u64(vsp_cycles * 170, 100);
		} else if (inst->entropy_mode == HFI_H264_ENTROPY_CABAC) {
			vsp_cycles = div_u64(vsp_cycles * 135, 100);
		} else {
			base_cycles = 0;
			vsp_cycles = vsp_cycles / 2;
			vsp_cycles = div_u64(vsp_cycles, 2);
			/* VSP FW Overhead 1.05 */
			vsp_cycles = vsp_cycles * 21 / 20;
			vsp_cycles = div_u64(vsp_cycles * 21, 20);
		}

		if (inst->clk_data.work_mode == HFI_WORKMODE_1)
+4 −4
Original line number Diff line number Diff line
@@ -7240,10 +7240,10 @@ int msm_comm_check_window_bitrate(struct msm_vidc_inst *inst,
		inst->core->resources.allowed_clks_tbl[0].clock_rate / fps -
		inst->clk_data.entry->vsp_cycles *
		msm_vidc_get_mbs_per_frame(inst);
	max_avg_frame_size = (u64)max_frame_size * 100 *
		(window_size + window_buffer) / (window_size * 135);
	max_frame_size = (u64)max_frame_size * 100 *
		(1 + window_buffer) / 135;
	max_avg_frame_size = div_u64((u64)max_frame_size * 100 *
		(window_size + window_buffer), (window_size * 135));
	max_frame_size = div_u64((u64)max_frame_size * 100 *
				(1 + window_buffer), 135);

	frame_size = frame_data->filled_len;
	window_start = inst->count.etb;
+3 −3
Original line number Diff line number Diff line
@@ -80,13 +80,13 @@ static struct msm_vidc_codec_data lito_codec_data[] = {
static struct msm_vidc_codec_data kona_codec_data[] =  {
	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_VP8, MSM_VIDC_ENCODER, 60, 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),
	CODEC_ENTRY(V4L2_PIX_FMT_VP8, MSM_VIDC_DECODER, 60, 200, 200),
	CODEC_ENTRY(V4L2_PIX_FMT_VP9, MSM_VIDC_DECODER, 60, 200, 200),
};

/* Update with SM6150 data */
+1 −1
Original line number Diff line number Diff line
@@ -1007,7 +1007,7 @@ static int msm_vidc_setup_context_bank(struct msm_vidc_platform_resources *res,
		dev->dma_parms =
			devm_kzalloc(dev, sizeof(*dev->dma_parms), GFP_KERNEL);
	dma_set_max_seg_size(dev, DMA_BIT_MASK(32));
	dma_set_seg_boundary(dev, DMA_BIT_MASK(64));
	dma_set_seg_boundary(dev, (unsigned long)DMA_BIT_MASK(64));

	d_vpr_h("Attached %s and created mapping\n", dev_name(dev));
	d_vpr_h(