Bug 195270

Summary: [CoordinatedGraphics] The compositing loop is still running even after exiting AC mode
Product: WebKit Reporter: Fujii Hironori <Hironori.Fujii>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bugs-noreply, cgarcia, commit-queue, don.olmstead, zan
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=194979
https://bugs.webkit.org/show_bug.cgi?id=184969
Bug Depends on:    
Bug Blocks: 186364, 194979    
Attachments:
Description Flags
Patch none

Description Fujii Hironori 2019-03-04 02:24:56 PST
[CoordinatedGraphics] The compositing loop is still running even after exiting AC mode

I tested with GTK port MiniBrowser, trunk@242333. 

1) Go to https://bugs.webkit.org/
2) Go to https://webkit.org/blog-files/3d-transforms/morphing-cubes.html
3) Back
4) The compositing loop is still running.
5) Wait to 5 second to destruct LayerTreeHost
6) The compositing loop is still running.

Callstack:

> #0  WebKit::ThreadedCompositor::renderLayerTree (this=0x7fae65f165d8)
>     at ../../Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:178
> #1  0x00007fae7c3c0f2f in WebKit::ThreadedCompositor::<lambda()>::operator()(void) const (__closure=0x7fae65f04bb8)
>     at ../../Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:57
> #2  0x00007fae7c3c8fc4 in WTF::Function<void()>::CallableWrapper<WebKit::ThreadedCompositor::ThreadedCompositor(WebKit::ThreadedCompositor::Client&, WebKit::ThreadedDisplayRefreshMonitor::Client&, WebCore::PlatformDisplayID, const WebCore::IntSize&, float, WebKit::ThreadedCompositor::ShouldDoFrameSync, WebCore::TextureMapper::PaintFlags)::<lambda()> >::call(void) (this=0x7fae65f04bb0) at DerivedSources/ForwardingHeaders/wtf/Function.h:102
> #3  0x00007fae7bf0808e in WTF::Function<void ()>::operator()() const (this=0x7fae65fb4f50) at DerivedSources/ForwardingHeaders/wtf/Function.h:57
> #4  0x00007fae7c3c0e58 in WebKit::CompositingRunLoop::updateTimerFired (this=0x7fae65fb4f08)
>     at ../../Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:210
> #5  0x00007fae7c3da726 in WTF::RunLoop::Timer<WebKit::CompositingRunLoop>::fired (this=0x7fae65fb4f10) at DerivedSources/ForwardingHeaders/wtf/RunLoop.h:148
> #6  0x00007fae70208723 in WTF::RunLoop::TimerBase::<lambda(gpointer)>::operator()(gpointer) const (__closure=0x0, userData=0x7fae65fb4f10)
>     at ../../Source/WTF/wtf/glib/RunLoopGLib.cpp:171
> #7  0x00007fae7020877b in WTF::RunLoop::TimerBase::<lambda(gpointer)>::_FUN(gpointer) () at ../../Source/WTF/wtf/glib/RunLoopGLib.cpp:177
> #8  0x00007fae70207dc4 in WTF::<lambda(GSource*, GSourceFunc, gpointer)>::operator()(GSource *, GSourceFunc, gpointer) const (__closure=0x0, 
>     source=0x55ad6efe9760, callback=0x7fae7020875e <WTF::RunLoop::TimerBase::<lambda(gpointer)>::_FUN(gpointer)>, userData=0x7fae65fb4f10)
>     at ../../Source/WTF/wtf/glib/RunLoopGLib.cpp:45
> #9  0x00007fae70207df4 in WTF::<lambda(GSource*, GSourceFunc, gpointer)>::_FUN(GSource *, GSourceFunc, gpointer) () at ../../Source/WTF/wtf/glib/RunLoopGLib.cpp:46
> #10 0x00007fae71daaa58 in g_main_dispatch () at ../../Source/glib-2.58.1/glib/gmain.c:3182
> #11 g_main_context_dispatch () at ../../Source/glib-2.58.1/glib/gmain.c:3847
> #12 0x00007fae71daae48 in g_main_context_iterate () at ../../Source/glib-2.58.1/glib/gmain.c:3920
> #13 0x00007fae71dab142 in g_main_loop_run () at ../../Source/glib-2.58.1/glib/gmain.c:4116
> #14 0x00007fae70208333 in WTF::RunLoop::run () at ../../Source/WTF/wtf/glib/RunLoopGLib.cpp:96
> #15 0x00007fae7c3c05e5 in WebKit::<lambda()>::operator()(void) const (__closure=0x7fae1e0dd278)
>     at ../../Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:49
> #16 0x00007fae7c3c90b4 in WTF::Function<void()>::CallableWrapper<WebKit::createRunLoop()::<lambda()> >::call(void) (this=0x7fae1e0dd270)
>     at DerivedSources/ForwardingHeaders/wtf/Function.h:102
> #17 0x00007fae7bf0808e in WTF::Function<void ()>::operator()() const (this=0x7fadf69fec30) at DerivedSources/ForwardingHeaders/wtf/Function.h:57
> #18 0x00007fae701936c3 in WTF::Thread::entryPoint (newThreadContext=0x7fae65f1e8c0) at ../../Source/WTF/wtf/Threading.cpp:148
> #19 0x00007fae7020ab87 in WTF::wtfThreadEntryPoint (context=0x7fae65f1e8c0) at ../../Source/WTF/wtf/posix/ThreadingPOSIX.cpp:200
> #20 0x00007fae6c5fd164 in start_thread (arg=<optimized out>) at pthread_create.c:486
> #21 0x00007fae72c2bdef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Comment 1 Carlos Garcia Campos 2019-03-04 03:34:07 PST
I think this is because of PSON, it was enabled in GTK, but we are not yet ready to enable it.
Comment 2 Carlos Garcia Campos 2019-03-04 03:57:18 PST
I'm going to rollout r242045, but I'm leaving this bug open, because the compositor run loop shouldn't be running even for the 5 seconds until the layer host is destroyed. I have a wip patch to properly suspend/resume the threaded compositor.
Comment 3 Fujii Hironori 2019-03-04 05:52:41 PST
Thank you. This is causing a flicker bug mixing AC rendering and non-AC rendering for the five seconds.
I tried to stop the compositing loop in WIP patch, but it doesn't work as expected (Bug 186364 Comment 10).
Comment 4 Carlos Garcia Campos 2019-03-04 06:34:06 PST
Created attachment 363507 [details]
Patch
Comment 5 WebKit Commit Bot 2019-03-04 10:06:24 PST
Comment on attachment 363507 [details]
Patch

Clearing flags on attachment: 363507

Committed r242364: <https://trac.webkit.org/changeset/242364>
Comment 6 WebKit Commit Bot 2019-03-04 10:06:25 PST
All reviewed patches have been landed.  Closing bug.
Comment 7 Fujii Hironori 2019-03-04 17:54:01 PST
I confirmed your change fixed the WinCairo issue (Bug 186364 Comment 12). It works very nicely. Thank you very much.