mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 13:49:24 -04:00
msm: vidc: tune input buffer size based on buffer_size_limit
Codec2 HAL sets V4L2_CID_MPEG_VIDC_VIDEO_BUFFER_SIZE_LIMIT for all session and it is very low value. So decoder input buffer size is always limited by buffer_size_limit. Memory budget estimation is going for toss in msm_comm_check_memory_supported. So video driver started allowing all sessions during concurrency run without any restriction. Added change to use correct buffer size during memory estimation. Change-Id: Ic7c5e51a91615fdba8965b3a359c2d3a37c9a14b Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
This commit is contained in:
parent
671ed1c5f6
commit
2c0ee3a2b6
4 changed files with 21 additions and 11 deletions
|
|
@ -685,7 +685,7 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
|
|||
}
|
||||
|
||||
mplane->plane_fmt[0].sizeimage =
|
||||
msm_vidc_calculate_dec_input_frame_size(inst);
|
||||
msm_vidc_calculate_dec_input_frame_size(inst, inst->buffer_size_limit);
|
||||
|
||||
/* Driver can recalculate buffer count only for
|
||||
* only for bitstream port. Decoder YUV port reconfig
|
||||
|
|
@ -733,7 +733,7 @@ int msm_vdec_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
|
|||
} else if (f->type == INPUT_MPLANE) {
|
||||
fmt = &inst->fmts[INPUT_PORT].v4l2_fmt;
|
||||
fmt->fmt.pix_mp.plane_fmt[0].sizeimage =
|
||||
msm_vidc_calculate_dec_input_frame_size(inst);
|
||||
msm_vidc_calculate_dec_input_frame_size(inst, inst->buffer_size_limit);
|
||||
memcpy(f, fmt, sizeof(struct v4l2_format));
|
||||
} else {
|
||||
s_vpr_e(inst->sid, "%s: Unsupported buf type: %d\n",
|
||||
|
|
@ -817,7 +817,7 @@ int msm_vdec_inst_init(struct msm_vidc_inst *inst)
|
|||
f->fmt.pix_mp.pixelformat = V4L2_PIX_FMT_H264;
|
||||
f->fmt.pix_mp.num_planes = 1;
|
||||
f->fmt.pix_mp.plane_fmt[0].sizeimage =
|
||||
msm_vidc_calculate_dec_input_frame_size(inst);
|
||||
msm_vidc_calculate_dec_input_frame_size(inst, inst->buffer_size_limit);
|
||||
fmt_desc = msm_comm_get_pixel_fmt_fourcc(vdec_input_formats,
|
||||
ARRAY_SIZE(vdec_input_formats), f->fmt.pix_mp.pixelformat,
|
||||
inst->sid);
|
||||
|
|
|
|||
|
|
@ -876,7 +876,7 @@ static int msm_vidc_get_extra_output_buff_count(struct msm_vidc_inst *inst)
|
|||
return extra_output_count;
|
||||
}
|
||||
|
||||
u32 msm_vidc_calculate_dec_input_frame_size(struct msm_vidc_inst *inst)
|
||||
u32 msm_vidc_calculate_dec_input_frame_size(struct msm_vidc_inst *inst, u32 buffer_size_limit)
|
||||
{
|
||||
u32 frame_size, num_mbs;
|
||||
u32 div_factor = 1;
|
||||
|
|
@ -928,9 +928,8 @@ u32 msm_vidc_calculate_dec_input_frame_size(struct msm_vidc_inst *inst)
|
|||
inst->core->platform_data->vpu_ver != VPU_VERSION_AR50_LITE)
|
||||
frame_size = frame_size + (frame_size >> 2);
|
||||
|
||||
if (inst->buffer_size_limit &&
|
||||
(inst->buffer_size_limit < frame_size)) {
|
||||
frame_size = inst->buffer_size_limit;
|
||||
if (buffer_size_limit && (buffer_size_limit < frame_size)) {
|
||||
frame_size = buffer_size_limit;
|
||||
s_vpr_h(inst->sid, "input buffer size limited to %d\n",
|
||||
frame_size);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@ int msm_vidc_calculate_output_buffer_count(struct msm_vidc_inst *inst);
|
|||
int msm_vidc_calculate_buffer_counts(struct msm_vidc_inst *inst);
|
||||
int msm_vidc_get_extra_buff_count(struct msm_vidc_inst *inst,
|
||||
enum hal_buffer buffer_type);
|
||||
u32 msm_vidc_calculate_dec_input_frame_size(struct msm_vidc_inst *inst);
|
||||
u32 msm_vidc_calculate_dec_input_frame_size(struct msm_vidc_inst *inst,
|
||||
u32 buffer_size_limit);
|
||||
u32 msm_vidc_calculate_dec_output_frame_size(struct msm_vidc_inst *inst);
|
||||
u32 msm_vidc_calculate_dec_output_extra_size(struct msm_vidc_inst *inst);
|
||||
u32 msm_vidc_calculate_enc_input_frame_size(struct msm_vidc_inst *inst);
|
||||
|
|
|
|||
|
|
@ -3351,7 +3351,10 @@ static void msm_comm_print_mem_usage(struct msm_vidc_core *core)
|
|||
break;
|
||||
}
|
||||
}
|
||||
sz_i = iplane->plane_fmt[0].sizeimage;
|
||||
if (is_decode_session(inst))
|
||||
sz_i = msm_vidc_calculate_dec_input_frame_size(inst, 0);
|
||||
else
|
||||
sz_i = iplane->plane_fmt[0].sizeimage;
|
||||
sz_i_e = iplane->plane_fmt[1].sizeimage;
|
||||
cnt_i = inp_f->count_min_host;
|
||||
|
||||
|
|
@ -5802,7 +5805,7 @@ int msm_comm_check_memory_supported(struct msm_vidc_inst *vidc_inst)
|
|||
struct v4l2_format *f;
|
||||
struct hal_buffer_requirements *req;
|
||||
struct context_bank_info *cb = NULL;
|
||||
u32 i, dpb_cnt = 0, dpb_size = 0, rc = 0;
|
||||
u32 i, dpb_cnt = 0, dpb_size = 0, input_size = 1, rc = 0;
|
||||
u32 inst_mem_size, non_sec_cb_size = 0;
|
||||
u64 total_mem_size = 0, non_sec_mem_size = 0;
|
||||
u32 memory_limit_mbytes;
|
||||
|
|
@ -5812,10 +5815,17 @@ int msm_comm_check_memory_supported(struct msm_vidc_inst *vidc_inst)
|
|||
mutex_lock(&core->lock);
|
||||
list_for_each_entry(inst, &core->instances, list) {
|
||||
inst_mem_size = 0;
|
||||
input_size = 1;
|
||||
/* input port buffers memory size */
|
||||
fmt = &inst->fmts[INPUT_PORT];
|
||||
f = &fmt->v4l2_fmt;
|
||||
for (i = 0; i < f->fmt.pix_mp.num_planes; i++)
|
||||
if (is_decode_session(inst))
|
||||
input_size = msm_vidc_calculate_dec_input_frame_size(inst, 0);
|
||||
else
|
||||
input_size = f->fmt.pix_mp.plane_fmt[0].sizeimage;
|
||||
inst_mem_size += input_size * fmt->count_min_host;
|
||||
|
||||
for (i = 1; i < f->fmt.pix_mp.num_planes; i++)
|
||||
inst_mem_size += f->fmt.pix_mp.plane_fmt[i].sizeimage *
|
||||
fmt->count_min_host;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue