diff options
author | Ankit Goyal <layog@google.com> | 2021-08-02 19:14:58 +0800 |
---|---|---|
committer | Ankit Goyal <layog@google.com> | 2021-08-04 22:32:17 +0800 |
commit | 56831666f59b6bf33e1837669b6f752f973d0755 (patch) | |
tree | 2af457e383c1d25ee4281869c28e58e54a06a654 /gralloc4/src/allocator | |
parent | d91ca7bd043f4bae411f298000726176c083d5b3 (diff) | |
download | gchips-56831666f59b6bf33e1837669b6f752f973d0755.tar.gz |
Commit all gralloc logs to warning on high memory allocation
Bug: 192821955
Test: Manually verified
Change-Id: Ib1f3cfdae6bf5280c5ee85fbbfa11f1e2da7cbdc
Diffstat (limited to 'gralloc4/src/allocator')
-rw-r--r-- | gralloc4/src/allocator/mali_gralloc_ion.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gralloc4/src/allocator/mali_gralloc_ion.cpp b/gralloc4/src/allocator/mali_gralloc_ion.cpp index 3123848..dd003c9 100644 --- a/gralloc4/src/allocator/mali_gralloc_ion.cpp +++ b/gralloc4/src/allocator/mali_gralloc_ion.cpp @@ -608,6 +608,12 @@ int mali_gralloc_ion_allocate(const gralloc_buffer_descriptor_t *descriptors, if (ion_fd >= 0 && fidx == 0) { fds[fidx] = ion_fd; } else { + // Warn of high memory allocation on size request greater than 200M + if (bufDescriptor->alloc_sizes[fidx] > static_cast<uint64_t>(200ull << 20)) { + log_info_verbose_as_warning(); + MALI_GRALLOC_LOGW("Huge memory allocation: %" PRIu64, bufDescriptor->alloc_sizes[fidx]); + } + fds[fidx] = dev->alloc_from_ion_heap(usage, bufDescriptor->alloc_sizes[fidx], ion_flags, &min_pgsz); } if (fds[fidx] < 0) |