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

Commit ac11cf20 authored by Vikash Garodia's avatar Vikash Garodia
Browse files

msm: vidc: Update bitstream buffer size for secure case



Existing logic to calculate buffer size is based on
the max bitrate supported during a secure session. Even
the peak bitrate calculation is not sufficient to arrive
at the required frame size.
Going back to earlier logic based on macroblocks per frame.

CRs-Fixed: 2467242
Change-Id: I0fe1768036f19ad2f1d08222e3ed239be7a2e27c
Signed-off-by: default avatarVikash Garodia <vgarodia@codeaurora.org>
parent 82b12123
Loading
Loading
Loading
Loading
+3 −11
Original line number Diff line number Diff line
@@ -782,22 +782,14 @@ u32 msm_vidc_calculate_dec_input_frame_size(struct msm_vidc_inst *inst)

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

	if (is_secure_session(inst)) {
		u32 max_bitrate = inst->capability.cap[CAP_SECURE_BITRATE].max;

		/*
		 * for secure, calc frame_size based on max bitrate,
		 * peak bitrate can be 10 times more and
		 * frame rate assumed to be 30 fps at least
		 */
		frame_size = (max_bitrate * 10 / 8) / 30;
	}

	 /* multiply by 10/8 (1.25) to get size for 10 bit case */
	if ((f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_VP9) ||
		(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;