[TexMap] Apply frames-per-second debug counter to WK1.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Feb 2013 09:34:40 +0000 (09:34 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Feb 2013 09:34:40 +0000 (09:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=109540

Patch by Huang Dongsung <luxtella@company100.net> on 2013-02-12
Reviewed by Noam Rosenthal.

Source/WebCore:

r142524 implemented frames-per-second debug counter on WK2. This patch
applies frames-per-second debug counter to WK1 also.

Visual debugging feature, no need for new tests.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* platform/graphics/texmap/TextureMapper.h:
* platform/graphics/texmap/TextureMapperFPSCounter.cpp: Added.
(WebCore):
(WebCore::TextureMapperFPSCounter::TextureMapperFPSCounter):
(WebCore::TextureMapperFPSCounter::updateFPSAndDisplay):
* platform/graphics/texmap/TextureMapperFPSCounter.h: Added.
(WebCore):
(TextureMapperFPSCounter):
* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore):
(WebCore::TextureMapperGL::drawNumber):
  Rename from drawRepaintCounter to drawNumber.
* platform/graphics/texmap/TextureMapperGL.h:
* platform/graphics/texmap/TextureMapperImageBuffer.cpp:
(WebCore::TextureMapperImageBuffer::drawNumber):
* platform/graphics/texmap/TextureMapperImageBuffer.h:
(TextureMapperImageBuffer):
* platform/graphics/texmap/TextureMapperTiledBackingStore.cpp:
(WebCore::TextureMapperTiledBackingStore::drawRepaintCounter):
* platform/graphics/texmap/coordinated/CoordinatedBackingStore.cpp:
(WebCore::CoordinatedBackingStore::drawRepaintCounter):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp:
  Move frames-per-second debug counter code to TextureMapperFPSCounter.
(WebCore::CoordinatedGraphicsScene::CoordinatedGraphicsScene):
(WebCore::CoordinatedGraphicsScene::paintToCurrentGLContext):
(WebCore::CoordinatedGraphicsScene::paintToGraphicsContext):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h:

Source/WebKit/efl:

Make AcceleratedCompositingContextEfl use TextureMapperFPSCounter.

* WebCoreSupport/AcceleratedCompositingContextEfl.cpp:
(WebCore::AcceleratedCompositingContext::renderLayers):
* WebCoreSupport/AcceleratedCompositingContextEfl.h:
(AcceleratedCompositingContext):

Source/WebKit/gtk:

Make AcceleratedCompositingContext use TextureMapperFPSCounter.

* WebCoreSupport/AcceleratedCompositingContext.h:
* WebCoreSupport/AcceleratedCompositingContextGL.cpp:
(WebKit::AcceleratedCompositingContext::compositeLayersToContext):

Source/WebKit/qt:

Make TextureMapperLayerClientQt use TextureMapperFPSCounter.

* WebCoreSupport/TextureMapperLayerClientQt.cpp:
(TextureMapperLayerClientQt::renderCompositedLayers):
* WebCoreSupport/TextureMapperLayerClientQt.h:
(TextureMapperLayerClientQt):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@142595 268f45cc-cd09-0410-ab3c-d52691b4dbfc

24 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/platform/graphics/texmap/TextureMapper.h
Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.h [new file with mode: 0644]
Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperGL.h
Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h
Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.cpp
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBackingStore.cpp
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h
Source/WebKit/efl/ChangeLog
Source/WebKit/efl/WebCoreSupport/AcceleratedCompositingContextEfl.cpp
Source/WebKit/efl/WebCoreSupport/AcceleratedCompositingContextEfl.h
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h
Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/TextureMapperLayerClientQt.cpp
Source/WebKit/qt/WebCoreSupport/TextureMapperLayerClientQt.h

index 040f228d52ee268578508e777dc3e8be3ddd19f2..06093315184fc478599a2800e0fc7fb00c6075b1 100644 (file)
@@ -2001,6 +2001,7 @@ set(WebCore_SOURCES
     platform/graphics/texmap/coordinated/UpdateAtlas.cpp
     platform/graphics/texmap/TextureMapper.cpp
     platform/graphics/texmap/TextureMapperBackingStore.cpp
+    platform/graphics/texmap/TextureMapperFPSCounter.cpp
     platform/graphics/texmap/TextureMapperImageBuffer.cpp
     platform/graphics/texmap/TextureMapperLayer.cpp
     platform/graphics/texmap/TextureMapperSurfaceBackingStore.cpp
index dcadc6766569e4d943b6759077ac976c4de3f847..339ce6fcce2c5d1753567dccde3e859aeaa9804e 100644 (file)
@@ -1,3 +1,46 @@
+2013-02-12  Huang Dongsung  <luxtella@company100.net>
+
+        [TexMap] Apply frames-per-second debug counter to WK1.
+        https://bugs.webkit.org/show_bug.cgi?id=109540
+
+        Reviewed by Noam Rosenthal.
+
+        r142524 implemented frames-per-second debug counter on WK2. This patch
+        applies frames-per-second debug counter to WK1 also.
+
+        Visual debugging feature, no need for new tests.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * platform/graphics/texmap/TextureMapper.h:
+        * platform/graphics/texmap/TextureMapperFPSCounter.cpp: Added.
+        (WebCore):
+        (WebCore::TextureMapperFPSCounter::TextureMapperFPSCounter):
+        (WebCore::TextureMapperFPSCounter::updateFPSAndDisplay):
+        * platform/graphics/texmap/TextureMapperFPSCounter.h: Added.
+        (WebCore):
+        (TextureMapperFPSCounter):
+        * platform/graphics/texmap/TextureMapperGL.cpp:
+        (WebCore):
+        (WebCore::TextureMapperGL::drawNumber):
+          Rename from drawRepaintCounter to drawNumber.
+        * platform/graphics/texmap/TextureMapperGL.h:
+        * platform/graphics/texmap/TextureMapperImageBuffer.cpp:
+        (WebCore::TextureMapperImageBuffer::drawNumber):
+        * platform/graphics/texmap/TextureMapperImageBuffer.h:
+        (TextureMapperImageBuffer):
+        * platform/graphics/texmap/TextureMapperTiledBackingStore.cpp:
+        (WebCore::TextureMapperTiledBackingStore::drawRepaintCounter):
+        * platform/graphics/texmap/coordinated/CoordinatedBackingStore.cpp:
+        (WebCore::CoordinatedBackingStore::drawRepaintCounter):
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp:
+          Move frames-per-second debug counter code to TextureMapperFPSCounter.
+        (WebCore::CoordinatedGraphicsScene::CoordinatedGraphicsScene):
+        (WebCore::CoordinatedGraphicsScene::paintToCurrentGLContext):
+        (WebCore::CoordinatedGraphicsScene::paintToGraphicsContext):
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h:
+
 2013-02-11  Yury Semikhatsky  <yurys@chromium.org>
 
         Web Inspector: stack trace is cut at native bind if inspector is closed
index fbe11e62d6b1e2af414edf9c12523785872262da..671719edbbd69de0aa10a55a45ce3f4e8c1d73e9 100644 (file)
@@ -6484,6 +6484,8 @@ webcore_sources += \
        Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h \
        Source/WebCore/platform/graphics/texmap/TextureMapper.cpp \
        Source/WebCore/platform/graphics/texmap/TextureMapper.h \
+       Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.cpp \
+       Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.h \
        Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp \
        Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h \
        Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp \
index 1d1a531950d833a1010bcbfde66911a8d255b2f7..eaa5c5ac1be585aa0f6ee4dfd04e953a8525a1b0 100644 (file)
@@ -2271,6 +2271,7 @@ HEADERS += \
     platform/graphics/texmap/GraphicsLayerTextureMapper.h \
     platform/graphics/texmap/TextureMapper.h \
     platform/graphics/texmap/TextureMapperBackingStore.h \
+    platform/graphics/texmap/TextureMapperFPSCounter.h \
     platform/graphics/texmap/TextureMapperImageBuffer.h \
     platform/graphics/texmap/TextureMapperLayer.h \
     platform/graphics/texmap/TextureMapperPlatformLayer.h \
@@ -2907,6 +2908,7 @@ SOURCES += \
     platform/graphics/texmap/GraphicsLayerTextureMapper.cpp \
     platform/graphics/texmap/TextureMapper.cpp \
     platform/graphics/texmap/TextureMapperBackingStore.cpp \
+    platform/graphics/texmap/TextureMapperFPSCounter.cpp \
     platform/graphics/texmap/TextureMapperImageBuffer.cpp \
     platform/graphics/texmap/TextureMapperLayer.cpp \
     platform/graphics/texmap/TextureMapperSurfaceBackingStore.cpp \
index d96116b7099368ad4455996c1b732016270deec2..adeaf3e718e132503829c904fc0a2d2752c46186 100644 (file)
@@ -130,7 +130,7 @@ public:
     };
 
     virtual void drawBorder(const Color&, float borderWidth, const FloatRect&, const TransformationMatrix&) = 0;
-    virtual void drawRepaintCounter(int repaintCount, const Color&, const FloatPoint&, const TransformationMatrix&) = 0;
+    virtual void drawNumber(int number, const Color&, const FloatPoint&, const TransformationMatrix&) = 0;
 
     virtual void drawTexture(const BitmapTexture&, const FloatRect& target, const TransformationMatrix& modelViewMatrix = TransformationMatrix(), float opacity = 1.0f, const BitmapTexture* maskTexture = 0, unsigned exposedEdges = AllEdges) = 0;
     virtual void drawSolidColor(const FloatRect&, const TransformationMatrix&, const Color&) = 0;
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.cpp
new file mode 100644 (file)
index 0000000..bd5ee03
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+    Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+    Copyright (C) 2012, 2013 Company 100, Inc.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "TextureMapperFPSCounter.h"
+
+#include "TextureMapper.h"
+#include <wtf/CurrentTime.h>
+
+namespace WebCore {
+
+TextureMapperFPSCounter::TextureMapperFPSCounter()
+    : m_isShowingFPS(false)
+    , m_fpsInterval(0)
+    , m_fpsTimestamp(0)
+    , m_lastFPS(0)
+    , m_frameCount(0)
+{
+    String showFPSEnvironment = getenv("WEBKIT_SHOW_FPS");
+    bool ok = false;
+    m_fpsInterval = showFPSEnvironment.toDouble(&ok);
+    if (ok && m_fpsInterval) {
+        m_isShowingFPS = true;
+        m_fpsTimestamp = WTF::currentTime();
+    }
+}
+
+void TextureMapperFPSCounter::updateFPSAndDisplay(TextureMapper* textureMapper, const FloatPoint& location, const TransformationMatrix& matrix)
+{
+    if (!m_isShowingFPS)
+        return;
+
+    m_frameCount++;
+    double delta = WTF::currentTime() - m_fpsTimestamp;
+    if (delta >= m_fpsInterval) {
+        m_lastFPS = int(m_frameCount / delta);
+        m_frameCount = 0;
+        m_fpsTimestamp += delta;
+    }
+
+    textureMapper->drawNumber(m_lastFPS, Color::black, location, matrix);
+}
+
+} // namespace WebCore
+
+#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.h b/Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.h
new file mode 100644 (file)
index 0000000..96fab17
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+    Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+    Copyright (C) 2012, 2013 Company 100, Inc.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef TextureMapperFPSCounter_h
+#define TextureMapperFPSCounter_h
+
+#if USE(ACCELERATED_COMPOSITING)
+#include "FloatPoint.h"
+#include "TransformationMatrix.h"
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+class TextureMapper;
+
+class TextureMapperFPSCounter {
+    WTF_MAKE_NONCOPYABLE(TextureMapperFPSCounter);
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    TextureMapperFPSCounter();
+    void updateFPSAndDisplay(TextureMapper*, const FloatPoint& = FloatPoint::zero(), const TransformationMatrix& = TransformationMatrix());
+
+private:
+    bool m_isShowingFPS;
+    double m_fpsInterval;
+    double m_fpsTimestamp;
+    int m_lastFPS;
+    int m_frameCount;
+};
+
+} // namespace WebCore
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif // TextureMapperFPSCounter_h
+
+
index b2e0e054fb0059a01885d1988ef8528a48377fd1..3cddc93631103ce8777a453189fe8a78bbc81681 100644 (file)
@@ -321,11 +321,12 @@ void TextureMapperGL::drawBorder(const Color& color, float width, const FloatRec
     draw(targetRect, modelViewMatrix, program.get(), GraphicsContext3D::LINE_LOOP, color.hasAlpha() ? ShouldBlend : 0);
 }
 
