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

Commit 12488769 authored by Manikanta Kanamarlapudi's avatar Manikanta Kanamarlapudi Committed by Gerrit - the friendly Code Review server
Browse files

msm:vidc: Modify input buffer size calculation



calculate buffer size as per the max resolution
for the targets that doesn't support 4k and also
ensure the size is equal to YUV size by overriding
the div factor to 1.

Change-Id: Ia63676d30d1ee1e697518780a03a48010380555d
Signed-off-by: default avatarManikanta Kanamarlapudi <kmanikan@codeaurora.org>
parent 951bb6d9
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -922,15 +922,24 @@ u32 msm_vidc_calculate_dec_input_frame_size(struct msm_vidc_inst *inst)
		div_factor = 4;
		base_res_mbs = inst->capability.cap[CAP_MBS_PER_FRAME].max;
	} else {
		base_res_mbs = min_t(unsigned int,
				inst->capability.cap[CAP_MBS_PER_FRAME].max,
				NUM_MBS_4k);
		base_res_mbs = NUM_MBS_4k;
		if (f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_VP9)
			div_factor = 1;
		else
			div_factor = 2;
	}

	if (is_secure_session(inst))
		div_factor = div_factor << 1;

	/* For targets that doesn't support 4k, consider max mb's for that
	 * target and allocate max input buffer size for the same
	 */
	if (base_res_mbs > inst->capability.cap[CAP_MBS_PER_FRAME].max) {
		base_res_mbs = inst->capability.cap[CAP_MBS_PER_FRAME].max;
		div_factor = 1;
	}

	frame_size = base_res_mbs * MB_SIZE_IN_PIXEL * 3 / 2 / div_factor;

	 /* multiply by 10/8 (1.25) to get size for 10 bit case */
@@ -938,9 +947,6 @@ u32 msm_vidc_calculate_dec_input_frame_size(struct msm_vidc_inst *inst)
		(f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_HEVC))
		frame_size = frame_size + (frame_size >> 2);

	if (is_secure_session(inst))
		frame_size /= 2;

	if (inst->buffer_size_limit &&
		(inst->buffer_size_limit < frame_size)) {
		frame_size = inst->buffer_size_limit;