Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ARRISEOS-41099] Repaint page after receiving wpe_compositor_refresh_… #202

Open
wants to merge 1 commit into
base: lgi-master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,9 @@ void ThreadedCompositor::updateViewport()
m_compositingRunLoop->scheduleUpdate();
}

void ThreadedCompositor::forceRepaint()
void ThreadedCompositor::forceRepaint(bool afterCompositorReconfigure)
{
if(!afterCompositorReconfigure) {
// FIXME: Enable this for WPE once it's possible to do these forced updates
// in a way that doesn't starve out the underlying graphics buffers.
#if PLATFORM(GTK)
Expand All @@ -230,6 +231,12 @@ void ThreadedCompositor::forceRepaint()
renderLayerTree();
});
#endif
} else {
m_compositingRunLoop->performTaskSync([this, protectedThis = makeRef(*this)] {
SetForScope<bool> change(m_inForceRepaint, true);
renderLayerTree();
});
}
}

void ThreadedCompositor::renderNonCompositedWebGL()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class ThreadedCompositor : public CoordinatedGraphicsSceneClient, public ThreadS

void invalidate();

void forceRepaint();
void forceRepaint(bool afterCompositorReconfigure = false);

#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
RefPtr<WebCore::DisplayRefreshMonitor> displayRefreshMonitor(WebCore::PlatformDisplayID);
Expand Down
7 changes: 6 additions & 1 deletion Source/WebKit/UIProcess/API/wpe/WPEView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,15 @@ View::View(struct wpe_view_backend* backend, const API::PageConfiguration& baseC
page.handleTouchEvent(WebKit::NativeWebTouchEvent(event, page.deviceScaleFactor()));
#endif
},
// handle_wpe_compositor_refresh
[](void* data)
{
auto& page = reinterpret_cast<View*>(data)->page();
page.repaintAfterCompositorReconfigure();
},
// padding
nullptr,
nullptr,
nullptr,
nullptr
};
wpe_view_backend_set_input_client(m_backend, &s_inputClient, this);
Expand Down
8 changes: 8 additions & 0 deletions Source/WebKit/UIProcess/WebPageProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4354,6 +4354,14 @@ void WebPageProxy::didExitFullscreen()
m_uiClient->didExitFullscreen(this);
}

void WebPageProxy::repaintAfterCompositorReconfigure()
{
if (!isValid())
return;

m_process->send(Messages::WebPage::repaintAfterCompositorReconfigure(), m_pageID);
}

void WebPageProxy::closePage(bool stopResponsivenessTimer)
{
if (stopResponsivenessTimer)
Expand Down
2 changes: 2 additions & 0 deletions Source/WebKit/UIProcess/WebPageProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,8 @@ class WebPageProxy : public API::ObjectImpl<API::Object::Type::Page>
void didEnterFullscreen();
void didExitFullscreen();

void repaintAfterCompositorReconfigure();

WebInspectorProxy* inspector() const;

void didChangeInspectorFrontendCount(unsigned count) { m_inspectorFrontendCount = count; }
Expand Down
4 changes: 2 additions & 2 deletions Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void AcceleratedDrawingArea::setLayerTreeStateIsFrozen(bool isFrozen)
exitAcceleratedCompositingModeSoon();
}

