Merge "SurfaceTexture: add context attach & detach"
diff --git a/include/gui/BufferQueue.h b/include/gui/BufferQueue.h
index 99776b5..a808216 100644
--- a/include/gui/BufferQueue.h
+++ b/include/gui/BufferQueue.h
@@ -128,11 +128,9 @@
// (zero point, etc) are client-dependent and should be documented by the
// client.
virtual status_t queueBuffer(int buf, int64_t timestamp,
+ const Rect& crop, int scalingMode, uint32_t transform,
uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform);
virtual void cancelBuffer(int buf);
- virtual status_t setCrop(const Rect& reg);
- virtual status_t setTransform(uint32_t transform);
- virtual status_t setScalingMode(int mode);
// setSynchronousMode set whether dequeueBuffer is synchronous or
// asynchronous. In synchronous mode, dequeueBuffer blocks until
@@ -180,18 +178,13 @@
// if no buffer has been allocated.
sp<GraphicBuffer> mGraphicBuffer;
- // mCrop is the current crop rectangle for this buffer slot. This gets
- // set to mNextCrop each time queueBuffer gets called for this buffer.
+ // mCrop is the current crop rectangle for this buffer slot.
Rect mCrop;
- // mTransform is the current transform flags for this buffer slot. This
- // gets set to mNextTransform each time queueBuffer gets called for this
- // slot.
+ // mTransform is the current transform flags for this buffer slot.
uint32_t mTransform;
- // mScalingMode is the current scaling mode for this buffer slot. This
- // gets set to mNextScalingMode each time queueBuffer gets called for
- // this slot.
+ // mScalingMode is the current scaling mode for this buffer slot.
uint32_t mScalingMode;
// mTimestamp is the current timestamp for this buffer slot. This gets
@@ -359,18 +352,13 @@
// needed but useful for debugging and catching client bugs.
bool mRequestBufferCalled;
- // mCrop is the current crop rectangle for this buffer slot. This gets
- // set to mNextCrop each time queueBuffer gets called for this buffer.
+ // mCrop is the current crop rectangle for this buffer slot.
Rect mCrop;
- // mTransform is the current transform flags for this buffer slot. This
- // gets set to mNextTransform each time queueBuffer gets called for this
- // slot.
+ // mTransform is the current transform flags for this buffer slot.
uint32_t mTransform;
- // mScalingMode is the current scaling mode for this buffer slot. This
- // gets set to mNextScalingMode each time queueBuffer gets called for
- // this slot.
+ // mScalingMode is the current scaling mode for this buffer slot.
uint32_t mScalingMode;
// mTimestamp is the current timestamp for this buffer slot. This gets
@@ -422,18 +410,6 @@
// mServerBufferCount buffer count requested by the server-side
int mServerBufferCount;
- // mNextCrop is the crop rectangle that will be used for the next buffer
- // that gets queued. It is set by calling setCrop.
- Rect mNextCrop;
-
- // mNextTransform is the transform identifier that will be used for the next
- // buffer that gets queued. It is set by calling setTransform.
- uint32_t mNextTransform;
-
- // mNextScalingMode is the scaling mode that will be used for the next
- // buffers that get queued. It is set by calling setScalingMode.
- int mNextScalingMode;
-
// mGraphicBufferAlloc is the connection to SurfaceFlinger that is used to
// allocate new GraphicBuffer objects.
sp<IGraphicBufferAlloc> mGraphicBufferAlloc;
diff --git a/include/gui/DummyConsumer.h b/include/gui/DummyConsumer.h
index 6fc8da7..7fe4d40 100644
--- a/include/gui/DummyConsumer.h
+++ b/include/gui/DummyConsumer.h
@@ -25,14 +25,11 @@
// The DummyConsumer does not keep a reference to BufferQueue
// unlike SurfaceTexture. This prevents a circular reference from
-// forming. The BufferQueue indirectly keeps a DummyConsumer alive
-// through the proxy ConsumerListener.
-class DummyConsumer : public virtual RefBase,
- protected BufferQueue::ConsumerListener {
+// forming without having to use a ProxyConsumerListener
+class DummyConsumer : public BufferQueue::ConsumerListener {
public:
- DummyConsumer(sp<BufferQueue> bufferQueue);
+ DummyConsumer();
virtual ~DummyConsumer();
-
protected:
// Implementation of the BufferQueue::ConsumerListener interface. These
diff --git a/include/gui/ISurfaceTexture.h b/include/gui/ISurfaceTexture.h
index 50626a0..b31fdaf 100644
--- a/include/gui/ISurfaceTexture.h
+++ b/include/gui/ISurfaceTexture.h
@@ -83,6 +83,7 @@
// and height of the window and current transform applied to buffers,
// respectively.
virtual status_t queueBuffer(int slot, int64_t timestamp,
+ const Rect& crop, int scalingMode, uint32_t transform,
uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) = 0;
// cancelBuffer indicates that the client does not wish to fill in the
@@ -90,10 +91,6 @@
// the server.
virtual void cancelBuffer(int slot) = 0;
- virtual status_t setCrop(const Rect& reg) = 0;
- virtual status_t setTransform(uint32_t transform) = 0;
- virtual status_t setScalingMode(int mode) = 0;
-
// query retrieves some information for this surface
// 'what' tokens allowed are that of android_natives.h
virtual int query(int what, int* value) = 0;
diff --git a/include/gui/SurfaceTextureClient.h b/include/gui/SurfaceTextureClient.h
index f86e8fd..b68fa81 100644
--- a/include/gui/SurfaceTextureClient.h
+++ b/include/gui/SurfaceTextureClient.h
@@ -129,8 +129,8 @@
// operation. It is initialized to 1.
uint32_t mReqWidth;
- // mReqHeight is the buffer height that will be requested at the next deuque
- // operation. It is initialized to 1.
+ // mReqHeight is the buffer height that will be requested at the next
+ // dequeue operation. It is initialized to 1.
uint32_t mReqHeight;
// mReqFormat is the buffer pixel format that will be requested at the next
@@ -146,6 +146,18 @@
// a timestamp is auto-generated when queueBuffer is called.
int64_t mTimestamp;
+ // mCrop is the crop rectangle that will be used for the next buffer
+ // that gets queued. It is set by calling setCrop.
+ Rect mCrop;
+
+ // mScalingMode is the scaling mode that will be used for the next
+ // buffers that get queued. It is set by calling setScalingMode.
+ int mScalingMode;
+
+ // mTransform is the transform identifier that will be used for the next
+ // buffer that gets queued. It is set by calling setTransform.
+ uint32_t mTransform;
+
// mDefaultWidth is default width of the window, regardless of the
// native_window_set_buffers_dimensions call
uint32_t mDefaultWidth;
diff --git a/include/powermanager/IPowerManager.h b/include/powermanager/IPowerManager.h
new file mode 100644
index 0000000..1723f04
--- /dev/null
+++ b/include/powermanager/IPowerManager.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_IPOWERMANAGER_H
+#define ANDROID_IPOWERMANAGER_H
+
+#include <utils/Errors.h>
+#include <binder/IInterface.h>
+
+namespace android {
+
+// ----------------------------------------------------------------------------
+
+// must be kept in sync with interface defined in IPowerManager.aidl
+class IPowerManager : public IInterface
+{
+public:
+ DECLARE_META_INTERFACE(PowerManager);
+
+ virtual status_t acquireWakeLock(int flags, const sp<IBinder>& lock, const String16& tag) = 0;
+ virtual status_t releaseWakeLock(const sp<IBinder>& lock, int flags) = 0;
+};
+
+// ----------------------------------------------------------------------------
+
+}; // namespace android
+
+#endif // ANDROID_IPOWERMANAGER_H
diff --git a/include/powermanager/PowerManager.h b/include/powermanager/PowerManager.h
new file mode 100644
index 0000000..4590174
--- /dev/null
+++ b/include/powermanager/PowerManager.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_POWERMANAGER_H
+#define ANDROID_POWERMANAGER_H
+
+namespace android {
+
+// must be kept in sync with definitions in PowerManager.java
+enum {
+ POWERMANAGER_PARTIAL_WAKE_LOCK = 1, // equals PowerManager.PARTIAL_WAKE_LOCK constant
+};
+
+}; // namespace android
+
+#endif // ANDROID_POWERMANAGER_H
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp
index ffc5fa0..1762a4a 100644
--- a/libs/gui/BufferQueue.cpp
+++ b/libs/gui/BufferQueue.cpp
@@ -76,8 +76,6 @@
mBufferCount(MIN_ASYNC_BUFFER_SLOTS),
mClientBufferCount(0),
mServerBufferCount(MIN_ASYNC_BUFFER_SLOTS),
- mNextTransform(0),
- mNextScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE),
mSynchronousMode(false),
mAllowSynchronousMode(allowSynchronousMode),
mConnectedApi(NO_CONNECTED_API),
@@ -94,7 +92,6 @@
ST_LOGV("BufferQueue");
sp<ISurfaceComposer> composer(ComposerService::getComposerService());
mGraphicBufferAlloc = composer->createGraphicBufferAlloc();
- mNextCrop.makeInvalid();
}
BufferQueue::~BufferQueue() {
@@ -454,9 +451,6 @@
mSlots[buf].mFence = EGL_NO_SYNC_KHR;
mSlots[buf].mEglDisplay = EGL_NO_DISPLAY;
-
-
-
returnFlags |= ISurfaceTexture::BUFFER_NEEDS_REALLOCATION;
}
@@ -476,7 +470,6 @@
ALOGE("dequeueBuffer: timeout waiting for fence");
}
eglDestroySyncKHR(dpy, fence);
-
}
ST_LOGV("dequeueBuffer: returning slot=%d buf=%p flags=%#x", *outBuf,
@@ -518,6 +511,7 @@
}
status_t BufferQueue::queueBuffer(int buf, int64_t timestamp,
+ const Rect& crop, int scalingMode, uint32_t transform,
uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
ATRACE_CALL();
ATRACE_BUFFER_INDEX(buf);
@@ -571,10 +565,20 @@
}
}
+ switch (scalingMode) {
+ case NATIVE_WINDOW_SCALING_MODE_FREEZE:
+ case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW:
+ break;
+ default:
+ ST_LOGE("unknown scaling mode: %d (ignoring)", scalingMode);
+ scalingMode = mSlots[buf].mScalingMode;
+ break;
+ }
+
mSlots[buf].mBufferState = BufferSlot::QUEUED;
- mSlots[buf].mCrop = mNextCrop;
- mSlots[buf].mTransform = mNextTransform;
- mSlots[buf].mScalingMode = mNextScalingMode;
+ mSlots[buf].mCrop = crop;
+ mSlots[buf].mTransform = transform;
+ mSlots[buf].mScalingMode = scalingMode;
mSlots[buf].mTimestamp = timestamp;
mFrameCounter++;
mSlots[buf].mFrameNumber = mFrameCounter;
@@ -620,50 +624,6 @@
mDequeueCondition.broadcast();
}
-status_t BufferQueue::setCrop(const Rect& crop) {
- ATRACE_CALL();
- ST_LOGV("setCrop: crop=[%d,%d,%d,%d]", crop.left, crop.top, crop.right,
- crop.bottom);
-
- Mutex::Autolock lock(mMutex);
- if (mAbandoned) {
- ST_LOGE("setCrop: BufferQueue has been abandoned!");
- return NO_INIT;
- }
- mNextCrop = crop;
- return OK;
-}
-
-status_t BufferQueue::setTransform(uint32_t transform) {
- ATRACE_CALL();
- ST_LOGV("setTransform: xform=%#x", transform);
- Mutex::Autolock lock(mMutex);
- if (mAbandoned) {
- ST_LOGE("setTransform: BufferQueue has been abandoned!");
- return NO_INIT;
- }
- mNextTransform = transform;
- return OK;
-}
-
-status_t BufferQueue::setScalingMode(int mode) {
- ATRACE_CALL();
- ST_LOGV("setScalingMode: mode=%d", mode);
-
- switch (mode) {
- case NATIVE_WINDOW_SCALING_MODE_FREEZE:
- case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW:
- break;
- default:
- ST_LOGE("unknown scaling mode: %d", mode);
- return BAD_VALUE;
- }
-
- Mutex::Autolock lock(mMutex);
- mNextScalingMode = mode;
- return OK;
-}
-
status_t BufferQueue::connect(int api,
uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
ATRACE_CALL();
@@ -731,9 +691,6 @@
if (mConnectedApi == api) {
drainQueueAndFreeBuffersLocked();
mConnectedApi = NO_CONNECTED_API;
- mNextCrop.makeInvalid();
- mNextScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE;
- mNextTransform = 0;
mDequeueCondition.broadcast();
listener = mConsumerListener;
} else {
@@ -766,12 +723,6 @@
char* buffer, size_t SIZE) const
{
Mutex::Autolock _l(mMutex);
- snprintf(buffer, SIZE,
- "%snext : {crop=[%d,%d,%d,%d], transform=0x%02x}\n"
- ,prefix, mNextCrop.left, mNextCrop.top, mNextCrop.right,
- mNextCrop.bottom, mNextTransform
- );
- result.append(buffer);
String8 fifo;
int fifoSize = 0;
diff --git a/libs/gui/DummyConsumer.cpp b/libs/gui/DummyConsumer.cpp
index e42aa05..be47e0e 100644
--- a/libs/gui/DummyConsumer.cpp
+++ b/libs/gui/DummyConsumer.cpp
@@ -24,17 +24,8 @@
namespace android {
-DummyConsumer::DummyConsumer(sp<BufferQueue> bufferQueue) {
- wp<BufferQueue::ConsumerListener> listener;
- sp<BufferQueue::ConsumerListener> proxy;
- listener = static_cast<BufferQueue::ConsumerListener*>(this);
- proxy = new BufferQueue::ProxyConsumerListener(listener);
-
- status_t err = bufferQueue->consumerConnect(proxy);
- if (err != NO_ERROR) {
- ALOGE("DummyConsumer: error connecting to BufferQueue: %s (%d)",
- strerror(-err), err);
- }
+DummyConsumer::DummyConsumer() {
+ ALOGV("DummyConsumer");
}
DummyConsumer::~DummyConsumer() {
diff --git a/libs/gui/ISurfaceTexture.cpp b/libs/gui/ISurfaceTexture.cpp
index d2e5627..29c50c9 100644
--- a/libs/gui/ISurfaceTexture.cpp
+++ b/libs/gui/ISurfaceTexture.cpp
@@ -36,13 +36,10 @@
DEQUEUE_BUFFER,
QUEUE_BUFFER,
CANCEL_BUFFER,
- SET_CROP,
- SET_TRANSFORM,
QUERY,
SET_SYNCHRONOUS_MODE,
CONNECT,
DISCONNECT,
- SET_SCALING_MODE,
};
@@ -102,11 +99,15 @@
}
virtual status_t queueBuffer(int buf, int64_t timestamp,
+ const Rect& crop, int scalingMode, uint32_t transform,
uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
Parcel data, reply;
data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
data.writeInt32(buf);
data.writeInt64(timestamp);
+ memcpy(data.writeInplace(sizeof(Rect)), &crop, sizeof(Rect));
+ data.writeInt32(scalingMode);
+ data.writeInt32(transform);
status_t result = remote()->transact(QUEUE_BUFFER, data, &reply);
if (result != NO_ERROR) {
return result;
@@ -125,45 +126,6 @@
remote()->transact(CANCEL_BUFFER, data, &reply);
}
- virtual status_t setCrop(const Rect& reg) {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
- data.writeFloat(reg.left);
- data.writeFloat(reg.top);
- data.writeFloat(reg.right);
- data.writeFloat(reg.bottom);
- status_t result = remote()->transact(SET_CROP, data, &reply);
- if (result != NO_ERROR) {
- return result;
- }
- result = reply.readInt32();
- return result;
- }
-
- virtual status_t setTransform(uint32_t transform) {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
- data.writeInt32(transform);
- status_t result = remote()->transact(SET_TRANSFORM, data, &reply);
- if (result != NO_ERROR) {
- return result;
- }
- result = reply.readInt32();
- return result;
- }
-
- virtual status_t setScalingMode(int mode) {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
- data.writeInt32(mode);
- status_t result = remote()->transact(SET_SCALING_MODE, data, &reply);
- if (result != NO_ERROR) {
- return result;
- }
- result = reply.readInt32();
- return result;
- }
-
virtual int query(int what, int* value) {
Parcel data, reply;
data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
@@ -261,8 +223,12 @@
CHECK_INTERFACE(ISurfaceTexture, data, reply);
int buf = data.readInt32();
int64_t timestamp = data.readInt64();
+ Rect crop( *reinterpret_cast<Rect const *>(data.readInplace(sizeof(Rect))) );
+ int scalingMode = data.readInt32();
+ uint32_t transform = data.readInt32();
uint32_t outWidth, outHeight, outTransform;
status_t result = queueBuffer(buf, timestamp,
+ crop, scalingMode, transform,
&outWidth, &outHeight, &outTransform);
reply->writeInt32(outWidth);
reply->writeInt32(outHeight);
@@ -276,31 +242,6 @@
cancelBuffer(buf);
return NO_ERROR;
} break;
- case SET_CROP: {
- Rect reg;
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
- reg.left = data.readFloat();
- reg.top = data.readFloat();
- reg.right = data.readFloat();
- reg.bottom = data.readFloat();
- status_t result = setCrop(reg);
- reply->writeInt32(result);
- return NO_ERROR;
- } break;
- case SET_TRANSFORM: {
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
- uint32_t transform = data.readInt32();
- status_t result = setTransform(transform);
- reply->writeInt32(result);
- return NO_ERROR;
- } break;
- case SET_SCALING_MODE: {
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
- int mode = data.readInt32();
- status_t result = setScalingMode(mode);
- reply->writeInt32(result);
- return NO_ERROR;
- } break;
case QUERY: {
CHECK_INTERFACE(ISurfaceTexture, data, reply);
int value;
diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp
index b9e870d..6aa81a9 100644
--- a/libs/gui/SurfaceTextureClient.cpp
+++ b/libs/gui/SurfaceTextureClient.cpp
@@ -75,6 +75,9 @@
mReqFormat = 0;
mReqUsage = 0;
mTimestamp = NATIVE_WINDOW_TIMESTAMP_AUTO;
+ mCrop.clear();
+ mScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE;
+ mTransform = 0;
mDefaultWidth = 0;
mDefaultHeight = 0;
mTransformHint = 0;
@@ -245,6 +248,7 @@
return i;
}
status_t err = mSurfaceTexture->queueBuffer(i, timestamp,
+ mCrop, mScalingMode, mTransform,
&mDefaultWidth, &mDefaultHeight, &mTransformHint);
if (err != OK) {
ALOGE("queueBuffer: error queuing buffer to SurfaceTexture, %d", err);
@@ -444,6 +448,9 @@
mReqWidth = 0;
mReqHeight = 0;
mReqUsage = 0;
+ mCrop.clear();
+ mScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE;
+ mTransform = 0;
if (api == NATIVE_WINDOW_API_CPU) {
mConnectedToCpu = false;
}
@@ -463,19 +470,17 @@
{
ATRACE_CALL();
ALOGV("SurfaceTextureClient::setCrop");
- Mutex::Autolock lock(mMutex);
Rect realRect;
if (rect == NULL || rect->isEmpty()) {
- realRect = Rect(0, 0);
+ realRect.clear();
} else {
realRect = *rect;
}
- status_t err = mSurfaceTexture->setCrop(*rect);
- ALOGE_IF(err, "ISurfaceTexture::setCrop(...) returned %s", strerror(-err));
-
- return err;
+ Mutex::Autolock lock(mMutex);
+ mCrop = *rect;
+ return NO_ERROR;
}
int SurfaceTextureClient::setBufferCount(int bufferCount)
@@ -499,7 +504,6 @@
{
ATRACE_CALL();
ALOGV("SurfaceTextureClient::setBuffersDimensions");
- Mutex::Autolock lock(mMutex);
if (w<0 || h<0)
return BAD_VALUE;
@@ -507,25 +511,22 @@
if ((w && !h) || (!w && h))
return BAD_VALUE;
+ Mutex::Autolock lock(mMutex);
mReqWidth = w;
mReqHeight = h;
-
- status_t err = mSurfaceTexture->setCrop(Rect(0, 0));
- ALOGE_IF(err, "ISurfaceTexture::setCrop(...) returned %s", strerror(-err));
-
- return err;
+ mCrop.clear();
+ return NO_ERROR;
}
int SurfaceTextureClient::setBuffersFormat(int format)
{
ALOGV("SurfaceTextureClient::setBuffersFormat");
- Mutex::Autolock lock(mMutex);
if (format<0)
return BAD_VALUE;
+ Mutex::Autolock lock(mMutex);
mReqFormat = format;
-
return NO_ERROR;
}
@@ -533,13 +534,19 @@
{
ATRACE_CALL();
ALOGV("SurfaceTextureClient::setScalingMode(%d)", mode);
- Mutex::Autolock lock(mMutex);
- // mode is validated on the server
- status_t err = mSurfaceTexture->setScalingMode(mode);
- ALOGE_IF(err, "ISurfaceTexture::setScalingMode(%d) returned %s",
- mode, strerror(-err));
- return err;
+ switch (mode) {
+ case NATIVE_WINDOW_SCALING_MODE_FREEZE:
+ case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW:
+ break;
+ default:
+ ALOGE("unknown scaling mode: %d", mode);
+ return BAD_VALUE;
+ }
+
+ Mutex::Autolock lock(mMutex);
+ mScalingMode = mode;
+ return NO_ERROR;
}
int SurfaceTextureClient::setBuffersTransform(int transform)
@@ -547,8 +554,8 @@
ATRACE_CALL();
ALOGV("SurfaceTextureClient::setBuffersTransform");
Mutex::Autolock lock(mMutex);
- status_t err = mSurfaceTexture->setTransform(transform);
- return err;
+ mTransform = transform;
+ return NO_ERROR;
}
int SurfaceTextureClient::setBuffersTimestamp(int64_t timestamp)
diff --git a/libs/gui/tests/Android.mk b/libs/gui/tests/Android.mk
index 55ac133..741534b 100644
--- a/libs/gui/tests/Android.mk
+++ b/libs/gui/tests/Android.mk
@@ -14,7 +14,6 @@
LOCAL_SHARED_LIBRARIES := \
libEGL \
libGLESv2 \
- libandroid \
libbinder \
libcutils \
libgui \
diff --git a/opengl/tests/Android.mk b/opengl/tests/Android.mk
index 5053e7d..071c679 100644
--- a/opengl/tests/Android.mk
+++ b/opengl/tests/Android.mk
@@ -1 +1,39 @@
-include $(call all-subdir-makefiles)
+dirs := \
+ angeles \
+ configdump \
+ EGLTest \
+ fillrate \
+ filter \
+ finish \
+ gl2_basic \
+ gl2_copyTexImage \
+ gl2_yuvtex \
+ gl_basic \
+ gl_perf \
+ gl_yuvtex \
+ gralloc \
+ hwc \
+ include \
+ lib \
+ linetex \
+ swapinterval \
+ textures \
+ tritex \
+
+ifneq ($(TARGET_BUILD_PDK), true)
+dirs += \
+ gl2_cameraeye \
+ gl2_java \
+ gl2_jni \
+ gldual \
+ gl_jni \
+ gl_perfapp \
+ lighting1709 \
+ testFramerate \
+ testLatency \
+ testPauseResume \
+ testViewport \
+
+endif
+
+include $(call all-named-subdir-makefiles, $(dirs))
diff --git a/services/powermanager/Android.mk b/services/powermanager/Android.mk
new file mode 100644
index 0000000..d98b2da
--- /dev/null
+++ b/services/powermanager/Android.mk
@@ -0,0 +1,15 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES:= \
+ IPowerManager.cpp
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libbinder
+
+LOCAL_MODULE:= libpowermanager
+
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/services/powermanager/IPowerManager.cpp b/services/powermanager/IPowerManager.cpp
new file mode 100644
index 0000000..a0f19d4
--- /dev/null
+++ b/services/powermanager/IPowerManager.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "IPowerManager"
+//#define LOG_NDEBUG 0
+#include <utils/Log.h>
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#include <binder/Parcel.h>
+
+#include <powermanager/IPowerManager.h>
+
+namespace android {
+
+// must be kept in sync with IPowerManager.aidl
+enum {
+ ACQUIRE_WAKE_LOCK = IBinder::FIRST_CALL_TRANSACTION,
+ RELEASE_WAKE_LOCK = IBinder::FIRST_CALL_TRANSACTION + 4,
+};
+
+class BpPowerManager : public BpInterface<IPowerManager>
+{
+public:
+ BpPowerManager(const sp<IBinder>& impl)
+ : BpInterface<IPowerManager>(impl)
+ {
+ }
+
+ virtual status_t acquireWakeLock(int flags, const sp<IBinder>& lock, const String16& tag)
+ {
+ Parcel data, reply;
+ data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor());
+
+ data.writeInt32(flags);
+ data.writeStrongBinder(lock);
+ data.writeString16(tag);
+ // no WorkSource passed
+ data.writeInt32(0);
+ return remote()->transact(ACQUIRE_WAKE_LOCK, data, &reply);
+ }
+
+ virtual status_t releaseWakeLock(const sp<IBinder>& lock, int flags)
+ {
+ Parcel data, reply;
+ data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor());
+ data.writeStrongBinder(lock);
+ data.writeInt32(flags);
+ return remote()->transact(RELEASE_WAKE_LOCK, data, &reply);
+ }
+};
+
+IMPLEMENT_META_INTERFACE(PowerManager, "android.os.IPowerManager");
+
+// ----------------------------------------------------------------------------
+
+}; // namespace android
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index fe39584..0b68aa3 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1013,18 +1013,29 @@
drawWormhole();
}
- // FIXME: workaroud for b/6020860
- glEnable(GL_SCISSOR_TEST);
- glScissor(0,0,0,0);
- glClear(GL_COLOR_BUFFER_BIT);
- // end-workaround
-
/*
* and then, render the layers targeted at the framebuffer
*/
+
hwc_layer_t* const cur(hwc.getLayers());
const Vector< sp<LayerBase> >& layers(mVisibleLayersSortedByZ);
size_t count = layers.size();
+
+
+ // FIXME: workaround for b/6020860
+ if (hw.getFlags() & DisplayHardware::BUFFER_PRESERVED) {
+ for (size_t i=0 ; i<count ; i++) {
+ if (cur && (cur[i].compositionType == HWC_FRAMEBUFFER)) {
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(0,0,0,0);
+ glClear(GL_COLOR_BUFFER_BIT);
+ break;
+ }
+ }
+ }
+ // FIXME: bug6020860 for b/6020860
+
+
for (size_t i=0 ; i<count ; i++) {
if (cur && (cur[i].compositionType != HWC_FRAMEBUFFER)) {
continue;
diff --git a/services/surfaceflinger/tests/Android.mk b/services/surfaceflinger/tests/Android.mk
index b655648..e210860 100644
--- a/services/surfaceflinger/tests/Android.mk
+++ b/services/surfaceflinger/tests/Android.mk
@@ -12,7 +12,6 @@
LOCAL_SHARED_LIBRARIES := \
libEGL \
libGLESv2 \
- libandroid \
libbinder \
libcutils \
libgui \