From 6cf60a612dce9d4b7a3a860c6b0f150d89da8e1e Mon Sep 17 00:00:00 2001 From: Hui Zhang Date: Sat, 22 Dec 2018 16:55:43 +0800 Subject: [PATCH] codec_mm: not to be blocked to wait scatter cache done [1/2] PD#SWPL-2206 Problem: decoding thread was blocked to wait scatter memory to be cached done. it may take 30+ ms and lead to cts/vts fail Solution: not to wait scatter cached done. it save timing of system Verify: Verified U212 Change-Id: I75fa3e892e0b9b8023c07b62a31ebd43d3c92044 Signed-off-by: Hui Zhang --- .../media/common/codec_mm/codec_mm_scatter.c | 25 ++++++++++++++++------ .../amlogic/media/codec_mm/codec_mm_scatter.h | 1 + 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/amlogic/media/common/codec_mm/codec_mm_scatter.c b/drivers/amlogic/media/common/codec_mm/codec_mm_scatter.c index 7976d83..f36336a 100644 --- a/drivers/amlogic/media/common/codec_mm/codec_mm_scatter.c +++ b/drivers/amlogic/media/common/codec_mm/codec_mm_scatter.c @@ -2205,6 +2205,14 @@ int codec_mm_scatter_update_config(struct codec_mm_scatter_mgt *smgt) smgt->no_alloc_from_sys = g_scatter.no_alloc_from_sys; return 0; } +int codec_mm_scatter_size(int is_tvp) +{ + struct codec_mm_scatter_mgt *smgt; + smgt = codec_mm_get_scatter_mgt(is_tvp ? 1 : 0); + + return smgt->total_page_num; +} +EXPORT_SYMBOL(codec_mm_scatter_size); int codec_mm_scatter_mgt_delay_free_swith( int on, @@ -2213,7 +2221,6 @@ int codec_mm_scatter_mgt_delay_free_swith( int is_tvp) { struct codec_mm_scatter_mgt *smgt; - unsigned long ret = 0; smgt = codec_mm_get_scatter_mgt(is_tvp); codec_mm_list_lock(smgt); @@ -2231,14 +2238,12 @@ int codec_mm_scatter_mgt_delay_free_swith( } codec_mm_list_unlock(smgt); if (on && wait_size_M > 0 && !is_tvp) { - u64 start_time = get_jiffies_64(); - int try_max = 10; - smgt->force_cache_on = 1; smgt->force_cache_page_cnt = wait_size_M >> PAGE_SHIFT; smgt->delay_free_timeout_jiffies64 = get_jiffies_64() + 10000 * HZ/1000; codec_mm_schedule_delay_work(smgt, 0, 1);/*start cache*/ +#if 0 while (smgt->total_page_num < smgt->force_cache_page_cnt) { if (smgt->cache_sc && (smgt->cached_pages >= @@ -2263,6 +2268,7 @@ int codec_mm_scatter_mgt_delay_free_swith( smgt->force_cache_on = 0; smgt->delay_free_timeout_jiffies64 = get_jiffies_64() + delay_ms * HZ/1000; +#endif } else if (on) { codec_mm_schedule_delay_work(smgt, 0, 1); } else { @@ -2288,8 +2294,11 @@ static void codec_mm_scatter_cache_manage( (smgt->no_cache_size_M * (SZ_1M >> PAGE_SHIFT)))) { /*have enough pages for most movies.*/ /*don't cache more.*/ - if (smgt->force_cache_on) - complete(&smgt->complete); + if (smgt->force_cache_on) { + smgt->force_cache_on = 0; + smgt->delay_free_timeout_jiffies64 = + get_jiffies_64() + 2000 * HZ/1000; + } } else if ((smgt->cached_pages < smgt->keep_size_PAGE) || (smgt->force_cache_on &&/*on star cache*/ (smgt->total_page_num < smgt->force_cache_page_cnt)) @@ -2333,7 +2342,9 @@ static void codec_mm_scatter_cache_manage( smgt->force_cache_on && (smgt->cached_pages >= smgt->force_cache_page_cnt)) { - complete(&smgt->complete); + smgt->force_cache_on = 0; + smgt->delay_free_timeout_jiffies64 = + get_jiffies_64() + 2000 * HZ/1000; } } else if ((smgt->cached_pages > (smgt->keep_size_PAGE + 1000)) && diff --git a/include/linux/amlogic/media/codec_mm/codec_mm_scatter.h b/include/linux/amlogic/media/codec_mm/codec_mm_scatter.h index 5e02182..5a84e3c 100644 --- a/include/linux/amlogic/media/codec_mm/codec_mm_scatter.h +++ b/include/linux/amlogic/media/codec_mm/codec_mm_scatter.h @@ -60,6 +60,7 @@ struct codec_mm_scatter *codec_mm_scatter_alloc(int max_page, int page_num, int istvp); int codec_mm_scatter_alloc_want_pages(struct codec_mm_scatter *mms, int want_pages); +int codec_mm_scatter_size(int is_tvp); int codec_mm_scatter_mgt_delay_free_swith(int on, int delay_ms, int wait_size_M, int istvp); int codec_mm_dump_scatter(struct codec_mm_scatter *mms, void *buf, int size); -- 2.7.4