Created
October 6, 2012 05:54
-
-
Save drewis/3844148 to your computer and use it in GitHub Desktop.
qcom-display diff ev..cm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Android.mk b/Android.mk | |
index 0b5f9ee..0b50b34 100644 | |
--- a/Android.mk | |
+++ b/Android.mk | |
@@ -2,8 +2,13 @@ | |
#libs to be built for QCOM targets only | |
ifeq ($(BOARD_USES_QCOM_HARDWARE),true) | |
-display-hals := libgralloc libgenlock libcopybit liblight | |
+display-hals := libgralloc libgenlock libcopybit | |
display-hals += libhwcomposer liboverlay libqdutils | |
+ | |
+ifneq ($(TARGET_PROVIDES_LIBLIGHTS),true) | |
+display-hals += liblight | |
+endif | |
+ | |
endif | |
display-hals += libtilerenderer | |
diff --git a/common.mk b/common.mk | |
index 07afeb3..b27a104 100644 | |
--- a/common.mk | |
+++ b/common.mk | |
@@ -16,10 +16,9 @@ common_libs := liblog libutils libcutils libhardware | |
#Common C flags | |
common_flags := -DDEBUG_CALC_FPS -Wno-missing-field-initializers | |
-#common_flags += -Werror | |
ifeq ($(TARGET_USES_ION),true) | |
-common_flags += -DUSE_ION | |
+ common_flags += -DUSE_ION | |
endif | |
ifeq ($(ARCH_ARM_HAVE_NEON),true) | |
diff --git a/libcopybit/Android.mk b/libcopybit/Android.mk | |
index 1d2c22a..d3243c4 100644 | |
--- a/libcopybit/Android.mk | |
+++ b/libcopybit/Android.mk | |
@@ -30,12 +30,8 @@ ifeq ($(TARGET_USES_C2D_COMPOSITION),true) | |
include $(BUILD_SHARED_LIBRARY) | |
else | |
ifneq ($(TARGET_BOARD_PLATFORM),msm7x30) | |
- ifeq ($(TARGET_BOARD_PLATFORM),qsd8k) | |
- LOCAL_CFLAGS += -DCOPYBIT_QSD8K=1 | |
- else | |
- LOCAL_CFLAGS += -DCOPYBIT_MSM7K=1 | |
- endif | |
- LOCAL_SRC_FILES := software_converter.cpp copybit.cpp | |
- include $(BUILD_SHARED_LIBRARY) | |
+ LOCAL_CFLAGS += -DCOPYBIT_MSM7K=1 | |
+ LOCAL_SRC_FILES := software_converter.cpp copybit.cpp | |
+ include $(BUILD_SHARED_LIBRARY) | |
endif | |
endif | |
diff --git a/libcopybit/copybit_c2d.cpp b/libcopybit/copybit_c2d.cpp | |
index a1fe040..aa21e95 100644 | |
--- a/libcopybit/copybit_c2d.cpp | |
+++ b/libcopybit/copybit_c2d.cpp | |
@@ -47,10 +47,9 @@ | |
#include <dlfcn.h> | |
using gralloc::IMemAlloc; | |
-#ifdef USE_ION | |
using gralloc::IonController; | |
-#endif | |
using gralloc::alloc_data; | |
+using android::sp; | |
C2D_STATUS (*LINK_c2dCreateSurface)( uint32 *surface_id, | |
uint32 surface_bits, | |
@@ -111,7 +110,7 @@ enum eC2DFlags { | |
FLAGS_YUV_DESTINATION = 1<<1 | |
}; | |
-static gralloc::IAllocController* sAlloc = 0; | |
+static android::sp<gralloc::IAllocController> sAlloc = 0; | |
/******************************************************************************/ | |
/** State information for each device instance */ | |
@@ -268,10 +267,8 @@ static uint32 c2d_get_gpuaddr( struct private_handle_t *handle) | |
memtype = KGSL_USER_MEM_TYPE_PMEM; | |
else if (handle->flags & private_handle_t::PRIV_FLAGS_USES_ASHMEM) | |
memtype = KGSL_USER_MEM_TYPE_ASHMEM; | |
-#ifdef USE_ION | |
else if (handle->flags & private_handle_t::PRIV_FLAGS_USES_ION) | |
memtype = KGSL_USER_MEM_TYPE_ION; | |
-#endif | |
else { | |
ALOGE("Invalid handle flags: 0x%x", handle->flags); | |
return 0; | |
@@ -944,7 +941,7 @@ static int get_temp_buffer(const bufferInfo& info, alloc_data& data) | |
return COPYBIT_FAILURE; | |
} | |
- int err = sAlloc->allocate(data, allocFlags); | |
+ int err = sAlloc->allocate(data, allocFlags, 0); | |
if (0 != err) { | |
ALOGE("%s: allocate failed", __FUNCTION__); | |
return COPYBIT_FAILURE; | |
@@ -958,7 +955,7 @@ static int get_temp_buffer(const bufferInfo& info, alloc_data& data) | |
static void free_temp_buffer(alloc_data &data) | |
{ | |
if (-1 != data.fd) { | |
- IMemAlloc* memalloc = sAlloc->getAllocator(data.allocType); | |
+ sp<IMemAlloc> memalloc = sAlloc->getAllocator(data.allocType); | |
memalloc->free_buffer(data.base, data.size, 0, data.fd); | |
} | |
} | |
@@ -1184,7 +1181,7 @@ static int stretch_copybit_internal( | |
} | |
// Flush the cache | |
- IMemAlloc* memalloc = sAlloc->getAllocator(src_hnd->flags); | |
+ sp<IMemAlloc> memalloc = sAlloc->getAllocator(src_hnd->flags); | |
if (memalloc->clean_buffer((void *)(src_hnd->base), src_hnd->size, | |
src_hnd->offset, src_hnd->fd)) { | |
ALOGE("%s: clean_buffer failed", __FUNCTION__); | |
@@ -1261,7 +1258,7 @@ static int stretch_copybit_internal( | |
return status; | |
} | |
// Invalidate the cache. | |
- IMemAlloc* memalloc = sAlloc->getAllocator(dst_hnd->flags); | |
+ sp<IMemAlloc> memalloc = sAlloc->getAllocator(dst_hnd->flags); | |
memalloc->clean_buffer((void *)(dst_hnd->base), dst_hnd->size, | |
dst_hnd->offset, dst_hnd->fd); | |
} | |
diff --git a/libgenlock/Android.mk b/libgenlock/Android.mk | |
index 92ac227..9797000 100644 | |
--- a/libgenlock/Android.mk | |
+++ b/libgenlock/Android.mk | |
@@ -7,7 +7,6 @@ LOCAL_MODULE_TAGS := optional | |
LOCAL_C_INCLUDES := $(common_includes) | |
LOCAL_SHARED_LIBRARIES := liblog libcutils | |
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"libgenlock\" | |
-LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps) | |
LOCAL_SRC_FILES := genlock.cpp | |
include $(BUILD_SHARED_LIBRARY) | |
diff --git a/libgralloc/Android.mk b/libgralloc/Android.mk | |
index 40cb407..2b8f634 100644 | |
--- a/libgralloc/Android.mk | |
+++ b/libgralloc/Android.mk | |
@@ -20,11 +20,10 @@ include $(CLEAR_VARS) | |
LOCAL_MODULE := gralloc.$(TARGET_BOARD_PLATFORM) | |
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw | |
LOCAL_MODULE_TAGS := optional | |
-LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes) | |
+LOCAL_C_INCLUDES := $(common_includes) | |
LOCAL_SHARED_LIBRARIES := $(common_libs) libmemalloc libgenlock | |
LOCAL_SHARED_LIBRARIES += libqdutils libGLESv1_CM | |
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"gralloc\" | |
-LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps) | |
LOCAL_SRC_FILES := gpu.cpp gralloc.cpp framebuffer.cpp mapper.cpp | |
include $(BUILD_SHARED_LIBRARY) | |
@@ -37,10 +36,10 @@ LOCAL_SHARED_LIBRARIES := $(common_libs) libgenlock libqdutils | |
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"memalloc\" | |
LOCAL_SRC_FILES := alloc_controller.cpp | |
ifeq ($(TARGET_USES_ION),true) | |
- LOCAL_SRC_FILES += ionalloc.cpp | |
+ LOCAL_SRC_FILES += ionalloc.cpp | |
else | |
- LOCAL_SRC_FILES += pmemalloc.cpp \ | |
- ashmemalloc.cpp \ | |
- pmem_bestfit_alloc.cpp | |
+ LOCAL_SRC_FILES += ashmemalloc.cpp \ | |
+ pmemalloc.cpp \ | |
+ pmem_bestfit_alloc.cpp | |
endif | |
include $(BUILD_SHARED_LIBRARY) | |
diff --git a/libgralloc/alloc_controller.cpp b/libgralloc/alloc_controller.cpp | |
index a807420..d721d24 100644 | |
--- a/libgralloc/alloc_controller.cpp | |
+++ b/libgralloc/alloc_controller.cpp | |
@@ -28,21 +28,30 @@ | |
*/ | |
#include <cutils/log.h> | |
+#include <utils/RefBase.h> | |
#include <fcntl.h> | |
#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" | |
using namespace gralloc; | |
using namespace qdutils; | |
+using android::sp; | |
+ | |
+const int GRALLOC_HEAP_MASK = GRALLOC_USAGE_PRIVATE_ADSP_HEAP | | |
+ GRALLOC_USAGE_PRIVATE_UI_CONTIG_HEAP | | |
+ GRALLOC_USAGE_PRIVATE_SMI_HEAP | | |
+ GRALLOC_USAGE_PRIVATE_SYSTEM_HEAP | | |
+ GRALLOC_USAGE_PRIVATE_IOMMU_HEAP | | |
+ GRALLOC_USAGE_PRIVATE_MM_HEAP | | |
+ GRALLOC_USAGE_PRIVATE_WRITEBACK_HEAP | | |
+ GRALLOC_USAGE_PRIVATE_CAMERA_HEAP; | |
+ | |
//Common functions | |
static bool canFallback(int usage, bool triedSystem) | |
@@ -79,8 +88,8 @@ static bool useUncached(int usage) | |
return false; | |
} | |
-IAllocController* IAllocController::sController = NULL; | |
-IAllocController* IAllocController::getInstance(bool useMasterHeap) | |
+sp<IAllocController> IAllocController::sController = NULL; | |
+sp<IAllocController> IAllocController::getInstance(bool useMasterHeap) | |
{ | |
if(sController == NULL) { | |
#ifdef USE_ION | |
@@ -103,7 +112,8 @@ IonController::IonController() | |
mIonAlloc = new IonAlloc(); | |
} | |
-int IonController::allocate(alloc_data& data, int usage) | |
+int IonController::allocate(alloc_data& data, int usage, | |
+ int compositionType) | |
{ | |
int ionFlags = 0; | |
int ret; | |
@@ -126,12 +136,20 @@ int IonController::allocate(alloc_data& data, int usage) | |
if(usage & GRALLOC_USAGE_PRIVATE_MM_HEAP) | |
ionFlags |= ION_HEAP(ION_CP_MM_HEAP_ID); | |
+ if(usage & GRALLOC_USAGE_PRIVATE_WRITEBACK_HEAP) | |
+ ionFlags |= ION_HEAP(ION_CP_WB_HEAP_ID); | |
+ | |
if(usage & GRALLOC_USAGE_PRIVATE_CAMERA_HEAP) | |
ionFlags |= ION_HEAP(ION_CAMERA_HEAP_ID); | |
if(usage & GRALLOC_USAGE_PRIVATE_CP_BUFFER) | |
ionFlags |= ION_SECURE; | |
+ if(usage & GRALLOC_USAGE_PRIVATE_DO_NOT_MAP) | |
+ data.allocType |= private_handle_t::PRIV_FLAGS_NOT_MAPPED; | |
+ else | |
+ data.allocType &= ~(private_handle_t::PRIV_FLAGS_NOT_MAPPED); | |
+ | |
// if no flags are set, default to | |
// SF + IOMMU heaps, so that bypass can work | |
// we can fall back to system heap if | |
@@ -163,9 +181,9 @@ int IonController::allocate(alloc_data& data, int usage) | |
return ret; | |
} | |
-IMemAlloc* IonController::getAllocator(int flags) | |
+sp<IMemAlloc> IonController::getAllocator(int flags) | |
{ | |
- IMemAlloc* memalloc = NULL; | |
+ sp<IMemAlloc> memalloc; | |
if (flags & private_handle_t::PRIV_FLAGS_USES_ION) { | |
memalloc = mIonAlloc; | |
} else { | |
@@ -174,8 +192,11 @@ IMemAlloc* IonController::getAllocator(int flags) | |
return memalloc; | |
} | |
-#else | |
+#endif | |
+ | |
//-------------- PmemKernelController-----------------------// | |
+//XXX: Remove - we're not using pmem anymore | |
+#ifndef USE_ION | |
PmemKernelController::PmemKernelController() | |
{ | |
mPmemAdspAlloc = new PmemKernelAlloc(DEVICE_PMEM_ADSP); | |
@@ -187,7 +208,8 @@ PmemKernelController::~PmemKernelController() | |
{ | |
} | |
-int PmemKernelController::allocate(alloc_data& data, int usage) | |
+int PmemKernelController::allocate(alloc_data& data, int usage, | |
+ int compositionType) | |
{ | |
int ret = 0; | |
bool adspFallback = false; | |
@@ -202,7 +224,7 @@ int PmemKernelController::allocate(alloc_data& data, int usage) | |
int tempFd = open(DEVICE_PMEM_SMIPOOL, O_RDWR, 0); | |
if(tempFd > 0) { | |
close(tempFd); | |
- IMemAlloc* memalloc; | |
+ sp<IMemAlloc> memalloc; | |
memalloc = new PmemKernelAlloc(DEVICE_PMEM_SMIPOOL); | |
ret = memalloc->alloc_buffer(data); | |
if(ret >= 0) | |
@@ -220,9 +242,9 @@ int PmemKernelController::allocate(alloc_data& data, int usage) | |
return ret; | |
} | |
-IMemAlloc* PmemKernelController::getAllocator(int flags) | |
+sp<IMemAlloc> PmemKernelController::getAllocator(int flags) | |
{ | |
- IMemAlloc* memalloc; | |
+ sp<IMemAlloc> memalloc; | |
if (flags & private_handle_t::PRIV_FLAGS_USES_PMEM_ADSP) | |
memalloc = mPmemAdspAlloc; | |
else { | |
@@ -246,7 +268,8 @@ PmemAshmemController::~PmemAshmemController() | |
{ | |
} | |
-int PmemAshmemController::allocate(alloc_data& data, int usage) | |
+int PmemAshmemController::allocate(alloc_data& data, int usage, | |
+ int compositionType) | |
{ | |
int ret = 0; | |
data.allocType = 0; | |
@@ -261,7 +284,7 @@ int PmemAshmemController::allocate(alloc_data& data, int usage) | |
// If ADSP or SMI is requested use the kernel controller | |
if(usage & (GRALLOC_USAGE_PRIVATE_ADSP_HEAP| | |
GRALLOC_USAGE_PRIVATE_SMI_HEAP)) { | |
- ret = mPmemKernelCtrl->allocate(data, usage); | |
+ ret = mPmemKernelCtrl->allocate(data, usage, compositionType); | |
if(ret < 0) | |
ALOGE("%s: Failed to allocate ADSP/SMI memory", __func__); | |
else | |
@@ -299,9 +322,9 @@ int PmemAshmemController::allocate(alloc_data& data, int usage) | |
return ret; | |
} | |
-IMemAlloc* PmemAshmemController::getAllocator(int flags) | |
+sp<IMemAlloc> PmemAshmemController::getAllocator(int flags) | |
{ | |
- IMemAlloc* memalloc; | |
+ sp<IMemAlloc> memalloc; | |
if (flags & private_handle_t::PRIV_FLAGS_USES_PMEM) | |
memalloc = mPmemUserspaceAlloc; | |
else if (flags & private_handle_t::PRIV_FLAGS_USES_PMEM_ADSP) | |
@@ -316,7 +339,6 @@ IMemAlloc* PmemAshmemController::getAllocator(int flags) | |
return memalloc; | |
} | |
#endif | |
- | |
size_t getBufferSizeAndDimensions(int width, int height, int format, | |
int& alignedw, int &alignedh) | |
{ | |
@@ -397,7 +419,7 @@ int alloc_buffer(private_handle_t **pHnd, int w, int h, int format, int usage) | |
{ | |
alloc_data data; | |
int alignedw, alignedh; | |
- gralloc::IAllocController* sAlloc = | |
+ android::sp<gralloc::IAllocController> sAlloc = | |
gralloc::IAllocController::getInstance(false); | |
data.base = 0; | |
data.fd = -1; | |
@@ -407,15 +429,14 @@ int alloc_buffer(private_handle_t **pHnd, int w, int h, int format, int usage) | |
data.uncached = useUncached(usage); | |
int allocFlags = usage; | |
- int err = sAlloc->allocate(data, allocFlags); | |
+ int err = sAlloc->allocate(data, allocFlags, 0); | |
if (0 != err) { | |
ALOGE("%s: allocate failed", __FUNCTION__); | |
return -ENOMEM; | |
} | |
private_handle_t* hnd = new private_handle_t(data.fd, data.size, | |
- data.allocType, 0, format, | |
- alignedw, alignedh); | |
+ data.allocType, 0, format, alignedw, alignedh); | |
hnd->base = (int) data.base; | |
hnd->offset = data.offset; | |
hnd->gpuaddr = 0; | |
@@ -425,10 +446,10 @@ int alloc_buffer(private_handle_t **pHnd, int w, int h, int format, int usage) | |
void free_buffer(private_handle_t *hnd) | |
{ | |
- gralloc::IAllocController* sAlloc = | |
+ android::sp<gralloc::IAllocController> sAlloc = | |
gralloc::IAllocController::getInstance(false); | |
if (hnd && hnd->fd > 0) { | |
- IMemAlloc* memalloc = sAlloc->getAllocator(hnd->flags); | |
+ sp<IMemAlloc> memalloc = sAlloc->getAllocator(hnd->flags); | |
memalloc->free_buffer((void*)hnd->base, hnd->size, hnd->offset, hnd->fd); | |
} | |
if(hnd) | |
diff --git a/libgralloc/alloc_controller.h b/libgralloc/alloc_controller.h | |
index b3b1523..134ad40 100644 | |
--- a/libgralloc/alloc_controller.h | |
+++ b/libgralloc/alloc_controller.h | |
@@ -29,59 +29,63 @@ | |
#ifndef GRALLOC_ALLOCCONTROLLER_H | |
#define GRALLOC_ALLOCCONTROLLER_H | |
+#include <utils/RefBase.h> | |
+ | |
namespace gralloc { | |
struct alloc_data; | |
class IMemAlloc; | |
class IonAlloc; | |
-class IAllocController { | |
+class IAllocController : public android::RefBase { | |
public: | |
/* Allocate using a suitable method | |
* Returns the type of buffer allocated | |
*/ | |
- virtual int allocate(alloc_data& data, int usage) = 0; | |
+ virtual int allocate(alloc_data& data, int usage, | |
+ int compositionType) = 0; | |
- virtual IMemAlloc* getAllocator(int flags) = 0; | |
+ virtual android::sp<IMemAlloc> getAllocator(int flags) = 0; | |
virtual ~IAllocController() {}; | |
- static IAllocController* getInstance(bool useMasterHeap); | |
+ static android::sp<IAllocController> getInstance(bool useMasterHeap); | |
private: | |
- static IAllocController* sController; | |
+ static android::sp<IAllocController> sController; | |
}; | |
-#ifdef USE_ION | |
class IonController : public IAllocController { | |
public: | |
- virtual int allocate(alloc_data& data, int usage); | |
+ virtual int allocate(alloc_data& data, int usage, | |
+ int compositionType); | |
- virtual IMemAlloc* getAllocator(int flags); | |
+ virtual android::sp<IMemAlloc> getAllocator(int flags); | |
IonController(); | |
private: | |
- IonAlloc* mIonAlloc; | |
+ android::sp<IonAlloc> mIonAlloc; | |
}; | |
-#else | |
+ | |
class PmemKernelController : public IAllocController { | |
public: | |
- virtual int allocate(alloc_data& data, int usage); | |
+ virtual int allocate(alloc_data& data, int usage, | |
+ int compositionType); | |
- virtual IMemAlloc* getAllocator(int flags); | |
+ virtual android::sp<IMemAlloc> getAllocator(int flags); | |
PmemKernelController (); | |
~PmemKernelController (); | |
private: | |
- IMemAlloc* mPmemAdspAlloc; | |
+ android::sp<IMemAlloc> mPmemAdspAlloc; | |
}; | |
@@ -90,21 +94,21 @@ class PmemKernelController : public IAllocController { | |
class PmemAshmemController : public IAllocController { | |
public: | |
- virtual int allocate(alloc_data& data, int usage); | |
+ virtual int allocate(alloc_data& data, int usage, | |
+ int compositionType); | |
- virtual IMemAlloc* getAllocator(int flags); | |
+ virtual android::sp<IMemAlloc> getAllocator(int flags); | |
PmemAshmemController(); | |
~PmemAshmemController(); | |
private: | |
- IMemAlloc* mPmemUserspaceAlloc; | |
- IMemAlloc* mAshmemAlloc; | |
- IAllocController* mPmemKernelCtrl; | |
+ android::sp<IMemAlloc> mPmemUserspaceAlloc; | |
+ android::sp<IMemAlloc> mAshmemAlloc; | |
+ android::sp<IAllocController> mPmemKernelCtrl; | |
}; | |
-#endif | |
} //end namespace gralloc | |
#endif // GRALLOC_ALLOCCONTROLLER_H | |
diff --git a/libgralloc/ashmemalloc.cpp b/libgralloc/ashmemalloc.cpp | |
index b659d90..89b1944 100644 | |
--- a/libgralloc/ashmemalloc.cpp | |
+++ b/libgralloc/ashmemalloc.cpp | |
@@ -73,7 +73,7 @@ int AshmemAlloc::alloc_buffer(alloc_data& data) | |
data.base = base; | |
data.offset = offset; | |
clean_buffer(base, data.size, offset, fd); | |
- ALOGD("ashmem: Allocated buffer base:%p size:%d fd:%d", | |
+ ALOGV("ashmem: Allocated buffer base:%p size:%d fd:%d", | |
base, data.size, fd); | |
} | |
@@ -83,7 +83,7 @@ int AshmemAlloc::alloc_buffer(alloc_data& data) | |
int AshmemAlloc::free_buffer(void* base, size_t size, int offset, int fd) | |
{ | |
- ALOGD("ashmem: Freeing buffer base:%p size:%d fd:%d", | |
+ ALOGV("ashmem: Freeing buffer base:%p size:%d fd:%d", | |
base, size, fd); | |
int err = 0; | |
@@ -109,7 +109,7 @@ int AshmemAlloc::map_buffer(void **pBase, size_t size, int offset, int fd) | |
strerror(errno)); | |
err = -errno; | |
} else { | |
- ALOGD("ashmem: Mapped buffer base:%p size:%d fd:%d", | |
+ ALOGV("ashmem: Mapped buffer base:%p size:%d fd:%d", | |
base, size, fd); | |
} | |
return err; | |
@@ -117,7 +117,7 @@ int AshmemAlloc::map_buffer(void **pBase, size_t size, int offset, int fd) | |
int AshmemAlloc::unmap_buffer(void *base, size_t size, int offset) | |
{ | |
- ALOGD("ashmem: Unmapping buffer base: %p size: %d", base, size); | |
+ ALOGV("ashmem: Unmapping buffer base: %p size: %d", base, size); | |
int err = munmap(base, size); | |
if(err) { | |
ALOGE("ashmem: Failed to unmap memory at %p: %s", | |
diff --git a/libgralloc/framebuffer.cpp b/libgralloc/framebuffer.cpp | |
index c643e3b..5531d70 100644 | |
--- a/libgralloc/framebuffer.cpp | |
+++ b/libgralloc/framebuffer.cpp | |
@@ -208,14 +208,21 @@ int mapFrameBufferLocked(struct private_module_t* module) | |
/* | |
* Explicitly request RGBA_8888 | |
*/ | |
- info.bits_per_pixel = 32; | |
+#ifdef SEMC_RGBA_8888_OFFSET | |
+ info.red.offset = 0; | |
+ info.green.offset = 8; | |
+ info.blue.offset = 16; | |
+ info.transp.offset = 24; | |
+#else | |
info.red.offset = 24; | |
- info.red.length = 8; | |
info.green.offset = 16; | |
- info.green.length = 8; | |
info.blue.offset = 8; | |
- info.blue.length = 8; | |
info.transp.offset = 0; | |
+#endif | |
+ info.bits_per_pixel = 32; | |
+ info.red.length = 8; | |
+ info.green.length = 8; | |
+ info.blue.length = 8; | |
info.transp.length = 8; | |
/* Note: the GL driver does not have a r=8 g=8 b=8 a=0 config, so if we | |
diff --git a/libgralloc/gpu.cpp b/libgralloc/gpu.cpp | |
index 898dbbc..89a860d 100644 | |
--- a/libgralloc/gpu.cpp | |
+++ b/libgralloc/gpu.cpp | |
@@ -29,9 +29,10 @@ | |
#include "alloc_controller.h" | |
using namespace gralloc; | |
+using android::sp; | |
gpu_context_t::gpu_context_t(const private_module_t* module, | |
- IAllocController* alloc_ctrl ) : | |
+ sp<IAllocController> alloc_ctrl ) : | |
mAllocCtrl(alloc_ctrl) | |
{ | |
// Zero out the alloc_device_t | |
@@ -53,8 +54,8 @@ int gpu_context_t::gralloc_alloc_framebuffer_locked(size_t size, int usage, | |
{ | |
private_module_t* m = reinterpret_cast<private_module_t*>(common.module); | |
- // we don't support framebuffer allocations with graphics heap flags | |
- if (usage & GRALLOC_HEAP_MASK) { | |
+ // we don't support allocations with both the FB and PMEM_ADSP flags | |
+ if (usage & GRALLOC_USAGE_PRIVATE_ADSP_HEAP) { | |
return -EINVAL; | |
} | |
@@ -137,7 +138,7 @@ int gpu_context_t::gralloc_alloc_buffer(size_t size, int usage, | |
else | |
data.align = getpagesize(); | |
data.pHandle = (unsigned int) pHandle; | |
- err = mAllocCtrl->allocate(data, usage); | |
+ err = mAllocCtrl->allocate(data, usage, 0); | |
if (usage & GRALLOC_USAGE_PRIVATE_UNSYNCHRONIZED) { | |
flags |= private_handle_t::PRIV_FLAGS_UNSYNCHRONIZED; | |
@@ -244,7 +245,7 @@ int gpu_context_t::free_impl(private_handle_t const* hnd) { | |
m->bufferMask &= ~(1<<index); | |
} else { | |
terminateBuffer(&m->base, const_cast<private_handle_t*>(hnd)); | |
- IMemAlloc* memalloc = mAllocCtrl->getAllocator(hnd->flags); | |
+ sp<IMemAlloc> memalloc = mAllocCtrl->getAllocator(hnd->flags); | |
int err = memalloc->free_buffer((void*)hnd->base, (size_t) hnd->size, | |
hnd->offset, hnd->fd); | |
if(err) | |
diff --git a/libgralloc/gpu.h b/libgralloc/gpu.h | |
index 5a6c0ea..487f4d1 100644 | |
--- a/libgralloc/gpu.h | |
+++ b/libgralloc/gpu.h | |
@@ -25,6 +25,7 @@ | |
#include <cutils/log.h> | |
#include <cutils/ashmem.h> | |
+#include <utils/RefBase.h> | |
#include "gralloc_priv.h" | |
#include <fb_priv.h> | |
@@ -34,7 +35,7 @@ class IAllocController; | |
class gpu_context_t : public alloc_device_t { | |
public: | |
gpu_context_t(const private_module_t* module, | |
- IAllocController* alloc_ctrl); | |
+ android::sp<IAllocController>alloc_ctrl); | |
int gralloc_alloc_framebuffer_locked(size_t size, int usage, | |
buffer_handle_t* pHandle); | |
@@ -68,7 +69,7 @@ class gpu_context_t : public alloc_device_t { | |
static int gralloc_close(struct hw_device_t *dev); | |
private: | |
- IAllocController* mAllocCtrl; | |
+ android::sp<IAllocController> mAllocCtrl; | |
void getGrallocInformationFromFormat(int inputFormat, | |
int *colorFormat, | |
int *bufferType); | |
diff --git a/libgralloc/gralloc.cpp b/libgralloc/gralloc.cpp | |
index 97f0c6a..cf57fee 100644 | |
--- a/libgralloc/gralloc.cpp | |
+++ b/libgralloc/gralloc.cpp | |
@@ -23,6 +23,7 @@ | |
#include <sys/types.h> | |
#include <sys/ioctl.h> | |
#include <cutils/properties.h> | |
+#include <utils/RefBase.h> | |
#include <linux/android_pmem.h> | |
@@ -32,6 +33,7 @@ | |
#include "alloc_controller.h" | |
using namespace gralloc; | |
+using android::sp; | |
int fb_device_open(const hw_module_t* module, const char* name, | |
hw_device_t** device); | |
@@ -100,7 +102,7 @@ int gralloc_device_open(const hw_module_t* module, const char* name, | |
const private_module_t* m = reinterpret_cast<const private_module_t*>( | |
module); | |
gpu_context_t *dev; | |
- IAllocController* alloc_ctrl = IAllocController::getInstance(true); | |
+ sp<IAllocController> alloc_ctrl = IAllocController::getInstance(true); | |
dev = new gpu_context_t(m, alloc_ctrl); | |
*device = &dev->common; | |
status = 0; | |
diff --git a/libgralloc/gralloc_priv.h b/libgralloc/gralloc_priv.h | |
index a848915..7cdaa5f 100644 | |
--- a/libgralloc/gralloc_priv.h | |
+++ b/libgralloc/gralloc_priv.h | |
@@ -34,57 +34,6 @@ enum { | |
/* gralloc usage bits indicating the type | |
* of allocation that should be used */ | |
-#ifdef USE_ION | |
- /* SYSTEM heap comes from kernel vmalloc, | |
- * can never be uncached, is not secured*/ | |
- GRALLOC_USAGE_PRIVATE_SYSTEM_HEAP = GRALLOC_USAGE_PRIVATE_0, | |
- /* SF heap is used for application buffers, is not secured */ | |
- GRALLOC_USAGE_PRIVATE_UI_CONTIG_HEAP = GRALLOC_USAGE_PRIVATE_1, | |
- /* IOMMU heap comes from manually allocated pages, | |
- * can be cached/uncached, is not secured */ | |
- GRALLOC_USAGE_PRIVATE_IOMMU_HEAP = GRALLOC_USAGE_PRIVATE_2, | |
- /* MM heap is a carveout heap for video, can be secured*/ | |
- GRALLOC_USAGE_PRIVATE_MM_HEAP = GRALLOC_USAGE_PRIVATE_3, | |
- /* CAMERA heap is a carveout heap for camera, is not secured*/ | |
- GRALLOC_USAGE_PRIVATE_CAMERA_HEAP = 0x01000000, | |
- | |
- /* Set this for allocating uncached memory (using O_DSYNC) | |
- * cannot be used with noncontiguous heaps */ | |
- GRALLOC_USAGE_PRIVATE_UNCACHED = 0x02000000, | |
- | |
- /* This flag can be set to disable genlock synchronization | |
- * for the gralloc buffer. If this flag is set the caller | |
- * is required to perform explicit synchronization. | |
- * WARNING - flag is outside the standard PRIVATE region | |
- * and may need to be moved if the gralloc API changes | |
- */ | |
- GRALLOC_USAGE_PRIVATE_UNSYNCHRONIZED = 0X04000000, | |
- | |
- /* Buffer content should be displayed on an external display only */ | |
- GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY = 0x08000000, | |
- | |
- /* Only this buffer content should be displayed on external, even if | |
- * other EXTERNAL_ONLY buffers are available. Used during suspend. | |
- */ | |
- GRALLOC_USAGE_PRIVATE_EXTERNAL_BLOCK = 0x00100000, | |
- | |
- /* Close Caption displayed on an external display only */ | |
- GRALLOC_USAGE_PRIVATE_EXTERNAL_CC = 0x00200000, | |
- | |
- /* Use this flag to request content protected buffers. Please note | |
- * that this flag is different from the GRALLOC_USAGE_PROTECTED flag | |
- * which can be used for buffers that are not secured for DRM | |
- * but still need to be protected from screen captures | |
- */ | |
- GRALLOC_USAGE_PRIVATE_CP_BUFFER = 0x00400000, | |
- | |
- /* Legacy heaps - these heaps are no-ops so we are making them zero | |
- * The flags need to be around to compile certain HALs which have | |
- * not cleaned up the code | |
- */ | |
- GRALLOC_USAGE_PRIVATE_ADSP_HEAP = 0x0, | |
- GRALLOC_USAGE_PRIVATE_SMI_HEAP = 0x0, | |
-#else | |
/* ADSP heap is deprecated, use only if using pmem */ | |
GRALLOC_USAGE_PRIVATE_ADSP_HEAP = GRALLOC_USAGE_PRIVATE_0, | |
/* SF heap is used for application buffers, is not secured */ | |
@@ -132,17 +81,15 @@ enum { | |
*/ | |
GRALLOC_USAGE_PRIVATE_EXTERNAL_BLOCK = 0x00020000, | |
+ /* Close Caption displayed on an external display only */ | |
+ GRALLOC_USAGE_PRIVATE_EXTERNAL_CC = 0x00040000, | |
+ | |
/* Use this flag to request content protected buffers. Please note | |
* that this flag is different from the GRALLOC_USAGE_PROTECTED flag | |
* which can be used for buffers that are not secured for DRM | |
* but still need to be protected from screen captures | |
- * 0x00040000 is reserved and these values are subject to change. | |
*/ | |
GRALLOC_USAGE_PRIVATE_CP_BUFFER = 0x00080000, | |
- | |
- /* Close Caption displayed on an external display only */ | |
- GRALLOC_USAGE_PRIVATE_EXTERNAL_CC = 0x000F0000, | |
-#endif | |
}; | |
enum { | |
@@ -151,31 +98,21 @@ enum { | |
GRALLOC_MODULE_PERFORM_CREATE_HANDLE_FROM_BUFFER = 0x080000001, | |
}; | |
-#ifdef USE_ION | |
-#define GRALLOC_HEAP_MASK (GRALLOC_USAGE_PRIVATE_UI_CONTIG_HEAP |\ | |
- GRALLOC_USAGE_PRIVATE_SYSTEM_HEAP |\ | |
- GRALLOC_USAGE_PRIVATE_IOMMU_HEAP |\ | |
- GRALLOC_USAGE_PRIVATE_MM_HEAP |\ | |
- GRALLOC_USAGE_PRIVATE_CAMERA_HEAP) | |
-#else | |
-#define GRALLOC_HEAP_MASK (GRALLOC_USAGE_PRIVATE_ADSP_HEAP |\ | |
- GRALLOC_USAGE_PRIVATE_UI_CONTIG_HEAP |\ | |
- GRALLOC_USAGE_PRIVATE_SMI_HEAP |\ | |
- GRALLOC_USAGE_PRIVATE_SYSTEM_HEAP |\ | |
- GRALLOC_USAGE_PRIVATE_IOMMU_HEAP |\ | |
- GRALLOC_USAGE_PRIVATE_MM_HEAP |\ | |
- GRALLOC_USAGE_PRIVATE_WRITEBACK_HEAP |\ | |
- GRALLOC_USAGE_PRIVATE_CAMERA_HEAP) | |
+ | |
+#define INTERLACE_MASK 0x80 | |
+#define S3D_FORMAT_MASK 0xFF000 | |
#define DEVICE_PMEM "/dev/pmem" | |
#define DEVICE_PMEM_ADSP "/dev/pmem_adsp" | |
#define DEVICE_PMEM_SMIPOOL "/dev/pmem_smipool" | |
-#endif | |
- | |
/*****************************************************************************/ | |
enum { | |
/* OEM specific HAL formats */ | |
HAL_PIXEL_FORMAT_NV12_ENCODEABLE = 0x102, | |
+#ifdef QCOM_ICS_COMPAT | |
+ HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED = 0x108, | |
+#else | |
HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED = 0x7FA30C03, | |
+#endif | |
HAL_PIXEL_FORMAT_YCbCr_420_SP = 0x109, | |
HAL_PIXEL_FORMAT_YCrCb_420_SP_ADRENO = 0x7FA30C01, | |
HAL_PIXEL_FORMAT_YCrCb_422_SP = 0x10B, | |
diff --git a/libgralloc/ionalloc.cpp b/libgralloc/ionalloc.cpp | |
index e01e3df..1ebbdfd 100644 | |
--- a/libgralloc/ionalloc.cpp | |
+++ b/libgralloc/ionalloc.cpp | |
@@ -27,7 +27,7 @@ | |
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
*/ | |
-#define DEBUG 0 | |
+ | |
#include <linux/ioctl.h> | |
#include <sys/mman.h> | |
#include <stdlib.h> | |
@@ -118,7 +118,9 @@ int IonAlloc::alloc_buffer(alloc_data& data) | |
return err; | |
} | |
- if(!(data.flags & ION_SECURE)) { | |
+ if(!(data.flags & ION_SECURE) && | |
+ !(data.allocType & private_handle_t::PRIV_FLAGS_NOT_MAPPED)) { | |
+ | |
base = mmap(0, ionAllocData.len, PROT_READ|PROT_WRITE, | |
MAP_SHARED, fd_data.fd, 0); | |
if(base == MAP_FAILED) { | |
@@ -144,7 +146,7 @@ int IonAlloc::alloc_buffer(alloc_data& data) | |
data.base = base; | |
data.fd = fd_data.fd; | |
ioctl(mIonFd, ION_IOC_FREE, &handle_data); | |
- ALOGD_IF(DEBUG, "ion: Allocated buffer base:%p size:%d fd:%d", | |
+ ALOGV("ion: Allocated buffer base:%p size:%d fd:%d", | |
data.base, ionAllocData.len, data.fd); | |
return 0; | |
} | |
@@ -153,7 +155,7 @@ int IonAlloc::alloc_buffer(alloc_data& data) | |
int IonAlloc::free_buffer(void* base, size_t size, int offset, int fd) | |
{ | |
Locker::Autolock _l(mLock); | |
- ALOGD_IF(DEBUG, "ion: Freeing buffer base:%p size:%d fd:%d", | |
+ ALOGV("ion: Freeing buffer base:%p size:%d fd:%d", | |
base, size, fd); | |
int err = 0; | |
err = open_device(); | |
@@ -181,10 +183,10 @@ int IonAlloc::map_buffer(void **pBase, size_t size, int offset, int fd) | |
*pBase = base; | |
if(base == MAP_FAILED) { | |
err = -errno; | |
- ALOGE("ion: Failed to map memory in the client: %s", | |
+ ALOGD("ion: Failed to map memory in the client: %s", | |
strerror(errno)); | |
} else { | |
- ALOGD_IF(DEBUG, "ion: Mapped buffer base:%p size:%d offset:%d fd:%d", | |
+ ALOGV("ion: Mapped buffer base:%p size:%d offset:%d fd:%d", | |
base, size, offset, fd); | |
} | |
return err; | |
@@ -192,7 +194,7 @@ int IonAlloc::map_buffer(void **pBase, size_t size, int offset, int fd) | |
int IonAlloc::unmap_buffer(void *base, size_t size, int offset) | |
{ | |
- ALOGD_IF(DEBUG, "ion: Unmapping buffer base:%p size:%d", base, size); | |
+ ALOGV("ion: Unmapping buffer base:%p size:%d", base, size); | |
int err = 0; | |
if(munmap(base, size)) { | |
err = -errno; | |
diff --git a/libgralloc/mapper.cpp b/libgralloc/mapper.cpp | |
index b099245..4249f3f 100644 | |
--- a/libgralloc/mapper.cpp | |
+++ b/libgralloc/mapper.cpp | |
@@ -44,14 +44,15 @@ | |
#include "memalloc.h" | |
using namespace gralloc; | |
+using android::sp; | |
/*****************************************************************************/ | |
// Return the type of allocator - | |
// these are used for mapping/unmapping | |
-static IMemAlloc* getAllocator(int flags) | |
+static sp<IMemAlloc> getAllocator(int flags) | |
{ | |
- IMemAlloc* memalloc; | |
- IAllocController* alloc_ctrl = IAllocController::getInstance(true); | |
+ sp<IMemAlloc> memalloc; | |
+ sp<IAllocController> alloc_ctrl = IAllocController::getInstance(true); | |
memalloc = alloc_ctrl->getAllocator(flags); | |
return memalloc; | |
} | |
@@ -65,7 +66,7 @@ static int gralloc_map(gralloc_module_t const* module, | |
if (!(hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER) && | |
!(hnd->flags & private_handle_t::PRIV_FLAGS_SECURE_BUFFER)) { | |
size_t size = hnd->size; | |
- IMemAlloc* memalloc = getAllocator(hnd->flags) ; | |
+ sp<IMemAlloc> memalloc = getAllocator(hnd->flags) ; | |
int err = memalloc->map_buffer(&mappedAddress, size, | |
hnd->offset, hnd->fd); | |
if(err) { | |
@@ -97,7 +98,7 @@ static int gralloc_unmap(gralloc_module_t const* module, | |
int err = -EINVAL; | |
void* base = (void*)hnd->base; | |
size_t size = hnd->size; | |
- IMemAlloc* memalloc = getAllocator(hnd->flags) ; | |
+ sp<IMemAlloc> memalloc = getAllocator(hnd->flags) ; | |
if(memalloc != NULL) | |
err = memalloc->unmap_buffer(base, size, hnd->offset); | |
if (err) { | |
@@ -283,7 +284,7 @@ int gralloc_unlock(gralloc_module_t const* module, | |
if (hnd->flags & private_handle_t::PRIV_FLAGS_NEEDS_FLUSH) { | |
int err; | |
- IMemAlloc* memalloc = getAllocator(hnd->flags) ; | |
+ sp<IMemAlloc> memalloc = getAllocator(hnd->flags) ; | |
err = memalloc->clean_buffer((void*)hnd->base, | |
hnd->size, hnd->offset, hnd->fd); | |
ALOGE_IF(err < 0, "cannot flush handle %p (offs=%x len=%x, flags = 0x%x) err=%s\n", | |
@@ -327,12 +328,25 @@ int gralloc_perform(struct gralloc_module_t const* module, | |
private_handle_t::sNumFds, private_handle_t::sNumInts); | |
hnd->magic = private_handle_t::sMagic; | |
hnd->fd = fd; | |
-#ifdef USE_ION | |
- hnd->flags = private_handle_t::PRIV_FLAGS_USES_ION; | |
-#else | |
- hnd->flags = private_handle_t::PRIV_FLAGS_USES_PMEM | | |
- private_handle_t::PRIV_FLAGS_DO_NOT_FLUSH; | |
-#endif | |
+ unsigned int contigFlags = GRALLOC_USAGE_PRIVATE_ADSP_HEAP | | |
+ GRALLOC_USAGE_PRIVATE_UI_CONTIG_HEAP | | |
+ GRALLOC_USAGE_PRIVATE_SMI_HEAP; | |
+ | |
+ if (memoryFlags & contigFlags) { | |
+ // check if the buffer is a pmem buffer | |
+ pmem_region region; | |
+ if (ioctl(fd, PMEM_GET_SIZE, ®ion) < 0) | |
+ hnd->flags = private_handle_t::PRIV_FLAGS_USES_ION; | |
+ else | |
+ hnd->flags = private_handle_t::PRIV_FLAGS_USES_PMEM | | |
+ private_handle_t::PRIV_FLAGS_DO_NOT_FLUSH; | |
+ } else { | |
+ if (memoryFlags & GRALLOC_USAGE_PRIVATE_ION) | |
+ hnd->flags = private_handle_t::PRIV_FLAGS_USES_ION; | |
+ else | |
+ hnd->flags = private_handle_t::PRIV_FLAGS_USES_ASHMEM; | |
+ } | |
+ | |
hnd->size = size; | |
hnd->offset = offset; | |
hnd->base = intptr_t(base) + offset; | |
diff --git a/libgralloc/memalloc.h b/libgralloc/memalloc.h | |
index af509fb..349078d 100644 | |
--- a/libgralloc/memalloc.h | |
+++ b/libgralloc/memalloc.h | |
@@ -31,6 +31,7 @@ | |
#define GRALLOC_MEMALLOC_H | |
#include <stdlib.h> | |
+#include <utils/RefBase.h> | |
namespace gralloc { | |
@@ -46,7 +47,7 @@ struct alloc_data { | |
int allocType; | |
}; | |
-class IMemAlloc { | |
+class IMemAlloc : public android::RefBase { | |
public: | |
// Allocate buffer - fill in the alloc_data | |
diff --git a/libgralloc/pmem_bestfit_alloc.cpp b/libgralloc/pmem_bestfit_alloc.cpp | |
index 82302fa..48fea18 100644 | |
--- a/libgralloc/pmem_bestfit_alloc.cpp | |
+++ b/libgralloc/pmem_bestfit_alloc.cpp | |
@@ -164,9 +164,9 @@ SimpleBestFitAllocator::chunk_t* SimpleBestFitAllocator::dealloc(size_t start) | |
chunk_t* cur = mList.head(); | |
while (cur) { | |
if (cur->start == start) { | |
- LOG_FATAL_IF(cur->free, | |
- "block at offset 0x%08lX of size 0x%08lX already freed", | |
- cur->start*kMemoryAlign, cur->size*kMemoryAlign); | |
+ //ALOG_FATAL_IF(cur->free, | |
+ // "block at offset 0x%08lX of size 0x%08lX already freed", | |
+ // cur->start*kMemoryAlign, cur->size*kMemoryAlign); | |
// merge freed blocks together | |
chunk_t* freed = cur; | |
@@ -183,9 +183,9 @@ SimpleBestFitAllocator::chunk_t* SimpleBestFitAllocator::dealloc(size_t start) | |
cur = n; | |
} while (cur && cur->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); | |
+ //ALOG_FATAL_IF(!freed->free, | |
+ // "freed block at offset 0x%08lX of size 0x%08lX is not free!", | |
+ // freed->start * kMemoryAlign, freed->size * kMemoryAlign); | |
return freed; | |
} | |
diff --git a/libgralloc/pmemalloc.cpp b/libgralloc/pmemalloc.cpp | |
index 4f61308..a246594 100644 | |
--- a/libgralloc/pmemalloc.cpp | |
+++ b/libgralloc/pmemalloc.cpp | |
@@ -26,8 +26,6 @@ | |
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | |
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
*/ | |
- | |
-//#define LOG_NDEBUG 0 | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <sys/mman.h> | |
@@ -40,6 +38,7 @@ | |
#include "pmem_bestfit_alloc.h" | |
using namespace gralloc; | |
+using android::sp; | |
// Common functions between userspace | |
// and kernel allocators | |
@@ -118,13 +117,13 @@ PmemUserspaceAlloc::~PmemUserspaceAlloc() | |
int PmemUserspaceAlloc::init_pmem_area_locked() | |
{ | |
- ALOGD("%s: Opening master pmem FD", __FUNCTION__); | |
+ ALOGV("%s: Opening master pmem FD", __FUNCTION__); | |
int err = 0; | |
int fd = open(mPmemDev, O_RDWR, 0); | |
if (fd >= 0) { | |
size_t size = 0; | |
err = getPmemTotalSize(fd, &size); | |
- ALOGD("%s: Total pmem size: %d", __FUNCTION__, size); | |
+ ALOGV("%s: Total pmem size: %d", __FUNCTION__, size); | |
if (err < 0) { | |
ALOGE("%s: PMEM_GET_TOTAL_SIZE failed (%d), limp mode", mPmemDev, | |
err); | |
@@ -159,7 +158,7 @@ int PmemUserspaceAlloc::init_pmem_area() | |
int err = mMasterFd; | |
if (err == FD_INIT) { | |
// first time, try to initialize pmem | |
- ALOGD("%s: Initializing pmem area", __FUNCTION__); | |
+ ALOGV("%s: Initializing pmem area", __FUNCTION__); | |
err = init_pmem_area_locked(); | |
if (err) { | |
ALOGE("%s: failed to initialize pmem area", mPmemDev); | |
diff --git a/libgralloc/pmemalloc.h b/libgralloc/pmemalloc.h | |
index 1151d13..82794ec 100644 | |
--- a/libgralloc/pmemalloc.h | |
+++ b/libgralloc/pmemalloc.h | |
@@ -31,13 +31,14 @@ | |
#define GRALLOC_PMEMALLOC_H | |
#include <linux/ion.h> | |
+#include <utils/RefBase.h> | |
#include "memalloc.h" | |
namespace gralloc { | |
class PmemUserspaceAlloc : public IMemAlloc { | |
public: | |
- class Allocator { | |
+ class Allocator: public android::RefBase { | |
public: | |
virtual ~Allocator() {}; | |
virtual ssize_t setSize(size_t size) = 0; | |
@@ -68,7 +69,7 @@ class PmemUserspaceAlloc : public IMemAlloc { | |
int mMasterFd; | |
void* mMasterBase; | |
const char* mPmemDev; | |
- Allocator* mAllocator; | |
+ android::sp<Allocator> mAllocator; | |
pthread_mutex_t mLock; | |
int init_pmem_area(); | |
int init_pmem_area_locked(); | |
diff --git a/libhwcomposer/Android.mk b/libhwcomposer/Android.mk | |
index 8ad7e17..1592508 100644 | |
--- a/libhwcomposer/Android.mk | |
+++ b/libhwcomposer/Android.mk | |
@@ -4,7 +4,7 @@ include $(CLEAR_VARS) | |
LOCAL_MODULE := hwcomposer.$(TARGET_BOARD_PLATFORM) | |
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw | |
LOCAL_MODULE_TAGS := optional | |
-LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes) | |
+LOCAL_C_INCLUDES := $(common_includes) | |
LOCAL_SHARED_LIBRARIES := $(common_libs) libEGL liboverlay libgenlock \ | |
libhwcexternal libqdutils libhardware_legacy \ | |
libdl libmemalloc libhwcservice | |
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp | |
index 1df07a3..bcdc200 100644 | |
--- a/libhwcomposer/hwc.cpp | |
+++ b/libhwcomposer/hwc.cpp | |
@@ -243,12 +243,18 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name, | |
methods->eventControl = hwc_eventControl; | |
dev->device.common.tag = HARDWARE_DEVICE_TAG; | |
-#ifdef NO_HW_VSYNC | |
- dev->device.common.version = 0; | |
- ALOGI("%s: Hardware VSYNC not supported", __FUNCTION__); | |
-#else | |
- dev->device.common.version = HWC_DEVICE_API_VERSION_0_3; | |
- ALOGI("%s: Hardware VSYNC supported", __FUNCTION__); | |
+#ifndef NO_HW_VSYNC | |
+ //XXX: This disables hardware vsync on 8x55 | |
+ // Fix when HW vsync is available on 8x55 | |
+ if(dev->mMDP.version == 400) { | |
+#endif | |
+ dev->device.common.version = 0; | |
+ ALOGI("%s: Hardware VSYNC not supported", __FUNCTION__); | |
+#ifndef NO_HW_VSYNC | |
+ } else { | |
+ dev->device.common.version = HWC_DEVICE_API_VERSION_0_3; | |
+ ALOGI("%s: Hardware VSYNC supported", __FUNCTION__); | |
+ } | |
#endif | |
dev->device.common.module = const_cast<hw_module_t*>(module); | |
dev->device.common.close = hwc_device_close; | |
diff --git a/libhwcomposer/hwc_copybit.cpp b/libhwcomposer/hwc_copybit.cpp | |
index 069913f..a8a3420 100644 | |
--- a/libhwcomposer/hwc_copybit.cpp | |
+++ b/libhwcomposer/hwc_copybit.cpp | |
@@ -347,8 +347,7 @@ int CopyBit::drawLayerUsingCopybit(hwc_context_t *dev, hwc_layer_t *layer, | |
} | |
ALOGE("%s:%d::tmp_w = %d,tmp_h = %d",__FUNCTION__,__LINE__,tmp_w,tmp_h); | |
- int usage = GRALLOC_USAGE_PRIVATE_ADSP_HEAP | | |
- GRALLOC_USAGE_PRIVATE_MM_HEAP; | |
+ int usage = GRALLOC_USAGE_PRIVATE_MM_HEAP; | |
if (0 == alloc_buffer(&tmpHnd, tmp_w, tmp_h, fbHandle->format, usage)){ | |
copybit_image_t tmp_dst; | |
diff --git a/libhwcomposer/hwc_external.cpp b/libhwcomposer/hwc_external.cpp | |
index 5ecb72e..e8ec8f2 100644 | |
--- a/libhwcomposer/hwc_external.cpp | |
+++ b/libhwcomposer/hwc_external.cpp | |
@@ -569,4 +569,3 @@ int ExternalDisplay::enableHDMIVsync(int enable) | |
} | |
}; | |
- | |
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp | |
old mode 100644 | |
new mode 100755 | |
index 864a9e3..b54fd03 | |
--- a/libhwcomposer/hwc_mdpcomp.cpp | |
+++ b/libhwcomposer/hwc_mdpcomp.cpp | |
@@ -282,6 +282,7 @@ int MDPComp::prepare(hwc_context_t *ctx, hwc_layer_t *layer, | |
ovutils::Whf info(hnd->width, hnd->height, hnd->format, hnd->size); | |
ovutils::eMdpFlags mdpFlags = mdp_info.isVG ? ovutils::OV_MDP_PIPE_SHARE | |
: ovutils::OV_MDP_FLAGS_NONE; | |
+ ovutils::setMdpFlags(mdpFlags, ovutils::OV_MDP_BACKEND_COMPOSITION); | |
ovutils::eIsFg isFG = mdp_info.isFG ? ovutils::IS_FG_SET | |
: ovutils::IS_FG_OFF; | |
diff --git a/libhwcomposer/hwc_mdpcomp.h b/libhwcomposer/hwc_mdpcomp.h | |
old mode 100644 | |
new mode 100755 | |
diff --git a/liboverlay/Android.mk b/liboverlay/Android.mk | |
index bb83111..3234e9e 100644 | |
--- a/liboverlay/Android.mk | |
+++ b/liboverlay/Android.mk | |
@@ -4,10 +4,9 @@ include $(CLEAR_VARS) | |
LOCAL_MODULE := liboverlay | |
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES) | |
LOCAL_MODULE_TAGS := optional | |
-LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes) | |
+LOCAL_C_INCLUDES := $(common_includes) | |
LOCAL_SHARED_LIBRARIES := $(common_libs) libmemalloc | |
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"overlay\" | |
-LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps) | |
LOCAL_SRC_FILES := \ | |
overlay.cpp \ | |
overlayCtrl.cpp \ | |
diff --git a/liboverlay/overlayMem.h b/liboverlay/overlayMem.h | |
index d22e6f5..dbafbbb 100644 | |
--- a/liboverlay/overlayMem.h | |
+++ b/liboverlay/overlayMem.h | |
@@ -94,11 +94,12 @@ private: | |
uint32_t mNumBuffers; | |
/* gralloc alloc controller */ | |
- gralloc::IAllocController* mAlloc; | |
+ android::sp<gralloc::IAllocController> mAlloc; | |
}; | |
//-------------------Inlines----------------------------------- | |
+using android::sp; | |
using gralloc::IMemAlloc; | |
using gralloc::alloc_data; | |
@@ -117,16 +118,15 @@ inline bool OvMem::open(uint32_t numbufs, | |
uint32_t bufSz, bool isSecure) | |
{ | |
alloc_data data; | |
- int allocFlags = GRALLOC_USAGE_PRIVATE_IOMMU_HEAP; | |
+ | |
+ int err = 0; | |
+ int allocFlags = GRALLOC_USAGE_PRIVATE_MM_HEAP | GRALLOC_USAGE_PRIVATE_IOMMU_HEAP; | |
if(isSecure) { | |
allocFlags |= GRALLOC_USAGE_PRIVATE_MM_HEAP; | |
- allocFlags |= GRALLOC_USAGE_PRIVATE_CP_BUFFER; | |
-#ifndef USE_ION | |
allocFlags |= GRALLOC_USAGE_PRIVATE_DO_NOT_MAP; | |
-#endif | |
+ allocFlags |= GRALLOC_USAGE_PRIVATE_CP_BUFFER; | |
} | |
- int err = 0; | |
OVASSERT(numbufs && bufSz, "numbufs=%d bufSz=%d", numbufs, bufSz); | |
mBufSz = bufSz; | |
@@ -139,12 +139,12 @@ inline bool OvMem::open(uint32_t numbufs, | |
data.align = getpagesize(); | |
data.uncached = true; | |
- err = mAlloc->allocate(data, allocFlags); | |
+ err = mAlloc->allocate(data, allocFlags, 0); | |
//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); | |
+ err = mAlloc->allocate(data, allocFlags, 0); | |
if (err != 0) { | |
ALOGE(" could not allocate from fallback heap"); | |
return false; | |
@@ -170,7 +170,7 @@ inline bool OvMem::close() | |
return true; | |
} | |
- IMemAlloc* memalloc = mAlloc->getAllocator(mAllocType); | |
+ sp<IMemAlloc> memalloc = mAlloc->getAllocator(mAllocType); | |
ret = memalloc->free_buffer(mBaseAddr, mBufSz * mNumBuffers, 0, mFd); | |
if (ret != 0) { | |
ALOGE("OvMem: error freeing buffer"); | |
diff --git a/liboverlay/overlayUtils.h b/liboverlay/overlayUtils.h | |
index 5ee78b4..4509a27 100644 | |
--- a/liboverlay/overlayUtils.h | |
+++ b/liboverlay/overlayUtils.h | |
@@ -293,6 +293,7 @@ enum eMdpFlags { | |
OV_MDP_SECURE_OVERLAY_SESSION = MDP_SECURE_OVERLAY_SESSION, | |
OV_MDP_SOURCE_ROTATED_90 = MDP_SOURCE_ROTATED_90, | |
OV_MDP_MEMORY_ID_TYPE_FB = MDP_MEMORY_ID_TYPE_FB, | |
+ OV_MDP_BACKEND_COMPOSITION = MDP_BACKEND_COMPOSITION, | |
OV_MDP_BLEND_FG_PREMULT = MDP_BLEND_FG_PREMULT, | |
}; | |
diff --git a/liboverlay/pipes/overlayGenPipe.h b/liboverlay/pipes/overlayGenPipe.h | |
index f3d5141..cbcb05a 100644 | |
--- a/liboverlay/pipes/overlayGenPipe.h | |
+++ b/liboverlay/pipes/overlayGenPipe.h | |
@@ -182,6 +182,10 @@ inline bool GenericPipe<PANEL>::setSource( | |
const utils::PipeArgs& args) | |
{ | |
utils::PipeArgs newargs(args); | |
+ //Interlace video handling. | |
+ if(newargs.whf.format & INTERLACE_MASK) { | |
+ setMdpFlags(newargs.mdpFlags, utils::OV_MDP_DEINTERLACE); | |
+ } | |
utils::Whf whf(newargs.whf); | |
//Extract HAL format from lower bytes. Deinterlace if interlaced. | |
whf.format = utils::getColorFormat(whf.format); | |
diff --git a/libqdutils/idle_invalidator.cpp b/libqdutils/idle_invalidator.cpp | |
old mode 100644 | |
new mode 100755 | |
diff --git a/libqdutils/mdp_version.cpp b/libqdutils/mdp_version.cpp | |
index cf642fe..61025fc 100644 | |
--- a/libqdutils/mdp_version.cpp | |
+++ b/libqdutils/mdp_version.cpp | |
@@ -71,14 +71,9 @@ MDPVersion::MDPVersion() | |
close(fb_fd); | |
mMDPVersion = mdp_version; | |
mHasOverlay = false; | |
- if((mMDPVersion >= MDP_V4_0) || (mMDPVersion == MDP_V_UNKNOWN)) | |
+ if(mMDPVersion >= MDP_V4_0) | |
mHasOverlay = true; | |
mPanelType = panel_type; | |
-#ifdef TARGET_8x50 | |
- mMDPVersion = MDP_V3_1; | |
- mHasOverlay = false; | |
- mPanelType = 0; | |
-#endif | |
} | |
}; //namespace qdutils | |
diff --git a/libtilerenderer/Android.mk b/libtilerenderer/Android.mk | |
index 074244b..0452b27 100644 | |
--- a/libtilerenderer/Android.mk | |
+++ b/libtilerenderer/Android.mk | |
@@ -9,7 +9,7 @@ LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES | |
LOCAL_CFLAGS += -DQCOM_APP_TILE_RENDER | |
LOCAL_C_INCLUDES := \ | |
- frameworks/base/include/utils \ | |
+ frameworks/native/include/utils \ | |
frameworks/base/libs/hwui \ | |
hardware/libhardware/include/hardware \ | |
frameworks/native/opengl/include/GLES2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment