Skip to content
Permalink
Browse files

Merge branch 'mr1-staging' of https://github.com/ColdFusionX/android_…

…frameworks_native into cm-10.1

Conflicts:
	services/surfaceflinger/DisplayHardware/HWComposer.cpp
  • Loading branch information
Rashed97 committed Dec 16, 2012
2 parents d262585 + 2869c4d commit 1399ec2260badd4de3cb6b0cf9fd3de9bf93d8b9
@@ -44,7 +44,9 @@ class IMemoryHeap : public IInterface
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(); }
@@ -64,10 +64,10 @@ class MemoryHeapBase : public virtual BnMemoryHeap

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 */
void dispose();

@@ -94,7 +94,9 @@ class MemoryHeapBase : public virtual BnMemoryHeap
uint32_t mFlags;
const char* mDevice;
bool mNeedUnmap;
#ifndef BINDER_COMPAT
uint32_t mOffset;
#endif
};

// ---------------------------------------------------------------------------
@@ -246,7 +246,11 @@ class SurfaceTexture : public ConsumerBase {
virtual ~BufferRejecter() { }
};
friend class Layer;
#ifdef DECIDE_TEXTURE_TARGET
status_t updateTexImage(BufferRejecter* rejecter, bool skipSync, bool isComposition=false);
#else
status_t updateTexImage(BufferRejecter* rejecter, bool skipSync);
#endif

// createImage creates a new EGLImage from a GraphicBuffer.
EGLImageKHR createImage(EGLDisplay dpy,
@@ -338,7 +342,11 @@ class SurfaceTexture : public ConsumerBase {
// glCopyTexSubImage to read from the texture. This is a hack to work
// around a GL driver limitation on the number of FBO attachments, which the
// browser's tile cache exceeds.
#ifdef DECIDE_TEXTURE_TARGET
GLenum mTexTarget;
#else
const GLenum mTexTarget;
#endif

// EGLSlot contains the information and object references that
// SurfaceTexture maintains about a BufferQueue buffer slot.
@@ -85,8 +85,9 @@ class BpMemoryHeap : public BpInterface<IMemoryHeap>
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;
friend class HeapCache;
@@ -112,7 +113,9 @@ class BpMemoryHeap : public BpInterface<IMemoryHeap>
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;
};
@@ -235,8 +238,13 @@ 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)
{
//HERE!
}

BpMemoryHeap::~BpMemoryHeap() {
@@ -276,7 +284,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 {
@@ -300,7 +310,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

ALOGE_IF(err, "binder=%p transaction failed fd=%d, size=%ld, err=%d (%s)",
asBinder().get(), parcel_fd, size, err, strerror(-err));
@@ -342,7 +356,9 @@ void BpMemoryHeap::assertReallyMapped() const
} else {
mSize = size;
mFlags = flags;
#ifndef BINDER_COMPAT
mOffset = offset;
#endif
android_atomic_write(fd, &mHeapId);
}
}
@@ -374,11 +390,12 @@ uint32_t BpMemoryHeap::getFlags() const {
assertMapped();
return mFlags;
}

#ifndef BINDER_COMPAT
uint32_t BpMemoryHeap::getOffset() const {
assertMapped();
return mOffset;
}
#endif

// ---------------------------------------------------------------------------

@@ -399,7 +416,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:
@@ -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));
@@ -132,7 +144,7 @@ status_t MemoryHeapBase::mapfd(int fd, size_t size, uint32_t offset)
close(fd);
return -errno;
}
//ALOGD("mmap(fd=%d, base=%p, size=%lu)", fd, base, size);
//LOGD("mmap(fd=%d, base=%p, size=%lu)", fd, base, size);
mBase = base;
mNeedUnmap = true;
} else {
@@ -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;
}

@@ -155,7 +169,7 @@ void MemoryHeapBase::dispose()
int fd = android_atomic_or(-1, &mFD);
if (fd >= 0) {
if (mNeedUnmap) {
//ALOGD("munmap(fd=%d, base=%p, size=%lu)", fd, mBase, mSize);
//LOGD("munmap(fd=%d, base=%p, size=%lu)", fd, mBase, mSize);
munmap(mBase, mSize);
}
mBase = 0;
@@ -184,9 +198,11 @@ const char* MemoryHeapBase::getDevice() const {
return mDevice;
}

#ifndef BINDER_COMPAT
uint32_t MemoryHeapBase::getOffset() const {
return mOffset;
}
#endif

// ---------------------------------------------------------------------------
}; // namespace android
@@ -55,7 +55,11 @@ ifneq ($(filter generic%,$(TARGET_DEVICE)),)
endif

ifeq ($(TARGET_BOARD_PLATFORM), msm8960)
LOCAL_CFLAGS += -DUSE_NATIVE_FENCE_SYNC
LOCAL_CFLAGS += -DUSE_NATIVE_FENCE_SYNC
endif

ifeq ($(BOARD_ADRENO_DECIDE_TEXTURE_TARGET),true)
LOCAL_CFLAGS += -DDECIDE_TEXTURE_TARGET
endif

include $(BUILD_SHARED_LIBRARY)
@@ -195,7 +195,11 @@ status_t SurfaceTexture::releaseBufferLocked(int buf, EGLDisplay display,
return err;
}

#ifdef DECIDE_TEXTURE_TARGET
status_t SurfaceTexture::updateTexImage(BufferRejecter* rejecter, bool skipSync, bool isComposition) {
#else
status_t SurfaceTexture::updateTexImage(BufferRejecter* rejecter, bool skipSync) {
#endif
ATRACE_CALL();
ST_LOGV("updateTexImage");
Mutex::Autolock lock(mMutex);
@@ -254,6 +258,28 @@ status_t SurfaceTexture::updateTexImage(BufferRejecter* rejecter, bool skipSync)
}

EGLImageKHR image = mEglSlots[buf].mEglImage;
#ifdef DECIDE_TEXTURE_TARGET
// GPU is not efficient in handling GL_TEXTURE_EXTERNAL_OES
// texture target. Depending on the image format, decide,
// the texture target to be used

if(isComposition){
switch (mSlots[buf].mGraphicBuffer->format) {
case HAL_PIXEL_FORMAT_RGBA_8888:
case HAL_PIXEL_FORMAT_RGBX_8888:
case HAL_PIXEL_FORMAT_RGB_888:
case HAL_PIXEL_FORMAT_RGB_565:
case HAL_PIXEL_FORMAT_BGRA_8888:
case HAL_PIXEL_FORMAT_RGBA_5551:
case HAL_PIXEL_FORMAT_RGBA_4444:
mTexTarget = GL_TEXTURE_2D;
break;
default:
mTexTarget = GL_TEXTURE_EXTERNAL_OES;
break;
}
}
#endif
glBindTexture(mTexTarget, mTexName);
glEGLImageTargetTexture2DOES(mTexTarget, (GLeglImageOES)image);

@@ -46,6 +46,10 @@ ifneq ($(NUM_FRAMEBUFFER_SURFACE_BUFFERS),)
LOCAL_CFLAGS += -DNUM_FRAMEBUFFER_SURFACE_BUFFERS=$(NUM_FRAMEBUFFER_SURFACE_BUFFERS)
endif

ifeq ($(BOARD_ADRENO_DECIDE_TEXTURE_TARGET),true)
LOCAL_CFLAGS += -DDECIDE_TEXTURE_TARGET
endif

LOCAL_SHARED_LIBRARIES := \
libcutils \
libdl \
@@ -233,17 +233,16 @@ HWComposer::HWComposer(
loadFbHalModule();
loadHwcModule();

if (mFbDev && mHwc && hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)) {
// close FB HAL if we don't needed it.
// FIXME: this is temporary until we're not forced to open FB HAL
// before HWC.
framebuffer_close(mFbDev);
mFbDev = NULL;
}

// If we have no HWC, or a pre-1.1 HWC, an FB dev is mandatory.
if ((!mHwc || !hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1))
&& !mFbDev) {
if (mHwc && hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)) {
if (mFbDev) {
// close FB HAL if we don't needed it.
// FIXME: this is temporary until we're not forced to open FB HAL
// before HWC.
framebuffer_close(mFbDev);
mFbDev = NULL;
}
} else if (!mFbDev) {
// If we have no HWC, or a pre-1.1 HWC, an FB dev is mandatory.
ALOGE("ERROR: failed to open framebuffer, aborting");
abort();
}

0 comments on commit 1399ec2

Please sign in to comment.
You can’t perform that action at this time.