WebPlatformForEmbedded / WPEWebKit

WPE WebKit port (downstream)
210 stars 135 forks source link

Force sync layer states on making browser visible #1270

Closed kkanag314 closed 6 months ago

kkanag314 commented 6 months ago
< bug title >
https://bugs.webkit.org/show_bug.cgi?id=#####

Reviewed by NOBODY (OOPS!).

*  ./WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp :
(LayerTreeHost::resumeRendering()): 

kkanag314 commented 6 months ago

When there is a state change (i.e., visibility is restored by browser plugin),ThreadedCompositor schedules an update immediately in wpe-2.38.But this update causes TheadedCompositor to use existing states to display a frame (stale frame from the previous app) Andalso In wpe_2.28 layerFlush will always force a repaint https://github.com/WebPlatformForEmbedded/WPEWebKit/blob/wpe-2.28/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp#L796 But in wpe_2.38, state update is not happening always, so ThreadedCompositor uses existing states for drawing on visibility state change. https://github.com/WebPlatformForEmbedded/WPEWebKit/commit/d6716e4ccbe4f73ba0a27fa6d71a900bb6dfa26e

The call flow : WebPageProxy::activityStateDidChange WebPageProxy::dispatchActivityStateChange sendWithAsyncReply(Messages::WebPage::SetActivityState(...)) WebPage::setActivityState Page::setActivityState DrawingAreaCoordinatedGraphics::activityStateDidChange DrawingAreaCoordinatedGraphics::resumePainting LayerTreeHost::resumeRendering ThreadedCompositor::resume <- This resumes CompositionRunLoop & schedules an update rightaway (in 2.28, the scheduling is not done here) WPE_2.28 => https://github.com/WebPlatformForEmbedded/WPEWebKit/blob/wpe-2.28/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp#L160 WPE_2.38 => https://github.com/WebPlatformForEmbedded/WPEWebKit/blob/wpe-2.38/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp#L173 LayerTreeHost::scheduleLayerFlush <- This will update layers and trigger an update in the flow later (only if there is some change in any of the layers)

As part of the changes,We are forceing the repaint and the state will be updated in ThreadedCompositor::resume()

kkanag314 commented 6 months ago

@magomez Could you please review the changes

magomez commented 6 months ago

@kkanag314 can you provide a test case or some URL where I can reproduce this problem?