-void TextureMapperGL::drawRepaintCounter(int repaintCount, const Color& color, const FloatPoint& targetPoint, const TransformationMatrix& modelViewMatrix)
+// FIXME: drawNumber() should save a number texture-atlas and re-use whenever possible.
+void TextureMapperGL::drawNumber(int number, const Color& color, const FloatPoint& targetPoint, const TransformationMatrix& modelViewMatrix)
 {
     int pointSize = 8;
 #if PLATFORM(QT)
-    QString counterString = QString::number(repaintCount);
+    QString counterString = QString::number(number);
 
     QFont font(QString::fromLatin1("Monospace"), pointSize, QFont::Bold);
     font.setStyleHint(QFont::TypeWriter);
@@ -351,7 +352,7 @@ void TextureMapperGL::drawRepaintCounter(int repaintCount, const Color& color, c
     drawTexture(*texture, targetRect, modelViewMatrix, 1.0f, 0, AllEdges);
 
 #elif USE(CAIRO)
-    CString counterString = String::number(repaintCount).ascii();
+    CString counterString = String::number(number).ascii();
     // cairo_text_extents() requires a cairo_t, so dimensions need to be guesstimated.
     int width = counterString.length() * pointSize * 1.2;
     int height = pointSize * 1.5;
@@ -385,7 +386,7 @@ void TextureMapperGL::drawRepaintCounter(int repaintCount, const Color& color, c
     cairo_destroy(cr);
 
 #else
-    UNUSED_PARAM(repaintCount);
+    UNUSED_PARAM(number);
     UNUSED_PARAM(pointSize);
     UNUSED_PARAM(targetPoint);
     UNUSED_PARAM(modelViewMatrix);
index 983e2a06c3c43d63aa9eba1af6c1a1d8df593ddd..3e80a1782ec14891fd7bccc2e99093b96ddde315 100644 (file)
@@ -53,7 +53,7 @@ public:
 
     // TextureMapper implementation
     virtual void drawBorder(const Color&, float borderWidth, const FloatRect&, const TransformationMatrix&) OVERRIDE;
-    virtual void drawRepaintCounter(int repaintCount, const Color&, const FloatPoint&, const TransformationMatrix&) OVERRIDE;
+    virtual void drawNumber(int number, const Color&, const FloatPoint&, const TransformationMatrix&) OVERRIDE;
     virtual void drawTexture(const BitmapTexture&, const FloatRect&, const TransformationMatrix&, float opacity, const BitmapTexture* maskTexture, unsigned exposedEdges) OVERRIDE;
     virtual void drawTexture(Platform3DObject texture, Flags, const IntSize& textureSize, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix, float opacity, const BitmapTexture* maskTexture, unsigned exposedEdges = AllEdges);
     virtual void drawSolidColor(const FloatRect&, const TransformationMatrix&, const Color&) OVERRIDE;
index b4e122d2cd8da09705f79c4becdcc63f0aa8322a..1e49f9b6eca88d6a7cfd93191222c04811039d75 100644 (file)
@@ -170,7 +170,7 @@ void TextureMapperImageBuffer::drawBorder(const Color&, float /* borderWidth */,
     notImplemented();
 }
 
-void TextureMapperImageBuffer::drawRepaintCounter(int /* repaintCount */, const Color&, const FloatPoint&, const TransformationMatrix&)
+void TextureMapperImageBuffer::drawNumber(int /* number */, const Color&, const FloatPoint&, const TransformationMatrix&)
 {
     notImplemented();
 }
index 5b2e9783d69c058639272a2b631c76ae10573d3c..80e69440590547607e703261e793155dde3c20d5 100644 (file)
@@ -54,7 +54,7 @@ public:
 
     // TextureMapper implementation
     virtual void drawBorder(const Color&, float borderWidth, const FloatRect&, const TransformationMatrix&) OVERRIDE;
-    virtual void drawRepaintCounter(int repaintCount, const Color&, const FloatPoint&, const TransformationMatrix&) OVERRIDE;
+    virtual void drawNumber(int number, const Color&, const FloatPoint&, const TransformationMatrix&) OVERRIDE;
     virtual void drawTexture(const BitmapTexture&, const FloatRect& targetRect, const TransformationMatrix&, float opacity, const BitmapTexture* maskTexture, unsigned exposedEdges) OVERRIDE;
     virtual void drawSolidColor(const FloatRect&, const TransformationMatrix&, const Color&) OVERRIDE;
     virtual void beginClip(const TransformationMatrix&, const FloatRect&) OVERRIDE;
index 3516f0f4a51b06f9344474e57bfd60c494ac7c2e..8097922267e990a810f202d457a62faf9fb88d0b 100644 (file)
@@ -66,7 +66,7 @@ void TextureMapperTiledBackingStore::drawRepaintCounter(TextureMapper* textureMa
 {
     TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect);
     for (size_t i = 0; i < m_tiles.size(); ++i)
-        textureMapper->drawRepaintCounter(repaintCount, borderColor, m_tiles[i].rect().location(), adjustedTransform);
+        textureMapper->drawNumber(repaintCount, borderColor, m_tiles[i].rect().location(), adjustedTransform);
 }
 
 void TextureMapperTiledBackingStore::createOrDestroyTilesIfNeeded(const FloatSize& size, const IntSize& tileSize, bool hasAlpha)
index 95da2b8fb5f4a8d9d2c9879e93acb85c0f3c9b8b..68129c73d2b60a864322c45f47b0e010d312d838 100644 (file)
@@ -169,7 +169,7 @@ void CoordinatedBackingStore::drawRepaintCounter(TextureMapper* textureMapper, i
     TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect);
     CoordinatedBackingStoreTileMap::iterator end = m_tiles.end();
     for (CoordinatedBackingStoreTileMap::iterator it = m_tiles.begin(); it != end; ++it)
-        textureMapper->drawRepaintCounter(repaintCount, borderColor, it->value.rect().location(), adjustedTransform);
+        textureMapper->drawNumber(repaintCount, borderColor, it->value.rect().location(), adjustedTransform);
 }
 
 void CoordinatedBackingStore::commitTileOperations(TextureMapper* textureMapper)
index 5910a9a14c03c77bee831a1a9f31e31a313c4099..103ed1defeca40fdcac615f2975077e759c0ddb2 100644 (file)
@@ -32,7 +32,6 @@
 #include "TextureMapperLayer.h"
 #include <OpenGLShims.h>
 #include <wtf/Atomics.h>
-#include <wtf/CurrentTime.h>
 #include <wtf/MainThread.h>
 
 #if ENABLE(CSS_SHADERS)
@@ -67,21 +66,8 @@ CoordinatedGraphicsScene::CoordinatedGraphicsScene(CoordinatedGraphicsSceneClien
 #endif
     , m_backgroundColor(Color::white)
     , m_setDrawsBackground(false)
-    , m_isShowingFPS(false)
-    , m_fpsInterval(0)
-    , m_fpsTimestamp(0)
-    , m_lastFPS(0)
-    , m_frameCount(0)
 {
     ASSERT(isMainThread());
-
-    String showFPSEnvironment = getenv("WEBKIT_SHOW_FPS");
-    bool ok = false;
-    m_fpsInterval = showFPSEnvironment.toDouble(&ok);
-    if (ok && m_fpsInterval) {
-        m_isShowingFPS = true;
-        m_fpsTimestamp = WTF::currentTime();
-    }
 }
 
 CoordinatedGraphicsScene::~CoordinatedGraphicsScene()
@@ -128,8 +114,7 @@ void CoordinatedGraphicsScene::paintToCurrentGLContext(const TransformationMatri
     }
 
     layer->paint();
-    if (m_isShowingFPS)
-        updateFPS(clipRect.location(), matrix);
+    m_fpsCounter.updateFPSAndDisplay(m_textureMapper.get(), clipRect.location(), matrix);
     m_textureMapper->endClip();
     m_textureMapper->endPainting();
 
@@ -182,8 +167,7 @@ void CoordinatedGraphicsScene::paintToGraphicsContext(cairo_t* painter)
         m_textureMapper->drawSolidColor(clipRect, TransformationMatrix(), m_backgroundColor);
 
     layer->paint();
-    if (m_isShowingFPS)
-        updateFPS(clipRect.location());
+    m_fpsCounter.updateFPSAndDisplay(m_textureMapper.get(), clipRect.location());
     m_textureMapper->endPainting();
     m_textureMapper->setGraphicsContext(0);
 }
@@ -695,20 +679,6 @@ void CoordinatedGraphicsScene::setBackgroundColor(const Color& color)
     m_backgroundColor = color;
 }
 
-void CoordinatedGraphicsScene::updateFPS(const FloatPoint& location, const TransformationMatrix& matrix)
-{
-    m_frameCount++;
-    double delta = WTF::currentTime() - m_fpsTimestamp;
-    if (delta >= m_fpsInterval) {
-        m_lastFPS = int(m_frameCount / delta);
-        m_frameCount = 0;
-        m_fpsTimestamp += delta;
-    }
-
-    // FIXME: drawRepaintCounter() should save a texture and re-use whenever possible.
-    m_textureMapper->drawRepaintCounter(m_lastFPS, Color::black, location, matrix);
-}
-
 } // namespace WebCore
 
 #endif // USE(COORDINATED_GRAPHICS)
