Merge "remove dead/usnused code"
diff --git a/include/ui/GraphicLog.h b/include/ui/GraphicLog.h
deleted file mode 100644
index ee1b09a..0000000
--- a/include/ui/GraphicLog.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2010 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 _UI_GRAPHIC_LOG_H
-#define _UI_GRAPHIC_LOG_H
-
-#include <utils/Singleton.h>
-#include <cutils/compiler.h>
-
-namespace android {
-
-class GraphicLog : public Singleton<GraphicLog>
-{
-    int32_t mEnabled;
-    static void logImpl(int32_t tag, int32_t buffer);
-    static void logImpl(int32_t tag, int32_t identity, int32_t buffer);
-
-public:
-    enum {
-        SF_APP_DEQUEUE_BEFORE   = 60100,
-        SF_APP_DEQUEUE_AFTER    = 60101,
-        SF_APP_LOCK_BEFORE      = 60102,
-        SF_APP_LOCK_AFTER       = 60103,
-        SF_APP_QUEUE            = 60104,
-
-        SF_REPAINT              = 60105,
-        SF_COMPOSITION_COMPLETE = 60106,
-        SF_UNLOCK_CLIENTS       = 60107,
-        SF_SWAP_BUFFERS         = 60108,
-        SF_REPAINT_DONE         = 60109,
-
-        SF_FB_POST_BEFORE       = 60110,
-        SF_FB_POST_AFTER        = 60111,
-        SF_FB_DEQUEUE_BEFORE    = 60112,
-        SF_FB_DEQUEUE_AFTER     = 60113,
-        SF_FB_LOCK_BEFORE       = 60114,
-        SF_FB_LOCK_AFTER        = 60115,
-    };
-
-    inline void log(int32_t tag, int32_t buffer) {
-        if (CC_UNLIKELY(mEnabled))
-            logImpl(tag, buffer);
-    }
-    inline void log(int32_t tag, int32_t identity, int32_t buffer) {
-        if (CC_UNLIKELY(mEnabled))
-            logImpl(tag, identity, buffer);
-    }
-
-    GraphicLog();
-
-    void setEnabled(bool enable);
-};
-
-}
-
-#endif // _UI_GRAPHIC_LOG_H
-
diff --git a/libs/ui/Android.mk b/libs/ui/Android.mk
index fbabfc4..f8b4452 100644
--- a/libs/ui/Android.mk
+++ b/libs/ui/Android.mk
@@ -47,7 +47,6 @@
 	GraphicBuffer.cpp \
 	GraphicBufferAllocator.cpp \
 	GraphicBufferMapper.cpp \
-	GraphicLog.cpp \
 	InputTransport.cpp \
 	PixelFormat.cpp \
 	Rect.cpp \
diff --git a/libs/ui/FramebufferNativeWindow.cpp b/libs/ui/FramebufferNativeWindow.cpp
index f5ed981..d1dca0c 100644
--- a/libs/ui/FramebufferNativeWindow.cpp
+++ b/libs/ui/FramebufferNativeWindow.cpp
@@ -29,7 +29,6 @@
 
 #include <ui/Rect.h>
 #include <ui/FramebufferNativeWindow.h>
-#include <ui/GraphicLog.h>
 
 #include <EGL/egl.h>
 
@@ -211,9 +210,6 @@
     if (self->mBufferHead >= self->mNumBuffers)
         self->mBufferHead = 0;
 
-    GraphicLog& logger(GraphicLog::getInstance());
-    logger.log(GraphicLog::SF_FB_DEQUEUE_BEFORE, index);
-
     // wait for a free buffer
     while (!self->mNumFreeBuffers) {
         self->mCondition.wait(self->mutex);
@@ -224,7 +220,6 @@
 
     *buffer = self->buffers[index].get();
 
-    logger.log(GraphicLog::SF_FB_DEQUEUE_AFTER, index);
     return 0;
 }
 
@@ -235,16 +230,12 @@
     Mutex::Autolock _l(self->mutex);
 
     const int index = self->mCurrentBufferIndex;
-    GraphicLog& logger(GraphicLog::getInstance());
-    logger.log(GraphicLog::SF_FB_LOCK_BEFORE, index);
 
     // wait that the buffer we're locking is not front anymore
     while (self->front == buffer) {
         self->mCondition.wait(self->mutex);
     }
 
-    logger.log(GraphicLog::SF_FB_LOCK_AFTER, index);
-
     return NO_ERROR;
 }
 
@@ -257,13 +248,7 @@
     buffer_handle_t handle = static_cast<NativeBuffer*>(buffer)->handle;
 
     const int index = self->mCurrentBufferIndex;
-    GraphicLog& logger(GraphicLog::getInstance());
-    logger.log(GraphicLog::SF_FB_POST_BEFORE, index);
-
     int res = fb->post(fb, handle);
-
-    logger.log(GraphicLog::SF_FB_POST_AFTER, index);
-
     self->front = static_cast<NativeBuffer*>(buffer);
     self->mNumFreeBuffers++;
     self->mCondition.broadcast();
diff --git a/libs/ui/GraphicLog.cpp b/libs/ui/GraphicLog.cpp
deleted file mode 100644
index 7ba2779..0000000
--- a/libs/ui/GraphicLog.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <cutils/log.h>
-#include <cutils/properties.h>
-#include <utils/Endian.h>
-#include <utils/Timers.h>
-
-#include <ui/GraphicLog.h>
-
-namespace android {
-
-ANDROID_SINGLETON_STATIC_INSTANCE(GraphicLog)
-
-static inline
-void writeInt32(uint8_t* base, size_t& pos, int32_t value) {
-#ifdef HAVE_LITTLE_ENDIAN
-    int32_t v = value;
-#else
-    int32_t v = htole32(value);
-#endif
-    base[pos] = EVENT_TYPE_INT;
-    memcpy(&base[pos+1], &v, sizeof(int32_t));
-    pos += 1+sizeof(int32_t);
-}
-
-static inline
-void writeInt64(uint8_t* base,  size_t& pos, int64_t value) {
-#ifdef HAVE_LITTLE_ENDIAN
-    int64_t v = value;
-#else
-    int64_t v = htole64(value);
-#endif
-    base[pos] = EVENT_TYPE_LONG;
-    memcpy(&base[pos+1], &v, sizeof(int64_t));
-    pos += 1+sizeof(int64_t);
-}
-
-void GraphicLog::logImpl(int32_t tag, int32_t buffer)
-{
-    uint8_t scratch[2 + 2 + sizeof(int32_t) + sizeof(int64_t)];
-    size_t pos = 0;
-    scratch[pos++] = EVENT_TYPE_LIST;
-    scratch[pos++] = 2;
-    writeInt32(scratch, pos, buffer);
-    writeInt64(scratch, pos, ns2ms( systemTime( SYSTEM_TIME_MONOTONIC ) ));
-    android_bWriteLog(tag, scratch, sizeof(scratch));
-}
-
-void GraphicLog::logImpl(int32_t tag, int32_t identity, int32_t buffer)
-{
-    uint8_t scratch[2 + 3 + sizeof(int32_t) + sizeof(int32_t) + sizeof(int64_t)];
-    size_t pos = 0;
-    scratch[pos++] = EVENT_TYPE_LIST;
-    scratch[pos++] = 3;
-    writeInt32(scratch, pos, buffer);
-    writeInt32(scratch, pos, identity);
-    writeInt64(scratch, pos, ns2ms( systemTime( SYSTEM_TIME_MONOTONIC ) ));
-    android_bWriteLog(tag, scratch, sizeof(scratch));
-}
-
-GraphicLog::GraphicLog()
-    : mEnabled(0)
-{
-    char property[PROPERTY_VALUE_MAX];
-    if (property_get("debug.graphic_log", property, NULL) > 0) {
-        mEnabled = atoi(property);
-    }
-}
-
-void GraphicLog::setEnabled(bool enable)
-{
-    mEnabled = enable;
-}
-
-}
diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp b/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
index cf131b1..438a6da 100644
--- a/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
+++ b/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
@@ -384,10 +384,6 @@
     return mNativeWindow->compositionComplete();
 }
 
