vav1: remove header bufsize in ucode work buffer. [1/1]
authorshihong.zheng <shihong.zheng@amlogic.com>
Tue, 22 Dec 2020 07:07:35 +0000 (15:07 +0800)
committerHui Zhang <hui.zhang@amlogic.com>
Thu, 24 Dec 2020 03:08:05 +0000 (19:08 -0800)
PD#SWPL-39162

Problem:
fix av1 alloc ucode work buffer failed when create
many instances.

Solution:
reduce used bufsize in workspace. the header
buf is alloc dynamic, so do not need add size
here.

Verify:
ah212

Change-Id: I5b35fcc8a06aaea96a066d610d3991f32cdb3a83
Signed-off-by: shihong.zheng <shihong.zheng@amlogic.com>
drivers/frame_provider/decoder/vav1/vav1.c

index c006e094336860ca1bd86d8ea7c53f95953c47f4..3e5101935bb2801d690b5ef968dc15e7c1089b1e 100644 (file)
@@ -1775,8 +1775,12 @@ static u32 seg_map_size = 0xd8000;
 static u32 seg_map_size = 0x36000;
 #endif
 
+#define VBH_BUF_SIZE (((2 * 16 * 2304) + 0xffff) & (~0xffff))
+#define VBH_BUF_COUNT 4
+
 #define WORK_BUF_SPEC_NUM 2