index b25d00d30275a6cb5fb4acb976cbaaf671949f48..86ae36ce510f42b35c8d3afd8978da4d6fcaa0f7 100644 (file)
@@ -32,6 +32,7 @@
 #include "RunLoop.h"
 #include "TextureMapper.h"
 #include "TextureMapperBackingStore.h"
+#include "TextureMapperFPSCounter.h"
 #include "Timer.h"
 #include <wtf/Functional.h>
 #include <wtf/HashSet.h>
@@ -172,8 +173,6 @@ private:
     void removeBackingStoreIfNeeded(GraphicsLayer*);
     void resetBackingStoreSizeToLayerSize(GraphicsLayer*);
 
-    void updateFPS(const FloatPoint&, const TransformationMatrix& = TransformationMatrix());
-
     // Render queue can be accessed ony from main thread or updatePaintNode call stack!
     Vector<Function<void()> > m_renderQueue;
     Mutex m_renderQueueMutex;
@@ -222,11 +221,7 @@ private:
     CustomFilterProgramMap m_customFilterPrograms;
 #endif
 
-    bool m_isShowingFPS;
-    double m_fpsInterval;
-    double m_fpsTimestamp;
-    int m_lastFPS;
-    int m_frameCount;
+    TextureMapperFPSCounter m_fpsCounter;
 };
 
 } // namespace WebCore
