Closed Bug 1531898 Opened 6 years ago Closed 5 years ago

Battery: Don't trigger composites on out-of-viewport native texture image updates

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: bholley, Assigned: sotaro)

References

()

Details

(Whiteboard: [wr-amvp][wr-q2])

Attachments

(1 file, 5 obsolete files)

I noticed that a small video near the top of the page on cnn.com causes us to continue compositing after the video has been scrolled out of view. This is bad for battery on mobile.

STR:
(1) Enable the WR profiler overlay (compact is fine).
(2) Load http://fiddle.jshell.net/ovdjseLm/show/light/ , click play.
(3) Scroll down, and watch the FPS counter.

Presumably, WebRenderImageHost::UseTextureHost could check whether the texture is in view before scheduling composition.

[1] https://searchfox.org/mozilla-central/rev/00f3836a87b844b5e4bc82f698c559b9966e4be2/gfx/layers/wr/WebRenderImageHost.cpp#69

Sotaro, would this be straightforward to fix?

Flags: needinfo?(sotaro.ikeda.g)

It seems possible to pause/resume video's ScheduleComposition() by using result of build frame.

video's ScheduleComposition() is triggered in WebRenderImageHost::UseTextureHost() and WebRenderBridgeParent::MaybeGenerateFrame().

https://searchfox.org/mozilla-central/rev/78b2129696eaad2162fd26256b5a19a2b0d9840a/gfx/layers/wr/WebRenderImageHost.cpp#75
https://searchfox.org/mozilla-central/rev/78b2129696eaad2162fd26256b5a19a2b0d9840a/gfx/layers/wr/WebRenderBridgeParent.cpp#1203

Flags: needinfo?(sotaro.ikeda.g)
Summary: Don't trigger composites on out-of-viewport texture updates → Battery: Don't trigger composites on out-of-viewport texture updates
Priority: -- → P2
Assignee: nobody → sotaro.ikeda.g
Whiteboard: [wr-amvp][wr-q2]

Gecko has 2 mechanisms to suppress video rendering
[1] Skip Composite at LayerManagerComposite::UpdateAndRender(), since invalid. region is empty.
[2] Suspend video playback by element visibility at MediaDecoder::UpdateVideoDecodeMode()

At STR in comment 0 with Compositor, [1] was suppressed, but [2] still happened.

WebRender is going to handle [1] in comment 3. It makes WebRender to similar situation to compositor.

Depends on: 1554091
Attached patch wip (obsolete) (deleted) — Splinter Review
Attached patch wip (obsolete) (deleted) — Splinter Review
Attachment #9067278 - Attachment is obsolete: true
Attached patch wip (obsolete) (deleted) — Splinter Review
Attachment #9067509 - Attachment is obsolete: true
Attachment #9067684 - Attachment is obsolete: true

Implementation seems to become simpler if we use a list of used external image ids than Attachment 9068648 [details] as we discussed in Comment 10.

Attachment #9068648 - Attachment is obsolete: true

WebRenderTextureHostWrapper updates its data outside of WebRender. If WebRenderTextureHostWrapper's update is the only resource update, Webrender does not need to re-build frame for rendering. In this case, WebRender just does rendering. If an Image of the WebRenderTextureHostWrapper's update is not visible, WebRender does not need rendering.

During frame build, Document detects if it has an visible Image that might be update outside of WebRender(async image). invalidate_async_image() invalidates WebRender's rendered frame if there is visible async image.

Attachment 9070899 [details] does not have necessary change around WebRenderBridgeParent::RecvEmptyTransaction()

Attachment #9070899 - Attachment is obsolete: true
Attachment #9070899 - Attachment is obsolete: false
Attachment #9073519 - Attachment is obsolete: true
Attachment #9070899 - Attachment description: Bug 1531898 - Don't trigger composites on out-of-viewport native texture image updates → Bug 1531898 - Don't trigger composites on out-of-viewport native texture image updates of videos
Attachment #9070899 - Attachment description: Bug 1531898 - Don't trigger composites on out-of-viewport native texture image updates of videos → Bug 1531898 - Don't trigger composites on out-of-viewport native texture image updates
Type: defect → enhancement
Pushed by sikeda.birchill@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8f1f4702a5c2 Don't trigger composites on out-of-viewport native texture image updates r=gw
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
Summary: Battery: Don't trigger composites on out-of-viewport texture updates → Battery: Don't trigger composites on out-of-viewport native texture image updates
Regressions: 1570981
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: