Граф коммитов

41 Коммитов

Автор SHA1 Сообщение Дата
Brad Werth 6af8eda593 Bug 1731136 Part 5: Make macOS native compositor and NativeLayerCA handle backdrop r=mstange
layers.


This makes the macOS native compositor claim the ability to handle color
layers and makes NativeLayerCA actually do it. Color layers have a different
structure than other layers. Color layers apply the color to the
wrappingCALayer, and have no contentCALayer at all. That means that the
color layers are always sized to the layer's clip rect.

This also contains a drive-by fix to handle the case where an mOpaquenessTintLayer
exists when mMutatedSpecializeVideo is set to true. Before this change, in such a
case, the opaqueness layer will not be associated with the recreated wrapping layer.

Depends on D128131

Differential Revision: https://phabricator.services.mozilla.com/D128545
2022-06-01 19:40:04 +00:00
Molnar Sandor 307fd4a744 Backed out 5 changesets (bug 1731136) for causing reftest failures in layout/reftests/bugs/299136-1.html CLOSED TREE
Backed out changeset d2a56d51c65b (bug 1731136)
Backed out changeset a24467137e9b (bug 1731136)
Backed out changeset e127e41e12da (bug 1731136)
Backed out changeset 7dfdcb74d1c1 (bug 1731136)
Backed out changeset 6b5626a7b82d (bug 1731136)
2022-06-01 04:12:55 +03:00
Brad Werth 47917e0be8 Bug 1731136 Part 5: Make macOS native compositor and NativeLayerCA handle backdrop r=mstange
layers.


This makes the macOS native compositor claim the ability to handle color
layers and makes NativeLayerCA actually do it. Color layers have a different
structure than other layers. Color layers apply the color to the
wrappingCALayer, and have no contentCALayer at all. That means that the
color layers are always sized to the layer's clip rect.

This also contains a drive-by fix to handle the case where an mOpaquenessTintLayer
exists when mMutatedSpecializeVideo is set to true. Before this change, in such a
case, the opaqueness layer will not be associated with the recreated wrapping layer.

Depends on D128131

Differential Revision: https://phabricator.services.mozilla.com/D128545
2022-05-31 22:21:15 +00:00
criss 59b9e1210a Backed out 4 changesets (bug 1731136) for causing Bug 1771465 . CLOSED TREE
Backed out changeset c333a19d8712 (bug 1731136)
Backed out changeset 6b5b4b5eb1e9 (bug 1731136)
Backed out changeset 7afa3f4b5a85 (bug 1731136)
Backed out changeset b408a3230170 (bug 1731136)
2022-05-27 17:39:43 +03:00
Brad Werth 77aa170cdd Bug 1731136 Part 4: Make macOS native compositor and NativeLayerCA handle backdrop layers. r=mstange
This makes the macOS native compositor claim the ability to handle color
layers and makes NativeLayerCA actually do it. Color layers have a different
structure than other layers. Color layers apply the color to the
wrappingCALayer, and have no contentCALayer at all. That means that the
color layers are always sized to the layer's clip rect.

This also contains a drive-by fix to handle the case where an mOpaquenessTintLayer
exists when mMutatedSpecializeVideo is set to true. Before this change, in such a
case, the opaqueness layer will not be associated with the recreated wrapping layer.

Differential Revision: https://phabricator.services.mozilla.com/D128545
2022-05-26 15:24:13 +00:00
Robert Mader 48aa55faf4 Bug 1752469 - Remove Gnome specific workaround using PauseCompositor(), r=gfx-reviewers,lsalzman
This was originally implemented in D111662 to work around a crash
that otherwise would get triggered in Gnome/Mutter.
The fix for that crash has been available for a couple of month now,
thus remove the workaround again.

This may help preventing flickering for menus in certain situations.

Differential Revision: https://phabricator.services.mozilla.com/D137251
2022-01-28 04:24:16 +00:00
Robert Mader 7aea8e97e7 Bug 1720375 - Restructure surface pool into a buffer pool,r=stransky,gfx-reviewers,lsalzman
Note: Sorry in advance that this patch is so big. Unfortunately
splitting it up would create lots of redundant changes.
This should be the last big refactoring for the Wayland compositor
backend for now.

Up until now SurfacePoolWayland was a pool of actual `wl_surface`s,
as before bug 1718569 we had no direct access to `wl_buffer`s when
using EGL. However, the way `SurfacePoolCA` manages native surfaces
is closer to what in Wayland terminology would be a buffer pool:
buffers are heavy-weight and expansive to allocate, while
`wl_surface` objects are cheap to recreate.

