From 8d90904f86fb3b6403284c90079dd0c18bd08f94 Mon Sep 17 00:00:00 2001 From: Prabhanjan Kandula Date: Wed, 25 Jul 2012 11:18:15 +0530 Subject: [PATCH] HDMI: Fallback to MM heap. - IOMMU heap is not available for all targets. we should have a fallback heap always as IOMMU can be disabled. Change-Id: I7e987ac69ba5e5fdd6228b50930e064a4420a472 --- liboverlay/overlayMem.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/liboverlay/overlayMem.h b/liboverlay/overlayMem.h index f8109d1..caf0437 100644 --- a/liboverlay/overlayMem.h +++ b/liboverlay/overlayMem.h @@ -139,11 +139,21 @@ inline bool OvMem::open(uint32_t numbufs, data.uncached = true; err = mAlloc->allocate(data, allocFlags, 0); - if (err != 0) { - ALOGE("OvMem: error allocating memory"); + //see if we can fallback to other heap + //we can try MM_HEAP once if it's not secure playback + if (err != 0 && !isSecure) { + allocFlags |= GRALLOC_USAGE_PRIVATE_MM_HEAP; + err = mAlloc->allocate(data, allocFlags, 0); + if (err != 0) { + ALOGE(" could not allocate from fallback heap"); + return false; + } + } else if (err != 0) { + ALOGE("OvMem: error allocating memory can not fall back"); return false; } + mFd = data.fd; mBaseAddr = data.base; mAllocType = data.allocType;