summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-01-26 12:41:02 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-01-26 12:41:02 -0800
commita0f40033c03a0b64538bf1c22f83d3c9a325ff87 (patch)
tree9a9385bf9ff3f266c08ef60f4aa2e4674975d111
parent2c070bae4493cd1976c5086ec4cbf6ce10482742 (diff)
parentd35c6667c8233385f31aa203f486b2cb826bf6be (diff)
downloadframeworks_base-a0f40033c03a0b64538bf1c22f83d3c9a325ff87.zip
frameworks_base-a0f40033c03a0b64538bf1c22f83d3c9a325ff87.tar.gz
frameworks_base-a0f40033c03a0b64538bf1c22f83d3c9a325ff87.tar.bz2
Merge "fix [3385504] Surface flinger hang when adding dim surface" into honeycomb
-rw-r--r--services/java/com/android/server/ScreenRotationAnimation.java2
-rw-r--r--services/surfaceflinger/LayerBase.cpp5
-rw-r--r--services/surfaceflinger/LayerBase.h2
-rw-r--r--services/surfaceflinger/LayerDim.cpp10
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp2
5 files changed, 17 insertions, 4 deletions
diff --git a/services/java/com/android/server/ScreenRotationAnimation.java b/services/java/com/android/server/ScreenRotationAnimation.java
index bef64b3..90318f1 100644
--- a/services/java/com/android/server/ScreenRotationAnimation.java
+++ b/services/java/com/android/server/ScreenRotationAnimation.java
@@ -102,7 +102,7 @@ class ScreenRotationAnimation {
Slog.w(TAG, "Unable to allocate freeze surface", e);
}
- if (false) {
+ if (true) {
try {
int size = mOriginalWidth > mOriginalHeight ? mOriginalWidth : mOriginalHeight;
mBlackSurface = new Surface(session, 0, "BlackSurface",
diff --git a/services/surfaceflinger/LayerBase.cpp b/services/surfaceflinger/LayerBase.cpp
index 464841b..8d83f0b 100644
--- a/services/surfaceflinger/LayerBase.cpp
+++ b/services/surfaceflinger/LayerBase.cpp
@@ -563,10 +563,15 @@ sp<LayerBaseClient::Surface> LayerBaseClient::getSurface()
if (s == 0) {
s = createSurface();
mClientSurface = s;
+ mClientSurfaceBinder = s->asBinder();
}
return s;
}
+wp<IBinder> LayerBaseClient::getSurfaceBinder() const {
+ return mClientSurfaceBinder;
+}
+
sp<LayerBaseClient::Surface> LayerBaseClient::createSurface() const
{
return new Surface(mFlinger, mIdentity,
diff --git a/services/surfaceflinger/LayerBase.h b/services/surfaceflinger/LayerBase.h
index 1a34f52..8ed4749 100644
--- a/services/surfaceflinger/LayerBase.h
+++ b/services/surfaceflinger/LayerBase.h
@@ -285,6 +285,7 @@ public:
virtual ~LayerBaseClient();
sp<Surface> getSurface();
+ wp<IBinder> getSurfaceBinder() const;
virtual sp<Surface> createSurface() const;
virtual sp<LayerBaseClient> getLayerBaseClient() const {
return const_cast<LayerBaseClient*>(this); }
@@ -325,6 +326,7 @@ protected:
private:
mutable Mutex mLock;
mutable wp<Surface> mClientSurface;
+ wp<IBinder> mClientSurfaceBinder;
const wp<Client> mClientRef;
// only read
const uint32_t mIdentity;
diff --git a/services/surfaceflinger/LayerDim.cpp b/services/surfaceflinger/LayerDim.cpp
index 80cc52c..11f8feb 100644
--- a/services/surfaceflinger/LayerDim.cpp
+++ b/services/surfaceflinger/LayerDim.cpp
@@ -67,8 +67,14 @@ void LayerDim::onDraw(const Region& clip) const
const GLfloat alpha = s.alpha/255.0f;
const uint32_t fbHeight = hw.getHeight();
glDisable(GL_DITHER);
- glEnable(GL_BLEND);
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+
+ if (s.alpha == 0xFF) {
+ glDisable(GL_BLEND);
+ } else {
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ }
+
glColor4f(0, 0, 0, alpha);
#if defined(GL_OES_EGL_image_external)
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 291ebc5..87b66ea 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1088,7 +1088,7 @@ status_t SurfaceFlinger::removeLayer_l(const sp<LayerBase>& layerBase)
{
sp<LayerBaseClient> lbc(layerBase->getLayerBaseClient());
if (lbc != 0) {
- mLayerMap.removeItem( lbc->getSurface()->asBinder() );
+ mLayerMap.removeItem( lbc->getSurfaceBinder() );
}
ssize_t index = mCurrentState.layersSortedByZ.remove(layerBase);
if (index >= 0) {