Browse Source

wave511: Fix decoder dma buffer unconsistency in samll buffer size

Signed-off-by: Som Qin <som.qin@starfivetech.com>
Som Qin 4 months ago
parent
commit
a3ccb286c4
2 changed files with 8 additions and 0 deletions
  1. 6 0
      wave511/code/vpuapi/vpuapi.c
  2. 2 0
      wave511/code/vpuapi/vpuconfig.h

+ 6 - 0
wave511/code/vpuapi/vpuapi.c

@@ -1698,6 +1698,7 @@ RetCode VPU_DecClrDispFlag(DecHandle handle, int index)
     RetCode     ret         = RETCODE_SUCCESS;
     Int32       endIndex, SvacSvcFlag;
     VpuAttr*    pAttr       = NULL;
+    FrameBuffer* pBuffer    = NULL;
     BOOL        supportCommandQueue;
 
     ret = CheckDecInstanceValidity(handle);
@@ -1716,6 +1717,11 @@ RetCode VPU_DecClrDispFlag(DecHandle handle, int index)
         return RETCODE_INVALID_PARAM;
     }
 
+    pBuffer = &pDecInfo->frameBufPool[pDecInfo->numFbsForDecoding + index];
+    if(pBuffer->size < MAX_CACHE_SIZE) {
+        vdi_flush_ddr(pCodecInst->coreIdx, pBuffer->bufY, pBuffer->size, 1);
+    }
+
     supportCommandQueue = (pAttr->supportCommandQueue == TRUE);
     if (supportCommandQueue == TRUE) {
         EnterLock(pCodecInst->coreIdx);

+ 2 - 0
wave511/code/vpuapi/vpuconfig.h

@@ -62,6 +62,8 @@
 #define MAX_NUM_VPU_CORE                1
 #define MAX_NUM_VCORE                   1
 
+#define MAX_CACHE_SIZE                  0x200000
+
     #define MAX_ENC_AVC_PIC_WIDTH           4096
     #define MAX_ENC_AVC_PIC_HEIGHT          2304
 #define MAX_ENC_PIC_WIDTH               4096