void AcceleratedDrawingArea::forceRepaint()
void AcceleratedDrawingArea::forceRepaint(bool afterCompositorReconfigure)
{
setNeedsDisplay();

Expand All @@ -139,7 +139,7 @@ void AcceleratedDrawingArea::forceRepaint()
// but clearly it doesn't make sense to call the function with that name.
// Consider refactoring and renaming it.
if (m_compositingAccordingToProxyMessages)
m_layerTreeHost->forceRepaint();
m_layerTreeHost->forceRepaint(afterCompositorReconfigure);
else {
// Call setShouldNotifyAfterNextScheduledLayerFlush(false) here to
// prevent layerHostDidFlushLayers() from being called a second time.
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class AcceleratedDrawingArea : public DrawingArea {
void setLayerTreeStateIsFrozen(bool) override;
bool layerTreeStateIsFrozen() const override { return m_layerTreeStateIsFrozen; }
LayerTreeHost* layerTreeHost() const override { return m_layerTreeHost.get(); }
void forceRepaint() override;
void forceRepaint(bool afterCompositorReconfigure = false) override;
bool forceRepaintAsync(CallbackID) override;

void setPaintingEnabled(bool) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void CoordinatedLayerTreeHost::resumeRendering()
LayerTreeHost::resumeRendering();
}

void CoordinatedLayerTreeHost::forceRepaint()
void CoordinatedLayerTreeHost::forceRepaint(bool afterCompositorReconfigure)
{
// This is necessary for running layout tests. Since in this case we are not waiting for a UIProcess to reply nicely.
// Instead we are just triggering forceRepaint. But we still want to have the scripted animation callbacks being executed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CoordinatedLayerTreeHost : public LayerTreeHost, public CompositingCoordin
void pauseRendering() override;
void resumeRendering() override;

void forceRepaint() override;
void forceRepaint(bool afterCompositorReconfigure = false) override;
bool forceRepaintAsync(CallbackID) override;
void sizeDidChange(const WebCore::IntSize& newSize) override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ void ThreadedCoordinatedLayerTreeHost::invalidate()
m_surface = nullptr;
}

void ThreadedCoordinatedLayerTreeHost::forceRepaint()
void ThreadedCoordinatedLayerTreeHost::forceRepaint(bool afterCompositorReconfigure)
{
CoordinatedLayerTreeHost::forceRepaint();
m_compositor->forceRepaint();
m_compositor->forceRepaint(afterCompositorReconfigure);
}

void ThreadedCoordinatedLayerTreeHost::pauseRendering()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ThreadedCoordinatedLayerTreeHost final : public CoordinatedLayerTreeHost,

void invalidate() override;

void forceRepaint() override;
void forceRepaint(bool afterCompositorReconfigure = false) override;

void pauseRendering() override;
void resumeRendering() override;
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/WebProcess/WebPage/DrawingArea.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class DrawingArea : public IPC::MessageReceiver {

// FIXME: These should be pure virtual.
virtual void pageBackgroundTransparencyChanged() { }
virtual void forceRepaint() { }
virtual void forceRepaint(bool afterCompositorReconfigure = false) { }
virtual bool forceRepaintAsync(CallbackID) { return false; }
virtual void setLayerTreeStateIsFrozen(bool) { }
virtual bool layerTreeStateIsFrozen() const { return false; }
Expand Down
4 changes: 2 additions & 2 deletions Source/WebKit/WebProcess/WebPage/DrawingAreaImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void DrawingAreaImpl::scroll(const IntRect& scrollRect, const IntSize& scrollDel
m_scrollOffset += scrollDelta;
}

void DrawingAreaImpl::forceRepaint()
void DrawingAreaImpl::forceRepaint(bool afterCompositorReconfigure)
{
if (m_inUpdateBackingStoreState) {
m_forceRepaintAfterBackingStoreStateUpdate = true;
Expand All @@ -157,7 +157,7 @@ void DrawingAreaImpl::forceRepaint()
m_forceRepaintAfterBackingStoreStateUpdate = false;

if (m_layerTreeHost) {
AcceleratedDrawingArea::forceRepaint();
AcceleratedDrawingArea::forceRepaint(afterCompositorReconfigure);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/WebProcess/WebPage/DrawingAreaImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class DrawingAreaImpl final : public AcceleratedDrawingArea {
void setNeedsDisplay() override;
void setNeedsDisplayInRect(const WebCore::IntRect&) override;
void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollDelta) override;
void forceRepaint() override;
void forceRepaint(bool afterCompositorReconfigure = false) override;

void updatePreferences(const WebPreferencesStore&) override;

Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/WebProcess/WebPage/LayerTreeHost.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class LayerTreeHost : public RefCounted<LayerTreeHost> {
virtual void setNonCompositedContentsNeedDisplay() { };
virtual void setNonCompositedContentsNeedDisplayInRect(const WebCore::IntRect&) { };
virtual void scrollNonCompositedContents(const WebCore::IntRect&) { };
virtual void forceRepaint() = 0;
virtual void forceRepaint(bool afterCompositorReconfigure = false) = 0;
virtual bool forceRepaintAsync(CallbackID) { return false; }
virtual void sizeDidChange(const WebCore::IntSize& newSize) = 0;
virtual void pageBackgroundTransparencyChanged() = 0;
Expand Down
5 changes: 5 additions & 0 deletions Source/WebKit/WebProcess/WebPage/WebPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3148,6 +3148,11 @@ void WebPage::forceRepaintWithoutCallback()
m_drawingArea->forceRepaint();
}

void WebPage::repaintAfterCompositorReconfigure()
{
m_drawingArea->forceRepaint(true);
}

void WebPage::forceRepaint(CallbackID callbackID)
{
if (m_drawingArea->forceRepaintAsync(callbackID))
Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/WebProcess/WebPage/WebPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,7 @@ class WebPage : public API::ObjectImpl<API::Object::Type::BundlePage>, public IP
float deviceScaleFactor() const;

void forceRepaintWithoutCallback();
void repaintAfterCompositorReconfigure();

void unmarkAllMisspellings();
void unmarkAllBadGrammar();
Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/WebProcess/WebPage/WebPage.messages.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
messages -> WebPage LegacyReceiver {
SetInitialFocus(bool forward, bool isKeyboardEventValid, WebKit::WebKeyboardEvent event, WebKit::CallbackID callbackID)
SetActivityState(OptionSet<WebCore::ActivityState::Flag> activityState, WebKit::ActivityStateChangeID activityStateChangeID, Vector<WebKit::CallbackID> callbackIDs)
repaintAfterCompositorReconfigure()
SetLayerHostingMode(enum WebKit::LayerHostingMode layerHostingMode)

SetDrawsBackground(bool drawsBackground)
Expand Down