index 077936679afe737d8e358c36aab75998d1242ad5..8d9053202098907ff39c4ae26b656d936f418281 100644 (file)
@@ -1,3 +1,17 @@
+2013-02-12  Huang Dongsung  <luxtella@company100.net>
+
+        [TexMap] Apply frames-per-second debug counter to WK1.
+        https://bugs.webkit.org/show_bug.cgi?id=109540
+
+        Reviewed by Noam Rosenthal.
+
+        Make AcceleratedCompositingContextEfl use TextureMapperFPSCounter.
+
+        * WebCoreSupport/AcceleratedCompositingContextEfl.cpp:
+        (WebCore::AcceleratedCompositingContext::renderLayers):
+        * WebCoreSupport/AcceleratedCompositingContextEfl.h:
+        (AcceleratedCompositingContext):
+
 2013-02-11  Ryosuke Niwa  <rniwa@webkit.org>
 
         Disable delete button controller on non-Mac ports and delete EditorClient::shouldShowDeleteInterface
index 8a3a249be200bef3592fca8c4bd00b453ac3bdb3..99692622aad10260c0a606e5e3da61068c6647aa 100644 (file)
@@ -89,6 +89,7 @@ void AcceleratedCompositingContext::renderLayers()
 
     m_textureMapper->beginPainting();
     m_rootTextureMapperLayer->paint();
+    m_fpsCounter.updateFPSAndDisplay(m_textureMapper.get());
     m_textureMapper->endPainting();
 }
 
index 50b89b9cac332768dc34395ace4b85c5b44e0b55..d2869a48d68635d91e7aad0e3d72fca55a563648 100644 (file)
@@ -25,6 +25,7 @@
 
 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL)
 
+#include "TextureMapperFPSCounter.h"
 #include "ewk_private.h"
 
 namespace WebCore {
@@ -56,6 +57,7 @@ private:
     TextureMapperLayer* m_rootTextureMapperLayer;
 
     RefPtr<GraphicsContext3D> m_context3D;
+    TextureMapperFPSCounter m_fpsCounter;
 };
 
 } // namespace WebCore
index 02639e5a6c27cc9d667f2e8bfc049a2d7f9ecf58..bfa72418e70b42672ea2db14e5df516742e9dbcf 100644 (file)
@@ -1,3 +1,16 @@
+2013-02-12  Huang Dongsung  <luxtella@company100.net>
+
+        [TexMap] Apply frames-per-second debug counter to WK1.
+        https://bugs.webkit.org/show_bug.cgi?id=109540
+
+        Reviewed by Noam Rosenthal.
+
+        Make AcceleratedCompositingContext use TextureMapperFPSCounter.
+
+        * WebCoreSupport/AcceleratedCompositingContext.h:
+        * WebCoreSupport/AcceleratedCompositingContextGL.cpp:
+        (WebKit::AcceleratedCompositingContext::compositeLayersToContext):
+
 2013-02-11  Ryosuke Niwa  <rniwa@webkit.org>
 
         Disable delete button controller on non-Mac ports and delete EditorClient::shouldShowDeleteInterface
