Closed Bug 1021845 Opened 6 years ago Closed 4 years ago

Optimize intermediate surface sizes when compositing and take clips into account

Categories

(Core :: Graphics: Layers, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox45 --- disabled
firefox46 --- fixed

People

(Reporter: mstange, Assigned: mstange)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

When a container layer requires an intermediate surface, the surface is sized to its visible region. However, in some cases container layers lie about their visible region; the cases that immediately come to my mind are:
 - display ports and
 - prerendered transforms.

In these cases we ask the GPU to do a lot of work for stuff that won't be visible in the end.
One way to fix this would be to have a "compute visibility" pass on the Compositor side prior to every composite that sets the shadow visible region to what will actually be visible of this layer in the current frame, taking async transforms into account. Then we can keep the logic that sizes the intermediate surface to the visible region bounds. We just need to make sure that it uses the shadow visible region if available.
The combination of display ports and intermediate container layer surfaces can cause the fill ratio number to go up considerably.
Bug 1021845 - Before compositing, clip the visible region of a layer to the layer's clip rect. r?mattwoodrow
Attachment #8664842 - Flags: review?(matt.woodrow)
This patch is very similar to the second part in bug 1136766 (which you already reviewed), but it's not based on the first patch from that bug (because that caused performance regressions) and it's not limited to integer translations.
Comment on attachment 8664842 [details]
MozReview Request: Bug 1021845 - Before compositing, clip the visible region of a layer to the layer's clip rect. r=mattwoodrow

https://reviewboard.mozilla.org/r/20039/#review18061
Attachment #8664842 - Flags: review?(matt.woodrow) → review+
Note that I added code to retain intermediate surfaces. I skimmed the patch but it wasn't clear if it interfered with that or not.
Blocks: 1210418
Blocks: 1206704
Blocks: 1225868
(In reply to Benoit Girard (:BenWa) from comment #10)
> Note that I added code to retain intermediate surfaces. I skimmed the patch
> but it wasn't clear if it interfered with that or not.

I don't think it will. Whenever the surface rect moves or changes size, we reallocate the surface.
No longer blocks: 1225868
Flags: needinfo?(mstange)
I assume you didn't mean to clear that dependency.
Blocks: 1225868
Comment on attachment 8664842 [details]
MozReview Request: Bug 1021845 - Before compositing, clip the visible region of a layer to the layer's clip rect. r=mattwoodrow

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/20039/diff/1-2/
Attachment #8664842 - Attachment description: MozReview Request: Bug 1021845 - Before compositing, clip the visible region of a layer to the layer's clip rect. r?mattwoodrow → MozReview Request: Bug 1021845 - Before compositing, clip the visible region of a layer to the layer's clip rect. r=mattwoodrow
Bug 1021845 - Don't skip checkerboarding layers during compositing, even if the layer's visible region is empty. r?botond
Attachment #8693528 - Flags: review?(botond)
Priority: -- → P1
https://reviewboard.mozilla.org/r/20039/#review24043

::: gfx/layers/composite/LayerManagerComposite.cpp:209
(Diff revision 2)
> +IntersectMaybeRects(const Maybe<RectType>& aRect1, const Maybe<RectType>& aRect2)

In bug 1168263, I added an IntersectMaybeRects() function to AsyncCompositionManager.cpp. We may want to consider moving it to a shared header and reusing it.
Comment on attachment 8693528 [details]
MozReview Request: Bug 1021845 - Don't skip checkerboarding layers during compositing, even if the layer's visible region is empty. r?botond

https://reviewboard.mozilla.org/r/26207/#review24045
Attachment #8693528 - Flags: review?(botond) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/10fb062fb1ae906a0ad43555ee0f62dfe7ec667f
Bug 1021845 - Before compositing, clip the visible region of a layer to the layer's clip rect. r=mattwoodrow

https://hg.mozilla.org/integration/mozilla-inbound/rev/fc0ac31d14eb4b218df818e164bf9de897cf561a
Bug 1021845 - Don't skip checkerboarding layers during compositing, even if the layer's visible region is empty. r=botond
https://hg.mozilla.org/mozilla-central/rev/10fb062fb1ae
https://hg.mozilla.org/mozilla-central/rev/fc0ac31d14eb
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
Blocks: 1240783
This was backed out from Firefox 45.

https://hg.mozilla.org/releases/mozilla-aurora/rev/64ec448f156d
Assignee: nobody → mstange
You need to log in before you can comment on or make changes to this bug.