From: gan.zhang Date: Tue, 10 Aug 2021 13:30:22 +0000 (+0800) Subject: mmpeg4: CB1 mpeg4 crc check fail. [1/2] X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6ab9bc8eb177dbe194679322a20bb69b85b8ba3b;p=GitHub%2FLineageOS%2FG12%2Fandroid_hardware_amlogic_kernel-modules_media.git mmpeg4: CB1 mpeg4 crc check fail. [1/2] PD#SWPL-56277 Problem: The mPEG4 decoder working buffer is not initialized before decoding and it may cause the CRC check to be affected by dirty data. Solution: Clear decoder internal working buffer before decoding. Verify: ADT3 Change-Id: I5ae0f1951705e332263e17720237936d523cab52 Signed-off-by: gan.zhang --- diff --git a/drivers/frame_provider/decoder/mpeg4/vmpeg4_multi.c b/drivers/frame_provider/decoder/mpeg4/vmpeg4_multi.c index 71b07bf..c2ed496 100644 --- a/drivers/frame_provider/decoder/mpeg4/vmpeg4_multi.c +++ b/drivers/frame_provider/decoder/mpeg4/vmpeg4_multi.c @@ -1842,6 +1842,23 @@ static int vmpeg4_canvas_init(struct vdec_mpeg4_hw_s *hw) decbuf_size, i); return ret; } + if (!vdec_secure(vdec)) { + /*init internal buf*/ + char *tmpbuf = (char *)codec_mm_phys_to_virt(decbuf_start); + if (tmpbuf) { + memset(tmpbuf, 0, decbuf_size); + codec_mm_dma_flush(tmpbuf, + decbuf_size, DMA_TO_DEVICE); + } else { + tmpbuf = codec_mm_vmap(decbuf_start, decbuf_size); + if (tmpbuf) { + memset(tmpbuf, 0, decbuf_size); + codec_mm_dma_flush(tmpbuf, + decbuf_size, DMA_TO_DEVICE); + codec_mm_unmap_phyaddr(tmpbuf); + } + } + } } if (i == hw->buf_num) {