-int DisplayHardware::getCurrentBufferIndex() const {
-    return mNativeWindow->getCurrentBufferIndex();
-}
-
 void DisplayHardware::flip(const Region& dirty) const
 {
     checkGLErrors();
diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardware.h b/services/surfaceflinger/DisplayHardware/DisplayHardware.h
index 45d4b45..77da272 100644
--- a/services/surfaceflinger/DisplayHardware/DisplayHardware.h
+++ b/services/surfaceflinger/DisplayHardware/DisplayHardware.h
@@ -93,9 +93,6 @@
     }
     inline Rect bounds() const { return getBounds(); }
 
-    // only for debugging
-    int getCurrentBufferIndex() const;
-
 private:
     void init(uint32_t displayIndex) __attribute__((noinline));
     void fini() __attribute__((noinline));
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index bbb30b0..42ae408 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -41,7 +41,6 @@
 #include <utils/StopWatch.h>
 
 #include <ui/GraphicBufferAllocator.h>
-#include <ui/GraphicLog.h>
 #include <ui/PixelFormat.h>
 
 #include <pixelflinger/pixelflinger.h>
@@ -431,21 +430,10 @@
     const DisplayHardware& hw(graphicPlane(0).displayHardware());
     if (CC_LIKELY(hw.canDraw())) {
         // repaint the framebuffer (if needed)
-
-        const int index = hw.getCurrentBufferIndex();
-        GraphicLog& logger(GraphicLog::getInstance());
-
-        logger.log(GraphicLog::SF_REPAINT, index);
         handleRepaint();
-
         // inform the h/w that we're done compositing
-        logger.log(GraphicLog::SF_COMPOSITION_COMPLETE, index);
         hw.compositionComplete();
-
-        logger.log(GraphicLog::SF_SWAP_BUFFERS, index);
         postFramebuffer();
-
-        logger.log(GraphicLog::SF_REPAINT_DONE, index);
     } else {
         // pretend we did the post
         hw.compositionComplete();
@@ -1097,23 +1085,6 @@
     }
 }
 
-void SurfaceFlinger::debugShowFPS() const
-{
-    static int mFrameCount;
-    static int mLastFrameCount = 0;
-    static nsecs_t mLastFpsTime = 0;
-    static float mFps = 0;
-    mFrameCount++;
-    nsecs_t now = systemTime();
-    nsecs_t diff = now - mLastFpsTime;
-    if (diff > ms2ns(250)) {
-        mFps =  ((mFrameCount - mLastFrameCount) * float(s2ns(1))) / diff;
-        mLastFpsTime = now;
-        mLastFrameCount = mFrameCount;
-    }
-    // XXX: mFPS has the value we want
- }
-
 status_t SurfaceFlinger::addLayer(const sp<LayerBase>& layer)
 {
     Mutex::Autolock _l(mStateLock);
@@ -1707,11 +1678,6 @@
                 setTransactionFlags(eTransactionNeeded|eTraversalNeeded);
                 return NO_ERROR;
             }
-            case 1006:{ // enable/disable GraphicLog
-                int enabled = data.readInt32();
-                GraphicLog::getInstance().setEnabled(enabled);
-                return NO_ERROR;
-            }
             case 1008:  // toggle use of hw composer
                 n = data.readInt32();
                 mDebugDisableHWC = n ? 1 : 0;
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index ffd3ac9..7f6c90c 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -335,7 +335,6 @@
             status_t electronBeamOnAnimationImplLocked();
 
             void        debugFlashRegions();
-            void        debugShowFPS() const;
             void        drawWormhole() const;