diff options
Diffstat (limited to 'libs/hwui/tests')
| -rw-r--r-- | libs/hwui/tests/TestContext.cpp | 5 | ||||
| -rw-r--r-- | libs/hwui/tests/how_to_run.txt | 17 | ||||
| -rw-r--r-- | libs/hwui/tests/main.cpp | 20 |
3 files changed, 37 insertions, 5 deletions
diff --git a/libs/hwui/tests/TestContext.cpp b/libs/hwui/tests/TestContext.cpp index 542bbae..3687a50 100644 --- a/libs/hwui/tests/TestContext.cpp +++ b/libs/hwui/tests/TestContext.cpp @@ -57,6 +57,10 @@ sp<Surface> TestContext::surface() { } void TestContext::waitForVsync() { +#if HWUI_NULL_GPU + return; +#endif + // Request vsync mDisplayEventReceiver.requestNextVsync(); @@ -71,4 +75,3 @@ void TestContext::waitForVsync() { } // namespace test } // namespace uirenderer } // namespace android - diff --git a/libs/hwui/tests/how_to_run.txt b/libs/hwui/tests/how_to_run.txt new file mode 100644 index 0000000..686cd78 --- /dev/null +++ b/libs/hwui/tests/how_to_run.txt @@ -0,0 +1,17 @@ +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 diff --git a/libs/hwui/tests/main.cpp b/libs/hwui/tests/main.cpp index 62782af..aca7c52 100644 --- a/libs/hwui/tests/main.cpp +++ b/libs/hwui/tests/main.cpp @@ -14,8 +14,6 @@ * limitations under the License. */ -#include <stdio.h> - #include <cutils/log.h> #include <gui/Surface.h> #include <ui/PixelFormat.h> @@ -28,6 +26,9 @@ #include "TestContext.h" +#include <stdio.h> +#include <unistd.h> + using namespace android; using namespace android::uirenderer; using namespace android::uirenderer::renderthread; @@ -93,16 +94,27 @@ public: animation.createContent(width, height, renderer); 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++) { -#if !HWUI_NULL_GPU testContext.waitForVsync(); -#endif + // workaround b/20853441 + proxy->fence(); ATRACE_NAME("UI-Draw Frame"); + nsecs_t vsync = systemTime(CLOCK_MONOTONIC); + UiFrameInfoBuilder(proxy->frameInfo()) + .setVsync(vsync, vsync); animation.doFrame(i); proxy->syncAndDrawFrame(); } + proxy->dumpProfileInfo(STDOUT_FILENO, 0); rootNode->decStrong(nullptr); } }; |
