msm: vidc: add 32 bit support in video driver

The commit adds the following
1 Keep DMA mask aligned with api definition.
2 Replace the various division operations with 32 bit compatible modules.

Change-Id: I7bc931ffd124ef2b0be8d2bec44fbebf29d4cfb3
Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
Signed-off-by: Mihir Ganu <mganu@codeaurora.org>
This commit is contained in:
Vikash Garodia 2019-10-16 11:38:37 +05:30 committed by Mihir Ganu
parent 237897b02f
commit c7abb94cc3
3 changed files with 18 additions and 18 deletions

View File

@ -583,7 +583,7 @@ static unsigned long msm_vidc_calc_freq_ar50_lt(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__);
@ -651,17 +651,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 */
@ -671,17 +671,17 @@ 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);
base_cycles = inst->clk_data.entry->vsp_cycles;
if (inst->entropy_mode == HFI_H264_ENTROPY_CABAC) {
vsp_cycles = (vsp_cycles * 135) / 100;
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)
@ -697,18 +697,18 @@ 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 */
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;
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)

View File

@ -7187,10 +7187,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;

View File

@ -942,7 +942,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(