Loading libs/hwui/renderthread/RenderProxy.cpp +15 −1 Original line number Original line Diff line number Diff line Loading @@ -383,8 +383,10 @@ void RenderProxy::notifyFramePending() { mRenderThread.queueAtFront(task); mRenderThread.queueAtFront(task); } } CREATE_BRIDGE3(dumpProfileInfo, CanvasContext* context, int fd, int dumpFlags) { CREATE_BRIDGE4(dumpProfileInfo, CanvasContext* context, RenderThread* thread, int fd, int dumpFlags) { args->context->profiler().dumpData(args->fd); args->context->profiler().dumpData(args->fd); args->thread->jankTracker().dump(args->fd); if (args->dumpFlags & DumpFlags::kFrameStats) { if (args->dumpFlags & DumpFlags::kFrameStats) { args->context->dumpFrames(args->fd); args->context->dumpFrames(args->fd); } } Loading @@ -397,11 +399,23 @@ CREATE_BRIDGE3(dumpProfileInfo, CanvasContext* context, int fd, int dumpFlags) { void RenderProxy::dumpProfileInfo(int fd, int dumpFlags) { void RenderProxy::dumpProfileInfo(int fd, int dumpFlags) { SETUP_TASK(dumpProfileInfo); SETUP_TASK(dumpProfileInfo); args->context = mContext; args->context = mContext; args->thread = &mRenderThread; args->fd = fd; args->fd = fd; args->dumpFlags = dumpFlags; args->dumpFlags = dumpFlags; postAndWait(task); postAndWait(task); } } CREATE_BRIDGE1(resetProfileInfo, CanvasContext* context) { args->context->resetFrameStats(); return nullptr; } void RenderProxy::resetProfileInfo() { SETUP_TASK(resetProfileInfo); args->context = mContext; postAndWait(task); } CREATE_BRIDGE2(dumpGraphicsMemory, int fd, RenderThread* thread) { CREATE_BRIDGE2(dumpGraphicsMemory, int fd, RenderThread* thread) { args->thread->jankTracker().dump(args->fd); args->thread->jankTracker().dump(args->fd); Loading libs/hwui/renderthread/RenderProxy.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -96,6 +96,8 @@ public: ANDROID_API void notifyFramePending(); ANDROID_API void notifyFramePending(); ANDROID_API void dumpProfileInfo(int fd, int dumpFlags); ANDROID_API void dumpProfileInfo(int fd, int dumpFlags); // Not exported, only used for testing void resetProfileInfo(); ANDROID_API static void dumpGraphicsMemory(int fd); ANDROID_API static void dumpGraphicsMemory(int fd); ANDROID_API void setTextureAtlas(const sp<GraphicBuffer>& buffer, int64_t* map, size_t size); ANDROID_API void setTextureAtlas(const sp<GraphicBuffer>& buffer, int64_t* map, size_t size); Loading libs/hwui/tests/TestContext.cpp +4 −1 Original line number Original line Diff line number Diff line Loading @@ -57,6 +57,10 @@ sp<Surface> TestContext::surface() { } } void TestContext::waitForVsync() { void TestContext::waitForVsync() { #if HWUI_NULL_GPU return; #endif // Request vsync // Request vsync mDisplayEventReceiver.requestNextVsync(); mDisplayEventReceiver.requestNextVsync(); Loading @@ -71,4 +75,3 @@ void TestContext::waitForVsync() { } // namespace test } // namespace test } // namespace uirenderer } // namespace uirenderer } // namespace android } // namespace android libs/hwui/tests/how_to_run.txt 0 → 100644 +17 −0 Original line number Original line Diff line number Diff line mmm -j8 frameworks/base/libs/hwui/tests/ && adb push $OUT/data/local/tmp/hwuitest /data/local/tmp/hwuitest && adb shell /data/local/tmp/hwuitest Command arguments: hwuitest [testname] Default test is 'shadowgrid' List of tests: shadowgrid: creates a grid of rounded rects that cast shadows, high CPU & GPU load rectgrid: creates a grid of 1x1 rects oval: draws 1 oval libs/hwui/tests/main.cpp +16 −4 Original line number Original line Diff line number Diff line Loading @@ -14,8 +14,6 @@ * limitations under the License. * limitations under the License. */ */ #include <stdio.h> #include <cutils/log.h> #include <cutils/log.h> #include <gui/Surface.h> #include <gui/Surface.h> #include <ui/PixelFormat.h> #include <ui/PixelFormat.h> Loading @@ -28,6 +26,9 @@ #include "TestContext.h" #include "TestContext.h" #include <stdio.h> #include <unistd.h> using namespace android; using namespace android; using namespace android::uirenderer; using namespace android::uirenderer; using namespace android::uirenderer::renderthread; using namespace android::uirenderer::renderthread; Loading Loading @@ -93,16 +94,27 @@ public: animation.createContent(width, height, renderer); animation.createContent(width, height, renderer); endRecording(renderer, rootNode); endRecording(renderer, rootNode); // Do a few cold runs then reset the stats so that the caches are all hot for (int i = 0; i < 3; i++) { testContext.waitForVsync(); proxy->syncAndDrawFrame(); } proxy->resetProfileInfo(); for (int i = 0; i < animation.getFrameCount(); i++) { for (int i = 0; i < animation.getFrameCount(); i++) { #if !HWUI_NULL_GPU testContext.waitForVsync(); testContext.waitForVsync(); #endif // workaround b/20853441 proxy->fence(); ATRACE_NAME("UI-Draw Frame"); ATRACE_NAME("UI-Draw Frame"); nsecs_t vsync = systemTime(CLOCK_MONOTONIC); UiFrameInfoBuilder(proxy->frameInfo()) .setVsync(vsync, vsync); animation.doFrame(i); animation.doFrame(i); proxy->syncAndDrawFrame(); proxy->syncAndDrawFrame(); } } proxy->dumpProfileInfo(STDOUT_FILENO, 0); rootNode->decStrong(nullptr); rootNode->decStrong(nullptr); } } }; }; Loading Loading
libs/hwui/renderthread/RenderProxy.cpp +15 −1 Original line number Original line Diff line number Diff line Loading @@ -383,8 +383,10 @@ void RenderProxy::notifyFramePending() { mRenderThread.queueAtFront(task); mRenderThread.queueAtFront(task); } } CREATE_BRIDGE3(dumpProfileInfo, CanvasContext* context, int fd, int dumpFlags) { CREATE_BRIDGE4(dumpProfileInfo, CanvasContext* context, RenderThread* thread, int fd, int dumpFlags) { args->context->profiler().dumpData(args->fd); args->context->profiler().dumpData(args->fd); args->thread->jankTracker().dump(args->fd); if (args->dumpFlags & DumpFlags::kFrameStats) { if (args->dumpFlags & DumpFlags::kFrameStats) { args->context->dumpFrames(args->fd); args->context->dumpFrames(args->fd); } } Loading @@ -397,11 +399,23 @@ CREATE_BRIDGE3(dumpProfileInfo, CanvasContext* context, int fd, int dumpFlags) { void RenderProxy::dumpProfileInfo(int fd, int dumpFlags) { void RenderProxy::dumpProfileInfo(int fd, int dumpFlags) { SETUP_TASK(dumpProfileInfo); SETUP_TASK(dumpProfileInfo); args->context = mContext; args->context = mContext; args->thread = &mRenderThread; args->fd = fd; args->fd = fd; args->dumpFlags = dumpFlags; args->dumpFlags = dumpFlags; postAndWait(task); postAndWait(task); } } CREATE_BRIDGE1(resetProfileInfo, CanvasContext* context) { args->context->resetFrameStats(); return nullptr; } void RenderProxy::resetProfileInfo() { SETUP_TASK(resetProfileInfo); args->context = mContext; postAndWait(task); } CREATE_BRIDGE2(dumpGraphicsMemory, int fd, RenderThread* thread) { CREATE_BRIDGE2(dumpGraphicsMemory, int fd, RenderThread* thread) { args->thread->jankTracker().dump(args->fd); args->thread->jankTracker().dump(args->fd); Loading
libs/hwui/renderthread/RenderProxy.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -96,6 +96,8 @@ public: ANDROID_API void notifyFramePending(); ANDROID_API void notifyFramePending(); ANDROID_API void dumpProfileInfo(int fd, int dumpFlags); ANDROID_API void dumpProfileInfo(int fd, int dumpFlags); // Not exported, only used for testing void resetProfileInfo(); ANDROID_API static void dumpGraphicsMemory(int fd); ANDROID_API static void dumpGraphicsMemory(int fd); ANDROID_API void setTextureAtlas(const sp<GraphicBuffer>& buffer, int64_t* map, size_t size); ANDROID_API void setTextureAtlas(const sp<GraphicBuffer>& buffer, int64_t* map, size_t size); Loading
libs/hwui/tests/TestContext.cpp +4 −1 Original line number Original line Diff line number Diff line Loading @@ -57,6 +57,10 @@ sp<Surface> TestContext::surface() { } } void TestContext::waitForVsync() { void TestContext::waitForVsync() { #if HWUI_NULL_GPU return; #endif // Request vsync // Request vsync mDisplayEventReceiver.requestNextVsync(); mDisplayEventReceiver.requestNextVsync(); Loading @@ -71,4 +75,3 @@ void TestContext::waitForVsync() { } // namespace test } // namespace test } // namespace uirenderer } // namespace uirenderer } // namespace android } // namespace android
libs/hwui/tests/how_to_run.txt 0 → 100644 +17 −0 Original line number Original line Diff line number Diff line mmm -j8 frameworks/base/libs/hwui/tests/ && adb push $OUT/data/local/tmp/hwuitest /data/local/tmp/hwuitest && adb shell /data/local/tmp/hwuitest Command arguments: hwuitest [testname] Default test is 'shadowgrid' List of tests: shadowgrid: creates a grid of rounded rects that cast shadows, high CPU & GPU load rectgrid: creates a grid of 1x1 rects oval: draws 1 oval
libs/hwui/tests/main.cpp +16 −4 Original line number Original line Diff line number Diff line Loading @@ -14,8 +14,6 @@ * limitations under the License. * limitations under the License. */ */ #include <stdio.h> #include <cutils/log.h> #include <cutils/log.h> #include <gui/Surface.h> #include <gui/Surface.h> #include <ui/PixelFormat.h> #include <ui/PixelFormat.h> Loading @@ -28,6 +26,9 @@ #include "TestContext.h" #include "TestContext.h" #include <stdio.h> #include <unistd.h> using namespace android; using namespace android; using namespace android::uirenderer; using namespace android::uirenderer; using namespace android::uirenderer::renderthread; using namespace android::uirenderer::renderthread; Loading Loading @@ -93,16 +94,27 @@ public: animation.createContent(width, height, renderer); animation.createContent(width, height, renderer); endRecording(renderer, rootNode); endRecording(renderer, rootNode); // Do a few cold runs then reset the stats so that the caches are all hot for (int i = 0; i < 3; i++) { testContext.waitForVsync(); proxy->syncAndDrawFrame(); } proxy->resetProfileInfo(); for (int i = 0; i < animation.getFrameCount(); i++) { for (int i = 0; i < animation.getFrameCount(); i++) { #if !HWUI_NULL_GPU testContext.waitForVsync(); testContext.waitForVsync(); #endif // workaround b/20853441 proxy->fence(); ATRACE_NAME("UI-Draw Frame"); ATRACE_NAME("UI-Draw Frame"); nsecs_t vsync = systemTime(CLOCK_MONOTONIC); UiFrameInfoBuilder(proxy->frameInfo()) .setVsync(vsync, vsync); animation.doFrame(i); animation.doFrame(i); proxy->syncAndDrawFrame(); proxy->syncAndDrawFrame(); } } proxy->dumpProfileInfo(STDOUT_FILENO, 0); rootNode->decStrong(nullptr); rootNode->decStrong(nullptr); } } }; }; Loading