Skip to content

Commit

Permalink
Merge r243866 - [GTK][WPE] Use a timer to request the creation of pen…
Browse files Browse the repository at this point in the history
…ding tiles

https://bugs.webkit.org/show_bug.cgi?id=196594

Reviewed by Žan Doberšek.

Use a timer to request pending tile creation, as calls to notifyFlushRequired() are discarded
while inside a layer flush.

* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
(WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
(WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
(WebCore::CoordinatedGraphicsLayer::requestPendingTileCreationTimerFired):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
  • Loading branch information
magomez authored and carlosgcampos committed Apr 8, 2019
1 parent 74cdd6c commit bbc312b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
17 changes: 17 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,20 @@
2019-04-04 Miguel Gomez <magomez@igalia.com>

[GTK][WPE] Use a timer to request the creation of pending tiles
https://bugs.webkit.org/show_bug.cgi?id=196594

Reviewed by Žan Doberšek.

Use a timer to request pending tile creation, as calls to notifyFlushRequired() are discarded
while inside a layer flush.

* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
(WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
(WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
(WebCore::CoordinatedGraphicsLayer::requestPendingTileCreationTimerFired):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:

2019-04-05 Sergio Villar Senin <svillar@igalia.com>

[GTK][WPE] outlook.live.com displays old-fashioned UI
Expand Down
Expand Up @@ -44,6 +44,10 @@
#endif
#include <wtf/text/CString.h>

#if USE(GLIB_EVENT_LOOP)
#include <wtf/glib/RunLoopSourcePriority.h>
#endif

namespace WebCore {

Ref<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client, Type layerType)
Expand Down Expand Up @@ -121,6 +125,7 @@ CoordinatedGraphicsLayer::CoordinatedGraphicsLayer(Type layerType, GraphicsLayer
, m_coordinator(0)
, m_compositedNativeImagePtr(0)
, m_animationStartedTimer(*this, &CoordinatedGraphicsLayer::animationStartedTimerFired)
, m_requestPendingTileCreationTimer(RunLoop::main(), this, &CoordinatedGraphicsLayer::requestPendingTileCreationTimerFired)
{
static Nicosia::PlatformLayer::LayerID nextLayerID = 1;
m_id = nextLayerID++;
Expand All @@ -130,6 +135,10 @@ CoordinatedGraphicsLayer::CoordinatedGraphicsLayer(Type layerType, GraphicsLayer

// Enforce a complete flush on the first occasion.
m_nicosia.delta.value = UINT_MAX;

#if USE(GLIB_EVENT_LOOP)
m_requestPendingTileCreationTimer.setPriority(RunLoopSourcePriority::LayerFlushTimer);
#endif
}

CoordinatedGraphicsLayer::~CoordinatedGraphicsLayer()
Expand Down Expand Up @@ -624,6 +633,9 @@ void CoordinatedGraphicsLayer::updatePlatformLayer()

void CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly()
{
// Whether it kicked or not, we don't need this timer running anymore.
m_requestPendingTileCreationTimer.stop();

// When we have a transform animation, we need to update visible rect every frame to adjust the visible rect of a backing store.
bool hasActiveTransformAnimation = selfOrAncestorHasActiveTransformAnimation();
if (hasActiveTransformAnimation)
Expand Down Expand Up @@ -937,10 +949,11 @@ void CoordinatedGraphicsLayer::updateContentBuffers()
didUpdateTileBuffers();
}

// Request a second update immediately if some tiles are still pending creation.
// Request a new update immediately if some tiles are still pending creation. Do this on a timer
// as we're in a layer flush and flush requests at this point would be discarded.
if (layerState.hasPendingTileCreation) {
setNeedsVisibleRectAdjustment();
notifyFlushRequired();
m_requestPendingTileCreationTimer.startOneShot(0_s);
}

finishUpdate();
Expand Down Expand Up @@ -1183,6 +1196,11 @@ void CoordinatedGraphicsLayer::animationStartedTimerFired()
client().notifyAnimationStarted(this, "", m_lastAnimationStartTime);
}

void CoordinatedGraphicsLayer::requestPendingTileCreationTimerFired()
{
notifyFlushRequired();
}

bool CoordinatedGraphicsLayer::usesContentsLayer() const
{
return m_nicosia.contentLayer || m_compositedImage;
Expand Down
Expand Up @@ -33,6 +33,7 @@
#include "NicosiaPlatformLayer.h"
#include "TextureMapperAnimation.h"
#include "TransformationMatrix.h"
#include <wtf/RunLoop.h>
#include <wtf/text/StringHash.h>

namespace Nicosia {
Expand Down Expand Up @@ -149,6 +150,7 @@ class WEBCORE_EXPORT CoordinatedGraphicsLayer : public GraphicsLayer {
float effectiveContentsScale();

void animationStartedTimerFired();
void requestPendingTileCreationTimerFired();

bool filtersCanBeComposited(const FilterOperations&) const;

Expand Down Expand Up @@ -183,6 +185,7 @@ class WEBCORE_EXPORT CoordinatedGraphicsLayer : public GraphicsLayer {
NativeImagePtr m_compositedNativeImagePtr;

Timer m_animationStartedTimer;
RunLoop::Timer<CoordinatedGraphicsLayer> m_requestPendingTileCreationTimer;
TextureMapperAnimations m_animations;
MonotonicTime m_lastAnimationStartTime;

Expand Down

0 comments on commit bbc312b

Please sign in to comment.