Closed
Bug 1457413
Opened 8 years ago
Closed 7 years ago
Scroll jank due to slow paint on gsmarena.com animation
Categories
(Core :: Graphics, defect, P3)
Tracking
()
People
(Reporter: mark.paxman99, Assigned: alexical)
References
(Depends on 1 open bug)
Details
(Whiteboard: [gfx-noted])
Attachments
(3 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:59.0) Gecko/20100101 Firefox/59.0
Build ID: 20180323154952
Steps to reproduce:
Probably re-opening bug 1410461
www.gsmarena.com has an animation in the sidebar (see screenshot attached). The animation slides into & out of view as the page scrolls. On Firefox Mac 59.0.2 (and other Mac versions) the sliding animation causes a huge scroll jank with WebRender OFF. Looking in the devtools Performance screen there seems to be very slow painting when the animation takes place. The FPS can drop to single digits and some paints take many hundreds of ms, screenshot shows a 444 ms paint during the animation.
The problem exists at default & scaled resolutions but might be worse at scaled resolutions.
With WebRender ON the problem disappears and the scrolling is smooth.
I can't upload perf.html profiles ATM, it gets stuck on symbolification, I don't understand. So I've saved the profile and attached it. I hope it works.
In the Marker Chart I see a lot of BHR-detected hang of up to 270 ms and the refresh driver gets stuck for a similar duration. I think that's my scroll jank.
I've also attached a screen grab of the Marker Chart.
Comment 4•8 years ago
|
||
(In reply to Mark from comment #1)
> I can't upload perf.html profiles ATM, it gets stuck on symbolification, I
> don't understand.
(This might be bug 1414383. If you have Xcode installed, try starting it once and accepting the license.)
Yep that fixed it, thanks
https://perfht.ml/2FndQVU
250 ms BHR-detected delays (whatever that means, doesn't sound good but I know nothing) each time I swipe and the sidebar box animates. Scroll linked effect problem? Pretty nasty scroll jank on the real page. I think it's worse at high scaled resolutions, up to 500 ms delay sometimes. WebRender OFF; 1280x800; MacBookPro 11,1; Nightly 2018-04-27.
Comment 6•8 years ago
|
||
User Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:59.0) Gecko/20100101 Firefox/59.0
Firefox 59.0.2, Build ID: 20180323154952
I have tested this issue on latest Firefox 59.0.2 release and latest Nightly (61.0a1) build, but I haven't managed to reproduce this issue.
Mark, can you please retest this using a new Firefox profile (https://goo.gl/AWo6h8), maybe even safe mode (https://goo.gl/AR5o9d), to eliminate custom settings as a possible cause?
Mike, can you please take a look at the provided performance profile from comment 5?
Flags: needinfo?(mconley)
Flags: needinfo?(mark.paxman99)
I see the same problem with a new version of Nightly 2018-05-01 downloaded to the desktop of a newly created user and run from there, i.e. a completely clean Nightly version with no add-ons except Gecko profiler:- big jank as the box animates and BHR-detected delays of ~300 ms on the content thread.
I switched on opacity using gfx.compositor.glcontext.opaque TRUE
-> problem persists, jank and ~300 ms BHR-hangs
I switched Nightly to using Low Resolution mode by cmd-I on its icon and selecting "Open in Low Resolution mode"
-> problem goes away, scrolling is butter smooth and no BHR-detected hangs in the profile.
If I switch WebRender ON
-> problem goes away, ditto
I'm using a MacBookPro 11,1 at default 1280x800 Retina resolution. So a fairly old Retina machine with a fairly weak iGPU. MacOS 10.13.4.
Higher resolutions do seem to make the problem worse, Low Resolution Mode makes the problem go away.
I keep an eye on my GPU power consumption and animating that box causes a big spike in GPU power.
So... a Retina scaling issue? GPU maxing out? How come, with an opaque window & talking to the GPU via OpenGL?
see bug 1422090, bug 1429522 etc etc
Hope someone can replicate it. Cheers
Flags: needinfo?(mark.paxman99)
I don't see the problem on my older non-Retina MacBook Pro from circa 2009. So, just a Retina resolution issue?
Comment 9•8 years ago
|
||
Here's what I see:
1. https://perfht.ml/2HNMVV9: Long GPU upload times on the compositor thread on macOS, because we're copying memory over to it. That should hopefully be made better by bug 1265824.
2. https://perfht.ml/2HRlMRk: Very long paints. Some of these seem to be because we're allocating shared memory because we ran out of texture clients, and had to allocate more.
3. https://perfht.ml/2HNNyOv: There's also a long pause while we flush async paints. Unfortunately, we're not capturing the paint threads in this profile, so it's not clear why.
At any rate, all of this falls pretty squarely within the Graphics component.
| Reporter | ||
Comment 10•8 years ago
|
||
I don't see a paint thread in the perf.html using either FF 59.0.2 or Nightly 61. layers.omtp.enabled is true, all the omtp values are default, WebRender is off. Do I need to turn anything on in the profiler?
Updated•8 years ago
|
Priority: -- → P3
| Reporter | ||
Comment 11•8 years ago
|
||
https://perfht.ml/2K2uVag
with paint thread. Several scrolls up and down so repeated tests of the ~300 ms jank.
Comment 12•8 years ago
|
||
(In reply to Mike Conley (:mconley) (:⚙️) from comment #9)
> 2. https://perfht.ml/2HRlMRk: Very long paints. Some of these seem to be
> because we're allocating shared memory because we ran out of texture
> clients, and had to allocate more.
From the stack it spent time for setting 0xFF000000 to B8G8R8X8 format buffer for Skia.
https://dxr.mozilla.org/mozilla-central/source/gfx/layers/BufferTexture.cpp#490
Comment 13•8 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #12)
> (In reply to Mike Conley (:mconley) (:⚙️) from comment #9)
> > 2. https://perfht.ml/2HRlMRk: Very long paints. Some of these seem to be
> > because we're allocating shared memory because we ran out of texture
> > clients, and had to allocate more.
>
> From the stack it spent time for setting 0xFF000000 to B8G8R8X8 format
> buffer for Skia.
>
> https://dxr.mozilla.org/mozilla-central/source/gfx/layers/BufferTexture.cpp#490
:lsalzman, do we still need it?
Flags: needinfo?(lsalzman)
Comment 14•8 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #13)
> (In reply to Sotaro Ikeda [:sotaro] from comment #12)
> > (In reply to Mike Conley (:mconley) (:⚙️) from comment #9)
> > > 2. https://perfht.ml/2HRlMRk: Very long paints. Some of these seem to be
> > > because we're allocating shared memory because we ran out of texture
> > > clients, and had to allocate more.
> >
> > From the stack it spent time for setting 0xFF000000 to B8G8R8X8 format
> > buffer for Skia.
> >
> > https://dxr.mozilla.org/mozilla-central/source/gfx/layers/BufferTexture.cpp#490
>
> :lsalzman, do we still need it?
Skia absolutely requires that the alpha channel must be filled with opaque values. So this would entirely depend on the question of whether the downstream consumer of this shmem is always clearing it, in its entirety, with opaque values before use. If this is not the case, then we can't remove the mandatory clear.
This is a consequence of the fact that Skia upstream is not willing to support a true BGRX mode, so we just have to fake it.
Flags: needinfo?(lsalzman)
Comment 15•8 years ago
|
||
:rhunt, is it possible to move alpha channel initialization to paint thread if the paint thread is used?
Flags: needinfo?(rhunt)
Comment 16•8 years ago
|
||
Yes it is possible, but I'm not sure that would help here.
It will take the same amount of time on the paint thread to clear the alpha channel as it will on the main thread, and the paint thread looks like it's already busier than the main thread in this profile.
That is, we are blocking in FlushAsyncPaints because the paint thread is still working when a new paint wants to happen [1]. If we move this work to the paint thread, we might just end of blocking in FlushAsyncPaints longer.
[1] https://perfht.ml/2ImbjNW
Flags: needinfo?(rhunt)
| Reporter | ||
Comment 17•8 years ago
|
||
Chrome is butter smooth on the same animation. How does Chrome + Skia handle this?
... or is that a naive question ;)
Updated•8 years ago
|
Whiteboard: [qf]
Updated•8 years ago
|
Whiteboard: [qf] → [qf] [gfx-noted]
Updated•8 years ago
|
Whiteboard: [qf] [gfx-noted] → [qf:f64][qf:p1][gfx-noted]
Updated•8 years ago
|
Whiteboard: [qf:f64][qf:p1][gfx-noted] → [qf:p1:f64][gfx-noted]
Updated•8 years ago
|
Depends on: fixed-by-webrender
Comment 18•8 years ago
|
||
I had a play with this, the problem happens when the sidebar changes to have position:fixed.
When the sidebar is scrolling, the whole page is painted into a single layer.
When the sidebar switches to position:fixed, we separate that into a new layer, and also separate everything above the sidebar (in DOM order) into a layer. Unfortunately this 'above' section is the majority of the page content.
We do this since we assume that async scrolling might move the position:fixed content under the above content, but we don't have code to detect that there's no horizontal scrolling and that it can't actually happen.
From there we try to allocate tiles for all the new layers, exhaust the tile pool and have to actually allocate some of the tiles.
Allocations are slow, clearing the new tiles is slow, and then we have to repaint all the old tiles (to remove the above content), plus all the new tiles.
That's a lot of newly painted pixels, and we have to upload them all which takes a while. Bug 1265824 should make this faster.
Fixing FrameLayerBuilder to know that the sidebar can't ever intersect the scrolled content would be the best thing to do here.
| Reporter | ||
Comment 19•8 years ago
|
||
Yes I experimented with one of the trys for bug 1265824 and it seemed to substantially fix this gsmarena.com bug. Looking forward to bug 1265824 landing properly.
Comment 20•8 years ago
|
||
Filed bug 1477148 for one possible solution to the texture pool problem.
Depends on: 1477148
| Reporter | ||
Comment 21•8 years ago
|
||
I wonder if the problems here are similar to those on the new reddit... bug 1459875.
What they have in common is that both seem to hit my Mac's iGPU very hard. Looking at my GPU power consumption it goes very very when the gsmarena.com sidebar is animating during a scroll, and also when r/firefox is loading or scrolling. I think the high GPU consumption is not related to the opacity and Core Animation stuff affecting Macs, because it happens even with an opaque Firefox context and at default resolution, a configuration which does not normally tax my GPU.
This is with gfx.allow-texture-direct-mapping true.
Comment 22•7 years ago
|
||
Resolving this bug as fixed because the scroll jank was fixed by bug 1265824. The other problems mentioned here already have their own bugs.
Assignee: nobody → dothayer
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
status-firefox62:
--- → wontfix
status-firefox63:
--- → fixed
status-firefox64:
--- → fixed
OS: Unspecified → Mac OS X
Hardware: Unspecified → All
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Updated•4 years ago
|
Performance Impact: --- → P1
Whiteboard: [qf:p1:f64][gfx-noted] → [gfx-noted]
You need to log in
before you can comment on or make changes to this bug.
Description
•