mm: do not recache pages at the end of playback
authorrongrong zhou <rongrong.zhou@amlogic.com>
Thu, 18 Oct 2018 03:13:15 +0000 (11:13 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Mon, 22 Oct 2018 06:12:16 +0000 (23:12 -0700)
PD#SWPL-700

Problem:

The reset action will re-allocate the memory before the end of playback.
At this time, the codec_mm_scatter_mgt_delay_free_swith will raise the
cache pages from 20M to force_cache_page_cnt, resulting in redundant
allocation, resulting in memory fragmentation and more time-consuming
in reset action.

Solution:
Modify the judgment cache condition.

Verify:
verified by P212 platform

Change-Id: Ibe8bbbb1281667095d7c05daba48f75a8fae0dac
Signed-off-by: rongrong zhou <rongrong.zhou@amlogic.com>
drivers/amlogic/media/common/codec_mm/codec_mm_scatter.c

index a5f64fc..5cac20b 100644 (file)
@@ -2232,7 +2232,7 @@ int codec_mm_scatter_mgt_delay_free_swith(
                smgt->delay_free_timeout_jiffies64 =
                        get_jiffies_64() + 10000 * HZ/1000;
                codec_mm_schedule_delay_work(smgt, 0, 1);/*start cache*/
-               while (smgt->cached_pages < smgt->force_cache_page_cnt) {
+               while (smgt->total_page_num < smgt->force_cache_page_cnt) {
                        if (smgt->cache_sc &&
                                (smgt->cached_pages >=
                                        smgt->cache_sc->page_max_cnt - 100)) {
@@ -2282,7 +2282,7 @@ static void codec_mm_scatter_cache_manage(
                                complete(&smgt->complete);
                } else if ((smgt->cached_pages < smgt->keep_size_PAGE) ||
                        (smgt->force_cache_on &&/*on star cache*/
-                       (smgt->cached_pages < smgt->force_cache_page_cnt))
+                       (smgt->total_page_num < smgt->force_cache_page_cnt))
                ) {/*first 500ms ,alloc double.*/
                        mms = smgt->cache_sc;
                        if (mms) {
@@ -2566,7 +2566,7 @@ static int codec_mm_scatter_mgt_alloc_in(struct codec_mm_scatter_mgt **psmgt)
        smgt->try_alloc_in_sys_page_cnt_max = MAX_SYS_BLOCK_PAGE;
        smgt->try_alloc_in_sys_page_cnt = MAX_SYS_BLOCK_PAGE;
        smgt->try_alloc_in_sys_page_cnt_min = MIN_SYS_BLOCK_PAGE;
-       smgt->reserved_block_mm_M = 64;
+       smgt->reserved_block_mm_M = 128;
        smgt->keep_size_PAGE = 20 * SZ_1M >> PAGE_SHIFT;
        smgt->alloc_from_cma_first = 1;
        smgt->enable_slot_from_sys = 0;