Skip to content

Instantly share code, notes, and snippets.

@brandon15811
Created May 5, 2012 07:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brandon15811/2600592 to your computer and use it in GitHub Desktop.
Save brandon15811/2600592 to your computer and use it in GitHub Desktop.
patches
From 5b9332780ca89b23bb4c48c080a43a8da8d32b3b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Emilio=20L=C3=B3pez?= <turl@tuxfamily.org>
Date: Thu, 9 Feb 2012 22:30:47 +0000
Subject: [PATCH 2/2] fix cam - thx dude
Change-Id: If351791992bc66687e819cc2cccce4ed9cc0da8c
---
libs/camera/Camera.cpp | 4 ++++
libs/ui/FramebufferNativeWindow.cpp | 10 ++++++++++
2 files changed, 14 insertions(+)
diff --git a/libs/camera/Camera.cpp b/libs/camera/Camera.cpp
index 7ac3cc1..6d111f6 100644
--- a/libs/camera/Camera.cpp
+++ b/libs/camera/Camera.cpp
@@ -132,6 +132,10 @@ sp<Camera> Camera::connect(int cameraId)
return c;
}
+extern "C" sp<Camera> _ZN7android6Camera7connectEv () {
+ return Camera::connect(0);
+}
+
void Camera::disconnect()
{
LOGV("disconnect");
diff --git a/libs/ui/FramebufferNativeWindow.cpp b/libs/ui/FramebufferNativeWindow.cpp
index cd6849a..a4ff3c7 100644
--- a/libs/ui/FramebufferNativeWindow.cpp
+++ b/libs/ui/FramebufferNativeWindow.cpp
@@ -414,3 +414,13 @@ EGLNativeWindowType android_createDisplaySurface(void)
}
return (EGLNativeWindowType)w;
}
+
+extern "C" status_t _ZN7android7Overlay13dequeueBufferEPPv(void* buffer)
+{
+ return NO_ERROR;
+}
+
+extern "C" void _ZN7android7Overlay7destroyEv(void)
+{
+ return;
+}
--
1.7.9.5
From dc80cdbd5b0721bc7722c51d6eb02d2107237c66 Mon Sep 17 00:00:00 2001
From: Tanguy Pruvot <tanguy.pruvot@gmail.com>
Date: Tue, 6 Mar 2012 07:42:04 +0100
Subject: [PATCH 1/2] MemoryHeapBase: ifdef for gingerbread compatibility
Allow to "revert" by a board config flag the offset member addon
see commit f24c4cd0f20 (aosp change id Ie618fb5c0718e)
This change is required to use overlay based proprietary camera libs
coming from gingerbread and froyo builds.
This change also requires a global cflag named BINDER_COMPAT
because a lot of modules use the MemoryHeap includes
Add this in your BoardConfig.mk :
COMMON_GLOBAL_CFLAGS += -DBINDER_COMPAT
Change-Id: Ib0370fbf4c4770f8141607a8fc393639ffbdc8e2
---
include/binder/IMemory.h | 3 ++-
include/binder/MemoryHeapBase.h | 7 +++++--
libs/binder/Android.mk | 4 ++++
libs/binder/IMemory.cpp | 22 +++++++++++++++++++++-
libs/binder/MemoryHeapBase.cpp | 24 ++++++++++++++++++++----
5 files changed, 52 insertions(+), 8 deletions(-)
diff --git a/include/binder/IMemory.h b/include/binder/IMemory.h
index 2d0db00..d56eafd 100644
--- a/include/binder/IMemory.h
+++ b/include/binder/IMemory.h
@@ -43,8 +43,9 @@ public:
virtual void* getBase() const = 0;
virtual size_t getSize() const = 0;
virtual uint32_t getFlags() const = 0;
+#ifndef BINDER_COMPAT
virtual uint32_t getOffset() const = 0;
-
+#endif
// these are there just for backward source compatibility
int32_t heapID() const { return getHeapID(); }
void* base() const { return getBase(); }
diff --git a/include/binder/MemoryHeapBase.h b/include/binder/MemoryHeapBase.h
index bbbda9c..137dcfd 100644
--- a/include/binder/MemoryHeapBase.h
+++ b/include/binder/MemoryHeapBase.h
@@ -61,8 +61,9 @@ public:
virtual void* getBase() const;
virtual size_t getSize() const;
virtual uint32_t getFlags() const;
- virtual uint32_t getOffset() const;
-
+#ifndef BINDER_COMPAT
+ virtual uint32_t getOffset() const;
+#endif
const char* getDevice() const;
/* this closes this heap -- use carefully */
@@ -91,7 +92,9 @@ private:
uint32_t mFlags;
const char* mDevice;
bool mNeedUnmap;
+#ifndef BINDER_COMPAT
uint32_t mOffset;
+#endif
};
// ---------------------------------------------------------------------------
diff --git a/libs/binder/Android.mk b/libs/binder/Android.mk
index 44518a9..24e28ee 100644
--- a/libs/binder/Android.mk
+++ b/libs/binder/Android.mk
@@ -38,6 +38,10 @@ endif
LOCAL_PATH:= $(call my-dir)
+# Note about gingerbread compatibility : Require a global cflag,
+# several projects use binder's IMemory.h and MemoryHeapBase.h
+# COMMON_GLOBAL_CFLAGS += -DBINDER_COMPAT
+
include $(CLEAR_VARS)
LOCAL_LDLIBS += -lpthread
LOCAL_MODULE := libbinder
diff --git a/libs/binder/IMemory.cpp b/libs/binder/IMemory.cpp
index 1cf7175..7c03897 100644
--- a/libs/binder/IMemory.cpp
+++ b/libs/binder/IMemory.cpp
@@ -81,7 +81,9 @@ public:
virtual void* getBase() const;
virtual size_t getSize() const;
virtual uint32_t getFlags() const;
+#ifndef BINDER_COMPAT
virtual uint32_t getOffset() const;
+#endif
private:
friend class IMemory;
@@ -108,7 +110,9 @@ private:
mutable void* mBase;
mutable size_t mSize;
mutable uint32_t mFlags;
+#ifndef BINDER_COMPAT
mutable uint32_t mOffset;
+#endif
mutable bool mRealHeap;
mutable Mutex mLock;
#ifdef QCOM_HARDWARE
@@ -234,7 +238,11 @@ status_t BnMemory::onTransact(
BpMemoryHeap::BpMemoryHeap(const sp<IBinder>& impl)
: BpInterface<IMemoryHeap>(impl),
- mHeapId(-1), mBase(MAP_FAILED), mSize(0), mFlags(0), mOffset(0), mRealHeap(false)
+ mHeapId(-1), mBase(MAP_FAILED), mSize(0), mFlags(0),
+#ifndef BINDER_COMPAT
+ mOffset(0),
+#endif
+ mRealHeap(false)
{
#ifdef QCOM_HARDWARE
mIonFd = open("/dev/ion", O_RDONLY);
@@ -282,7 +290,9 @@ void BpMemoryHeap::assertMapped() const
if (mHeapId == -1) {
mBase = heap->mBase;
mSize = heap->mSize;
+#ifndef BINDER_COMPAT
mOffset = heap->mOffset;
+#endif
android_atomic_write( dup( heap->mHeapId ), &mHeapId );
}
} else {
@@ -306,7 +316,11 @@ void BpMemoryHeap::assertReallyMapped() const
int parcel_fd = reply.readFileDescriptor();
ssize_t size = reply.readInt32();
uint32_t flags = reply.readInt32();
+#ifndef BINDER_COMPAT
uint32_t offset = reply.readInt32();
+#else
+ uint32_t offset = 0;
+#endif
LOGE_IF(err, "binder=%p transaction failed fd=%d, size=%ld, err=%d (%s)",
asBinder().get(), parcel_fd, size, err, strerror(-err));
@@ -331,7 +345,9 @@ void BpMemoryHeap::assertReallyMapped() const
} else {
mSize = size;
mFlags = flags;
+#ifndef BINDER_COMPAT
mOffset = offset;
+#endif
android_atomic_write(fd, &mHeapId);
}
}
@@ -358,10 +374,12 @@ uint32_t BpMemoryHeap::getFlags() const {
return mFlags;
}
+#ifndef BINDER_COMPAT
uint32_t BpMemoryHeap::getOffset() const {
assertMapped();
return mOffset;
}
+#endif
// ---------------------------------------------------------------------------
@@ -382,7 +400,9 @@ status_t BnMemoryHeap::onTransact(
reply->writeFileDescriptor(getHeapID());
reply->writeInt32(getSize());
reply->writeInt32(getFlags());
+#ifndef BINDER_COMPAT
reply->writeInt32(getOffset());
+#endif
return NO_ERROR;
} break;
default:
diff --git a/libs/binder/MemoryHeapBase.cpp b/libs/binder/MemoryHeapBase.cpp
index bf4a73f..c9cee57 100644
--- a/libs/binder/MemoryHeapBase.cpp
+++ b/libs/binder/MemoryHeapBase.cpp
@@ -42,13 +42,19 @@ namespace android {
MemoryHeapBase::MemoryHeapBase()
: mFD(-1), mSize(0), mBase(MAP_FAILED),
- mDevice(NULL), mNeedUnmap(false), mOffset(0)
+ mDevice(NULL), mNeedUnmap(false)
+#ifndef BINDER_COMPAT
+ , mOffset(0)
+#endif
{
}
MemoryHeapBase::MemoryHeapBase(size_t size, uint32_t flags, char const * name)
: mFD(-1), mSize(0), mBase(MAP_FAILED), mFlags(flags),
- mDevice(0), mNeedUnmap(false), mOffset(0)
+ mDevice(0), mNeedUnmap(false)
+#ifndef BINDER_COMPAT
+ , mOffset(0)
+#endif
{
const size_t pagesize = getpagesize();
size = ((size + pagesize-1) & ~(pagesize-1));
@@ -65,7 +71,10 @@ MemoryHeapBase::MemoryHeapBase(size_t size, uint32_t flags, char const * name)
MemoryHeapBase::MemoryHeapBase(const char* device, size_t size, uint32_t flags)
: mFD(-1), mSize(0), mBase(MAP_FAILED), mFlags(flags),
- mDevice(0), mNeedUnmap(false), mOffset(0)
+ mDevice(0), mNeedUnmap(false)
+#ifndef BINDER_COMPAT
+ , mOffset(0)
+#endif
{
int open_flags = O_RDWR;
if (flags & NO_CACHING)
@@ -84,7 +93,10 @@ MemoryHeapBase::MemoryHeapBase(const char* device, size_t size, uint32_t flags)
MemoryHeapBase::MemoryHeapBase(int fd, size_t size, uint32_t flags, uint32_t offset)
: mFD(-1), mSize(0), mBase(MAP_FAILED), mFlags(flags),
- mDevice(0), mNeedUnmap(false), mOffset(0)
+ mDevice(0), mNeedUnmap(false)
+#ifndef BINDER_COMPAT
+ , mOffset(0)
+#endif
{
const size_t pagesize = getpagesize();
size = ((size + pagesize-1) & ~(pagesize-1));
@@ -141,7 +153,9 @@ status_t MemoryHeapBase::mapfd(int fd, size_t size, uint32_t offset)
}
mFD = fd;
mSize = size;
+#ifndef BINDER_COMPAT
mOffset = offset;
+#endif
return NO_ERROR;
}
@@ -184,9 +198,11 @@ const char* MemoryHeapBase::getDevice() const {
return mDevice;
}
+#ifndef BINDER_COMPAT
uint32_t MemoryHeapBase::getOffset() const {
return mOffset;
}
+#endif
// ---------------------------------------------------------------------------
}; // namespace android
--
1.7.9.5
From 64d874a2addc023bb050149759b8201679e199fa Mon Sep 17 00:00:00 2001
From: buildbot <buildbot@kanged.us>
Date: Fri, 27 Apr 2012 20:55:35 -0700
Subject: [PATCH] Add olympus
Change-Id: I1ddde5378d1f63782810f6ae1ec602d5dddf18fe
---
vendorsetup.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/vendorsetup.sh b/vendorsetup.sh
index 688f81e..b835297 100644
--- a/vendorsetup.sh
+++ b/vendorsetup.sh
@@ -13,6 +13,7 @@ add_lunch_combo cm_i777-userdebug
add_lunch_combo cm_iyokan-userdebug
add_lunch_combo cm_mango-userdebug
add_lunch_combo cm_maguro-userdebug
+add_lunch_combo cm_olympus-userdebug
add_lunch_combo cm_p1-userdebug
add_lunch_combo cm_p1c-userdebug
add_lunch_combo cm_p3-userdebug
--
1.7.9.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment