mmpeg4: CB1 mpeg4 crc check fail. [1/2]
authorgan.zhang <gan.zhang@amlogic.com>
Tue, 10 Aug 2021 13:30:22 +0000 (21:30 +0800)
committerLiang Ji <liang.ji@amlogic.com>
Wed, 18 Aug 2021 05:36:53 +0000 (13:36 +0800)
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 <gan.zhang@amlogic.com>
drivers/frame_provider/decoder/mpeg4/vmpeg4_multi.c

index 71b07bfb11a0e7418551e21cd3449266e63422c7..c2ed4963d2fe3300f9e6175b6a6d628a57810898 100644 (file)
@@ -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) {