From 15e6b2e2058ecc68b66d02a97d666d71b455a061 Mon Sep 17 00:00:00 2001 From: Peng Yixin Date: Thu, 31 Oct 2019 05:47:20 +0000 Subject: media_module: h264 green pixelation is seen during playback [1/1] PD#OTT-6820 Problem: Only when the resolution is switched from a stream with a lot of decoded buffers to another stream that needs a lot of decoded buffers,this problem occur when the canvas id used at the same time has exceeded the maximum value and cannot be allocated. Solution: When switching the resolution, there is no need the canvas id of the previous resolution, so release it, the canvas id will not be insufficient to cause flower screen. Verify: S922X Change-Id: Ie9944f71d1bc85c8c90198573c9b209b74f5f828 Signed-off-by: Peng Yixin --- diff --git a/drivers/frame_provider/decoder/h264_multi/vmh264.c b/drivers/frame_provider/decoder/h264_multi/vmh264.c index 35d67ad..8254fb8 100644 --- a/drivers/frame_provider/decoder/h264_multi/vmh264.c +++ b/drivers/frame_provider/decoder/h264_multi/vmh264.c @@ -4413,8 +4413,9 @@ static int get_max_dec_frame_buf_size(int level_idc, size /= pic_size; size = size + 1; /* need one more buffer */ - if (max_reference_frame_num < size) + if (max_reference_frame_num > size) size = max_reference_frame_num; + size = imin(size, 16); return size; } @@ -8497,6 +8498,7 @@ static void h264_reconfig(struct vdec_h264_hw_s *hw) int i; unsigned long flags; struct h264_dpb_stru *p_H264_Dpb = &hw->dpb; + struct vdec_s *vdec = hw_to_vdec(hw); dpb_print(DECODE_ID(hw), 0, "%s\n", __func__); /* after calling flush_dpb() and bufmgr_h264_remove_unused_frame(), @@ -8520,6 +8522,24 @@ static void h264_reconfig(struct vdec_h264_hw_s *hw) } spin_lock_irqsave(&hw->bufspec_lock, flags); for (i = 0; i < BUFSPEC_POOL_SIZE; i++) { + if (vdec->parallel_dec == 1) { + vdec->free_canvas_ex(hw->buffer_spec[i].y_canvas_index, vdec->id); + vdec->free_canvas_ex(hw->buffer_spec[i].u_canvas_index, vdec->id); + vdec->free_canvas_ex(hw->buffer_spec[i].v_canvas_index, vdec->id); + hw->buffer_spec[i].y_canvas_index = -1; + hw->buffer_spec[i].u_canvas_index = -1; + hw->buffer_spec[i].v_canvas_index = -1; +#ifdef VDEC_DW + if (IS_VDEC_DW(hw)) { + vdec->free_canvas_ex(hw->buffer_spec[i].vdec_dw_y_canvas_index, vdec->id); + vdec->free_canvas_ex(hw->buffer_spec[i].vdec_dw_u_canvas_index, vdec->id); + vdec->free_canvas_ex(hw->buffer_spec[i].vdec_dw_v_canvas_index, vdec->id); + hw->buffer_spec[i].vdec_dw_y_canvas_index = -1; + hw->buffer_spec[i].vdec_dw_u_canvas_index = -1; + hw->buffer_spec[i].vdec_dw_v_canvas_index = -1; +#endif + } + } /*make sure buffers not put back to bufmgr when vf_put is called*/ if (hw->buffer_spec[i].used == 2) -- cgit