Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Schedule rendering at regular interval (60fps)
https://bugs.webkit.org/show_bug.cgi?id=114617

Patch by Seulgi Kim <seulgikim@company100.net> on 2013-04-15
Reviewed by Martin Robinson.

Schedule rendering reguarly regardless of the time taken to render a
frame. Otherwise, next flush delayed by the amount of the rendering
time.

* WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
(WebKit::LayerTreeHostGtk::LayerTreeHostGtk):
(WebKit::LayerTreeHostGtk::layerFlushTimerFired):
(WebKit::LayerTreeHostGtk::flushAndRenderLayers):
* WebProcess/WebPage/gtk/LayerTreeHostGtk.h:

Canonical link: https://commits.webkit.org/133001@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@148439 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Seulgi Kim authored and webkit-commit-queue committed Apr 15, 2013
1 parent 1a4ad37 commit c0e413c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
17 changes: 17 additions & 0 deletions Source/WebKit2/ChangeLog
@@ -1,3 +1,20 @@
2013-04-15 Seulgi Kim <seulgikim@company100.net>

Schedule rendering at regular interval (60fps)
https://bugs.webkit.org/show_bug.cgi?id=114617

Reviewed by Martin Robinson.

Schedule rendering reguarly regardless of the time taken to render a
frame. Otherwise, next flush delayed by the amount of the rendering
time.

* WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
(WebKit::LayerTreeHostGtk::LayerTreeHostGtk):
(WebKit::LayerTreeHostGtk::layerFlushTimerFired):
(WebKit::LayerTreeHostGtk::flushAndRenderLayers):
* WebProcess/WebPage/gtk/LayerTreeHostGtk.h:

2013-04-15 Michał Pakuła vel Rutka <m.pakula@samsung.com>

[EFL][WK2] Use C API in ewk_context_menu
Expand Down
9 changes: 7 additions & 2 deletions Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp
Expand Up @@ -71,6 +71,7 @@ LayerTreeHostGtk::LayerTreeHostGtk(WebPage* webPage)
: LayerTreeHost(webPage)
, m_isValid(true)
, m_notifyAfterScheduledLayerFlush(false)
, m_lastFlushTime(0)
, m_layerFlushSchedulingEnabled(true)
, m_layerFlushTimerCallbackId(0)
{
Expand Down Expand Up @@ -301,8 +302,11 @@ void LayerTreeHostGtk::layerFlushTimerFired()

flushAndRenderLayers();

if (toTextureMapperLayer(m_rootLayer.get())->descendantsOrSelfHaveRunningAnimations() && !m_layerFlushTimerCallbackId)
m_layerFlushTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, 1000.0 / 60.0, reinterpret_cast<GSourceFunc>(layerFlushTimerFiredCallback), this, 0);
if (toTextureMapperLayer(m_rootLayer.get())->descendantsOrSelfHaveRunningAnimations() && !m_layerFlushTimerCallbackId) {
const double targetFPS = 60;
double nextFlush = std::max((1 / targetFPS) - (currentTime() - m_lastFlushTime), 0.0);
m_layerFlushTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, nextFlush * 1000.0, reinterpret_cast<GSourceFunc>(layerFlushTimerFiredCallback), this, 0);
}
}

bool LayerTreeHostGtk::flushPendingLayerChanges()
Expand Down Expand Up @@ -358,6 +362,7 @@ void LayerTreeHostGtk::flushAndRenderLayers()
if (!flushPendingLayerChanges())
return;

m_lastFlushTime = currentTime();
// Our model is very simple. We always composite and render the tree immediately after updating it.
compositeLayersToContext();

Expand Down
1 change: 1 addition & 0 deletions Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h
Expand Up @@ -104,6 +104,7 @@ class LayerTreeHostGtk : public LayerTreeHost, WebCore::GraphicsLayerClient {
PageOverlayLayerMap m_pageOverlayLayers;
OwnPtr<WebCore::TextureMapper> m_textureMapper;
OwnPtr<WebCore::GLContext> m_context;
double m_lastFlushTime;
bool m_layerFlushSchedulingEnabled;
unsigned m_layerFlushTimerCallbackId;
};
Expand Down

0 comments on commit c0e413c

Please sign in to comment.