diff options
| -rw-r--r-- | core/jni/android_view_GLES20Canvas.cpp | 2 | ||||
| -rw-r--r-- | libs/hwui/Android.common.mk | 3 | ||||
| -rw-r--r-- | libs/hwui/DeferredDisplayList.cpp | 6 | ||||
| -rw-r--r-- | libs/hwui/DisplayList.cpp | 1 | ||||
| -rw-r--r-- | libs/hwui/DisplayListLogBuffer.cpp | 110 | ||||
| -rw-r--r-- | libs/hwui/DisplayListLogBuffer.h | 57 | ||||
| -rw-r--r-- | libs/hwui/DisplayListRenderer.cpp | 1 | ||||
| -rw-r--r-- | libs/hwui/DisplayListRenderer.h | 1 | ||||
| -rw-r--r-- | libs/hwui/RenderNode.cpp | 25 | ||||
| -rw-r--r-- | libs/hwui/renderthread/RenderProxy.cpp | 16 | ||||
| -rw-r--r-- | libs/hwui/renderthread/RenderProxy.h | 2 |
11 files changed, 15 insertions, 209 deletions
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp index 8249120f606e..72cfd5b4e7d5 100644 --- a/core/jni/android_view_GLES20Canvas.cpp +++ b/core/jni/android_view_GLES20Canvas.cpp @@ -260,7 +260,7 @@ static jboolean android_view_GLES20Canvas_isAvailable(JNIEnv* env, jobject clazz static void android_app_ActivityThread_dumpGraphics(JNIEnv* env, jobject clazz, jobject javaFileDescriptor) { int fd = jniGetFDFromFileDescriptor(env, javaFileDescriptor); - android::uirenderer::renderthread::RenderProxy::outputLogBuffer(fd); + android::uirenderer::renderthread::RenderProxy::dumpGraphicsMemory(fd); } // ---------------------------------------------------------------------------- diff --git a/libs/hwui/Android.common.mk b/libs/hwui/Android.common.mk index 59a47de7ae89..b1673feb1bb8 100644 --- a/libs/hwui/Android.common.mk +++ b/libs/hwui/Android.common.mk @@ -23,7 +23,6 @@ LOCAL_SRC_FILES := \ DisplayList.cpp \ DeferredDisplayList.cpp \ DeferredLayerUpdater.cpp \ - DisplayListLogBuffer.cpp \ DisplayListRenderer.cpp \ Dither.cpp \ DrawProfiler.cpp \ @@ -102,4 +101,4 @@ endif # Defaults for ATRACE_TAG and LOG_TAG for libhwui LOCAL_CFLAGS += -DATRACE_TAG=ATRACE_TAG_VIEW -DLOG_TAG=\"OpenGLRenderer\" -LOCAL_CFLAGS += -Wall -Werror -Wno-unused-parameter -Wunused -Wunreachable-code +LOCAL_CFLAGS += -Wall -Werror -Wno-unused-parameter -Wunreachable-code diff --git a/libs/hwui/DeferredDisplayList.cpp b/libs/hwui/DeferredDisplayList.cpp index a1a7e1a4fecc..c78971a34d33 100644 --- a/libs/hwui/DeferredDisplayList.cpp +++ b/libs/hwui/DeferredDisplayList.cpp @@ -95,7 +95,6 @@ public: DEFER_LOGD("%d replaying DrawBatch %p, with %d ops (batch id %x, merge id %p)", index, this, mOps.size(), getBatchId(), getMergeId()); - DisplayListLogBuffer& logBuffer = DisplayListLogBuffer::getInstance(); for (unsigned int i = 0; i < mOps.size(); i++) { DrawOp* op = mOps[i].op; const DeferredDisplayState* state = mOps[i].state; @@ -104,7 +103,6 @@ public: #if DEBUG_DISPLAY_LIST_OPS_AS_EVENTS renderer.eventMark(op->name()); #endif - logBuffer.writeCommand(0, op->name()); op->applyDraw(renderer, dirty); #if DEBUG_MERGE_BEHAVIOR @@ -261,10 +259,6 @@ public: renderer.setupMergedMultiDraw(mClipSideFlags ? &mClipRect : nullptr); DrawOp* op = mOps[0].op; - DisplayListLogBuffer& buffer = DisplayListLogBuffer::getInstance(); - buffer.writeCommand(0, "multiDraw"); - buffer.writeCommand(1, op->name()); - #if DEBUG_DISPLAY_LIST_OPS_AS_EVENTS renderer.eventMark("multiDraw"); renderer.eventMark(op->name()); diff --git a/libs/hwui/DisplayList.cpp b/libs/hwui/DisplayList.cpp index 9832e607989f..317e395a852a 100644 --- a/libs/hwui/DisplayList.cpp +++ b/libs/hwui/DisplayList.cpp @@ -24,7 +24,6 @@ #include "Debug.h" #include "DisplayList.h" #include "DisplayListOp.h" -#include "DisplayListLogBuffer.h" namespace android { namespace uirenderer { diff --git a/libs/hwui/DisplayListLogBuffer.cpp b/libs/hwui/DisplayListLogBuffer.cpp deleted file mode 100644 index 23b6cff8dd02..000000000000 --- a/libs/hwui/DisplayListLogBuffer.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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. - */ - -#include "DisplayListLogBuffer.h" - -// BUFFER_SIZE size must be one more than a multiple of COMMAND_SIZE to ensure -// that mStart always points at the next command, not just the next item -#define NUM_COMMANDS 50 -#define BUFFER_SIZE ((NUM_COMMANDS) + 1) - -/** - * DisplayListLogBuffer is a utility class which logs the most recent display - * list operations in a circular buffer. The log is process-wide, because we - * only care about the most recent operations, not the operations on a per-window - * basis for a given activity. The purpose of the log is to provide more debugging - * information in a bug report, by telling us not just where a process hung (which - * generally is just reported as a stack trace at the Java level) or crashed, but - * also what happened immediately before that hang or crash. This may help track down - * problems in the native rendering code or driver interaction related to the display - * list operations that led up to the hang or crash. - * - * The log is implemented as a circular buffer for both space and performance - * reasons - we only care about the last several operations to give us context - * leading up to the problem, and we don't want to constantly copy data around or do - * additional mallocs to keep the most recent operations logged. Only numbers are - * logged to make the operation fast. If and when the log is output, we process this - * data into meaningful strings. - * - * There is an assumption about the format of the command (currently 2 ints: the - * opcode and the nesting level). If the type of information logged changes (for example, - * we may want to save a timestamp), then the size of the buffer and the way the - * information is recorded in writeCommand() should change to suit. - */ - -namespace android { - -using namespace uirenderer; -ANDROID_SINGLETON_STATIC_INSTANCE(DisplayListLogBuffer); - -namespace uirenderer { - - -DisplayListLogBuffer::DisplayListLogBuffer() { - mBufferFirst = (OpLog*) malloc(BUFFER_SIZE * sizeof(OpLog)); - mStart = mBufferFirst; - mBufferLast = mBufferFirst + BUFFER_SIZE - 1; - mEnd = mStart; -} - -DisplayListLogBuffer::~DisplayListLogBuffer() { - free(mBufferFirst); -} - -/** - * Called from DisplayListRenderer to output the current buffer into the - * specified FILE. This only happens in a dumpsys/bugreport operation. - */ -void DisplayListLogBuffer::outputCommands(FILE *file) -{ - OpLog* tmpBufferPtr = mStart; - while (true) { - if (tmpBufferPtr == mEnd) { - break; - } - - fprintf(file, "%*s%s\n", 2 * tmpBufferPtr->level, "", tmpBufferPtr->label); - - tmpBufferPtr++; - if (tmpBufferPtr > mBufferLast) { - tmpBufferPtr = mBufferFirst; - } - } -} - -/** - * Store the given level and label in the buffer and increment/wrap the mEnd - * and mStart values as appropriate. Label should point to static memory. - */ -void DisplayListLogBuffer::writeCommand(int level, const char* label) { - mEnd->level = level; - mEnd->label = label; - - if (mEnd == mBufferLast) { - mEnd = mBufferFirst; - } else { - mEnd++; - } - if (mEnd == mStart) { - mStart++; - if (mStart > mBufferLast) { - mStart = mBufferFirst; - } - } -} - -}; // namespace uirenderer -}; // namespace android diff --git a/libs/hwui/DisplayListLogBuffer.h b/libs/hwui/DisplayListLogBuffer.h deleted file mode 100644 index c884789e7f40..000000000000 --- a/libs/hwui/DisplayListLogBuffer.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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_HWUI_DISPLAY_LIST_LOG_BUFFER_H -#define ANDROID_HWUI_DISPLAY_LIST_LOG_BUFFER_H - -#include <utils/Singleton.h> - -#include <stdio.h> - -namespace android { -namespace uirenderer { - -class DisplayListLogBuffer: public Singleton<DisplayListLogBuffer> { - DisplayListLogBuffer(); - ~DisplayListLogBuffer(); - - friend class Singleton<DisplayListLogBuffer>; - -public: - void writeCommand(int level, const char* label); - void outputCommands(FILE *file); - - bool isEmpty() { - return (mStart == mEnd); - } - - struct OpLog { - int level; - const char* label; - }; - -private: - OpLog* mBufferFirst; // where the memory starts - OpLog* mStart; // where the current command stream starts - OpLog* mEnd; // where the current commands end - OpLog* mBufferLast; // where the buffer memory ends - -}; - -}; // namespace uirenderer -}; // namespace android - -#endif // ANDROID_HWUI_DISPLAY_LIST_LOG_BUFFER_H diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp index c7de03aeafe8..d98d744d9e5a 100644 --- a/libs/hwui/DisplayListRenderer.cpp +++ b/libs/hwui/DisplayListRenderer.cpp @@ -24,7 +24,6 @@ #include "ResourceCache.h" #include "DeferredDisplayList.h" #include "DeferredLayerUpdater.h" -#include "DisplayListLogBuffer.h" #include "DisplayListOp.h" #include "DisplayListRenderer.h" #include "RenderNode.h" diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h index 631290d3dc81..d2b3ead4531d 100644 --- a/libs/hwui/DisplayListRenderer.h +++ b/libs/hwui/DisplayListRenderer.h @@ -28,7 +28,6 @@ #include "Canvas.h" #include "CanvasState.h" #include "DisplayList.h" -#include "DisplayListLogBuffer.h" #include "RenderNode.h" #include "Renderer.h" #include "ResourceCache.h" diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index 23462cccc071..a0a5a1c1a21a 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -29,7 +29,6 @@ #include "DamageAccumulator.h" #include "Debug.h" #include "DisplayListOp.h" -#include "DisplayListLogBuffer.h" #include "LayerRenderer.h" #include "OpenGLRenderer.h" #include "TreeInfo.h" @@ -40,28 +39,6 @@ namespace android { namespace uirenderer { -void RenderNode::outputLogBuffer(int fd) { - DisplayListLogBuffer& logBuffer = DisplayListLogBuffer::getInstance(); - if (logBuffer.isEmpty()) { - return; - } - - FILE *file = fdopen(fd, "a"); - - fprintf(file, "\nRecent DisplayList operations\n"); - logBuffer.outputCommands(file); - - if (Caches::hasInstance()) { - String8 cachesLog; - Caches::getInstance().dumpMemoryUsage(cachesLog); - fprintf(file, "\nCaches:\n%s\n", cachesLog.string()); - } else { - fprintf(file, "\nNo caches instance.\n"); - } - - fflush(file); -} - void RenderNode::debugDumpLayers(const char* prefix) { if (mLayer) { ALOGD("%sNode %p (%s) has layer %p (fbo = %u, wasBuildLayered = %s)", @@ -910,7 +887,6 @@ void RenderNode::issueOperations(OpenGLRenderer& renderer, T& handler) { } else { const int saveCountOffset = renderer.getSaveCount() - 1; const int projectionReceiveIndex = mDisplayListData->projectionReceiveIndex; - DisplayListLogBuffer& logBuffer = DisplayListLogBuffer::getInstance(); for (size_t chunkIndex = 0; chunkIndex < mDisplayListData->getChunks().size(); chunkIndex++) { const DisplayListData::Chunk& chunk = mDisplayListData->getChunks()[chunkIndex]; @@ -926,7 +902,6 @@ void RenderNode::issueOperations(OpenGLRenderer& renderer, T& handler) { #if DEBUG_DISPLAY_LIST op->output(level + 1); #endif - logBuffer.writeCommand(level, op->name()); handler(op, saveCountOffset, properties().getClipToBounds()); if (CC_UNLIKELY(!mProjectedNodes.isEmpty() && projectionReceiveIndex >= 0 && diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp index 35f551286f91..4dc4248e443a 100644 --- a/libs/hwui/renderthread/RenderProxy.cpp +++ b/libs/hwui/renderthread/RenderProxy.cpp @@ -387,13 +387,21 @@ void RenderProxy::dumpProfileInfo(int fd) { postAndWait(task); } -CREATE_BRIDGE1(outputLogBuffer, int fd) { - RenderNode::outputLogBuffer(args->fd); +CREATE_BRIDGE1(dumpGraphicsMemory, int fd) { + FILE *file = fdopen(args->fd, "a"); + if (Caches::hasInstance()) { + String8 cachesLog; + Caches::getInstance().dumpMemoryUsage(cachesLog); + fprintf(file, "\nCaches:\n%s\n", cachesLog.string()); + } else { + fprintf(file, "\nNo caches instance.\n"); + } + fflush(file); return nullptr; } -void RenderProxy::outputLogBuffer(int fd) { - SETUP_TASK(outputLogBuffer); +void RenderProxy::dumpGraphicsMemory(int fd) { + SETUP_TASK(dumpGraphicsMemory); args->fd = fd; staticPostAndWait(task); } diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h index fd1fe05ffbdb..d87e777a3b48 100644 --- a/libs/hwui/renderthread/RenderProxy.h +++ b/libs/hwui/renderthread/RenderProxy.h @@ -96,7 +96,7 @@ public: ANDROID_API void notifyFramePending(); ANDROID_API void dumpProfileInfo(int fd); - ANDROID_API static void outputLogBuffer(int fd); + ANDROID_API static void dumpGraphicsMemory(int fd); ANDROID_API void setTextureAtlas(const sp<GraphicBuffer>& buffer, int64_t* map, size_t size); |