-static struct BuffInfo_s  aom_workbuff_spec[WORK_BUF_SPEC_NUM]={
+
+static struct BuffInfo_s  aom_workbuff_spec[WORK_BUF_SPEC_NUM] = {
        { //8M bytes
                .max_width = 1920,
                .max_height = 1088,
@@ -1815,11 +1819,11 @@ static struct BuffInfo_s  aom_workbuff_spec[WORK_BUF_SPEC_NUM]={
                        .buf_size = 0x800,
                },
                .cdf_buf = {
-               // for context store/load 1024x256 x16 = 512K bytes 16*0x8000
+                       // for context store/load 1024x256 x16 = 512K bytes 16*0x8000
                        .buf_size = 0x80000,
                },
                .gmc_buf = {
-               // for gmc_parameter store/load 128 x 16 = 2K bytes 0x800
+                       // for gmc_parameter store/load 128 x 16 = 2K bytes 0x800
                        .buf_size = 0x800,
                },
                .scalelut = {
@@ -1840,28 +1844,30 @@ static struct BuffInfo_s  aom_workbuff_spec[WORK_BUF_SPEC_NUM]={
                        .buf_size = 0x60000,
                },
                .fgs_table = {
-                 .buf_size = FGS_TABLE_SIZE * FRAME_BUFFERS, // 512x128bits
+                       .buf_size = FGS_TABLE_SIZE * FRAME_BUFFERS, // 512x128bits
                },
 #ifdef AOM_AV1_MMU
-#define VBH_BUF_SIZE (2 * 16 * 2304)
-#define VBH_BUF_COUNT 4
                .mmu_vbh = {
-                 .buf_size = VBH_BUF_SIZE * VBH_BUF_COUNT,
-                 //.buf_size = 0x5000, //2*16*(more than 2304)/4, 4K
+                       .buf_size = VBH_BUF_SIZE * VBH_BUF_COUNT, //2*16*(more than 2304)/4, 4K
                },
                .cm_header = {
-                 //.buf_size = MMU_COMPRESS_HEADER_SIZE*8, // 0x44000 = ((1088*2*1024*4)/32/4)*(32/8)
-                 .buf_size = MMU_COMPRESS_HEADER_SIZE*FRAME_BUFFERS, // 0x44000 = ((1088*2*1024*4)/32/4)*(32/8)
+       #ifdef USE_SPEC_BUF_FOR_MMU_HEAD
+                       .buf_size = MMU_COMPRESS_HEADER_SIZE * FRAME_BUFFERS, // 0x44000 = ((1088*2*1024*4)/32/4)*(32/8)
+       #else
+                       .buf_size = 0,
+       #endif
                },
 #endif
 #ifdef AOM_AV1_MMU_DW
                .mmu_vbh_dw = {
-                 .buf_size = VBH_BUF_SIZE * VBH_BUF_COUNT,
-                 //.buf_size = 0x5000, //2*16*(more than 2304)/4, 4K
+                       .buf_size = VBH_BUF_SIZE * VBH_BUF_COUNT, //2*16*(more than 2304)/4, 4K
                },
                .cm_header_dw = {
-                 //.buf_size = MMU_COMPRESS_HEADER_SIZE*8, // 0x44000 = ((1088*2*1024*4)/32/4)*(32/8)
-                 .buf_size = MMU_COMPRESS_HEADER_SIZE_DW*FRAME_BUFFERS, // 0x44000 = ((1088*2*1024*4)/32/4)*(32/8)
+       #ifdef USE_SPEC_BUF_FOR_MMU_HEAD
+                       .buf_size = MMU_COMPRESS_HEADER_SIZE_DW*FRAME_BUFFERS, // 0x44000 = ((1088*2*1024*4)/32/4)*(32/8)
+       #else
+                       .buf_size = 0,
+       #endif
                },
 #endif
                .mpred_above = {
@@ -1947,26 +1953,30 @@ static struct BuffInfo_s  aom_workbuff_spec[WORK_BUF_SPEC_NUM]={
                        .buf_size = 0x60000,
                },
                .fgs_table = {
-                 .buf_size = FGS_TABLE_SIZE * FRAME_BUFFERS, // 512x128bits
+                       .buf_size = FGS_TABLE_SIZE * FRAME_BUFFERS, // 512x128bits
                },
 #ifdef AOM_AV1_MMU
                .mmu_vbh = {
-                 .buf_size = VBH_BUF_SIZE * VBH_BUF_COUNT,
-                 //.buf_size = 0x5000, //2*16*(more than 2304)/4, 4K
+                       .buf_size = VBH_BUF_SIZE * VBH_BUF_COUNT, //2*16*(more than 2304)/4, 4K
                },
                .cm_header = {
-                 //.buf_size = MMU_COMPRESS_HEADER_SIZE*8, // 0x44000 = ((1088*2*1024*4)/32/4)*(32/8)
-                 .buf_size = MMU_COMPRESS_HEADER_SIZE*FRAME_BUFFERS, // 0x44000 = ((1088*2*1024*4)/32/4)*(32/8)
+       #ifdef USE_SPEC_BUF_FOR_MMU_HEAD
+                       .buf_size = MMU_COMPRESS_HEADER_SIZE*FRAME_BUFFERS, // 0x44000 = ((1088*2*1024*4)/32/4)*(32/8)
+       #else
+                       .buf_size = 0,
+       #endif
                },
 #endif
 #ifdef AOM_AV1_MMU_DW
                .mmu_vbh_dw = {
-                 .buf_size = VBH_BUF_SIZE * VBH_BUF_COUNT,
-                 //.buf_size = 0x5000, //2*16*(more than 2304)/4, 4K
+                       .buf_size = VBH_BUF_SIZE * VBH_BUF_COUNT, //2*16*(more than 2304)/4, 4K
                },
                .cm_header_dw = {
-                 //.buf_size = MMU_COMPRESS_HEADER_SIZE*8, // 0x44000 = ((1088*2*1024*4)/32/4)*(32/8)
-                 .buf_size = MMU_COMPRESS_HEADER_SIZE_DW*FRAME_BUFFERS, // 0x44000 = ((1088*2*1024*4)/32/4)*(32/8)
+       #ifdef USE_SPEC_BUF_FOR_MMU_HEAD
+                       .buf_size = MMU_COMPRESS_HEADER_SIZE_DW*FRAME_BUFFERS, // 0x44000 = ((1088*2*1024*4)/32/4)*(32/8)
+       #else
+                       .buf_size = 0,
+       #endif
                },
 #endif
                .mpred_above = {
@@ -4901,9 +4911,10 @@ static void aom_config_work_space_hw(struct AV1HW_s *hw, u32 mask)
 #ifdef AOM_AV1_MMU_DW
     data32 = READ_VREG(HEVC_SAO_CTRL5);
        if (hw->dw_mmu_enable) {
-               data32 = READ_VREG(HEVC_SAO_CTRL9);
-               data32 |= (1<<10);
-               WRITE_VREG(HEVC_SAO_CTRL9, data32);
+               u32 data_tmp;
+               data_tmp = READ_VREG(HEVC_SAO_CTRL9);
+               data_tmp |= (1<<10);
+               WRITE_VREG(HEVC_SAO_CTRL9, data_tmp);
 
            WRITE_VREG(HEVC_CM_BODY_LENGTH2,losless_comp_body_size_dw);
            WRITE_VREG(HEVC_CM_HEADER_OFFSET2,losless_comp_body_size_dw);