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

567 Коммитов

Автор SHA1 Сообщение Дата
Andrew Osmond 734922ce3d Bug 1785673 - Improve DisplayListPayload buffer preallocations. r=nical
Instead of setting a ceiling on how much we are willing to allocate, we
should always try to reallocate a buffer the same size that we used
before. If we cannot, we should fail gracefully and just not preallocate
at all. This should help with profiles where we consistently need a
larger payload buffer than the previous maximum, while minimizing OOM
crashes on the other side, where our preallocations fail and/or are more
than the next display list update actually requires.

Differential Revision: https://phabricator.services.mozilla.com/D154951
2022-08-18 11:47:03 +00:00
Glenn Watson a00b8ca709 Bug 1779952 - Refactor and optimize internal representation of clip state r=nical
This patch refactors how clip chains are internally represented and used
during scene and frame building. The intent is to make clip processing
during frame building more efficient and consistent. Additionally, this
work enables follow ups to cache the result of clip-chain builds between
frame and scene builds.

These changes will significantly reduce the cost of the visibility pass
for the common case when not much content has changed. In this patch,
the public API for clipping remains (mostly) the same, in order to allow
landing and stabilising this work without major changes to Gecko. However,
a longer term goal is to make the public WR clip API more closely match
the internal representation, to reduce work done during scene building.

Clips on a primitive can be categorized into two buckets. The first are
local clips that are specific to the primitive and move with it. These
could essentially be considered part of the definition of the primitive
itself. The second are a hierarchy of clips that apply to one or more
items, and may move independently of the primitive(s) they clip. These
clips are things like scroll regions, stacking context clips, iframe
clip regions etc. On (real world) pages, the clip hierarchy is typically
quite shallow, with a small number of clips that are shared by a large
number of primitives.

Finding clips that are shared between primitives is both required (for
things such as determining which picture cache slice a primitive can
be assigned to, while applying the shared clips during composition), and
also a potential optimization (processing shared clips only once and
caching this clip state similar primitives).

The public clip-chain API has two complexities that make the above
difficult and time consuming for WR to determine. It was possible to
express a clipping hierarchy both via the legacy clip parenting path
(via `ClipId` definitions) and also via clip-chains (the `parent`
field of a `ClipChain`). Second, clip-chains themselves can define
an arbitrary number and ordering of clips. Clips can also implicitly
apply to primitives via parent stacking contexts and iframes, but must
sometimes be removed (when an intermediate surface is created) for
performance reasons.

The new internal representation provided by this patch introduces a
`ClipTree` structure which is built during scene building by accumulating
the set of clips that apply to a primitive from all explicit and implicit
sources, and grafting this on to the existing clip-tree structure.
This provides WR a simple way to determine which clips are shared between
primitive (by checking ancestry) and reduces the size of the internal
representation (by sharing clips where possible rather than duplicating).
Interning is still used to identify parts of the clip-tree that define
the same clipping state.

Specific changes in this patch:
 * Remove legacy `ClipId` style parenting support (in conjunction with
   previous patches)
 * Remove the public API ability to specify the clip on a primitive via
   `ClipId` (it must now be a clip-chain)
 * Remove `combined_local_clip_rect` from `PrimitiveInstance`, reducing
   the size of the structure significantly
 * Introduce `ClipTree` used during frame building, which is created by
   `ClipTreeBuilder` during scene building
 * Separate out per-primitive clip concept (`ClipTreeLeaf`) from clipping
   hierarchy (`ClipTreeNode`). In future, more elements will be moved to
   the `ClipTreeLeaf` and the state of each `ClipTreeNode` will be cached)
 * Simplify the logic to disable / remove clips during frame building that
   are applied by parent surface(s)
 * Port hit-testing to be based on `ClipTree` which is simpler, faster and
   also resolves some edge case correctness bugs
 * Use a simpler and faster method to find shared clips during picture
   cache slice assignment of primitives
 * Update wrench to use the public clip-chain API definition changes

This patch already introduces some real-world optimizations (for example,
`displaylist_mutate` becomes 6% faster overall), but mostly sets things
up for follow up patches to be able to cache clip-state between frames,
which should result in much larger wins.

Differential Revision: https://phabricator.services.mozilla.com/D151987
2022-07-26 21:13:32 +00:00
Glenn Watson 5bd787a0ba Bug 1778036 - Switch public primitive API to be clip-chain based r=gfx-reviewers,lsalzman
This is mostly just changing a small number of structs and function
params (most of the work has been done in previous patches).

Differential Revision: https://phabricator.services.mozilla.com/D150987
2022-07-05 20:52:31 +00:00
Glenn Watson bbcff3fc66 Bug 1778017 - Remove ClipId-style parenting from rect clip public API r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D150983
2022-07-05 11:22:05 +00:00
Glenn Watson 60220b9b80 Bug 1778015 - Remove ClipId-style parenting from rounded-rects clip public API r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D150982
2022-07-05 09:53:28 +00:00
Glenn Watson 829af78106 Bug 1778013 - Remove ClipId-style parenting from image clip masks public API r=gfx-reviewers,lsalzman
Also make the parent in ClipTemplate an Option, so that the
semantics are a bit clearer (follow up patches will remove this
parent field entirely).

Differential Revision: https://phabricator.services.mozilla.com/D150980
2022-07-05 08:20:49 +00:00
Dan Robertson affccc0acb Bug 1753019 - Use the animation id to identify hit testing metadata. r=botond,gw
## Summary

Pass the fixed position element animation id through webrender, returning the
the animation id in the hit-test result if the element is a fixed position
element. This animation id then can be used to lookup the relevant Hit-Testing
Tree Node, which can be used to find the fixed (or sticky) position side bits.

## Motivation

Sticky content can be currently stuck to the root content or not, based on the
scroll position. As a result, when hit testing sticky content, APZ needs both
the sticky position side bits and additional information to determine if the
element is currently stuck to the root content. This is needed to fix the
hit-testing of sticky position content when a APZ transform is being applied,
such as overscroll and hiding the dynamic toolbar.

## Implementation

The information needed to determine if a element is currently stuck to the root
content and the fixed/sticky position side bits is already stored in the
hit-testing tree node. Any hit test result should have a corresponding
hit-testing tree node entry. When a hit-test result contains a animation id and
a hit-testing tree node is found, we can store a pointer to this node and use
this to check the fixed/sticky position side bits. Something similar is already
done for hit test results when a scrollbar is hit.

Differential Revision: https://phabricator.services.mozilla.com/D148648
2022-07-04 18:14:58 +00:00
Glenn Watson c048d4ef0e Bug 1777901 - Port more wrench tests to specify clips via clip-chains r=gfx-reviewers,lsalzman
The intent is to deprecate specifying clips via ClipId::Clip(..)
as this will simplify the ongoing clip-interning work.

Differential Revision: https://phabricator.services.mozilla.com/D150925
2022-07-04 10:14:56 +00:00
Bobby Holley 28696910b9 Bug 1776096 - Bump WebRender crate versions. r=jrmuizel
We formerly published webrender to crates.io, but haven't done so in
several years. However, the in-tree version number still matches the
version published on crates.io, causing cargo-vet to flag that this is
something that should potentially be audited. We could silence that on
the cargo-vet side, but then if we ever starting publishing it again
we'd miss the nudge to certify the audit (which would be useful to
anyone consuming it). So bumping the versions to a not-yet-published
number is a good way to correctly articulate the situation.

Differential Revision: https://phabricator.services.mozilla.com/D150055
2022-06-24 04:11:26 +00:00
Marian-Vasile Laza ca94966846 Backed out 3 changesets (bug 1776096) for causing cargo bustages.
Backed out changeset d7bdddbc2edf (bug 1776096)
Backed out changeset f45836578ddd (bug 1776096)
Backed out changeset 2fcab932329e (bug 1776096)
2022-06-24 01:54:07 +03:00
Bobby Holley 18e520a71c Bug 1776096 - Bump WebRender crate versions. r=jrmuizel
We formerly published webrender to crates.io, but haven't done so in
several years. However, the in-tree version number still matches the
version published on crates.io, causing cargo-vet to flag that this is
something that should potentially be audited. We could silence that on
the cargo-vet side, but then if we ever starting publishing it again
we'd miss the nudge to certify the audit (which would be useful to
anyone consuming it). So bumping the versions to a not-yet-published
number is a good way to correctly articulate the situation.

Differential Revision: https://phabricator.services.mozilla.com/D150055
2022-06-23 22:15:26 +00:00
Narcis Beleuzu 9a4bc45bba Backed out 3 changesets (bug 1776096) for build bustages on Cargo.lock . CLOSED TREE
Backed out changeset 8d2b8b3af2ac (bug 1776096)
Backed out changeset 8e0ed786341b (bug 1776096)
Backed out changeset fe93a0ac4a3f (bug 1776096)
2022-06-23 23:29:50 +03:00
Bobby Holley 6239d0c6f8 Bug 1776096 - Bump WebRender crate versions. r=jrmuizel
We formerly published webrender to crates.io, but haven't done so in
several years. However, the in-tree version number still matches the
version published on crates.io, causing cargo-vet to flag that this is
something that should potentially be audited. We could silence that on
the cargo-vet side, but then if we ever starting publishing it again
we'd miss the nudge to certify the audit (which would be useful to
anyone consuming it). So bumping the versions to a not-yet-published
number is a good way to correctly articulate the situation.

Differential Revision: https://phabricator.services.mozilla.com/D150055
2022-06-23 20:16:14 +00:00
Glenn Watson fb6ca66ec6 Bug 1775369 - Make hit-test API use clip-chains rather than ClipId r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D149938
2022-06-22 19:55:26 +00:00
Glenn Watson a523865d98 Bug 1775189 - Switch `push_stacking_context` API to be clip-chain based r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D149845
2022-06-21 21:09:24 +00:00
Mike Hommey c143e86971 Bug 1773399 - Update derive_more to 0.99.17. r=emilio,gfx-reviewers,nical
Limit its features to those we actually use, which turns out is none for
webrender_api.

Differential Revision: https://phabricator.services.mozilla.com/D148734
2022-06-11 20:34:18 +00:00
Glenn Watson 5b096fbcd2 Bug 1769953 - Only force tile cache slice for root scroll bar. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D147370
2022-05-26 03:30:50 +00:00
Noemi Erli 71bfa628d4 Backed out changeset ce5bb779d929 (bug 1769953) for causing webrender failures in overflow-top-left.html CLOSED TREE 2022-05-26 06:14:14 +03:00
Glenn Watson 003c174717 Bug 1769953 - Only force tile cache slice for root scroll bar. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D147370
2022-05-25 22:06:40 +00:00
Glenn Watson b96ac34916 Bug 1765525 - Fix gecko DL creation for backdrop-filters with clips r=gfx-reviewers,miko
Change to derive from nsDisplayEffectsBase, since the backdrop-filter
can still have a visual bounds (and effect) even if the child
stacking context has no items. Also use the same approach to get
the bounding rect and implement GetBounds as nsDisplayFilters uses.

Differential Revision: https://phabricator.services.mozilla.com/D145295
2022-05-17 01:53:33 +00:00
Glenn Watson cd0f97bcd5 Bug 1768989 - Handle implicit backdrop filter roots in WR r=gfx-reviewers,lsalzman
This is required to be done in WR rather than Gecko since a backdrop
filter may exist in a child iframe display list but sample from a
backdrop root in a parent iframe (if the iframe has transparency
enabled). In this case the parent display list has no knowledge
that a backdrop filter primitive is present.

