summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2011-07-20 16:12:29 -0700
committerChris Craik <ccraik@google.com>2011-07-21 14:21:33 -0700
commit687472b6cb489b5d3ea6a9a2fff110a685c27a79 (patch)
treecf3816df277c1242c69602a62f0fedd3a2eab016 /Source/WebCore/platform/graphics
parent4f25266c21bdd7dcd9996807fae04f7dfb0373de (diff)
downloadexternal_webkit-687472b6cb489b5d3ea6a9a2fff110a685c27a79.zip
external_webkit-687472b6cb489b5d3ea6a9a2fff110a685c27a79.tar.gz
external_webkit-687472b6cb489b5d3ea6a9a2fff110a685c27a79.tar.bz2
New tile logging JNI interface
bug:5062896 Added more functionality to tile logging and querying (explicit location and size), invalidation region logging, as well as string-based JNI query method which should stabilize the JNI interface in the future. Change-Id: I937d4227abf0d0f18124c484438fd13a62439fb6
Diffstat (limited to 'Source/WebCore/platform/graphics')
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.cpp10
-rw-r--r--Source/WebCore/platform/graphics/android/TiledPage.cpp3
-rw-r--r--Source/WebCore/platform/graphics/android/TilesProfiler.cpp36
-rw-r--r--Source/WebCore/platform/graphics/android/TilesProfiler.h24
4 files changed, 52 insertions, 21 deletions
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
index 2832017..2e379bc 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -236,6 +236,7 @@ void GLWebViewState::inval(const IntRect& rect)
} else {
m_invalidateRegion.op(rect.x(), rect.y(), rect.maxX(), rect.maxY(), SkRegion::kUnion_Op);
}
+ TilesManager::instance()->getProfiler()->nextInval(rect, m_currentScale);
}
void GLWebViewState::resetRings()
@@ -504,10 +505,11 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect,
{
glFinish();
TilesManager::instance()->registerGLWebViewState(this);
- TilesManager::instance()->getProfiler()->nextFrame(viewport.fLeft * scale,
- viewport.fTop * scale,
- viewport.fRight * scale,
- viewport.fBottom * scale);
+ TilesManager::instance()->getProfiler()->nextFrame(viewport.fLeft,
+ viewport.fTop,
+ viewport.fRight,
+ viewport.fBottom,
+ scale);
#ifdef DEBUG
TilesManager::instance()->getTilesTracker()->clear();
diff --git a/Source/WebCore/platform/graphics/android/TiledPage.cpp b/Source/WebCore/platform/graphics/android/TiledPage.cpp
index 477ae7c..a8be501 100644
--- a/Source/WebCore/platform/graphics/android/TiledPage.cpp
+++ b/Source/WebCore/platform/graphics/android/TiledPage.cpp
@@ -336,8 +336,7 @@ void TiledPage::draw(float transparency, const SkIRect& tileBounds)
tile.draw(transparency, rect, m_scale);
}
- TilesManager::instance()->getProfiler()->nextTile(tile.x(), tile.y(), tile.isTileReady(),
- tile.usedLevel(), tileInView);
+ TilesManager::instance()->getProfiler()->nextTile(tile, m_invScale, tileInView);
}
}
diff --git a/Source/WebCore/platform/graphics/android/TilesProfiler.cpp b/Source/WebCore/platform/graphics/android/TilesProfiler.cpp
index 5c6aaa0..466923a 100644
--- a/Source/WebCore/platform/graphics/android/TilesProfiler.cpp
+++ b/Source/WebCore/platform/graphics/android/TilesProfiler.cpp
@@ -28,6 +28,7 @@
#if USE(ACCELERATED_COMPOSITING)
+#include "TilesManager.h"
#include <wtf/CurrentTime.h>
#ifdef DEBUG
@@ -47,6 +48,7 @@
// Hard limit on amount of frames (and thus memory) profiling can take
#define MAX_PROF_FRAMES 400
+#define INVAL_CODE -2
namespace WebCore {
TilesProfiler::TilesProfiler()
@@ -77,7 +79,7 @@ void TilesProfiler::clear()
m_records.clear();
}
-void TilesProfiler::nextFrame(int l, int t, int r, int b)
+void TilesProfiler::nextFrame(int left, int top, int right, int bottom, float scale)
{
if (!m_enabled || (m_records.size() > MAX_PROF_FRAMES))
return;
@@ -96,22 +98,44 @@ void TilesProfiler::nextFrame(int l, int t, int r, int b)
m_records.append(WTF::Vector<TileProfileRecord>());
//first two records designate viewport
- m_records.last().append(TileProfileRecord(l, t, true, (int)(timeDelta * 1000)));
- m_records.last().append(TileProfileRecord(r, b, true, -1));
-
+ m_records.last().append(TileProfileRecord(
+ left, top, right, bottom,
+ scale, true, (int)(timeDelta * 1000)));
}
-void TilesProfiler::nextTile(int x, int y, bool isReady, int level, bool inView)
+void TilesProfiler::nextTile(BaseTile& tile, float scale, bool inView)
{
if (!m_enabled || (m_records.size() > MAX_PROF_FRAMES))
return;
+
+ bool isReady = tile.isTileReady();
+ int left = tile.x() * TilesManager::tileWidth();
+ int top = tile.y() * TilesManager::tileWidth();
+ int right = left + TilesManager::tileWidth();
+ int bottom = top + TilesManager::tileWidth();
+
if (inView) {
if (isReady)
m_goodTiles++;
else
m_badTiles++;
}
- m_records.last().append(TileProfileRecord(x, y, isReady, level));
+ m_records.last().append(TileProfileRecord(
+ left, top, right, bottom,
+ scale, isReady, tile.usedLevel()));
+ XLOG("adding tile %d %d %d %d, scale %f", left, top, right, bottom, scale);
+}
+
+void TilesProfiler::nextInval(const IntRect& rect, float scale)
+{
+ if (!m_enabled || (m_records.size() > MAX_PROF_FRAMES))
+ return;
+
+ m_records.last().append(TileProfileRecord(
+ rect.x(), rect.y(),
+ rect.maxX(), rect.maxY(), scale, false, INVAL_CODE));
+ XLOG("adding inval region %d %d %d %d, scale %f", rect.x(), rect.y(),
+ rect.maxX(), rect.maxY(), scale);
}
} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/android/TilesProfiler.h b/Source/WebCore/platform/graphics/android/TilesProfiler.h
index 84f8f20..286d350 100644
--- a/Source/WebCore/platform/graphics/android/TilesProfiler.h
+++ b/Source/WebCore/platform/graphics/android/TilesProfiler.h
@@ -28,20 +28,26 @@
#if USE(ACCELERATED_COMPOSITING)
+#include "BaseTile.h"
+#include "IntRect.h"
#include "Vector.h"
namespace WebCore {
struct TileProfileRecord {
- TileProfileRecord(int x, int y, int isReady, int level) {
- this->x = x;
- this->y = y;
+ TileProfileRecord(int left, int top, int right, int bottom, float scale, int isReady, int level) {
+ this->left = left;
+ this->top = top;
+ this->right = right;
+ this->bottom = bottom;
+ this->scale = scale;
this->isReady = isReady;
this->level = level;
}
- int x, y;
+ int left, top, right, bottom;
bool isReady;
int level;
+ float scale;
};
class TilesProfiler {
@@ -51,9 +57,9 @@ public:
void start();
float stop();
void clear();
- void nextFrame(int l, int t, int r, int b);
- void nextTile(int x, int y, bool isReady, int level, bool inView);
-
+ void nextFrame(int left, int top, int right, int bottom, float scale);
+ void nextTile(BaseTile& tile, float scale, bool inView);
+ void nextInval(const IntRect& rect, float scale);
int numFrames() {
return m_records.size();
};
@@ -62,8 +68,8 @@ public:
return m_records[frame].size();
}
- TileProfileRecord getTile(int frame, int tile) {
- return m_records[frame][tile];
+ TileProfileRecord* getTile(int frame, int tile) {
+ return &m_records[frame][tile];
}
private: