This can happen when there is a long nested chain of backdrop-filters
and float inaccuracies cause the final capture primitive to be culled.
Differential Revision: https://phabricator.services.mozilla.com/D147704
This removes a bunch of custom code from GfxInfo to obtain screen
information, and instead collects that screen information in
ScreenManager.
This, apart of removing duplicated code, has the extra benefit of
reporting multi-monitor information on GTK (and potentially in the
future reporting scale and refresh rate properly as well, I've kept the
telemetry as it was on that regard).
Differential Revision: https://phabricator.services.mozilla.com/D145178
This removes a bunch of custom code from GfxInfo to obtain screen
information, and instead collects that screen information in
ScreenManager.
This, apart of removing duplicated code, has the extra benefit of
reporting multi-monitor information on GTK (and potentially in the
future reporting scale and refresh rate properly as well, I've kept the
telemetry as it was on that regard).
Differential Revision: https://phabricator.services.mozilla.com/D145178
This makes vsync source swapping much more natural.
The VsyncSource now only has a reference to the VsyncDispatcher for the duration
during which the dispatcher is listening to vsync. Whenever the dispatcher is
not listening to vsync, the source has no reference to the dispatcher and there
is no cycle.
This patch also adds the ability to register multiple dispatchers with the same
source. This ability is not used yet; a vsync source always has zero or one
dispatchers at the moment. It is in preparation for a future patch where there
will be one dispatcher per widget.
Furthermore, nothing uses gfxPlatform::GetGlobalVsync anymore, so it is removed.
Differential Revision: https://phabricator.services.mozilla.com/D144375
This makes it so that the VsyncSource doesn't need to keep track of the compositor vsync dispatchers.
And the moving-between-sources logic needs to be handled only for the VsyncDispatcher.
Once we have one VsyncDispatcher per window, we can probably eliminate CompositorVsyncDispatcher.
Differential Revision: https://phabricator.services.mozilla.com/D144366
This makes vsync source swapping much more natural.
The VsyncSource now only has a reference to the VsyncDispatcher for the duration
during which the dispatcher is listening to vsync. Whenever the dispatcher is
not listening to vsync, the source has no reference to the dispatcher and there
is no cycle.
This patch also adds the ability to register multiple dispatchers with the same
source. This ability is not used yet; a vsync source always has zero or one
dispatchers at the moment. It is in preparation for a future patch where there
will be one dispatcher per widget.
Furthermore, nothing uses gfxPlatform::GetGlobalVsync anymore, so it is removed.
Differential Revision: https://phabricator.services.mozilla.com/D144375
This makes it so that the VsyncSource doesn't need to keep track of the compositor vsync dispatchers.
And the moving-between-sources logic needs to be handled only for the VsyncDispatcher.
Once we have one VsyncDispatcher per window, we can probably eliminate CompositorVsyncDispatcher.
Differential Revision: https://phabricator.services.mozilla.com/D144366
This member is no longer used on Windows, and having it in the
base class doesn't provide a real abstraction anyway since
the child classes will break if anything about it is changed.
Differential Revision: https://phabricator.services.mozilla.com/D145132
In these cases the combined local clip rect may be in reflected
local space. Map them to true raster space and then unmap them
back to the new local space to correct this.
Differential Revision: https://phabricator.services.mozilla.com/D142430
test_device_reset.html checks if canvas works after device reset. Since Bug 1757879 fix, windowutils.triggerDeviceReset() does the device reset handling asynchronously in gecko. And the device reset happened during testing canvas since 1757879 fix. The canvas testing needs to happen after the gecko's device reset handling.
The change adds more latency for waiting device reset completed in gecko.
Differential Revision: https://phabricator.services.mozilla.com/D141178
Every `VsyncSource` currently only has a single `Display` associated with it.
This means that we're not making use of the `Display` abstraction at all.
This patch gets rid of `Display` by merging it into `VsyncSource`.
Originally, the intention of the `Display` abstraction was to use it for
per-monitor vsync. There would be one software `VsyncSource` and one hardware
`VsyncSource`, and the hardware `VsyncSource` would have one `Display` per
screen. But in reality, things have played out differently: The only platform
with per-monitor vsync is currently Linux Wayland, which has per-**widget**
vsync. And it has chosen to have one `VsyncSource` per widget, with a single
`Display` each.
For the macOS implementation of per-monitor vsync, I think it also makes
sense to have one `VsyncSource` per screen.
We already need to handle switching between VsyncSources, for switching
between software and hardware vsync, if the pref `layout.frame_rate` is
changed. So we might as well reuse that same switching capability for
switching between screens, when a window moves between screens or when a
tab moves between windows on different screens.
Differential Revision: https://phabricator.services.mozilla.com/D140891
* Add support for local scale factors to a surface, allowing it to
be rasterized in root coordinate space. This allows snapping to
work across surfaces where the surface transform is a fractional
offset.
* Calculate scaling factors per rasterized surface and propagate
them. Ensures correct scale factor calculations when dealing with
nested preserve-3d contexts with 90-degree axis rotations.
* Support determining exact surface device rect for 2d surfaces
with fractional surface transforms.
* Fix line decoration cache key size calculations based on world
scaling factor.
* Remove `get_clipped_device_rect` usage for calculating clip-mask
surface allocations, use `surface.get_surface_rect` instead. The
prior method doesn't correctly account for expanded local regions
from the current dirty rect, resulting in invalidation issues in
some animated edge cases. Also unifies the way clip-mask surface
allocations work with the way general render target surface
allocations work.
Differential Revision: https://phabricator.services.mozilla.com/D138982
This patch introduces a number of subtle but important changes
to how we deal with off-screen surfaces. The overall goals are:
- Improve rendering correctness in a number of edge cases.
- Begin reducing complexity related to surfaces, scaling
factors, surface size adjustments and clipping.
- Improve CPU performance by removing some per-primitive work.
- Simplify implementation of future SVG and CSS filters by
having explicit support for picture rects + inflation regions.
- Lay the groundwork for caching child picture surfaces,
reduction of per-primitive work during visibility pass,
simplifying picture code.
Unfortunately, the nature of the changes make it impossible to
split up in to small isolated patches. Details below:
* Introduce `LocalRectKind` concept. This allows us to separate
out the bounding rect of the surface (a group of primitives
backed by a texture) from the bounding rect of the picture
compositing that surface (e.g. a drop-shadow which draws the
surface once at the local origin and once at a specific offset
+ blur-radius). This fixes a number of correctness bugs we have
related to culling, clipping, invalidation regions of complex
primitives such as drop-shadows and blur filters. Importantly,
it makes it simpler to implement (or fix) SVG filter chains,
backdrop-filter implementations.
* Establish raster roots for all off-screen surfaces. Every off-screen
surface uses the spatial node of the enclosing stacking context as
a coordinate system root, ensuring that each off-screen surface is
drawn in a 2D coordinate system, with appropriate scaling factors
applied to ensure high quality rendering. The primary goal is to make
it possible to correctly inflate and clip off-screen surfaces, removing
some correctness issues we currently have with complex filters interacting
with transforms. The initial work here doesn't reduce complexity a huge
amount, but will allow us to simplify large parts of the picture/surface
handling code in future, as well as simplify a number of shaders that
currently must handle arbitrarily complex transform matrices. This will
also allow us to simplify the implementation of features such as
mix-blend-mode and backdrop-filter, which rely on readback and UV mapping
from the parent surface.
* Remove concepts of `estimated` and `precise` local rects for pictures. This
is both a performance optimization and a code simplification. Instead, we
only determine the estimated local rect during bounding rect propagation,
and rely on the clipping regions from the tile dirty regions to reduce which
parts of the picture we allocate if drawing to an off-screen surface. This
removes some per-primitive work during the visibility pass, and also means
we can rely on the final picture bounding rect from the start of the visibility
pass. This also removes much of the complexity in `take_context` where we
previously determined surface scale factors and device pixel ratio - instead
these can be determined earlier during `propagate_bounding_rects`.
* Remove some complexity in `update_prim_visibility`. This is still recursive,
but follow up patches will aim to remove this recursion and integrate this
pass with the picture graph (similar to how `propagate_bounding_rects` works).
* Remove `PictureOptions` struct. Instead, store `inflate_if_required` with
the Blur filter enum, which is the only place that uses it.
* Remove `root_scaling_factor` from text runs - this is handled implicitly
by the surface device-pixel scale.
* Skip calling `update_clip_task` for pass-through pictures (since they have
no defined local rect).
* Improve scaling factors used for determining the render task cache size for
complex line decorations.
Differential Revision: https://phabricator.services.mozilla.com/D137569