Differential Revision: https://phabricator.services.mozilla.com/D146149
2022-05-16 01:04:08 +00:00
Glenn Watson cebe610723 Bug 1768983 - Add prim flag for checkerboarding backgrounds r=gfx-reviewers,lsalzman
Although not needed right now (checkerboarding backgrounds get
a slice anyway due to being a different scroll root), this will
be important for the upcoming work to make backdrop filter
roots implicit. This allows WR to know when slicing up a content
slice if the prim is relevant to the backdrop root.

Differential Revision: https://phabricator.services.mozilla.com/D146145
2022-05-15 21:54:25 +00:00
Bas Schouten ef6615b08f Bug 1767257: Migrate existing WebRender telemetry probes to use Glean directly. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D145315
2022-05-09 15:23:11 +00:00
Cosmin Sabou fa2ede0aba Backed out changeset 50ba61f5cf8c (bug 1767257) for causing webrender bustages. CLOSED TREE 2022-05-09 17:31:06 +03:00
Bas Schouten 5f53bddb5e Bug 1767257: Migrate existing WebRender telemetry probes to use Glean directly. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D145315
2022-05-09 13:46:51 +00:00
Glenn Watson 4c3f881374 Bug 1764005 - Add backdrop-filter primitive support r=gfx-reviewers,lsalzman,nical
Add support for backdrop-filter primitive in WR. Each backdrop
filter primitive establishes a render task sub-graph. The primitive
instance registers itself as a resolve source to receive the
pixels from the backdrop root.

Also add a number of basic wrench tests for various backdrop-filter
use cases.

Differential Revision: https://phabricator.services.mozilla.com/D143334
2022-04-20 01:09:09 +00:00
Lee Salzman 914e4af30a Bug 1761437 - Ensure the shared font namespace is allocated by the client. r=gw
The shared font namespace was getting allocated by the RenderBackend, while
we otherwise allocated namespaces for documents on the client. We need to make
sure that if namespace allocation happens on the client, that it also happens
on the client for the shared font namespace. This adds to RendererOptions to
make passing in a shared font namespace allocated by the client possible.

Differential Revision: https://phabricator.services.mozilla.com/D142381
2022-03-29 20:46:36 +00:00
Nicolas Silva 5810368294 Bug 1761744 - Better tag frames coming from the async image pipeline manager. r=gfx-reviewers,aosmond
We schedule additional composites as long as there is a CompositeUntil timestamp. These composites need a special tag and shouldn't carry the tags of whatever led us to check the timestamps. In addition, we should add the ASYNC_IMAGE tag when GetAndResetWillGenerateFrame returns true even if some other reason led us to check it.

Depends on D142233

Differential Revision: https://phabricator.services.mozilla.com/D142234
2022-03-29 09:30:56 +00:00
Nicolas Silva 84b0ae8f89 Bug 1761744 - Tag frames caused by the start of observe vsync. r=gfx-reviewers,aosmond
Also tag frames from FlushGenerateFrames.

Depends on D142232

Differential Revision: https://phabricator.services.mozilla.com/D142233
2022-03-29 09:30:55 +00:00
Nicolas Silva 7b8485e486 Bug 1761744 - Tag frames coming from skipped composites. r=gfx-reviewers,aosmond
Also differentiate between skipped composites (too many pending frames) and discarded composites (paused or no display list).

Differential Revision: https://phabricator.services.mozilla.com/D142232
2022-03-29 09:30:55 +00:00
Botond Ballo 5e29e2eee3 Bug 1755490 - Increase POLYGON_CLIP_VERTEX_MAX from 16 to 32. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D142260
2022-03-29 03:12:32 +00:00
Lee Salzman 2cbc657add Bug 1758555 - Share font keys across multiple namespaces within a Renderer. r=nical,gfx-reviewers
This replaces the sharing of SharedFontInstanceMap with a new structure
SharedFontResources that can be used to trade a mechanism between threads
of a single Renderer instance for de-duplicating fonts and font instances.

SharedFontResources stores maps of FontTemplates and FontInstances as well
as a new FontKeyMap and FontInstanceKeyMap which handles the mapping of
namespace-local font keys to a shared key. The shared key then maps to
the real, de-duplicated resource (template or instance) which has a lifetime
beyond that of any individual namespace that may refer to it. Reference
counting is used to track the lifetime of the shared key so that when no key
map entries refer to the shared key any longer, it will then expire and
be cleaned up. This does cause some complications with clearing a namespace
in that rather than simply crawling through a table looking for resources
with a given IdNamespace, we have to check for shared keys that have expired
when clearing a namespace caused the last references to their mappings
to be removed.

Given that ApiResources handles the up-front addition of font templates
and instances, while ResourceCache within the RenderBackend handles deletion,
most of these mappings have to be shared between threads, which is why they
live within SharedFontResources. When resource updates are processed by
either ApiResources or ResourceCache, we create a shared key as necessary to
add the font resource, and then delete the shared font resource when a resource
update caused the last reference to the resource's shared key to expire.

This only tries to de-duplicate fonts within a single Renderer (window). Since
each Renderer has its own texture cache and dependent glyph cache, sharing
across multiple windows would require extra complication with storing font
bitmaps outside of the texture cache and outside the Renderer instance itself.
For the sake of simplicity and to better understand how de-duplication impacts
performance, this patch only tries to address sharing within a single window.

Differential Revision: https://phabricator.services.mozilla.com/D140561
2022-03-11 10:15:02 +00:00
Brad Werth 26751bb55f Bug 1745492 Part 3: Expand WR YUV formats to include P010 as a MSB packing. r=lsalzman
P010 is trivially the same as NV12, but the 10-bit colors are packed into
the most significant bits instead of the least significant bits. This changes
the yuv shader to use the correct packing for P010. It treats P010 as its
own yuv format, which requires a lot of scaffolding.

Differential Revision: https://phabricator.services.mozilla.com/D140422
2022-03-05 17:31:19 +00:00
Brad Werth 418ae64bbb Bug 1745492 Part 2: Update MacIOSurface handling to deal with 10-bit formats. r=media-playback-reviewers,gfx-reviewers,lsalzman,alwu
This fixes an issue caused by landing Bug 1679927. Now that it's possible to
get 10-bit formats in macOS, the texture pipeline has to be updated to pass
those surfaces to WebRender.

This also contains a drive-by comment on D3D11 handing of 10-bit WebRender
display items. It was not clear why specifing 16-bit color depth for P010
format was correct there, but should be specified as 10-bit color elsewhere.

This also contains another drive-by fix to comments in webrender describing
the RG16 enum.

Depends on D136046

Differential Revision: https://phabricator.services.mozilla.com/D136823
2022-03-05 17:31:18 +00:00
Lee Salzman 1cab27db44 Bug 1757624 - Move FontInstanceMap out of webrender_api. r=nical,gfx-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D139971
2022-03-03 19:42:52 +00:00
Lee Salzman 619a501c21 Bug 1757449 - Make WR NativeFontHandle use String instead of CGFont on macOS. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D139882
2022-03-02 10:11:05 +00:00
criss b13da6025c Backed out changeset e0f1d94942ce (bug 1757449) for causing build bustages on macOs. CLOSED TREE 2022-03-02 12:02:50 +02:00
Lee Salzman a3df467ef4 Bug 1757449 - Make WR NativeFontHandle use String instead of CGFont on macOS. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D139882
2022-03-02 09:34:31 +00:00
Narcis Beleuzu 79e1db1339 Backed out 5 changesets (bug 1745492) for reftest failures on image-10bits-rendering-720-video.html CLOSED TREE
Backed out changeset 4cbbe77eaede (bug 1745492)
Backed out changeset 8eead27d1cc7 (bug 1745492)
Backed out changeset 6fc6bbab5b53 (bug 1745492)
Backed out changeset 823e45ca5fd3 (bug 1745492)
Backed out changeset f378944b0366 (bug 1745492)
2022-02-23 21:15:58 +02:00
Nicolas Silva 50ca258be2 Bug 1755747 - Add support for antialiased non-snapped rectangles. r=gfx-reviewers,aosmond
We need them for SVG primitives.

This patch adds a bit of plumbing to disable snapping some of the primitives and forcing the antialiasing shader feature where needed, and uses it for SVG solid rectangles and images.

Differential Revision: https://phabricator.services.mozilla.com/D139024
2022-02-23 13:37:39 +00:00
Brad Werth 4b772da5ef Bug 1745492 Part 2: Update MacIOSurface handling to deal with 10-bit formats. r=media-playback-reviewers,gfx-reviewers,lsalzman,alwu
This fixes an issue caused by landing Bug 1679927. Now that it's possible to
get 10-bit formats in macOS, the texture pipeline has to be updated to pass
those surfaces to WebRender.

This also contains a drive-by comment on D3D11 handing of 10-bit WebRender
display items. It was not clear why specifing 16-bit color depth for P010
format was correct there, but should be specified as 10-bit color elsewhere.

This also contains another drive-by fix to comments in webrender describing
the RG16 enum.

Differential Revision: https://phabricator.services.mozilla.com/D136823
2022-02-22 19:17:20 +00:00
Emilio Cobos Álvarez 4a152fdf3e Bug 1746248 - Style system and plumbing for mix-blend-mode: plus-lighter. r=jrmuizel,layout-reviewers,boris
Differential Revision: https://phabricator.services.mozilla.com/D137951
2022-02-09 03:15:52 +00:00
Lee Salzman 5136d81df6 Bug 1587094 - Support MULTISTRIKE_BOLD font instance flag for WebRender. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D137725
2022-02-05 01:09:00 +00:00
Marian-Vasile Laza ddac1da17c Backed out changeset 12f866a5b267 (bug 1587094) for wrench bustages on synthetic-bold.yaml . CLOSED TREE 2022-02-03 22:23:07 +02:00
Lee Salzman 36c0803568 Bug 1587094 - Support MULTISTRIKE_BOLD font instance flag for WebRender. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D137725
2022-02-03 18:53:13 +00:00
Hiroyuki Ikezoe c0048dceb1 Bug 1571758 - Inform multiple sampled scroll offsets to WR and pick the most appropriate one in WR. r=botond
This change mitigates the gap between the external_scroll_offset informed from
the main-thread and scroll_offset informed from APZ.

Some wrench reftests for this change are in the next commit.

Differential Revision: https://phabricator.services.mozilla.com/D133444
2022-01-31 09:40:35 +00:00
Hiroyuki Ikezoe 860a49babe Bug 1571758 - Inform apz scroll generation to WebRender's ScrollFrame from the main-thread. r=botond
Also inform a flat representing whether the frame's document has scroll-linked
effect or not.

Differential Revision: https://phabricator.services.mozilla.com/D133442
2022-01-31 09:40:35 +00:00
Jeff Muizelaar 1556e8b1ef Bug 1751426 - Expand the comment about Computed reference frames. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D136622
2022-01-21 16:07:54 +00:00
Dzmitry Malyshau d5354743fd Bug 1695318 - Pass the perspective association from CSS to WR r=gfx-reviewers,bradwerth
Depends on D136163

I have a feeling this isn't exactly the right way to pass this info, since the old WR code must have known about the perspective node without using my new flag.

Differential Revision: https://phabricator.services.mozilla.com/D136180
2022-01-19 22:41:12 +00:00
Emilio Cobos Álvarez c7e5725b0e Bug 1716442 - Apply image-rendering to border-image. r=gfx-reviewers,mstange
Differential Revision: https://phabricator.services.mozilla.com/D134341
2021-12-27 12:33:45 +00:00