From baef6141a3239c7dd9bad0e2cd8a9ece5eef5a7e Mon Sep 17 00:00:00 2001 From: Iliyan Malchev Date: Thu, 29 Oct 2009 22:55:00 -0700 Subject: [PATCH 1/2] libbinder: add a NO_CACHING flag to MemoryHeapBase The NO_CACHING flag translates to opening a memory region with O_SYNC. Signed-off-by: Iliyan Malchev --- include/binder/MemoryHeapBase.h | 3 ++- libs/binder/MemoryHeapBase.cpp | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/binder/MemoryHeapBase.h b/include/binder/MemoryHeapBase.h index 435540e8c60c2..d793c240f95f4 100644 --- a/include/binder/MemoryHeapBase.h +++ b/include/binder/MemoryHeapBase.h @@ -35,7 +35,8 @@ public: MAP_ONCE = IMemoryHeap::MAP_ONCE, // memory won't be mapped locally, but will be mapped in the remote // process. - DONT_MAP_LOCALLY = 0x00000100 + DONT_MAP_LOCALLY = 0x00000100, + NO_CACHING = 0x00000200 }; /* diff --git a/libs/binder/MemoryHeapBase.cpp b/libs/binder/MemoryHeapBase.cpp index 5df078f8bdbb3..624f7eba84707 100644 --- a/libs/binder/MemoryHeapBase.cpp +++ b/libs/binder/MemoryHeapBase.cpp @@ -67,7 +67,11 @@ MemoryHeapBase::MemoryHeapBase(const char* device, size_t size, uint32_t flags) : mFD(-1), mSize(0), mBase(MAP_FAILED), mFlags(flags), mDevice(0), mNeedUnmap(false) { - int fd = open(device, O_RDWR); + int open_flags = O_RDWR; + if (flags & NO_CACHING) + open_flags |= O_SYNC; + + int fd = open(device, open_flags); LOGE_IF(fd<0, "error opening %s: %s", device, strerror(errno)); if (fd >= 0) { const size_t pagesize = getpagesize(); From c4918c30147d72c44e9a2a9fe7b9cbe88948677a Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Mon, 2 Nov 2009 15:05:04 -0800 Subject: [PATCH 2/2] Fix a build break. Too many branches to keep track of. --- libs/rs/rsSimpleMesh.cpp | 2 -- libs/rs/rsType.cpp | 1 - 2 files changed, 3 deletions(-) diff --git a/libs/rs/rsSimpleMesh.cpp b/libs/rs/rsSimpleMesh.cpp index 434a35ffb3b0c..b082fd7db26b9 100644 --- a/libs/rs/rsSimpleMesh.cpp +++ b/libs/rs/rsSimpleMesh.cpp @@ -99,8 +99,6 @@ SimpleMeshContext::SimpleMeshContext() SimpleMeshContext::~SimpleMeshContext() { - delete[] mVertexTypes; - delete[] mVertexBuffers; } diff --git a/libs/rs/rsType.cpp b/libs/rs/rsType.cpp index 0eb41119daab5..ddaa2f0e14262 100644 --- a/libs/rs/rsType.cpp +++ b/libs/rs/rsType.cpp @@ -57,7 +57,6 @@ TypeState::TypeState() TypeState::~TypeState() { - delete[] mLODs; } size_t Type::getOffsetForFace(uint32_t face) const