Revert "merge various SF fixes from gingerbread to honeycomb-mr2" (DO NOT MERGE)

Also revert all dependent changes:
This reverts commit 8e18668d14adf601cbe5973030c310ec23d88461.
This reverts commit 69b4587bfbb3e98f793959d9123340360fa233a2.
This reverts commit a9c9a4baf24700e8817d47d8ea8da1742caea0b5.
This reverts commit 2c0042b666a969091c931614f2fc0dce2f1cfac8.
This reverts commit f6c8206735e7e078461e5f2aef6e1a1446fdd075.
This reverts commit 24855c09173a6caaec7dcedd0c2d7ce15121d39b.

Change-Id: I33e699640f3f59e42fa03c99a9a1b7af0d27d4d8
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 731d82b..517c335 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -145,6 +145,18 @@
     return sur;
 }
 
+status_t Layer::ditch()
+{
+    // NOTE: Called from the main UI thread
+
+    // the layer is not on screen anymore. free as much resources as possible
+    mFreezeLock.clear();
+
+    Mutex::Autolock _l(mLock);
+    mWidth = mHeight = 0;
+    return NO_ERROR;
+}
+
 status_t Layer::setBuffers( uint32_t w, uint32_t h,
                             PixelFormat format, uint32_t flags)
 {