So instead of having a pool of surfaces, each of them having its
own pool of buffers, make `wl_surface`s part of tiles and make
`SurfacePoolWayland` manage `wl_buffer`s (in the form of SHM- or
DMABuf buffers). This will allow us to share buffers (especially
depth buffers) more efficiently, reducing VRAM usage and allocation
times.
Apart from that it will also simplify our tile management logic.
Most importantly, we'll need to reorder `wl_surface`s less often and
less complex (no `place_below` the parent surface) and can also drop
reattaching subsurfaces to compositors. Especially the former will
likely decrease CPU time in compositors.

Overall this patch makes `NativeLayerWayland` behave more like
`NativeLayerCA` while taking in lessons learned from
`WindowSurfaceWaylandMB`.

Differential Revision: https://phabricator.services.mozilla.com/D119993
2021-08-04 12:43:21 +00:00
Robert Mader 76692c1a43 Bug 1711244 - Integrate NativeLayerWayland with WaylandVsyncSource, r=stransky,gfx-reviewers,jrmuizel
Make the vsync source request frame callbacks from opaque native
layers. This is necessary as opaque layers may occlude the
MozContainer surface, which is normally used for frame callbacks.
Wayland compositors may (and are encouraged to) optimize away
such callbacks, so we need to make sure to request frame callbacks
from actually visible surfaces.

Callbacks are requested for all layers, but only the first callback
will trigger the vsync source.
In order to get this right concerning multiple requested callbacks,
possibly being called from different threads etc., introduce a
callback abstraction, `CallbackMultiplexHelper`, to make this simple
to handle for callers.

Differential Revision: https://phabricator.services.mozilla.com/D116026
2021-06-10 15:12:54 +00:00
Robert Mader 89349d8182 Bug 1699985 - Implement basic native Wayland compositor backend, r=stransky,mstange,aosmond
This implements a mostly working native backend for Wayland. It can
be enabled via `gfx.webrender.compositor.force-enabled`.

The focus here was to get a basic structure in place while mini-
mising changes in shared code.

Known issues and limitations:
 - No readback - this will likely require an internal compositor
   again, as Wayland doesn't allow easily allow readback of the
   composited image, at least not without asking for permission.
   Alternatively, a new Wayland extension could be written for it.
 - Frame-call related issues when using a compositor that optimizes
   them (e.g. Gnome-Shell). This will be fixed in a follow-up, in
   the mean time disabling `widget.wayland.opaque-region.enabled`
   and `widget.wayland.vsync.enabled` works around the issues.
 - Only works on Weston or very recent versions of Gnome-Shell, see
   bug 1699754

Differential Revision: https://phabricator.services.mozilla.com/D111662
2021-05-11 13:38:59 +00:00
Markus Stange 6d2642e09e Bug 1664047 - Only call UpdateSnapshot when ScreenshotGrabber calls GetWindowContents, which it only does if the profiler is running (and Screenshots are enabled). r=mattwoodrow
This requires passing down the window size down in a different way, because the
NativeLayerRootSnapshotter does not know the window size otherwise.

At the same time, this patch also removes WindowNLRS and makes the NativeLayerRoot
implement the profiler_screenshots::Window interface directly.

Differential Revision: https://phabricator.services.mozilla.com/D89864
2020-09-15 20:47:19 +00:00
Mihai Alexandru Michis a75aa1f3ed Backed out 2 changesets (bug 1664047, bug 1664135) for causing dt failures in ScreenshotGrabber.cpp
CLOSED TREE

Backed out changeset d8996fcd3568 (bug 1664047)
Backed out changeset 070815d3ff02 (bug 1664135)
2020-09-15 03:09:08 +03:00
Markus Stange b2cdbc6d3e Bug 1664047 - Only call UpdateSnapshot when ScreenshotGrabber calls GetWindowContents, which it only does if the profiler is running (and Screenshots are enabled). r=mattwoodrow
This requires passing down the window size down in a different way, because the
NativeLayerRootSnapshotter does not know the window size otherwise.

At the same time, this patch also removes WindowNLRS and makes the NativeLayerRoot
implement the profiler_screenshots::Window interface directly.

Depends on D89863

Differential Revision: https://phabricator.services.mozilla.com/D89864
2020-09-13 21:41:24 +00:00
Markus Stange a7d49adfc1 Bug 1592031 - Add profiler screenshots functionality to NativeLayerSnapshotter. r=mattwoodrow
Depends on D59157

