Closed Bug 810302 Opened 12 years ago Closed 12 years ago

Invalidation problems during scrolling after playing video

Categories

(Core :: Layout, defect)

x86_64
Linux
defect
Not set
major

Tracking

()

RESOLVED FIXED
mozilla20
Tracking Status
firefox18 + fixed
firefox19 + fixed
firefox20 + fixed

People

(Reporter: MatsPalmgren_bugz, Assigned: mattwoodrow)

References

()

Details

(Keywords: regression, reproducible, Whiteboard: [qa?])

Attachments

(5 files, 1 obsolete file)

STEPS TO REPRODUCE
1. create a fresh profile, start Firefox and then disable
   "Use smooth scrolling" in Preferences->Advanced
(also, click away any dialogs and other panels that may appear)
2. load https://hacks.mozilla.org/2012/11/firefox-os-video-presentations-and-slides-on-the-os-webapis-hacking-and-writing-apps/
3. scroll down a bit, then start one of the videos
4. click near the end in the video time slider and wait until the
   video stops
5. grab the scrollbar thumb and drag it the end of the page,
   then drag it to the top, then slowly one page down about where
   the video elements are
6. repeat 5 until you see content disappearing.  If it doesn't
   occur, try starting another of the videos and repeat 4,5

ACTUAL RESULTS
Content is not repainted properly, see attached video.
This is 100% reproducible even after restarting Fx.

PLATFORMS AND BUILDS TESTED
Nightly 19.0a1 (2012-11-08), Linux64
Attached video screen capture
Actually, the same STR is also reproducible with smooth scrolling, so it's
not necessary to change that pref.
I am seeing something similar scrolling divs in the autolog replacement for tbpl. No video involved. This appears to have started with this mornings update on OSX 10.7. I've seen it elsewhere this morning. I'll try to find a public instance.
Also reproducible after watching the "The HydroICE Solar Project" video at
http://inhabitat.com/hydroice-solar-powered-combustion-engine-could-cut-solar-costs-by-75/
and then scrolling the page to the end, using 20.0a1 (2012-11-27) Linux64.
Severity: normal → major
Assignee: nobody → matt.woodrow
Alright, I can reproduce this.

Note that it requires hardware acceleration to be disabled, and for you to have opted into the html5 trial on youtube.
Well, this was fun.

Once the video finishes playing, the size of the frame changes to 1x1 (pixels), and we adjust that for the aspect ratio to 1x0. We then use that to build a singular transform, which triggers cairo errors during painting and is the reason for us not painting half the page.

This patch fixes the issue in two places, and adds an assertion so that it's easier to catch.
Attachment #686349 - Flags: review?(roc)
There's a few other issues on this page too.

1) HTML5 video is causing component alpha flattening on BasicLayers - I assume something in the controls has text without opaque content behind it. This is pretty bad for video performance, but is easily fixed (use LAYER_ACTIVE_FORCE for the video layer) if losing subpixel AA for the controls text is acceptable.

2) Scrolling this page after it's started flattening component alpha repaints the whole page. This is probably the cause of other poor scrolling performance on BasicLayers bugs, as soon as anything triggers this, then scrolling will be slow.

We should only need to repaint the entire page if the component alpha flattening is being triggered by a fixed position background.

When we have a flattened container, we set the active scrolled root of all display items within it to be the containers reference frame, and all scrolling is detected (correctly) as a shift relative to the scrolled root, which invalidates.

There seems to be two options here, set the active scrolled root to be a frame that is above the actual scroll point (what we currently do), or set the active scrolled root to be the primary scroll frame for the page.

The former means that on pages with a fixed position background, we only invalidate the shifted content when we scroll, which is presumably considerably less than the entire page. However, on pages without a fixed background then we're invalidating the entire page.

The latter would result in no unnecessary invalidation when scrolling a page without a fixed background, but would invalidate more when we do have one.

I'd like to find a way to decide how much of the visible area is covered in fixed content, and use that to decide which of the two approaches will perform better for the current page.
I *think* that when we first decide to flatten layers, we can inspect the layer tree built, make the decision, and store that information for further paints.

I think the important question to answer is 'which scrolled root would be the best choice for all child layers to minimize the amount of painting during scrolling?'.

Need to figure out what heuristics to use to answer that.
This is a fairly simple approach for fixing problem 2.

It just takes the back-most display item for the flattened layer, and uses that to decide what active scrolled root to use.

Little bit worried about regressions with a change like this.
Attachment #686419 - Flags: review?(roc)
Youtubes video controls are definitely transparent (rgba 0,0,0,204) which is forcing the video to be inactive and ruining performance.

I think we should favour video playback performance over having subpixel AA in text on top of the video.
Attachment #686420 - Flags: review?(roc)
Comment on attachment 686419 [details] [diff] [review]
Use the background to decide the active scrolled root

Review of attachment 686419 [details] [diff] [review]:
-----------------------------------------------------------------

can this lead to the active scrolled root for an item not being an ancestor of the item's frame?
That seems unlikely, but possible, yes.
I'm not sure how we'd prevent that, maybe an extra iteration over the display items?
Yes, maybe if we have to flatten then we should traverse the display items in a separate pass to determine what the correct activeScrolledRoot should be.
https://hg.mozilla.org/mozilla-central/rev/54f28b6c51b5
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
Comment on attachment 686349 [details] [diff] [review]
Avoid singular transforms

[Approval Request Comment]
Bug caused by (feature/regressing bug #): Unsure exactly, bug has existed for a long time, but was made worse/exposed by bug 741682.
User impact if declined: Possible missing rendering on pages with videos and no hardware acceleration.
Testing completed (on m-c, etc.): Been on m-c for a week.
Risk to taking this patch (and alternatives if risky): Very low risk, just stops us trying to draw 0 sized videos.
String or UUID changes made by this patch: None.
Attachment #686349 - Flags: approval-mozilla-beta?
Attachment #686349 - Flags: approval-mozilla-aurora?
Comment on attachment 686420 [details] [diff] [review]
Force videos to always have active layers

[Approval Request Comment]
Bug caused by (feature/regressing bug #): Bug 741682
User impact if declined: Regressed youtube html5 video playback performance without hardware acceleration.
Testing completed (on m-c, etc.): Been on m-c for a week.
Risk to taking this patch (and alternatives if risky): Low risk, this takes us back closer to the original behaviour of having the video in it's own layer.
String or UUID changes made by this patch: None
Attachment #686420 - Flags: approval-mozilla-beta?
Attachment #686420 - Flags: approval-mozilla-aurora?
Comment on attachment 686938 [details] [diff] [review]
Use the background to decide the active scrolled root v2

[Approval Request Comment]
Bug caused by (feature/regressing bug #): Bug 741682
User impact if declined: Reduced scrolling performance on pages that have text on top of a transparent layer. HTML5 youtube videos trigger this, and this is likely the cause of bugs 781414, and 781414.
Testing completed (on m-c, etc.): Been on m-c for a week without issues.
Risk to taking this patch (and alternatives if risky): Higher risk than the other two, but shouldn't be too bad. I would expect to have seen regressions from m-c by now if there were issues. Definitely high impact, I think it's worth taking this.
String or UUID changes made by this patch: None
Attachment #686938 - Flags: approval-mozilla-beta?
Attachment #686938 - Flags: approval-mozilla-aurora?
Comment on attachment 686349 [details] [diff] [review]
Avoid singular transforms

Willing to take this high-impact fix since it's still early enough in 18 betas that we can make sure to get testing pre-release.  Is there anything QA can do to verify this is fixed and doesn't cause regressions?
Attachment #686349 - Flags: approval-mozilla-beta?
Attachment #686349 - Flags: approval-mozilla-beta+
Attachment #686349 - Flags: approval-mozilla-aurora?
Attachment #686349 - Flags: approval-mozilla-aurora+
Attachment #686420 - Flags: approval-mozilla-beta?
Attachment #686420 - Flags: approval-mozilla-beta+
Attachment #686420 - Flags: approval-mozilla-aurora?
Attachment #686420 - Flags: approval-mozilla-aurora+
Attachment #686938 - Flags: approval-mozilla-beta?
Attachment #686938 - Flags: approval-mozilla-beta+
Attachment #686938 - Flags: approval-mozilla-aurora?
Attachment #686938 - Flags: approval-mozilla-aurora+
I don't see this issue on the 12/07 build on Ubuntu 12.04 64bit, but I can't reproduce it on the 11/09 build either.

Mats, or anyone else that can reproduce the initial issue, please try to verify the fix on the latest Nightly.
Could not reproduce this issue following STR from Comment 0 and doing some exploratory in plus.

18b03
Mozilla/5.0 (X11; Linux i686; rv:18.0) Gecko/20100101 Firefox/18.0 (20121205060959)

Latest Nightly
Mozilla/5.0 (X11; Linux i686; rv:20.0) Gecko/20121209 Firefox/20.0 (20121209030817)

Based on this and on Comment 25 I consider this issue verified for ff18. If someone can still reproduce this issue please move back status for ff18 as fixed.
Considering comment 24, are there any reliable steps for reproducing this bug?
Whiteboard: [qa?]
(In reply to MarioMi from comment #26)
> Could not reproduce this issue following STR from Comment 0 and doing some
> exploratory in plus.
> 
> 18b03
> Mozilla/5.0 (X11; Linux i686; rv:18.0) Gecko/20100101 Firefox/18.0
> (20121205060959)
> 
> Latest Nightly
> Mozilla/5.0 (X11; Linux i686; rv:20.0) Gecko/20121209 Firefox/20.0
> (20121209030817)
> 
> Based on this and on Comment 25 I consider this issue verified for ff18. If
> someone can still reproduce this issue please move back status for ff18 as
> fixed.

MarioMi, can you reproduce this issue on the build it was filed on? If so, please verify it on all the versions it's tracked on.
Keywords: verifyme
Ioana I was not able to reproduce this issue on Mozilla/5.0 (X11; Linux i686; rv:19.0) Gecko/19.0 Firefox/19.0 (20121109030635). I tryed following STR from Comment 0 for all videos on that page but with no result.
Thanks for the reply, MarioMi. Please only mark the bug back as verified after performing the following steps:
1. reproduce the issue on a build without the fix;
2. verify the fix in the same environment as at step 1, but with a build with the fix.
Keywords: qawanted
Note also the additional requirements to reproduce the problem in comment 5.
Depends on: 829943
Depends on: 828206
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: