From: binqi.zhang Date: Fri, 3 Nov 2017 05:53:14 +0000 (+0800) Subject: gpu: mali will report GL OOM to hwui when alloc_page fail [1/1] X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1848b13f54bddebd646c35307db669cd0052db48;p=GitHub%2FLineageOS%2FG12%2Fandroid_hardware_amlogic_kernel-modules_mali-driver.git gpu: mali will report GL OOM to hwui when alloc_page fail [1/1] PD# 152678 add GFP_KERNEL flag to alloc_page if alloc_page fail and try alloc again Change-Id: I9bc87ed2e00c9525231eb2aaa3b3971cf0ac8ed8 --- diff --git a/utgard/r7p0/linux/mali_memory_os_alloc.c b/utgard/r7p0/linux/mali_memory_os_alloc.c index bcd87ec..e789a03 100644 --- a/utgard/r7p0/linux/mali_memory_os_alloc.c +++ b/utgard/r7p0/linux/mali_memory_os_alloc.c @@ -226,10 +226,15 @@ int mali_mem_os_alloc_pages(mali_mem_os_mem *os_mem, u32 size) new_page = alloc_page(flags); + if (new_page == NULL) { + MALI_PRINT_ERROR(("alloc_page() return NULL! try again!\n")); + new_page = alloc_page(flags | GFP_KERNEL); + } + if (unlikely(new_page == NULL)) { /* Calculate the number of pages actually allocated, and free them. */ + MALI_PRINT_ERROR(("alloc_page() return NULL at last\n")); #ifdef AML_MALI_DEBUG - MALI_PRINT_ERROR(("alloc_page() return NULL\n")); show_mem(SHOW_MEM_FILTER_NODES); #endif os_mem->count = (page_count - remaining) + i; @@ -552,12 +557,12 @@ _mali_osk_errcode_t mali_mem_os_get_table_page(mali_dma_addr *phys, mali_io_addr *phys = (mali_dma_addr)tmp_phys; } } -#ifdef AML_MALI_DEBUG if (ret != _MALI_OSK_ERR_OK) { MALI_PRINT_ERROR(("dma_alloc_attrs() return NULL\n")); +#ifdef AML_MALI_DEBUG show_mem(SHOW_MEM_FILTER_NODES); - } #endif + } return ret; }