Differential Revision: https://phabricator.services.mozilla.com/D59158
2020-08-27 03:55:53 +00:00
Narcis Beleuzu c259d84931 Backed out 4 changesets (bug 1658856, bug 1592031) for bustages on ScreenshotGrabber.h . CLOSED TREE
Backed out changeset 6d54a1050bbd (bug 1658856)
Backed out changeset 19145f742503 (bug 1592031)
Backed out changeset 5db68a6a5bc2 (bug 1592031)
Backed out changeset 925e3b179b9b (bug 1592031)
2020-08-22 02:06:39 +03:00
Markus Stange 1191e4de06 Bug 1592031 - Add profiler screenshots functionality to NativeLayerSnapshotter. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D59158
2020-08-21 22:44:26 +00:00
Matt Woodrow 8cc57f6b55 Bug 1657428 - Use correct interpolation mode for native compositing layers. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D86090
2020-08-06 21:14:45 +00:00
Matt Woodrow 87db131e32 Bug 1653048 - Add support for external images in the wr::Compositor API, and implement it for MacOS IOSurfaces. r=mstange,gw
Differential Revision: https://phabricator.services.mozilla.com/D84638
2020-08-04 01:19:59 +00:00
Matt Woodrow 01b5738a5d Bug 1653166 - Add transforms to WebRender Compositor API. r=gw,mstange,sotaro
Differential Revision: https://phabricator.services.mozilla.com/D84328
2020-08-04 01:19:59 +00:00
Markus Stange 4c8b889f5e Bug 1646066 - Make partial valid rects work properly in NativeLayerCA. r=jrmuizel
This moves the clipping responsibility into the layer. It also brings back
assertions that make sure that no invalid content reaches the screen.
On the layer side I'm renaming validRect to displayRect, because at the time
NextSurface* is called, that rect is not yet valid.
This implementation also allows having valid content outside of the display
rect. So, for example, if you grow and shrink the display rect multiple times
but most of the outer parts are transparent, in theory this allows you to paint
the transparent pixels only once rather than every time the display rect
expands.

Differential Revision: https://phabricator.services.mozilla.com/D79842
2020-06-18 22:15:22 +00:00
Simon Giesecke dce1e48caf Bug 1613985 - Use default for equivalent-to-default constructors/destructors in gfx. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D65288

--HG--
extra : moz-landing-system : lando
2020-03-04 15:39:20 +00:00
Glenn Watson 31585fc1e6 Bug 1608717 - Support per-tile clip (valid) region for native compositor implementations. r=sotaro,mstange
For Draw (non-native) and CA modes, we include the per-tile
valid rect in the clip rect from the surface.

For DC (non-virtual) mode, a per-tile clip rect is set on the
visual for each tile, separate from the overall clip rect that
is set on the surface visual.

For DC (virtual) mode, the Trim API is used to remove pixels
in the virtual tile area that are outside the valid / clipped
region.

Note: Although the valid rect is now applied in the native
compositors, it's currently only based on the overall picture
cache bounding rect. Thus, with this patch there isn't any
noticeable performance improvement. Once this lands and is
working correctly, the follow up patch to calculate a smaller
valid region per-tile is a small amount of work.

Differential Revision: https://phabricator.services.mozilla.com/D61424

--HG--
extra : moz-landing-system : lando
2020-02-12 04:27:15 +00:00
Markus Stange adfb18b9ed Bug 1592026 - Add a NativeLayerRootSnapshotter API and implement it with CARenderer. r=jrmuizel
Suggestions for a better name than "snapshotter" are welcome.
This is a separate object so that the lifetime of its GLContext isn't governed by the lifetime of the NativeLayerRootCA.
The NativeLayerRootCA gets destroyed on the main thread, but GLContext uses non-threadsafe weak pointer support, so it wants to be destroyed on the same thread that it was created on.
So now the GLContext lives on the snapshotter, which is created and destroyed on the renderer thread.

Differential Revision: https://phabricator.services.mozilla.com/D57068

--HG--
extra : moz-landing-system : lando
2019-12-29 12:20:28 +00:00
Markus Stange c96a136f94 Bug 1592026 - Move AsyncCATransaction suspension into NativeLayerRootCA. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D57061

--HG--
extra : moz-landing-system : lando
2019-12-29 12:18:32 +00:00
Markus Stange df5cfbc8df Bug 1592038 - Share depth buffers across IOSurface framebuffers with the same size. r=jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D54863

--HG--
extra : moz-landing-system : lando
2019-12-19 02:55:15 +00:00
Markus Stange 0f70058b6f Bug 1592044 - Reduce the frequency of IOSurface and framebuffer creation and destruction with the help of a surface pool. r=jgilbert
There are multiple SurfacePools: Main thread painting and the non-WebRender compositors create a new pool per window, and WebRender creates one shared pool across all windows. The non-WebRender users set the pool size limit to zero, i.e. no recycling across paints. This preserves the pre-existing behavior.
WebRender's pool size is configurable with the gfx.webrender.compositor.surface-pool-size pref.
Every window holds on to a SurfacePoolHandle. A SurfacePoolHandle has an owning reference to the pool, via a surface pool wrapper. Once all handles are gone, the surface pool goes away, too.
The SurfacePool holds on to IOSurfaces and MozFramebuffers. Both are created on demand, independently, but are associated with each other.
A given NativeLayer uses only one surface pool handle during its lifetime. The native layer no longer influences which GLContext its framebuffers are created for; the GL context is now managed by the surface pool handle.
As a result, a NativeLayer can no longer change which GLContext its framebuffers are created by.
So in the future, if we ever need to migrate a window frome one GLContext to another, we will need to recreate the NativeLayers inside it. I think that's ok.

Differential Revision: https://phabricator.services.mozilla.com/D54859

--HG--
extra : moz-landing-system : lando
2019-12-18 21:01:51 +00:00
Markus Stange 3faf29b5c5 Bug 1592150 - Remove CurrentSurfaceInvalidRegion(). Callers now always just repaint the update region that they supplied. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D51761

--HG--
extra : moz-landing-system : lando
2019-11-19 03:11:26 +00:00
Markus Stange ba013d0f42 Bug 1594950 - Change NextSurface APIs to accept a dirty region, and remove the public method InvalidateRegionThroughoutSwapchain. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D50878

--HG--
extra : moz-landing-system : lando
2019-11-13 18:55:18 +00:00
Markus Stange 80c235777f Bug 1594950 - Bake the layer size and its opaqueness into the layer, don't allow mutating it. r=jrmuizel
These settings are now supplied during layer creation and never change.
Consumers must now create new NativeLayer objects if they want to change size or toggle opaqueness.
This aligns the NativeLayer API with DirectComposition's capabilities. It also simplifies swap chain
management.

Differential Revision: https://phabricator.services.mozilla.com/D51757

--HG--
extra : moz-landing-system : lando
2019-11-13 18:46:02 +00:00
Cosmin Sabou 1d71e9f510 Backed out 4 changesets (bug 1594950) for turning bug 1405083 into permafail.
Backed out changeset 684a87e91d94 (bug 1594950)
Backed out changeset adea6912c3a3 (bug 1594950)
Backed out changeset aea7108204e9 (bug 1594950)
Backed out changeset 15baea8520de (bug 1594950)
2019-11-13 06:44:24 +02:00
Markus Stange 2db4b324b7 Bug 1594950 - Change NextSurface APIs to accept a dirty region, and remove the public method InvalidateRegionThroughoutSwapchain. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D50878

--HG--
extra : moz-landing-system : lando
2019-11-12 19:50:26 +00:00
Markus Stange 82452d888a Bug 1594950 - Bake the layer size and its opaqueness into the layer, don't allow mutating it. r=jrmuizel
These settings are now supplied during layer creation and never change.
Consumers must now create new NativeLayer objects if they want to change size or toggle opaqueness.
This aligns the NativeLayer API with DirectComposition's capabilities. It also simplifies swap chain
management.

Differential Revision: https://phabricator.services.mozilla.com/D51757

--HG--
extra : moz-landing-system : lando
2019-11-12 19:50:25 +00:00
Markus Stange e2f8c029aa Bug 1591523 - Add NativeLayerRoot::SetLayers. r=jrmuizel
This allows us to somewhat cheaply swap out the entire set of layers.
It also means that clearing the array of layers no longer has quadratic complexity;
in the past, you would do this by calling RemoveLayer once per layer, and RemoveLayer
does a linear scan through the array.

Differential Revision: https://phabricator.services.mozilla.com/D50725

--HG--
extra : moz-landing-system : lando
2019-10-29 20:31:44 +00:00
Bogdan Tara f866fef3ad Backed out 3 changesets (bug 1591523) for bustages complaining about RenderCompositorOGL.cpp CLOSED TREE
Backed out changeset 407f051e14db (bug 1591523)
Backed out changeset b4c8080dae86 (bug 1591523)
Backed out changeset abb627bc4f75 (bug 1591523)
2019-10-29 22:00:05 +02:00
Markus Stange eb84b69274 Bug 1591523 - Add NativeLayerRoot::SetLayers. r=jrmuizel
This allows us to somewhat cheaply swap out the entire set of layers.
It also means that clearing the array of layers no longer has quadratic complexity;
in the past, you would do this by calling RemoveLayer once per layer, and RemoveLayer
does a linear scan through the array.