index b0f97434db8846168eb4674300901fc2254022aa..2ab052e4af190915d9934d18cab24c60c2e72f17 100644 (file)
@@ -34,6 +34,7 @@
 #if USE(TEXTURE_MAPPER_GL)
 #include "GLContext.h"
 #include "RedirectedXCompositeWindow.h"
+#include "TextureMapperFPSCounter.h"
 #endif
 
 #if USE(ACCELERATED_COMPOSITING)
@@ -88,6 +89,7 @@ private:
     double m_lastFlushTime;
     double m_redrawPendingTime;
     bool m_needsExtraFlush;
+    WebCore::TextureMapperFPSCounter m_fpsCounter;
 
     void layerFlushTimerFired();
     void stopAnyPendingLayerFlush();
index c23de62a10a1c141e74a0d32203e4593bdf82071..92a052d3a8ccd00d951e0b0eaaa629bcbe71c177 100644 (file)
@@ -189,6 +189,7 @@ void AcceleratedCompositingContext::compositeLayersToContext(CompositePurpose pu
 
     m_textureMapper->beginPainting();
     toTextureMapperLayer(m_rootLayer.get())->paint();
+    m_fpsCounter.updateFPSAndDisplay(m_textureMapper.get());
     m_textureMapper->endPainting();
 
     context->swapBuffers();
index 6300f280a792ca485571c8e033d5f69511f5d416..c7e61b909a43eb259f80135b70122a7679473ad8 100644 (file)
@@ -1,3 +1,17 @@
+2013-02-12  Huang Dongsung  <luxtella@company100.net>
+
+        [TexMap] Apply frames-per-second debug counter to WK1.
+        https://bugs.webkit.org/show_bug.cgi?id=109540
+
+        Reviewed by Noam Rosenthal.
+
+        Make TextureMapperLayerClientQt use TextureMapperFPSCounter.
+
+        * WebCoreSupport/TextureMapperLayerClientQt.cpp:
+        (TextureMapperLayerClientQt::renderCompositedLayers):
+        * WebCoreSupport/TextureMapperLayerClientQt.h:
+        (TextureMapperLayerClientQt):
+
 2013-02-11  Ryosuke Niwa  <rniwa@webkit.org>
 
         Disable delete button controller on non-Mac ports and delete EditorClient::shouldShowDeleteInterface
index 66b8d0f96d4a7266e16dbdcae1a9bf58f3198708..371463d58177143fa6e08d9d4c468628b854ef99 100644 (file)
@@ -122,6 +122,7 @@ void TextureMapperLayerClientQt::renderCompositedLayers(GraphicsContext* context
     m_textureMapper->beginPainting();
     m_textureMapper->beginClip(matrix, clip);
     m_rootTextureMapperLayer->paint();
+    m_fpsCounter.updateFPSAndDisplay(m_textureMapper.get(), IntPoint::zero(), matrix);
     m_textureMapper->endClip();
     m_textureMapper->endPainting();
 }
index 67328cc99ccede6bcd3c39d0a9a57daac70a8375..2ffb5f0aa46b78661a8771c5955e96129a8d5e44 100644 (file)
@@ -25,6 +25,7 @@ class QWebFrameAdapter;
 
 #include "GraphicsLayer.h"
 #include "TextureMapper.h"
+#include "TextureMapperFPSCounter.h"
 #include "Timer.h"
 #include <wtf/OwnPtr.h>
 
@@ -53,6 +54,7 @@ private:
     Timer<TextureMapperLayerClientQt> m_syncTimer;
     WebCore::TextureMapperLayer* m_rootTextureMapperLayer;
     OwnPtr<WebCore::TextureMapper> m_textureMapper;
+    WebCore::TextureMapperFPSCounter m_fpsCounter;
 };
 #endif