Closed
Bug 952878
Opened 11 years ago
Closed 11 years ago
LayerRenderer.drawBackground can be expensive during a pageload
Categories
(Firefox for Android Graveyard :: Toolbar, defect)
Tracking
(firefox29+ fixed)
RESOLVED
FIXED
Firefox 29
People
(Reporter: mfinkle, Assigned: rnewman)
References
Details
(Keywords: perf)
Attachments
(4 files, 1 obsolete file)
50.70 KB,
image/png
|
Details | |
53.27 KB,
image/png
|
Details | |
6.09 KB,
patch
|
kats
:
review+
|
Details | Diff | Splinter Review |
2.50 KB,
patch
|
wesj
:
review+
|
Details | Diff | Splinter Review |
While loading cnn.com, LayerRenderer.drawBackground shows up in profiles at #38, taking ~150ms called 59 times.
The expensive call seems to be drawing the shadowlayer:
http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/gfx/LayerRenderer.java#604
What do we use the shadow layer for?
Reporter | ||
Comment 1•11 years ago
|
||
Most of the time is taken up here
Assignee | ||
Updated•11 years ago
|
Assignee | ||
Comment 2•11 years ago
|
||
mShadowView is undocumented, and has been around since the very first implementation of LayerView:
changeset: 81790:eaf778e88070
user: Patrick Walton <pwalton@mozilla.com>
date: Wed Nov 09 17:39:29 2011 -0800
summary: Bug 695448 - Implement a Java compositor, and use it to scroll. r=?
(which isn't attached to or discussed in that bug, nor any of its dependencies that I can see. Trail runs cold.)
Seeing needinfo on Patrick to comment on what it's for, and why it's so expensive.
Flags: needinfo?(pwalton)
Comment 3•11 years ago
|
||
The shadow layer is the shadow that you see around the content when you overscroll. Except that now you can't overscroll any more, so we can probably do without it.
Flags: needinfo?(pwalton)
Comment 4•11 years ago
|
||
Since overscrolling is gone, you can nuke the shadow layer.
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → rnewman
Status: NEW → ASSIGNED
Assignee | ||
Comment 5•11 years ago
|
||
This seems to work on my device...
Attachment #8351240 -
Flags: review?(bugmail.mozilla)
Assignee | ||
Comment 6•11 years ago
|
||
Also looks like overscroll was eliminated in 27, so this should probably be uplifted, no?
Assignee | ||
Comment 7•11 years ago
|
||
This also eliminates the overscroll color, which is also unnecessary.
Attachment #8351241 -
Flags: review?(bugmail.mozilla)
Assignee | ||
Updated•11 years ago
|
Attachment #8351240 -
Attachment is obsolete: true
Attachment #8351240 -
Flags: review?(bugmail.mozilla)
Reporter | ||
Comment 9•11 years ago
|
||
(In reply to Richard Newman [:rnewman] from comment #8)
> Perf win with this patch, mfinkle?
LayerRenderer.drawBackground moves from #38 down to #195 in the profile list. I don't see any visual regressions with the patch either.
Flags: needinfo?(mark.finkle)
Comment 10•11 years ago
|
||
Comment on attachment 8351241 [details] [diff] [review]
Eliminate shadow layer. v2
Review of attachment 8351241 [details] [diff] [review]:
-----------------------------------------------------------------
LGTM. Also flagging wesj for feedback in case there's some reason this shouldn't come out.
::: mobile/android/base/gfx/LayerRenderer.java
@@ -137,5 @@
> public LayerRenderer(LayerView view) {
> mView = view;
> - mOverscrollColor = view.getContext().getResources().getColor(R.color.background_normal);
> -
> - CairoImage shadowImage = new BufferedCairoImage(view.getShadowPattern());
You can also get rid of LayerView.getShadowPattern and drawable-mdpi/shadow.png.
Attachment #8351241 -
Flags: review?(bugmail.mozilla)
Attachment #8351241 -
Flags: review+
Attachment #8351241 -
Flags: feedback?(wjohnston)
Assignee | ||
Comment 11•11 years ago
|
||
Figured I'd land this and we can back it out or tweak it if Wes has further feedback. Thanks for the holiday review, kats!
Flags: needinfo?(wjohnston)
Target Milestone: --- → Firefox 29
Comment 12•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Comment 13•11 years ago
|
||
There are a lot of times when the viewport still isn't set correctly (for instance, load Twitter, scroll down a ways in the stream, and then click reply on a tweet) leading to graphical corruption pretty frequently showing with this patch. Other than that, I was just holding off on doing this until we were sure the other stuff was good to go.
Flags: needinfo?(wjohnston)
Assignee | ||
Comment 14•11 years ago
|
||
(In reply to Wesley Johnston (:wesj) from comment #13)
> There are a lot of times when the viewport still isn't set correctly (for
> instance, load Twitter, scroll down a ways in the stream, and then click
> reply on a tweet) leading to graphical corruption pretty frequently showing
> with this patch. Other than that, I was just holding off on doing this until
> we were sure the other stuff was good to go.
I've seen this on, IIRC, the occasional Blogger site -- a hall of mirrors off to the side where the viewport wasn't right. Is this something that's on track to be fixed (and if so, what's the bug number?), or should we back this out?
(Turns out this is a nice panning perf win, so I'd definitely rather keep it than back it out!)
Flags: needinfo?(wjohnston)
Comment 15•11 years ago
|
||
No bug. You mind filing (and marking them blocking this?)?
Avoid uplifiting until we feel good about things, and be prepared re-evaluate and back this out on beta, but we really should fix the viewport bugs and this will help push us to do it.
Flags: needinfo?(wjohnston)
Assignee | ||
Comment 16•11 years ago
|
||
Done. Marking tracking so we can watch this as 29 rides the trains.
(Also uncovered the excitement of Bug 955958 while I was trying to repro. Fun times.)
tracking-firefox29:
--- → ?
Updated•11 years ago
|
Reporter | ||
Comment 17•11 years ago
|
||
If we decide to back this out because of graphical corruption, I would like to try a partial backout first. I originally saw the Shadow causing some slow down. We then decided to try to remove the Overflow color too. If the regressions are related to the Overflow color, let's only add that back.
Reporter | ||
Comment 18•11 years ago
|
||
Brian, Wes - Can you also check that this patch actually fixes the corruption? I have not seen it myself.
Attachment #8358608 -
Flags: review?(wjohnston)
Flags: needinfo?(bnicholson)
Comment 20•11 years ago
|
||
Comment on attachment 8358608 [details] [diff] [review]
Add overflow color back v0.1
Review of attachment 8358608 [details] [diff] [review]:
-----------------------------------------------------------------
::: mobile/android/base/gfx/LayerRenderer.java
@@ +589,5 @@
>
> GLES20.glDisable(GLES20.GL_SCISSOR_TEST);
>
> + // Draw the overscroll background area as a solid color
> + clear(mOverscrollColor);
I'd like to try using mBackgroundColor here. It should match the page and look more like the page just continues on. Up to you though.
Attachment #8358608 -
Flags: review?(wjohnston) → review+
Reporter | ||
Comment 21•11 years ago
|
||
(In reply to Wesley Johnston (:wesj) from comment #20)
> Comment on attachment 8358608 [details] [diff] [review]
> Add overflow color back v0.1
>
> Review of attachment 8358608 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: mobile/android/base/gfx/LayerRenderer.java
> @@ +589,5 @@
> >
> > GLES20.glDisable(GLES20.GL_SCISSOR_TEST);
> >
> > + // Draw the overscroll background area as a solid color
> > + clear(mOverscrollColor);
>
> I'd like to try using mBackgroundColor here. It should match the page and
> look more like the page just continues on. Up to you though.
We already do use the background color a few lines below, although we call setScissorRect first. Given that we are setting the background color and still saw a corruption, and Brian verified the current patch fixes bug 956939 - I want to just land this patch for now. We can file a new bug for removing the overflow color.
Perhaps we can really cleanup drawBackground:
* use background color instead of overflow color in the general clear() call
* stop calling setScissorRect and the now redundant clear with the background color
* stop calling GLES20.glDisable(GLES20.GL_SCISSOR_TEST); twice too
Reporter | ||
Comment 22•11 years ago
|
||
Pushed partial backout
https://hg.mozilla.org/integration/fx-team/rev/e9f1c39fe072
Comment 23•11 years ago
|
||
Updated•11 years ago
|
Updated•11 years ago
|
Attachment #8351241 -
Flags: feedback?(wjohnston)
Assignee | ||
Updated•11 years ago
|
status-firefox29:
--- → fixed
Updated•4 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•