Differential Revision: https://phabricator.services.mozilla.com/D50725

--HG--
extra : moz-landing-system : lando
2019-10-29 19:25:36 +00:00
Markus Stange 98f1e26c4e Bug 1587940 - Add NativeLayer::SetClipRect and implement it for Core Animation with a parent layer that has masksToBounds=YES. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D50723

--HG--
extra : moz-landing-system : lando
2019-10-29 19:25:27 +00:00
Markus Stange 64c13fc106 Bug 1587940 - Remove capability for opaque regions from NativeLayer interface. r=jrmuizel
This change makes opaqueness a boolean per layer again. The opaque region is
currently only used by the temporary WebRender code; the future WebRender code
won't use it. Removing this support simplifies the code and makes it easier to
implement clipping.

Differential Revision: https://phabricator.services.mozilla.com/D50722

--HG--
extra : moz-landing-system : lando
2019-10-29 19:24:24 +00:00
Markus Stange c6660314f0 Bug 1578099 - Add NativeLayer::NextSurfaceAsFramebuffer. r=mattwoodrow
This returns the raw framebuffer GLuint and lets the caller bind it.
Initially I wanted to return a RefPtr<MozFramebuffer>, but then I discovered
that MozFramebuffer is not a refcounted class and prefers UniquePtrs.

Depends on D44324

Differential Revision: https://phabricator.services.mozilla.com/D44325

--HG--
extra : moz-landing-system : lando
2019-09-01 22:35:56 +00:00
Markus Stange e6da884bfd Bug 1578099 - Add NativeLayer::NextSurfaceAsDrawTarget. r=mattwoodrow
This uses MacIOSurface internally. NextSurfaceAsDrawTarget locks the MacIOSurface,
and NotifySurfaceReady unlocks it if necessary.

Depends on D44321

Differential Revision: https://phabricator.services.mozilla.com/D44322

--HG--
extra : moz-landing-system : lando
2019-09-01 23:22:04 +00:00
Markus Stange 975773c0ae Bug 1578099 - Make more NativeLayerCA methods available on NativeLayerCA. r=mattwoodrow
The comments above these methods refer to NextSurface* methods which will be
added in later patches.

Differential Revision: https://phabricator.services.mozilla.com/D44321

--HG--
extra : moz-landing-system : lando
2019-09-01 20:54:07 +00:00
Markus Stange 32ec0f3341 Bug 1491448 - Add NativeLayer::SetOpaqueRegion and implement it for NativeLayerCA by assembling opaque and transparent sublayers to cover the regions. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D40553

--HG--
extra : moz-landing-system : lando
2019-08-19 22:54:26 +00:00
Markus Stange 3cfb0f5ea9 Bug 1491442 - Add interfaces mozilla::layers::NativeLayerRoot and NativeLayer, and add CoreAnimation implementations NativeLayerRootCA and NativeLayerCA. r=jrmuizel
NativeLayerRoot and NativeLayer allow building up a flat layer "tree" of sibling
layers. They're created and manipulated with a synchronous-looking API, but any
changes will only be applied to the underlying native layers when ApplyChanges()
is called. This ensures that the modifications can be limited to run within a
CoreAnimation transaction, and on a thread of the caller's choosing.
In the near future I'm planning to have LayerManagerComposite create these
layers. That's the reason for the pseudo-abstracted cross-platform C++ API:
LayerManagerComposite can create and place the layers, and any painting into the
layer surfaces will happen in the compositor implementations with platform-specific
code.
For now, the CoreAnimation implementation is the only implementation. I think
the current API will let us use the same infrastructure for DirectComposite
layers on Windows, but we'll likely need to make some API modifications once we
attempt that.
The classes are threadsafe; their methods can be called on any thread and the
caller is responsible for sufficient synchronization. In reality, there are only
two threads that would have a reason to use these layers: The compositor thread
and the main thread. The main thread creates and destroys the NativeLayerRootCA,
and sometimes it calls ApplyChanges, e.g. during window resizes. It also calls
SetBackingScale. All other methods are usually only called on the compositor
thread.

Differential Revision: https://phabricator.services.mozilla.com/D26407

--HG--
extra : moz-landing-system : lando
2019-08-16 01:30:02 +00:00