Closed Bug 1343814 Opened 8 years ago Closed 8 years ago

Factor a base class out of Compositor

Categories

(Core :: Graphics: Layers, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: dvander, Assigned: dvander)

References

Details

Attachments

(6 files)

It is difficult to introduce new HostLayerManagers and have them re-use existing texture/compositable code, because much of layers depends on a Compositor instance. This set of patches aims to factor texture-related code out of Compositor and into a TextureSourceProvider class.

Rather than add D3D11/OGL-specific TextureSourceProviders, the new class just directly exposes the ID3D11Device/GLContext and returns null if none exists. That turned out to be a lot easier and allows almost everything to stop doing crazy casting. A few classes still cast down to CompositorOGL since they need access to helper methods.

The major weirdness in the TextureHost/Compositor relationship is the SetCompositor call. It's inconsistent and messy. It gets called pretty much at random. Sometimes before using a texture we'll happen to call SetCompositor, just in case somewhere else we forgot to. Sometimes SetCompositor will reject a new compositor, sometimes not. Sometimes we'll remember to SetCompositor on sibling textures, sometimes not. Sometimes an invalid compositor causes stuff to get flushed, but not always. We handle setting a null compositor, but it's not clear why this would ever happen.

Anyway, these patches don't address any of that. I tried to preserve the behavior of existing SetCompositor calls.
This is the new base class for Compositor.
Attachment #8842791 - Flags: review?(matt.woodrow)
Change TextureSource::SetCompositor to TextureSource::SetTextureSourceProvider. In almost every case we can stop storing the compositor and instead directly store the device. We reject a change in GLContext or ID3D11Device, but don't care about the actual provider.
Attachment #8842797 - Flags: review?(matt.woodrow)
This changes the TextureHost API, removing GetCompositor (we can just store the provider always), and changing SetCompositor to SetTextureSourceProvider.

This patch includes all of the boring syntactic changes. The material changes are separate for easier reviewing.
Attachment #8842799 - Flags: review?(matt.woodrow)
This changes all of the platform-specific TextureHosts to use TextureSourceProvider. I tried to keep the reject/evict behavior the same for when the provider doesn't match.

One minor change is that the D3D11 code will now use the compositor's D3D11 device and not the system one (which could change randomly during a device reset).
Attachment #8842801 - Flags: review?(matt.woodrow)
Boring syntactic change - pass the Compositor into Composite calls, in preparation for removing CompositableHost::mCompositor.
Attachment #8842803 - Flags: review?(matt.woodrow)
Switch CompositableHost and LayerTransactionParent to use TextureSourceProvider. This is mostly syntactic.
Attachment #8842804 - Flags: review?(matt.woodrow)
Let's coordinate these changes with the graphics branch when it comes time to land them.
Attachment #8842791 - Flags: review?(matt.woodrow) → review+
Attachment #8842797 - Flags: review?(matt.woodrow) → review+
Attachment #8842799 - Flags: review?(matt.woodrow) → review+
Attachment #8842801 - Flags: review?(matt.woodrow) → review+
Attachment #8842803 - Flags: review?(matt.woodrow) → review+
Attachment #8842804 - Flags: review?(matt.woodrow) → review+
(In reply to Milan Sreckovic [:milan] from comment #7)
> Let's coordinate these changes with the graphics branch when it comes time
> to land them.

Wes just pushed a merge of graphics back to m-c [1], so now is as good a time as any to land this, since graphics and m-c are identical. (And by "now" I really mean "wait until those graphics patches get merged over to autoland or inbound, and then rebase and land on top of it").

[1] https://treeherder.mozilla.org/#/jobs?repo=mozilla-central&revision=942165e408f0241cf543c368db00fefe22a9997a
Modulo moving to 55 on Monday, that is :)
No merge or build conflicts from pulling latest m-c, luckily.
Pushed by danderson@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/4768fe2f6131
Factor texture methods out of Compositor into a TextureSourceProvider class. (bug 1343814 part 1, r=mattwoodrow)
https://hg.mozilla.org/integration/mozilla-inbound/rev/53c6fa699fa7
Change TextureSource::SetCompositor to use TextureSourceProvider. (bug 1343814 part 2, r=mattwoodrow)
https://hg.mozilla.org/integration/mozilla-inbound/rev/11811b48bbbe
Replace TextureHost compositor access with TextureSourceProvider. (bug 1343814 part 3.1, r=mattwoodrow)
https://hg.mozilla.org/integration/mozilla-inbound/rev/d55f871c503d
Material changes for TextureHost TextureSourceProvider support. (bug 1343814 part 3.2, r=mattwoodrow)
https://hg.mozilla.org/integration/mozilla-inbound/rev/3bf615dfeba0
Propagate the compositor through CompositableHost::Composite. (bug 1343814 part 4, r=mattwoodrow)
https://hg.mozilla.org/integration/mozilla-inbound/rev/64c73abd4190
Attach Compositables to TextureSourceProviders instead of Compositors. (bug 1343814 part 5, r=mattwoodrow)
Flags: needinfo?(dvander)
Pushed by danderson@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/b8cd7d7075c6
Factor texture methods out of Compositor into a TextureSourceProvider class. (bug 1343814 part 1, r=mattwoodrow)
https://hg.mozilla.org/integration/mozilla-inbound/rev/95a00dc5a1b6
Change TextureSource::SetCompositor to use TextureSourceProvider. (bug 1343814 part 2, r=mattwoodrow)
https://hg.mozilla.org/integration/mozilla-inbound/rev/53895c639823
Replace TextureHost compositor access with TextureSourceProvider. (bug 1343814 part 3.1, r=mattwoodrow)
https://hg.mozilla.org/integration/mozilla-inbound/rev/30cf9aea9a00
Material changes for TextureHost TextureSourceProvider support. (bug 1343814 part 3.2, r=mattwoodrow)
https://hg.mozilla.org/integration/mozilla-inbound/rev/ca398f2b75c7
Propagate the compositor through CompositableHost::Composite. (bug 1343814 part 4, r=mattwoodrow)
https://hg.mozilla.org/integration/mozilla-inbound/rev/45a0933af0d6
Attach Compositables to TextureSourceProviders instead of Compositors. (bug 1343814 part 5, r=mattwoodrow)
Depends on: 1350247
Depends on: 1350251
Depends on: 1350259
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: