Closed Bug 1420430 Opened 7 years ago Closed 6 years ago

Figure out why we rebuild scenes so often (particularly when playing video)

Categories

(Core :: Graphics: WebRender, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
Tracking Status
firefox59 --- affected

People

(Reporter: nical, Assigned: Gankra)

References

Details

(Whiteboard: [wr-reserve] [gfx-noted])

During video playback, if there is no invalidation in the page and if the video controls are not shown, we should be able to render the video without rebuilding the scene every frame. It works in simple cases but on youtube the scene gets rebuilt a lot (most frames) while I don't see any thing other than the vidoe visually changing on the page.

We should investigate this as a followup from Bug 1395989.
Priority: -- → P3
Whiteboard: [gfx-noted][wr-mvp] [triage] → [gfx-noted][wr-mvp] [triage][wr-reserve-candidate]
Whiteboard: [gfx-noted][wr-mvp] [triage][wr-reserve-candidate] → [wr-reserve] [gfx-noted]
Assignee: nobody → nical.bugzilla
After talked to nical on IRC, I would take this to see if there is anything I can do here.
Assignee: nical.bugzilla → vliu
From log observation I added, currently there are two paths to call build_scene[1] in render backend while video playing.

a). The message UpdateDynamicProperties[2] was received to update properties for animation.
b). The message SetDisplayList[3] was received to set displaylist.

The example html file to load video to play is quite simple showing below

        <!DOCTYPE html> 
        <html> 
        <body> 

        <video width="400" controls autoplay>
          <source src="1.webm" type="video/webm">
          Your browser does not support HTML5 video.
        </video>
        </body> 
        </html>

From above, it seems that both a) and b) were quite often to be called in each EndTransaction and CompositeToTarget to trigger build scene. I think it is better to look into them separately


[1]: https://searchfox.org/mozilla-central/rev/137f1b2f434346a0c3756ebfcbdbee4069e15dc8/gfx/webrender/src/render_backend.rs#111
[2]: https://searchfox.org/mozilla-central/rev/137f1b2f434346a0c3756ebfcbdbee4069e15dc8/gfx/webrender/src/render_backend.rs#460
[3]: https://searchfox.org/mozilla-central/rev/137f1b2f434346a0c3756ebfcbdbee4069e15dc8/gfx/webrender/src/render_backend.rs#291
(In reply to Vincent Liu[:vliu] from comment #2)
> b). The message SetDisplayList[3] was received to set displaylist.

I've filed bug 1430610 about the unnecessary display list building on the main thread.
I tried to play youtube bug 1430451 offered[1] to check the calling paths. 


> a). The message UpdateDynamicProperties[2] was received to update properties
> for animation.

 The build_scene was called by hovering video control bar during video playing. It wouldn't be a problem for this.

> b). The message SetDisplayList[3] was received to set displaylist.
  
  bug 1430610 was filed for this. I will take it for further study.
See Also: → 1430610
Depends on: 1430610
See Also: 1430610
nical, is it still a problem?
Flags: needinfo?(nical.bugzilla)
Looks like you fixed it on youtube! I still see some odd behaviors in other places.

For example watch https://media.w3.org/2010/05/sintel/trailer.webm with the pref "gfx.webrender.debug.epochs" set to true (need to manually add the pref in about:config).

You should see a that the chrome's pipeline's epoch stays fairly stable, the video pipeline's epoch is continuously updating as expected and the content's pipeline updating a whole lot more than I would expect it to.
pausing the video doesn't seem to prevent the pipelines from furiously updating either which might be another problem but worth looking into.

That said we need a better indicator than the epoch, because the latter can be incremented even though the scene was not rebuilt (for example in RecvEmptyTransaction), but even if these are a gazillion of empty transactions happening when nothing moves, it's worth understanding why they are here.
Flags: needinfo?(nical.bugzilla)
Assignee: vincent.liu1013 → a.beingessner
(In reply to Nicolas Silva [:nical] from comment #6)
> You should see a that the chrome's pipeline's epoch stays fairly stable, the
> video pipeline's epoch is continuously updating as expected and the
> content's pipeline updating a whole lot more than I would expect it to.
> pausing the video doesn't seem to prevent the pipelines from furiously
> updating either which might be another problem but worth looking into.

This doesn't seem to be happening any more. When I load that video with the pref enabled it's just the video epoch that increases, and when I pause the video it stops as well. When I mouse over stuff causing the toolbar to appear I see the other epochs increment as expected.

Is there anything left to do on this bug? If there's no video related issues it would be to close it out and file new bugs for any other issues.
Flags: needinfo?(nical.bugzilla)
Let's close and file new bugs if need be.
Status: NEW → RESOLVED
Closed: 6 years ago
Flags: needinfo?(nical.bugzilla)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.