summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/JankTracker.cpp25
-rw-r--r--libs/hwui/JankTracker.h3
-rw-r--r--libs/hwui/OpenGLRenderer.cpp6
-rw-r--r--libs/hwui/ProgramCache.cpp6
-rw-r--r--libs/hwui/SkiaCanvas.cpp1
5 files changed, 31 insertions, 10 deletions
diff --git a/libs/hwui/JankTracker.cpp b/libs/hwui/JankTracker.cpp
index d0ea3a6..46b0945 100644
--- a/libs/hwui/JankTracker.cpp
+++ b/libs/hwui/JankTracker.cpp
@@ -15,6 +15,7 @@
*/
#include "JankTracker.h"
+#include <algorithm>
#include <cstdio>
#include <inttypes.h>
@@ -95,7 +96,12 @@ void JankTracker::addFrame(const FrameInfo& frame) {
// Fast-path for jank-free frames
int64_t totalDuration =
frame[FrameInfoIndex::kFrameCompleted] - frame[FrameInfoIndex::kIntendedVsync];
+ uint32_t framebucket = std::min(
+ static_cast<typeof sizeof(mFrameCounts)>(ns2ms(totalDuration)),
+ sizeof(mFrameCounts) / sizeof(mFrameCounts[0]));
+ // Keep the fast path as fast as possible.
if (CC_LIKELY(totalDuration < mFrameInterval)) {
+ mFrameCounts[framebucket]++;
return;
}
@@ -103,6 +109,7 @@ void JankTracker::addFrame(const FrameInfo& frame) {
return;
}
+ mFrameCounts[framebucket]++;
mJankFrameCount++;
for (int i = 0; i < NUM_BUCKETS; i++) {
@@ -119,6 +126,9 @@ void JankTracker::dump(int fd) {
fprintf(file, "\n Total frames rendered: %u", mTotalFrameCount);
fprintf(file, "\n Janky frames: %u (%.2f%%)", mJankFrameCount,
(float) mJankFrameCount / (float) mTotalFrameCount * 100.0f);
+ fprintf(file, "\n 90th percentile: %ums", findPercentile(90));
+ fprintf(file, "\n 95th percentile: %ums", findPercentile(95));
+ fprintf(file, "\n 99th percentile: %ums", findPercentile(99));
for (int i = 0; i < NUM_BUCKETS; i++) {
fprintf(file, "\n Number %s: %u", JANK_TYPE_NAMES[i], mBuckets[i].count);
}
@@ -127,10 +137,23 @@ void JankTracker::dump(int fd) {
}
void JankTracker::reset() {
- memset(mBuckets, 0, sizeof(JankBucket) * NUM_BUCKETS);
+ memset(mBuckets, 0, sizeof(mBuckets));
+ memset(mFrameCounts, 0, sizeof(mFrameCounts));
mTotalFrameCount = 0;
mJankFrameCount = 0;
}
+uint32_t JankTracker::findPercentile(int percentile) {
+ int pos = percentile * mTotalFrameCount / 100;
+ int remaining = mTotalFrameCount - pos;
+ for (int i = sizeof(mFrameCounts) / sizeof(mFrameCounts[0]) - 1; i >= 0; i--) {
+ remaining -= mFrameCounts[i];
+ if (remaining <= 0) {
+ return i;
+ }
+ }
+ return 0;
+}
+
} /* namespace uirenderer */
} /* namespace android */
diff --git a/libs/hwui/JankTracker.h b/libs/hwui/JankTracker.h
index aa554cd..3d4929b 100644
--- a/libs/hwui/JankTracker.h
+++ b/libs/hwui/JankTracker.h
@@ -54,8 +54,11 @@ public:
void reset();
private:
+ uint32_t findPercentile(int p);
+
JankBucket mBuckets[NUM_BUCKETS];
int64_t mThresholds[NUM_BUCKETS];
+ uint32_t mFrameCounts[128];
int64_t mFrameInterval;
uint32_t mTotalFrameCount;
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 7fd115f..a6f6e18 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -2845,8 +2845,6 @@ void OpenGLRenderer::drawPosText(const char* text, int bytesCount, int count,
const Rect& clip(pureTranslate ? writableSnapshot()->getClipRect() : writableSnapshot()->getLocalClip());
Rect bounds(FLT_MAX / 2.0f, FLT_MAX / 2.0f, FLT_MIN / 2.0f, FLT_MIN / 2.0f);
- const bool hasActiveLayer = hasLayer();
-
TextSetupFunctor functor(this, x, y, pureTranslate, alpha, mode, paint);
if (fontRenderer.renderPosText(paint, &clip, text, 0, bytesCount, count, x, y,
positions, hasLayer() ? &bounds : nullptr, &functor)) {
@@ -3046,10 +3044,8 @@ void OpenGLRenderer::drawTextOnPath(const char* text, int bytesCount, int count,
const Rect* clip = &writableSnapshot()->getLocalClip();
Rect bounds(FLT_MAX / 2.0f, FLT_MAX / 2.0f, FLT_MIN / 2.0f, FLT_MIN / 2.0f);
- const bool hasActiveLayer = hasLayer();
-
if (fontRenderer.renderTextOnPath(paint, clip, text, 0, bytesCount, count, path,
- hOffset, vOffset, hasActiveLayer ? &bounds : nullptr, &functor)) {
+ hOffset, vOffset, hasLayer() ? &bounds : nullptr, &functor)) {
dirtyLayer(bounds.left, bounds.top, bounds.right, bounds.bottom, *currentTransform());
mDirty = true;
}
diff --git a/libs/hwui/ProgramCache.cpp b/libs/hwui/ProgramCache.cpp
index 8c6a91cc..e9b22e2 100644
--- a/libs/hwui/ProgramCache.cpp
+++ b/libs/hwui/ProgramCache.cpp
@@ -380,9 +380,9 @@ const char* gBlendOps[18] = {
// Xor
"return vec4(src.rgb * (1.0 - dst.a) + (1.0 - src.a) * dst.rgb, "
"src.a + dst.a - 2.0 * src.a * dst.a);\n",
- // Add
+ // Plus
"return min(src + dst, 1.0);\n",
- // Multiply
+ // Modulate
"return src * dst;\n",
// Screen
"return src + dst - src * dst;\n",
@@ -830,7 +830,7 @@ void ProgramCache::printLongString(const String8& shader) const {
while ((index = shader.find("\n", index)) > -1) {
String8 line(str, index - lastIndex);
if (line.length() == 0) line.append("\n");
- PROGRAM_LOGD("%s", line.string());
+ ALOGD("%s", line.string());
index++;
str += (index - lastIndex);
lastIndex = index;
diff --git a/libs/hwui/SkiaCanvas.cpp b/libs/hwui/SkiaCanvas.cpp
index efbb709..71088b7 100644
--- a/libs/hwui/SkiaCanvas.cpp
+++ b/libs/hwui/SkiaCanvas.cpp
@@ -22,7 +22,6 @@
#include <SkDeque.h>
#include <SkDrawFilter.h>
#include <SkGraphics.h>
-#include <SkPorterDuff.h>
#include <SkShader.h>
#include <SkTArray.h>
#include <SkTemplates.h>