Closed Bug 1618132 Opened 5 years ago Closed 5 years ago

Avoid redundant hit test tree rebuilds

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
mozilla76
Tracking Status
firefox76 --- fixed

People

(Reporter: nical, Assigned: nical)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

The hit tester is unconditionally rebuilt after frame building after frame building in build_frame here: https://searchfox.org/mozilla-central/rev/96f1457323cc598a36f5701f8e67aedaf97acfcf/gfx/wr/webrender/src/render_backend.rs#576

build_frame is called by update_document which calls rebuild_hit_tester if the hit test tree is invalidated. The advantage of doing it there is that it is after the frame has been submitted to the renderer so we are out of the critical path and the work can overlap with draw call submission.

So we don't need to call it right after frame building, and since we don't currently set the validity flag there we are often re-building the hit test tree a second time after frame building.

Priority: -- → P3

build_frame is called by update_document which calls rebuild_hit_tester if the hit test tree is invalidated. The advantage of doing it there is that it is after the frame has been submitted to the renderer so we are out of the critical path and the work can overlap with draw call submission.

So we don't need to do the work in build_frame, and since we don't currently set the validity flag there we are often re-building the hit test tree a second time after frame building.

Assignee: nobody → nical.bugzilla
Status: NEW → ASSIGNED
Pushed by nsilva@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a2ddfcc2a7d4 Avoid redundant hit test tree builds. r=gw

Backed out changeset a2ddfcc2a7d4 (Bug 1618132) for mochitests failures complaining about hittest tests

Push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&fromchange=d32be4ed8786ed555678e484dbffb2581fa017e8&searchStr=mochitest&tochange=6b61e86e08037ba077a5f149fcaad73c6fc1ea42&selectedJob=292411093

Backout link: https://hg.mozilla.org/integration/autoland/rev/6b61e86e08037ba077a5f149fcaad73c6fc1ea42

Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=292411093&repo=autoland&lineNumber=15871

[task 2020-03-10T09:12:51.597Z] 09:12:51     INFO - TEST-START | gfx/layers/apz/test/mochitest/test_group_hittest.html
[task 2020-03-10T09:12:52.058Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | got MozAfterPaint: 0,0,0,0
[task 2020-03-10T09:12:52.059Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | Dispatching 0 onpaint listeners
[task 2020-03-10T09:12:52.059Z] 09:12:52     INFO - GECKO(6876) | WaitUntilApzStable: flushed APZ repaints in parent proc, waiting for callback...
[task 2020-03-10T09:12:52.061Z] 09:12:52     INFO - GECKO(6876) | WaitUntilApzStable: APZ flush done in parent proc
[task 2020-03-10T09:12:52.062Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | WaitUntilApzStable: got apz-flush-done in child proc
[task 2020-03-10T09:12:52.072Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | WaitUntilApzStable: done promiseFocus
[task 2020-03-10T09:12:52.072Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | done...
[task 2020-03-10T09:12:52.072Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | WaitUntilApzStable: done promiseAllPaintsDone
[task 2020-03-10T09:12:52.072Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | PromiseApzRepaintsFlushed: Flushed APZ repaints, waiting for callback...
[task 2020-03-10T09:12:52.075Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | PromiseApzRepaintsFlushed: APZ flush done
[task 2020-03-10T09:12:52.075Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | WaitUntilApzStable: all done
[task 2020-03-10T09:12:52.080Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | Hit-testing point (208, 250)
[task 2020-03-10T09:12:52.108Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | Hit-testing point (108, 450)
[task 2020-03-10T09:12:52.118Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | Hit-testing point (349.5, 122)
[task 2020-03-10T09:12:52.141Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | Hit-testing point (80, 391.5)
[task 2020-03-10T09:12:52.151Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | waiting for paint...
[task 2020-03-10T09:12:52.173Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | got MozAfterPaint: 0,0,0,0
[task 2020-03-10T09:12:52.173Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | Dispatching 1 onpaint listeners
[task 2020-03-10T09:12:52.173Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | done...
[task 2020-03-10T09:12:52.176Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | PromiseApzRepaintsFlushed: Flushed APZ repaints, waiting for callback...
[task 2020-03-10T09:12:52.178Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | PromiseApzRepaintsFlushed: APZ flush done
[task 2020-03-10T09:12:52.178Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | waiting for paint...
[task 2020-03-10T09:12:52.180Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | got MozAfterPaint: 0,0,0,0
[task 2020-03-10T09:12:52.180Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | Dispatching 1 onpaint listeners
[task 2020-03-10T09:12:52.180Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | done...
[task 2020-03-10T09:12:52.198Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | Hit-testing point (208, 250)
[task 2020-03-10T09:12:52.203Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | Hit-testing point (108, 233)
[task 2020-03-10T09:12:52.222Z] 09:12:52     INFO - TEST-INFO | started process screenshot
[task 2020-03-10T09:12:52.311Z] 09:12:52     INFO - TEST-INFO | screenshot: exit 0
[task 2020-03-10T09:12:52.311Z] 09:12:52     INFO - Buffered messages logged at 09:12:51
[task 2020-03-10T09:12:52.311Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | Starting subtest helper_hittest_basic.html 
[task 2020-03-10T09:12:52.312Z] 09:12:52     INFO - Buffered messages logged at 09:12:52
[task 2020-03-10T09:12:52.312Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | Expected at least one hit result in the APZTestData 
[task 2020-03-10T09:12:52.312Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | inactive scrollframe hit info 
[task 2020-03-10T09:12:52.312Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | inactive scrollframe scrollid 
[task 2020-03-10T09:12:52.313Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | inactive scrollframe layersid 
[task 2020-03-10T09:12:52.313Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | Expected at least one hit result in the APZTestData 
[task 2020-03-10T09:12:52.313Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | inactive scrollframe - apzaware block hit info 
[task 2020-03-10T09:12:52.313Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | inactive scrollframe - apzaware block scrollid 
[task 2020-03-10T09:12:52.313Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | inactive scrollframe - apzaware block layersid 
[task 2020-03-10T09:12:52.313Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | Expected at least one hit result in the APZTestData 
[task 2020-03-10T09:12:52.313Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | inactive scrollframe - vertical scrollbar hit info 
[task 2020-03-10T09:12:52.313Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | inactive scrollframe - vertical scrollbar scrollid 
[task 2020-03-10T09:12:52.314Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | inactive scrollframe - vertical scrollbar layersid 
[task 2020-03-10T09:12:52.314Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | Expected at least one hit result in the APZTestData 
[task 2020-03-10T09:12:52.314Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | inactive scrollframe - horizontal scrollbar hit info 
[task 2020-03-10T09:12:52.315Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | inactive scrollframe - horizontal scrollbar scrollid 
[task 2020-03-10T09:12:52.315Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | inactive scrollframe - horizontal scrollbar layersid 
[task 2020-03-10T09:12:52.315Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | Expected at least one hit result in the APZTestData 
[task 2020-03-10T09:12:52.316Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | active scrollframe hit info 
[task 2020-03-10T09:12:52.316Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | active scrollframe scrollid 
[task 2020-03-10T09:12:52.316Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | active scrollframe layersid 
[task 2020-03-10T09:12:52.316Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | Expected at least one hit result in the APZTestData 
[task 2020-03-10T09:12:52.317Z] 09:12:52     INFO - Buffered messages finished
[task 2020-03-10T09:12:52.317Z] 09:12:52     INFO - TEST-UNEXPECTED-FAIL | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | active scrollframe - apzaware block hit info - got "VISIBLE", expected "VISIBLE | APZ_AWARE_LISTENERS"
[task 2020-03-10T09:12:52.317Z] 09:12:52     INFO -     SimpleTest.is@SimpleTest/SimpleTest.js:383:14
[task 2020-03-10T09:12:52.317Z] 09:12:52     INFO -     spawnTest/w.is@gfx/layers/apz/test/mochitest/apz_test_utils.js:389:18
[task 2020-03-10T09:12:52.317Z] 09:12:52     INFO -     checkHitResult@gfx/layers/apz/test/mochitest/apz_test_utils.js:851:5
[task 2020-03-10T09:12:52.317Z] 09:12:52     INFO -     test@gfx/layers/apz/test/mochitest/helper_hittest_basic.html:82:17
[task 2020-03-10T09:12:52.317Z] 09:12:52     INFO -     driveTest@gfx/layers/apz/test/mochitest/apz_test_utils.js:610:36
[task 2020-03-10T09:12:52.317Z] 09:12:52     INFO -     setTimeout handler*paintListener@SimpleTest/paint_listener.js:44:14
[task 2020-03-10T09:12:52.318Z] 09:12:52     INFO -     EventListener.handleEvent*@SimpleTest/paint_listener.js:47:10
[task 2020-03-10T09:12:52.318Z] 09:12:52     INFO -     @SimpleTest/paint_listener.js:109:3
[task 2020-03-10T09:12:52.318Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | active scrollframe - apzaware block scrollid 
[task 2020-03-10T09:12:52.319Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | active scrollframe - apzaware block layersid 
[task 2020-03-10T09:12:52.319Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | Hit-testing point (349.5, 122)
[task 2020-03-10T09:12:52.319Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | Expected at least one hit result in the APZTestData 
[task 2020-03-10T09:12:52.320Z] 09:12:52     INFO - Not taking screenshot here: see the one that was previously logged
[task 2020-03-10T09:12:52.320Z] 09:12:52     INFO - TEST-UNEXPECTED-FAIL | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | active scrollframe - vertical scrollbar hit info - got "VISIBLE | APZ_AWARE_LISTENERS | SCROLLBAR | SCROLLBAR_THUMB | SCROLLBAR_VERTICAL", expected "VISIBLE | SCROLLBAR | SCROLLBAR_VERTICAL"
[task 2020-03-10T09:12:52.320Z] 09:12:52     INFO -     SimpleTest.is@SimpleTest/SimpleTest.js:383:14
[task 2020-03-10T09:12:52.320Z] 09:12:52     INFO -     spawnTest/w.is@gfx/layers/apz/test/mochitest/apz_test_utils.js:389:18
[task 2020-03-10T09:12:52.320Z] 09:12:52     INFO -     checkHitResult@gfx/layers/apz/test/mochitest/apz_test_utils.js:851:5
[task 2020-03-10T09:12:52.321Z] 09:12:52     INFO -     hitTestScrollbar@gfx/layers/apz/test/mochitest/apz_test_utils.js:957:19
[task 2020-03-10T09:12:52.321Z] 09:12:52     INFO -     test@gfx/layers/apz/test/mochitest/helper_hittest_basic.html:95:19
[task 2020-03-10T09:12:52.321Z] 09:12:52     INFO -     driveTest@gfx/layers/apz/test/mochitest/apz_test_utils.js:610:36
[task 2020-03-10T09:12:52.321Z] 09:12:52     INFO -     setTimeout handler*paintListener@SimpleTest/paint_listener.js:44:14
[task 2020-03-10T09:12:52.321Z] 09:12:52     INFO -     EventListener.handleEvent*@SimpleTest/paint_listener.js:47:10
[task 2020-03-10T09:12:52.321Z] 09:12:52     INFO -     @SimpleTest/paint_listener.js:109:3
[task 2020-03-10T09:12:52.322Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | active scrollframe - vertical scrollbar scrollid 
[task 2020-03-10T09:12:52.322Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | active scrollframe - vertical scrollbar layersid 
[task 2020-03-10T09:12:52.322Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | Hit-testing point (349.5, 361)
[task 2020-03-10T09:12:52.322Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | Expected at least one hit result in the APZTestData 
[task 2020-03-10T09:12:52.322Z] 09:12:52     INFO - Not taking screenshot here: see the one that was previously logged
[task 2020-03-10T09:12:52.322Z] 09:12:52     INFO - TEST-UNEXPECTED-FAIL | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | active scrollframe - vertical scrollbar hit info - got "VISIBLE | SCROLLBAR | SCROLLBAR_VERTICAL", expected "VISIBLE | APZ_AWARE_LISTENERS | SCROLLBAR | SCROLLBAR_THUMB | SCROLLBAR_VERTICAL"
[task 2020-03-10T09:12:52.322Z] 09:12:52     INFO -     SimpleTest.is@SimpleTest/SimpleTest.js:383:14
[task 2020-03-10T09:12:52.323Z] 09:12:52     INFO -     spawnTest/w.is@gfx/layers/apz/test/mochitest/apz_test_utils.js:389:18
[task 2020-03-10T09:12:52.323Z] 09:12:52     INFO -     checkHitResult@gfx/layers/apz/test/mochitest/apz_test_utils.js:851:5
[task 2020-03-10T09:12:52.323Z] 09:12:52     INFO -     hitTestScrollbar@gfx/layers/apz/test/mochitest/apz_test_utils.js:957:19
[task 2020-03-10T09:12:52.323Z] 09:12:52     INFO -     test@gfx/layers/apz/test/mochitest/helper_hittest_basic.html:105:19
[task 2020-03-10T09:12:52.323Z] 09:12:52     INFO -     driveTest@gfx/layers/apz/test/mochitest/apz_test_utils.js:610:36
[task 2020-03-10T09:12:52.323Z] 09:12:52     INFO -     setTimeout handler*paintListener@SimpleTest/paint_listener.js:44:14
[task 2020-03-10T09:12:52.323Z] 09:12:52     INFO -     EventListener.handleEvent*@SimpleTest/paint_listener.js:47:10
[task 2020-03-10T09:12:52.323Z] 09:12:52     INFO -     @SimpleTest/paint_listener.js:109:3
[task 2020-03-10T09:12:52.323Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | active scrollframe - vertical scrollbar scrollid 
[task 2020-03-10T09:12:52.323Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | active scrollframe - vertical scrollbar layersid 
[task 2020-03-10T09:12:52.323Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | Hit-testing point (80, 391.5)
[task 2020-03-10T09:12:52.323Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | Expected at least one hit result in the APZTestData 
[task 2020-03-10T09:12:52.324Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | active scrollframe - horizontal scrollbar hit info 
[task 2020-03-10T09:12:52.324Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | active scrollframe - horizontal scrollbar scrollid 
[task 2020-03-10T09:12:52.324Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | active scrollframe - horizontal scrollbar layersid 
[task 2020-03-10T09:12:52.324Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_basic.html | Hit-testing point (319, 391.5)
[task 2020-03-10T09:12:52.324Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | Expected at least one hit result in the APZTestData 
[task 2020-03-10T09:12:52.324Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | active scrollframe - horizontal scrollbar hit info 
[task 2020-03-10T09:12:52.324Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | active scrollframe - horizontal scrollbar scrollid 
[task 2020-03-10T09:12:52.324Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | helper_hittest_basic.html | active scrollframe - horizontal scrollbar layersid 
[task 2020-03-10T09:12:52.325Z] 09:12:52     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_hittest.html | Starting subtest helper_hittest_fixed_in_scrolled_transform.html 
[task 2020-03-10T09:12:52.766Z] 09:12:52     INFO - GECKO(6876) | WaitUntilApzStable: flushed APZ repaints in parent proc, waiting for callback...
[task 2020-03-10T09:12:52.766Z] 09:12:52     INFO - GECKO(6876) | WaitUntilApzStable: APZ flush done in parent proc
[task 2020-03-10T09:12:52.776Z] 09:12:52     INFO - GECKO(6876) | helper_hittest_fixed_in_scrolled_transform.html | WaitUntilApzStable: got apz-flush-done in child proc
...
Flags: needinfo?(nical.bugzilla)
Flags: needinfo?(nical.bugzilla)
Pushed by nsilva@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2c6a51317166 Avoid redundant hit test tree builds. r=gw
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla76
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: