diff --git a/amp/src/libs/shm/src/amp_shm.c b/amp/src/libs/shm/src/amp_shm.c index 8d916ef..bfbdf5f 100755 --- a/amp/src/libs/shm/src/amp_shm.c +++ b/amp/src/libs/shm/src/amp_shm.c @@ -54,6 +54,7 @@ #include #include #include +#include #ifndef BUILDIN_AMP_CORE #include "amp_client.h" @@ -198,18 +199,35 @@ HRESULT AMP_SHM_Allocate_ext(AMP_SHM_TYPE eMemType, UINT32 uiSize, UINT32 uiAlig } AMP_RPC(ret, AMP_LIB_SHM_Allocate, g_shm_ctx.hLib, eMemType, uiSize, uiAlign, phShm); + + if(ret != SUCCESS) { - SHM_ERROR_LOG("Fail to allocate memory errcode(0x%x).\n", HRESULT_VALUE(ret)); - goto error; + SHM_ERROR_LOG("#XYZ#1-Fail to allocate memory errcode(0x%x).\n", HRESULT_VALUE(ret)); + sleep(5); + AMP_RPC(ret, AMP_LIB_SHM_Allocate, g_shm_ctx.hLib, eMemType, uiSize, uiAlign, phShm); + if(ret != SUCCESS) { + SHM_ERROR_LOG("#XYZ#2-Fail to allocate memory errcode(0x%x).\n", HRESULT_VALUE(ret)); + sleep(10); + AMP_RPC(ret, AMP_LIB_SHM_Allocate, g_shm_ctx.hLib, eMemType, uiSize, uiAlign, phShm); + { + SHM_ERROR_LOG("#XYZ#3-Fail to allocate memory errcode(0x%x).\n", HRESULT_VALUE(ret)); + goto error; + } + } } + ret = MV_OSAL_SHM_Ref(*phShm, NULL); } error: #endif + + + if (ret != SUCCESS) { - SHM_ERROR_LOG("Fail to allocate errcode(0x%x).\n", HRESULT_VALUE(ret)); + SHM_ERROR_LOG("#XYZ#Fail to allocate errcode(0x%x).\n", HRESULT_VALUE(ret)); } + SHM_API_EXIT(ret); return ret; diff --git a/osal/ion/ion.c b/osal/ion/ion.c index b87c4ef..a3863a6 100755 --- a/osal/ion/ion.c +++ b/osal/ion/ion.c @@ -166,11 +166,25 @@ int ion_alloc(int fd, size_t len, size_t align, unsigned int heap_mask, } ret = ioctl(fd, ION_IOC_ALLOC, &data); if (ret < 0) { - ion_printf("ion_alloc failed with code %d errno[%d][%s]\n", + + #if 1 //kail test + ion_printf("#XYZ#_1-ion_alloc failed retry after 5sec\n"); + sleep(5); + ret = ioctl(fd, ION_IOC_ALLOC, &data); + if (ret < 0) { + ion_printf("#XYZ#_2-ion_alloc failed retry after 10sec\n"); + sleep(10); + ret = ioctl(fd, ION_IOC_ALLOC, &data); + } + + if (ret < 0){ + #endif + ion_printf("#XYZ#_3 ion_alloc failed with code %d errno[%d][%s]\n", ret, errno, strerror(errno)); - ion_dump_backtrace("ION"); + ion_dump_backtrace("ION"); return ret; } + } *handle = data.handle; return ret; }