libgralloc: bring back pmem support

pmem is now legacy. ion is default, override with TARGET_USES_PMEM:=true

Change-Id: I05c95647838eb1613ddf80a9f672c2b93dc035f8
This commit is contained in:
Andrew Sutherland 2012-07-13 00:38:41 -05:00
parent 0e7581a767
commit bcc7c1c42f
3 changed files with 17 additions and 6 deletions

View File

@ -50,9 +50,16 @@ LOCAL_PRELINK_MODULE := false
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)
LOCAL_C_INCLUDES := hardware/qcom/display/libqdutils
LOCAL_SHARED_LIBRARIES := liblog libcutils libutils
LOCAL_SRC_FILES := ionalloc.cpp alloc_controller.cpp
LOCAL_SRC_FILES := alloc_controller.cpp
LOCAL_CFLAGS:= -DLOG_TAG=\"memalloc\"
LOCAL_CFLAGS += -DUSE_ION
LOCAL_MODULE := libmemalloc
LOCAL_MODULE_TAGS := optional
ifeq ($(TARGET_USES_PMEM),true)
LOCAL_SRC_FILES += pmemalloc.cpp \
ashmemalloc.cpp \
pmem_bestfit_alloc.cpp
else
LOCAL_CFLAGS += -DUSE_ION
LOCAL_SRC_FILES += ionalloc.cpp
endif
include $(BUILD_SHARED_LIBRARY)

View File

@ -33,9 +33,12 @@
#include "gralloc_priv.h"
#include "alloc_controller.h"
#include "memalloc.h"
#ifdef USE_ION
#include "ionalloc.h"
#else
#include "pmemalloc.h"
#include "ashmemalloc.h"
#endif
#include "gr.h"
#include "comptype.h"
@ -105,6 +108,7 @@ sp<IAllocController> IAllocController::getInstance(bool useMasterHeap)
}
#ifdef USE_ION
//-------------- IonController-----------------------//
IonController::IonController()
{
@ -191,10 +195,10 @@ sp<IMemAlloc> IonController::getAllocator(int flags)
return memalloc;
}
#endif
//-------------- PmemKernelController-----------------------//
//XXX: Remove - we're not using pmem anymore
#if 0
#ifndef USE_ION
PmemKernelController::PmemKernelController()
{
mPmemAdspAlloc = new PmemKernelAlloc(DEVICE_PMEM_ADSP);

View File

@ -164,7 +164,7 @@ SimpleBestFitAllocator::chunk_t* SimpleBestFitAllocator::dealloc(size_t start)
chunk_t* cur = mList.head();
while (cur) {
if (cur->start == start) {
ALOG_FATAL_IF(cur->free,
LOG_FATAL_IF(cur->free,
"block at offset 0x%08lX of size 0x%08lX already freed",
cur->start*kMemoryAlign, cur->size*kMemoryAlign);
@ -183,7 +183,7 @@ SimpleBestFitAllocator::chunk_t* SimpleBestFitAllocator::dealloc(size_t start)
cur = n;
} while (cur && cur->free);
ALOG_FATAL_IF(!freed->free,
LOG_FATAL_IF(!freed->free,
"freed block at offset 0x%08lX of size 0x%08lX is not free!",
freed->start * kMemoryAlign, freed->size * kMemoryAlign);