diff --git a/drivers/media/common/codec_mm/codec_mm.c b/drivers/media/common/codec_mm/codec_mm.c index 6d624d991..efc3d1bab 100644 --- a/drivers/media/common/codec_mm/codec_mm.c +++ b/drivers/media/common/codec_mm/codec_mm.c @@ -4056,6 +4056,20 @@ int __nocfi get_mte_sync_tags_hook_kprobe(void *data) } #endif +bool is_2k_platform(void) +{ + int cpu_type = get_cpu_type(); + int pack_type = get_meson_cpu_version(MESON_CPU_VERSION_LVL_PACK); + + if (cpu_type == MESON_CPU_MAJOR_ID_T5D || + cpu_type == MESON_CPU_MAJOR_ID_TXHD2 || + cpu_type == MESON_CPU_MAJOR_ID_S1A || + (cpu_type == MESON_CPU_MAJOR_ID_S4 && pack_type == 2) || + (cpu_type == MESON_CPU_MAJOR_ID_S7 && pack_type == 3)) + return true; + + return false; +} static int codec_mm_probe(struct platform_device *pdev) { int r; diff --git a/drivers/media/common/codec_mm/codec_mm_priv.h b/drivers/media/common/codec_mm/codec_mm_priv.h index 9b927a48b..95e7c0c74 100644 --- a/drivers/media/common/codec_mm/codec_mm_priv.h +++ b/drivers/media/common/codec_mm/codec_mm_priv.h @@ -46,4 +46,5 @@ void codec_mm_scatter_level_increase(int size); void codec_mm_set_min_linear_size(int min_mem_val); int codec_mm_get_min_linear_size(void); int codec_mm_get_scatter_watermark(void); +bool is_2k_platform(void); #endif /**/ diff --git a/drivers/media/common/codec_mm/codec_mm_scatter.c b/drivers/media/common/codec_mm/codec_mm_scatter.c index fe8d6a07a..7cdd53ec9 100644 --- a/drivers/media/common/codec_mm/codec_mm_scatter.c +++ b/drivers/media/common/codec_mm/codec_mm_scatter.c @@ -3103,7 +3103,8 @@ static int codec_mm_scatter_mgt_alloc_in(struct codec_mm_scatter_mgt **psmgt) 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 = 300; - smgt->keep_size_PAGE = 20 * SZ_1M >> PAGE_SHIFT; + smgt->keep_size_PAGE = is_2k_platform() ? + 4 * SZ_1M >> PAGE_SHIFT : 20 * SZ_1M >> PAGE_SHIFT; smgt->alloc_from_cma_first = 1; smgt->enable_slot_from_sys = 0; smgt->expected_slot_sid[0] = MAX_SID;