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

2175 Коммитов

Автор SHA1 Сообщение Дата
Nicolas Silva ab19851395 Bug 1694909 - Part 10 - Remove ImageBufferKind::Texture2DArray. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D106508
2021-02-26 14:54:18 +00:00
Nicolas Silva fe203350ef Bug 1694909 - Part 9 - Remove layer from ImageSource. r=gw
Also rename the shader's ImageResource into ImageSource to match the terminology on the rust side (especially since the rust code has a different thing named ImageResource).

Differential Revision: https://phabricator.services.mozilla.com/D106484
2021-02-26 14:54:17 +00:00
Nicolas Silva 3bdd0ac816 Bug 1694909 - Part 8 - Remove most remaining usage of layer index in the shaders. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D106483
2021-02-26 14:54:17 +00:00
Nicolas Silva f998e2063e Bug 1694909 - Part 7 - Store RenderTaskData's user data as a vec4. r=gw
This replaces the vec3 with a vec4.

Differential Revision: https://phabricator.services.mozilla.com/D106482
2021-02-26 14:54:16 +00:00
Nicolas Silva c358947209 Bug 1694909 - Part 6 - Remove the layer index from render task struct in the shaders. r=gw
Remove RenderTaskCommonData in the process and replace it with RectWithSize directly.

Differential Revision: https://phabricator.services.mozilla.com/D106481
2021-02-26 14:54:16 +00:00
Nicolas Silva 12bc395575 Bug 1694909 - Part 5 - Remove layer parameter from draw_texture_cache_target. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D106480
2021-02-26 14:54:16 +00:00
Nicolas Silva 8293182c53 Bug 1694909 - Part 4 - Remove texture arrays from the composite shader. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D106479
2021-02-26 14:54:15 +00:00
Nicolas Silva f1fc07132e Bug 1694909 - Part 3 - Remove Texture arrays from the scaling shader. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D106478
2021-02-26 14:54:15 +00:00
Nicolas Silva 731bc00cd1 Bug 1694909 - Part 2 - Remove more texture array support code in WebRender. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D106477
2021-02-26 14:54:14 +00:00
Nicolas Silva 2d3cce8d9d Bug 1694909 - Part 1 - Remove some texture array support code. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D106476
2021-02-26 14:54:14 +00:00
Nicolas Silva b654dd7889 Bug 1694910 - Merge FrameGraph back into RenderTaskGraph. r=gw
I chose to rename it back to RenderTaskGraph instead of the other way around to minimize code churn and because it's the name most people are already familiar with.

Differential Revision: https://phabricator.services.mozilla.com/D106411
2021-02-26 14:54:13 +00:00
Jim Blandy e01b214402 Bug 1694744: Let the WebRender render backend know when sequence capture should stop. r=nical
The RenderBackend::capture_config field determines whether the render backend
logs ongoing activity as requested by `wr_api_start_capture_sequence`. This
field is set by `SceneBuilderResult::CapturedTransactions` messages, but there
is nothing that clears it. This patch adds an additional `SceneBuilderResult`
message to do so.

It would probably suffice to simply always clear `capture_config` upon receipt
of an ordinary `Transactions` message. But it seemed to me to be slighty nicer
to leave capture control to messages specific to that purpose, rather than
letting ordinary messages affect it implicitly.

Differential Revision: https://phabricator.services.mozilla.com/D106308
2021-02-25 23:09:24 +00:00
Glenn Watson 991ec0768d Bug 1694750 - Revert backface surface patch for regression. r=nical
For now, we will revert this patch since it's not relied on
elsewhere yet, while we find a correct fix for this regression.

Revert "Bug 1687409 - Use offscreen surface for backface visibility + non-preserve3d stacking contexts r=nical"

This reverts commit 2f5002791fa9671aa5c0e6573d28b52d5c978942.

Differential Revision: https://phabricator.services.mozilla.com/D106366
2021-02-25 20:13:42 +00:00
Glenn Watson f50764ccd0 Bug 1694554 - Remove unused picture info stack. r=nical
Existing code does push/pop of this during the visibility pass,
but it's no longer used so can be removed.

Differential Revision: https://phabricator.services.mozilla.com/D106243
2021-02-24 19:54:51 +00:00
Lee Salzman 6d0dfe44e3 Bug 1690216 - Clarify that StartRemoteDrawingInRegion does not actually modify the region. r=mattwoodrow
It caused us substantial confusion investigating this bug under the belief that
StartRemoteDrawingInRegion may have been modifying the dirty region. None of our
existing widget code anymore uses the API in this way, so it makes sense to just
force this dirty region to be const so that we no longer support the assumption
and alleviate confusion in the future about how our widget code actually behaves.

Depends on D106246

Differential Revision: https://phabricator.services.mozilla.com/D106247
2021-02-24 18:34:52 +00:00
Lee Salzman f2c57b81f4 Bug 1690216 - Report whether to redraw on invalidation to WR. r=mattwoodrow
This requires us to plumb CompositorCapabilities to support the extra field.
This is complicated by the fact that since it is a Rust struct, it has no
default constructor that can pass through to C++ via bindings, so every
one of our RenderCompositors was forced to manually initialize fields. To
get around this brittle footgun, instead the structure is initialized on
the Rust side, and RenderCompositor's are encouraged to only change fields
that actually diverge from the defaults as passed in via pointer.

Finally, we can then do what we need to do, which is just to send the
ForceRedraw message that needs to happen based on what we know about
CompositorCapabilities.

Differential Revision: https://phabricator.services.mozilla.com/D106246
2021-02-24 14:15:02 +00:00
Nicolas Silva a14439cf73 Bug 1692250 - Begin refactoring the how pictures refer to their textured content. r=gw
This patch only erases some of the differences between how pictures and other primitves resolve their render tasks. There is a lot more to do there but I quite haven't figured out the incremental next step towards decoupling the picture primitive its content. After this patch we may be close to a good place to start extracting composite modes out into their own primitives.

Differential Revision: https://phabricator.services.mozilla.com/D106142
2021-02-24 10:32:25 +00:00
Nicolas Silva 94ed405587 Bug 1692250 - Remove ImageSourceHandle. r=gw
Replaced with RenderTaskId or Option<RenderTaskId> depending on context.

Differential Revision: https://phabricator.services.mozilla.com/D105984
2021-02-24 10:32:25 +00:00
Nicolas Silva 0e6dc9d100 Bug 1692250 - Make RenderTaskId smaller. r=gw
65k render tasks is a lot more than what we need, and RenderTaskId will soon be stored in more places where size affects performance.

Differential Revision: https://phabricator.services.mozilla.com/D105986
2021-02-24 10:32:24 +00:00
Nicolas Silva 64d2e19380 Bug 1692250 - Get the gpu cache in a valid state in frame graph tests. r=gw
The test render tasks used to dodge the gpu cache interactions. Rather than maintain special cases, make it so the gpu cache is usable during these tests (which mainly means having a valid frame stamp to not trigger some assertions).

Differential Revision: https://phabricator.services.mozilla.com/D105985
2021-02-24 10:32:24 +00:00
Nicolas Silva beb3f1412b Bug 1692250 - Refer to cached render tasks with a render task ID. r=gw
This is the last important change of this render task refactoring. Cached render tasks now create nodes in the frame graph so that they can be referenced via a render task ID. With this it is now possible to refer to almost any textured content via a render task ID, regardless of how it was produced and whether it is cached. It also allows any render task to read from a cached one (before, only primitives and clip sources could).
This obsoletes ImageSourceHandle which will be remvoed in a subsequent patch.

Differential Revision: https://phabricator.services.mozilla.com/D105952
2021-02-24 10:32:23 +00:00
Andreea Pavel 4d15e7e3f1 Backed out changeset 45b36995cfd6 (bug 1690216) for build bustages at rules.mk on a CLOSED TREE 2021-02-24 12:03:14 +02:00
Lee Salzman e746523892 Bug 1690216 - Report whether to redraw on invalidation to WR. r=mattwoodrow
This requires us to plumb CompositorCapabilities to support the extra field.
This is complicated by the fact that since it is a Rust struct, it has no
default constructor that can pass through to C++ via bindings, so every
one of our RenderCompositors was forced to manually initialize fields. To
get around this brittle footgun, instead the structure is initialized on
the Rust side, and RenderCompositor's are encouraged to only change fields
that actually diverge from the defaults as passed in via pointer.

Finally, we can then do what we need to do, which is just to send the
ForceRedraw message that needs to happen based on what we know about
CompositorCapabilities.

Differential Revision: https://phabricator.services.mozilla.com/D106246
2021-02-24 09:18:33 +00:00
Glenn Watson d61eac7b12 Bug 1694305 - Fix local clip rects on off-screen surfaces that are also raster roots. r=nical
When compositing a filter (or any off-screen surface) into the
parent picture, we also need to assume non-opaque if the transform
is complex, so that AA gets applied along the edges (and that any
fragments outside the AA zone are discarded).

In future, we aim to improve the performance of this fairly rare
scenario by reducing which parts of the picture get the AA shader,
but for now this is a simple fix for a correctess issue.

Differential Revision: https://phabricator.services.mozilla.com/D106054
2021-02-23 23:00:02 +00:00
Dzmitry Malyshau b595afbcdc Bug 1694510 - Assume default last_frame_used during WR deserialization r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D106193
2021-02-23 22:08:12 +00:00
Jim Blandy 4afdc767c0 Bug 1694284: Use moves to populate webrender::scene_builder_thread::BuiltTransaction r=gw
Instead of calling `std::mem::replace` with dummy values to extract fields from
the `TransactionMsg` into the `BuiltTransaction`, it's more Rustic to pass the
former by value and just move its fields out.

`SceneBuildingThread::process_transaction` seems to contribute almost no self
time to profiles, so the cost of a move instead of passing a reference is
apparently negligible.

Differential Revision: https://phabricator.services.mozilla.com/D106059
2021-02-23 18:27:40 +00:00
Nicolas Silva 8ff2dd18be Bug 1692250 - Use ImageSourceHandle with Yuv image primtives. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D105951
2021-02-23 14:47:10 +00:00
Nicolas Silva 7a5fe8b08c Bug 1692250 - Make image borders use ImageSourceHandle. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D105950
2021-02-23 14:47:10 +00:00
Nicolas Silva 98e0a77b54 Bug 1692250 - Simplify blit render tasks. r=gw
Blit render tasks have special code to read from the texture cache. This isn't necessary anymore now that texture cache items can be used as nodes of the frame graph. Blits can be simplified into reading from any render task without knowing how it was produced.

Differential Revision: https://phabricator.services.mozilla.com/D105746
2021-02-23 14:47:09 +00:00
Nicolas Silva 786dddeed8 Bug 1692250 - Request images when promoting them to picture surfaces. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D105652
2021-02-23 07:42:46 +00:00
Nicolas Silva 083d238aa7 Bug 1692250 - Turn images into render tasks and make them use ImageSourceHandle. r=gw
With this change, image primitives become render tasks. These render tasks don't produce drawing commands, instead they trigger image reuqests which will lead to texture uploads. Using render tasks provides two advantages:
 - It adds some expressiveness to the render task graph: render tasks can now take an image as a source directly. This will be needed to implement the Image svg filter, for example.
 - Since The image render tasks resolve their texture and uv handles before batching, the batching code can simply query the ImageSourceHandle without knowing whether the image comes from a (cached) render task or the resource cache.

A large part of the diff is moving a lot of the image primitive code from the visibility pass into ImageData::update which happens during the prepare pass.

Differential Revision: https://phabricator.services.mozilla.com/D105487
2021-02-23 07:42:46 +00:00
Nicolas Silva 9320137b5a Bug 1692250 - Add ImageSourceHandle r=gw
This patch starts moving some of the logic to resolve source texture ids and uv rects into a separate file, and introduces ImageSourceHandle which will be used in later patches in this series.

ImageSourceHandle is a unified way to refer to "some rectangle into some texture" regardless of how the texture, the rectangle and its content are produced. Moving all primitives to using this handle will allow us to decouple how content is pre-rendered from how it is composited into the main scene. The end goals are to remove some duplication/complexity and also to allow more flexibility, for example enable filters on some primitives directly without requiring a picture.

Differential Revision: https://phabricator.services.mozilla.com/D105486
2021-02-23 07:42:45 +00:00
Glenn Watson c9a99d4ee4 Bug 1684781 - Improve performance of mix-blend-mode. r=nical
This patch enables the faster mix-blend-mode path that allows using
picture cache tiles as the backdrop source for blends where that
is appropriate (most of the underlying work is in previous patches
or the dependencies of this bug).

In addition to avoiding an extra intermediate surface for blends
that are on a picture cache surface, it also avoids constant
invalidation of picture cache tiles due to the blend container
not being part of the main content scroll root.

As an example of the typical performance improvement, the GPU times
on an AMD 5700 GPU at 4k, when using the Firelux color temperature addon
browsing pages drops from ~1.8ms to ~0.3 ms.

Differential Revision: https://phabricator.services.mozilla.com/D104491
2021-02-22 23:00:57 +00:00
Lee Salzman b2e764a5fc Bug 1694165 - Override SWGL blend mode for drop shadows. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D105981
2021-02-22 19:58:15 +00:00
Jim Blandy 6269fcec0d Bug 1693947: Remove unused `webrender::RenderApi::set_document_view`. r=nical
Delete the method `webrender::RenderApi::set_document_view`, since it is unused
by Gecko. (The unused code suspiciously constructs a `TransactionMsg` whose
`use_scene_builder_thread` flag is false, despite the fact that it contains a
`SceneMsg`.)

Differential Revision: https://phabricator.services.mozilla.com/D105855
2021-02-22 18:44:40 +00:00
Jim Blandy 23d9ac18ee Bug 1693923: webrender::RenderApi::send_transaction need not set use_scene_builder_thread r=nical
The call to `self.resources.update` immediately above already sets
`transaction.use_scene_builder_thread` if the transaction has any `SceneMsg`
operations.

Differential Revision: https://phabricator.services.mozilla.com/D105844
2021-02-22 18:44:39 +00:00
Jim Blandy c15b4a8fea Bug 1693884: Delete unused webrender::RenderApi::send_transactions method. r=nical
Differential Revision: https://phabricator.services.mozilla.com/D105835
2021-02-22 18:44:39 +00:00
Lee Salzman 38845a4afa Bug 1686244 - Accelerate nearest repeat filtering in SWGL. r=jrmuizel
Some sites use pixelated/crisp image-rendering and/or 1x1 images as color
sources. When we hit these, we fall off the fast-path. Try to handle some
of those cases we are finding in the wild, namely nearest filtering and
repeat filtering.

There is some slight movement in the wrench fuzz due to the composite shader
being accelerated in situations it was previously not due to nearest filter.

Differential Revision: https://phabricator.services.mozilla.com/D105864
2021-02-22 04:14:39 +00:00
Lee Salzman 7d3755c3f6 Bug 1686244 - Accelerate radial gradients in SWGL. r=jrmuizel
The same optimization of looking for merged linear gradients can also be
applied to radial gradients by solving the quadratic equation to check
how large a span we can process within a given merged span. This allows
us to save a bunch of table lookup and some other math in the inner loops.

Differential Revision: https://phabricator.services.mozilla.com/D105858
2021-02-22 04:14:39 +00:00
Lee Salzman 6d46022aa7 Bug 1686244 - Accelerate linear gradients in SWGL. r=jrmuizel
For linear gradients, we are currently bottlenecked by looking up a gradient
table entry, doing interpolation, and converting to pixel formats for every
sample.

We can accelerate this by instead looking for contiguous segments of gradient
within the range of entries we need to sample and then interpolating these
as a single gradient. This also enables us to convert to relevant pixel formats
only when setting up this gradient, which greatly reduces the per-pixel processing
down to essentially a shift and add.

To enable this sort of crawling of the gradient table, the output gradients have
been modified such that each entry's step value will equal an adjacent entry's
step value if and only if they are from same gradient. We can ensure this by, in
the very rare case two segments of gradient have the same step, using the equivalent
of nextafter() to imperceptibly alter the value so that the invariant is maintained.

Differential Revision: https://phabricator.services.mozilla.com/D105716
2021-02-22 04:14:38 +00:00
Jamie Nicol 4fbbd0370b Bug 1692848 - Work around Mali driver crash caused by textureSize(samplerExternalOES). r=kvark
On some Mali devices we have encountered driver crashes caused by
calling textureSize(samplerExternalOES) in a shader without also
potentially sampling from the texture in the shader. ARM's suggested
workaround was to trick the driver in to thinking that the texture may
be sampled from (ie by sampling in a branch which is never dynamically
taken).

This is done by checking the value of a dummy uniform, and sampling
the texture if the value is non-default. Using a constant expression
did not work because the compiler would optimize the condition (and
therefore the sample) away.

Also re-enable webrender on Mali-72 and G76 devices, as it was blocked
due to this bug.

Differential Revision: https://phabricator.services.mozilla.com/D105493
2021-02-17 20:59:06 +00:00
Jim Blandy 8babe89301 Bug 1692013: Remove webrender::RenderApi::DebugCommand::SimulateLongLowPrioritySceneBuild. r=nical
This isn't used, and the support for it has bitrotted
(RenderBackend::low_priority_scene_tx is the wrong channel).

Differential Revision: https://phabricator.services.mozilla.com/D104730
2021-02-16 20:54:08 +00:00
Jamie Nicol f236321327 Bug 1691955 - Avoid partial updates to picture cache tiles on Mali-Txxx. r=nical
Previously we had encountered issues when rendering partial regions of
picture cache tiles on Mali-Gxx devices. These often manifested as
patterns of black squares and rectangles. We worked around this by
ensuring that we always clear and render the entire tile. We have now
had a report of a similar looking problem on a Mali-Txxx devices, so
apply the same workaround there.

Differential Revision: https://phabricator.services.mozilla.com/D105278
2021-02-16 14:16:15 +00:00
Mike Hommey 241dbe43de Bug 1692353 - Replace use of compare_and_swap with compare_exchange. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D104931
2021-02-12 22:32:27 +00:00
Nicolas Silva 5362b13377 Bug 1688180 - Decouple the render task kind from whether it is cached. r=gw
This patch removes from RenderTaskKind members that are independent from what the render task is drawing. The uv rect set automatically either to Some(handle) if the render task is not cached or to None if it is cached. This reflects what was happening implicitly before this patch. The uv rect kind defaults to Rect which is the most common case, but can be set when creating the render task.

This is a first step toward more flexibility when deciding whether a render task is cached or not (there is stil some coupling in the batching code between the type of primitive and whether their render tasks are cached).
More importantly, not having to understand what is up with presence or absence of uv handles in render tasks makes adding new ones much easier.

Differential Revision: https://phabricator.services.mozilla.com/D104840
2021-02-12 12:55:24 +00:00
Lee Salzman 15e2d003ce Bug 1678119 - Simplify SWGL image fast-paths since complex blending is no longer required. r=jrmuizel
Now that most of the complicated alpha-pass features such as clip-masking and anti-aliasing
are handled in SWGL during the blend stage, most of the fast-paths are identical and only call
swgl_commitTextureLinear in a tight loop. We can do a lot better here by just moving that loop
into SWGL, not only making it faster but removing all the redundant boiler-plate code out of
the shaders.

Differential Revision: https://phabricator.services.mozilla.com/D104536
2021-02-12 02:43:56 +00:00
Lee Salzman bd41ed1f9c Bug 1678119 - Use swgl_antiAlias() in WR brush shaders. r=jrmuizel
This cleans up the WR brush shaders to not have to use its own
implementation of init_transform_fs() for anti-aliasing when SWGL
is available. To enable this, most of the details of AAing have
been moved into brush.glsl to simplify the control knobs and
allow easier modifications.

With swgl_antiAlias() used, the drawSpan fast-paths no longer have to
care about whether ot not AA is enabled, so we can more easily stay
on these fast-paths without worry.

Differential Revision: https://phabricator.services.mozilla.com/D104493
2021-02-12 02:43:55 +00:00
Butkovits Atila 9852a9e53e Backed out 4 changesets (bug 1678119) for causing build bustage on brush_blend.h. CLOSED TREE
Backed out changeset c93691df2440 (bug 1678119)
Backed out changeset 163ea6e7bcc2 (bug 1678119)
Backed out changeset 16b232a35692 (bug 1678119)
Backed out changeset b9dce9d33351 (bug 1678119)
2021-02-12 03:32:07 +02:00
Lee Salzman 9c94c67c13 Bug 1678119 - Simplify SWGL image fast-paths since complex blending is no longer required. r=jrmuizel
Now that most of the complicated alpha-pass features such as clip-masking and anti-aliasing
are handled in SWGL during the blend stage, most of the fast-paths are identical and only call
swgl_commitTextureLinear in a tight loop. We can do a lot better here by just moving that loop
into SWGL, not only making it faster but removing all the redundant boiler-plate code out of
the shaders.

Differential Revision: https://phabricator.services.mozilla.com/D104536
2021-02-12 00:19:03 +00:00
Lee Salzman d54c0bf3cb Bug 1678119 - Use swgl_antiAlias() in WR brush shaders. r=jrmuizel
This cleans up the WR brush shaders to not have to use its own
implementation of init_transform_fs() for anti-aliasing when SWGL
is available. To enable this, most of the details of AAing have
been moved into brush.glsl to simplify the control knobs and
allow easier modifications.

With swgl_antiAlias() used, the drawSpan fast-paths no longer have to
care about whether ot not AA is enabled, so we can more easily stay
on these fast-paths without worry.

Differential Revision: https://phabricator.services.mozilla.com/D104493
2021-02-12 00:19:02 +00:00
Lee Salzman 5a8118aba6 Bug 1691859 - Emulate mix-blend-mode without KHR_blend_equation_advanced in WR when possible. r=gw
We don't actually need to use brush_mix_blend or KHR_blend_equation_advanced for multiply, screen,
and exclusion modes. Screen and exclusion can be done with simple blending, and multiply can be
done with dual-source blending. Since multiply is the most common mix-blend mode, and dual-source
blending is also common on the desktop with our ANGLE driver, this should be a significant boost
for mix-blend-mode performance for us across.

Differential Revision: https://phabricator.services.mozilla.com/D104614
2021-02-10 19:27:09 +00:00
Jim Blandy bdd9ffc731 Bug 1691120: Remove webrender::render_api::ApiMsg::WakeUp. r=nical
Differential Revision: https://phabricator.services.mozilla.com/D104253
2021-02-09 22:32:40 +00:00
Nicolas Silva cdbd331434 Bug 1691421 - Shrink the staging texture pool automatically. r=jnicol
If we have more than 8 unused/reusable staging textures and buffers for more than 120 consecutive frames, start deallocation them, spreading the deallocation over multiple frames.
The vast majority of frames require less than 4 staging textures and buffers (most don't require any), but some SVG animations can put a lot of pressure on uploads, requiring 30+ staging textures per frame. This patch avoids staying at this kind of peak memory usage for too long.

Differential Revision: https://phabricator.services.mozilla.com/D104510
2021-02-09 15:40:52 +00:00
Nicolas Silva 3a26d89afb Bug 1691421 - Improve the way stalls are avoided in the staging texture pool. r=jnicol
Instead of using a triple buffering scheme, tag each texture with a frame index and only reuse a texture that hasn't been used for more than two frames.

Differential Revision: https://phabricator.services.mozilla.com/D104421
2021-02-09 15:40:51 +00:00
Nicolas Silva df797398ca Bug 1691421 - Report staging texture memory. r=gfx-reviewers,jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D104420
2021-02-09 15:40:51 +00:00
Dzmitry Malyshau efe44f7248 Bug 1690546 - Fix Rust nightly warnings due to dead_code in WR r=gw
Note the `handle` comment - looks like a compiler bug to call it unused?

Differential Revision: https://phabricator.services.mozilla.com/D104289
2021-02-09 00:27:03 +00:00
Glenn Watson 71950f0f9e Bug 1690396 - Refactor mix-blend-mode impl to work correctly with raster roots. r=nical
This fixes incorrect rendering when either the source or backdrop
tasks establish a raster root.

By design, it also changes mix-blend backdrop readbacks to work in
a way that can handle readbacks from picture cache tiles, which is
a follow up optimization being worked on.

Differential Revision: https://phabricator.services.mozilla.com/D103853
2021-02-08 14:10:57 +00:00
Glenn Watson 150af8fa3c Bug 1690835 - Fix animation jitter regression. r=nical
In bug 1687394, the semantics of `requested_raster_space` were
changed to only take effect when an intermediate surface was
created.

However, this causes a regression to snapping with text runs
that are animated on the root surface (such as loading spinner
glyphs).

To fix that, while also keeping the functionality of the previous
patch (removing a source of pass-through pictures), there is now
a stack of requested raster space pushed and popped for each
stacking context. This is read and stored by text runs during
scene building, ensuring that these animated glyphs select the
correct raster space to avoid snapping / jittering bugs.

Differential Revision: https://phabricator.services.mozilla.com/D104345
2021-02-08 19:06:19 +00:00
Nicolas Silva 0ecd52647b Bug 1691042 - Dump alpha8 mask and glyph textures in frame captures. r=jnicol
Differential Revision: https://phabricator.services.mozilla.com/D104213
2021-02-05 19:11:15 +00:00
Jeff Muizelaar 0abab2be63 Bug 1687536 - Move SWGL compositor into WebRender proper. r=lsalzman
This will let us use it from Wrench.

Differential Revision: https://phabricator.services.mozilla.com/D102343
2021-02-07 20:04:14 +00:00
Lee Salzman d0e2a2997e Bug 1691139 - Optimize init_transform_fs for SWGL fast-paths where there is no perspective. r=jrmuizel
The result of compute_aa_range depends on fwidth(local_pos). In the no-perspective case,
the derivatives of local_pos are constant across an entire primitive. SWGL fast-paths only
run in the no-perspective case anyway, so it is convenient to compute the aa_range once
for the entire span and then reuse it, factoring out this per-pixel cost.

Differential Revision: https://phabricator.services.mozilla.com/D104294
2021-02-06 02:51:15 +00:00
Lee Salzman 28c09d8dcd Bug 1691139 - Use cheaper linear approximation for WR shader anti-aliasing. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D104270
2021-02-07 20:15:47 +00:00
Jeff Muizelaar d537e47349 Bug 1687829 - Add composite surface locking to MappableCompositor trait. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D102501
2021-02-07 17:10:58 +00:00
Jeff Muizelaar 9312f8cf88 Bug 1687536 - Add MappableCompositor trait. r=gw
This is added in preparation for moving the SWGL compositor
into WebRender proper.

Differential Revision: https://phabricator.services.mozilla.com/D102342
2021-02-07 02:07:04 +00:00
Nicolas Silva d85a05d78c Bug 1691023 - Add some profile counters for texture cache eviction. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D104207
2021-02-05 16:23:05 +00:00
Nicolas Silva f03f6249c6 Bug 1690247 - Don't batch texture uploads with SWGL. r=jnicol
Differential Revision: https://phabricator.services.mozilla.com/D104158
2021-02-05 13:23:37 +00:00
Csoregi Natalia 4d73b71b8e Merge mozilla-central to autoland. a=merge CLOSED TREE 2021-02-05 00:39:44 +02:00
Csoregi Natalia 40205f1b55 Backed out changeset 0788e77d2d62 (bug 1690396) for causing crashes in Bug 1690846. a=backout 2021-02-04 21:21:32 +02:00
Andreea Pavel 1715f26b05 Backed out changeset 18835f3f3936 (bug 1690319) for causing 1690689 a=backout 2021-02-04 18:05:14 +02:00
Glenn Watson cb776f3c4c Bug 1690396 - Refactor mix-blend-mode impl to work correctly with raster roots. r=nical
This fixes incorrect rendering when either the source or backdrop
tasks establish a raster root.

By design, it also changes mix-blend backdrop readbacks to work in
a way that can handle readbacks from picture cache tiles, which is
a follow up optimization being worked on.

Differential Revision: https://phabricator.services.mozilla.com/D103853
2021-02-04 02:43:18 +00:00
Dorel Luca d2b9c19b64 Backed out changeset ddd89e758a23 (bug 1690396) for Wrench failures. CLOSED TREE 2021-02-04 04:30:53 +02:00
Glenn Watson 5a2bff1c55 Bug 1690396 - Refactor mix-blend-mode impl to work correctly with raster roots. r=nical
This fixes incorrect rendering when either the source or backdrop
tasks establish a raster root.

By design, it also changes mix-blend backdrop readbacks to work in
a way that can handle readbacks from picture cache tiles, which is
a follow up optimization being worked on.

Differential Revision: https://phabricator.services.mozilla.com/D103853
2021-02-04 01:16:41 +00:00
Lee Salzman 900774169e Bug 1690886 - Support 4-component swizzles in SWGL. r=jnicol
Differential Revision: https://phabricator.services.mozilla.com/D104098
2021-02-04 21:50:36 +00:00
Jamie Nicol f21eb2a491 Bug 1685563 - Re-enable using R8 texture format for alpha glyphs. r=lsalzman
This change had previously been backed out due to causing rendering
issues on HTC 10 Android, and some Linux Radeon cards (bug 1687554).

On the HTC 10, the issue was that the extra case statement added to
the text run shader caused the glslopt optimized shader to become too
complex for the device, resulting in rendering issues. Since bug
1689316 has landed, the optimized shader output is simpler and this
issue is avoided.

On radeon, we have established that the problem is due to the format
of the texture and that the shader is fine. Furthermore, the shader
works correctly with either R8 or RGBA8 texture data, as all of the
channels contain the alpha value in the RGBA8 textures. Therefore we
continue to use RGBA8 textures for alpha glyphs on Linux Radeon, but
switch to R8 on other platforms.

Differential Revision: https://phabricator.services.mozilla.com/D104082
2021-02-04 20:53:31 +00:00
Butkovits Atila 9de4a8383a Merge mozilla-central to autoland. CLOSED TREE 2021-02-04 19:32:15 +02:00
Nicolas Silva 4ddd3c50c9 Bug 1649386 - Add a bit of documentation to scene building. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D81663
2021-02-04 14:15:48 +00:00
Jeff Muizelaar 69eeb000ea Bug 1687522 - Use a 'gecko' feature instead of having a ThreadListener trait. r=kvark
Previously, we've taken the strategy of exposing any gecko specific hooks
as traits. The disadvantage of this approach is that it requires plumbing
a boxed trait through to any places that need to use it.

With this approach, we add global functions that don't do anything when
compiled without the 'gecko' feature. This makes it easier to add hooks
and avoids the plumbing which should reduce friction in the process
of moving more stuff out of gecko and into webrender.

Differential Revision: https://phabricator.services.mozilla.com/D102334
2021-02-03 16:19:20 +00:00
Jeff Muizelaar 678b2741b3 Bug 1690086 - Remove workaroud in brush_vs. r=mstange
This reverts the workaround added in https://github.com/servo/webrender/pull/3540
(bug 1525032)

The root cause of that has been identified as bug 1690027.

Differential Revision: https://phabricator.services.mozilla.com/D103795
2021-02-02 16:06:54 +00:00
Jeff Muizelaar 293221bb1d Bug 1690319 - Remove integer comparison workaround in fetch_clip_area. r=mstange
This removes the workaround from https://github.com/servo/webrender/pull/2864

The root cause of that has been identified as bug 1690027.

Differential Revision: https://phabricator.services.mozilla.com/D103797
2021-02-02 17:17:50 +00:00
Jeff Muizelaar b971df08bb Bug 1690083 - Remove workaround in fetch_glyph and write_gradient_vertex. r=mstange
Originally from: https://github.com/servo/webrender/commit/917da3c1de
Should be fixed by bug 1690027.

Differential Revision: https://phabricator.services.mozilla.com/D103705
2021-02-02 16:37:47 +00:00
Jeff Muizelaar f92e9a2c14 Bug 1690074 - Remove YUV workaround. r=mstange
This removes the work around added in bug 1679700.
The root cause of that has been identified as bug 1690027.

Differential Revision: https://phabricator.services.mozilla.com/D103703
2021-02-01 19:24:22 +00:00
Nicolas Silva 997f34d803 Bug 1681310 - Add a batched texture upload code path using glTexSubImage2D. r=jnicol
Our existing batched texture upload logic works with pixel buffer objects which we don't use with ANGLE.
The motivation is to avoid expensive driver overhead from submitting many glTexSubImage2D calls (one for each texture cache item) on low-end Intel Windows configurations.

On Windows+Intel it is much faster to use batched draw calls to copy from staging textures to texture cache than using CopySubResourceRegion (when there is a high number of copies).

Differential Revision: https://phabricator.services.mozilla.com/D103333
2021-02-02 06:50:00 +00:00
Jamie Nicol abab286bf9 Bug 1689316 - Update glslopt to optimize shader switch statements in to fewer ifs. r=jrmuizel
We have encountered issues on some platforms due to a large number of
if statements in shaders. The shader optimizer previously generated
code with a large number of if statements, due to the way in which it
optimized switch statements.

Previously the optimizer output 2 if statements for every case in a
switch. First it ORs the "fallthrough" var with the case's
condition. Then sets the fallthrough var to false if the "break" var
is true. Then conditionally executes the case's instructions if
fallthrough is true. For example:

  switch (uMode) {
    case 0:
      gl_Position = vec4(0.0);
      break;
    case 1:
      gl_Position = vec4(1.0);
      break;
  }

becomes:

  bool break_var = bool(0);
  bool fallthrough_var = (0 == uMode);
  if (break_var) fallthrough_var = bool(0);
  if (fallthrough_var) {
    gl_Position = vec4(0.0, 0.0, 0.0, 0.0);
    break_var = bool(1);
  };
  fallthrough_var = (fallthrough_var || (1 == uMode));
  if (break_var) fallthrough_var = bool(0);
  if (fallthrough_var) {
    gl_Position = vec4(1.0, 1.0, 1.0, 1.0);
    break_var = bool(1);
  };

This update removes one of these ifs, by ANDing the fallthrough_var
with !break_var rather than conditionally setting it to false. eg:

  bool break_var = bool(0);
  bool fallthrough_var = (0 == uMode);
  if (fallthrough_var) {
    gl_Position = vec4(0.0, 0.0, 0.0, 0.0);
    break_var = bool(1);
  };
  fallthrough_var = (fallthrough_var || (1 == uMode));
  fallthrough_var = (fallthrough_var && !(break_var));
  if (fallthrough_var) {
    gl_Position = vec4(1.0, 1.0, 1.0, 1.0);
    break_var = bool(1);
  };

This is logically equivalent but uses half as many if statements,
which helps to avoid driver bugs on some platforms.

Differential Revision: https://phabricator.services.mozilla.com/D103713
2021-02-01 21:14:15 +00:00
Jeff Muizelaar 0a6b4af5e8 Bug 1690027. Avoid using texelFetchOffset on macOS. r=mstange
We've run into a number of bugs with integer comparison on macOS Intel. I
created a reduced test case of bug 1689510 here:
https://github.com/jrmuizel/texel-fetch-offset.

It appears that offset parameter to texelFetchOffset can cause subsequent uses
of that integer value to get confused and generate bad shader code.

There are known issues around texelFetchOffset on Intel mentioned in ANGLE
11e43ecee2
and https://github.com/google/angle/commit/0303cf6b95 and in mesa
4650aea7a5

My theory is that there's also a workaround in the Intel driver but this work
around is somehow broken which causes the incorrect code.

Here's the result of compilation in working case:
https://gist.github.com/jrmuizel/e6a9b838aba97ec6190c147e0aa3a335
and the broken one:
https://gist.github.com/jrmuizel/8b303770b920c44dee9a18586140ab01

The broken one has had the cmp instruction dropped.

Differential Revision: https://phabricator.services.mozilla.com/D103691
2021-02-01 17:16:19 +00:00
Glenn Watson cf743d8f14 Bug 1685145 - Fix incorrect usage of memory profiling code. r=jrmuizel
The calling code was directly calling the sizeof function, instead
of going via the API method wrapper.

Differential Revision: https://phabricator.services.mozilla.com/D103429
2021-01-31 20:15:47 +00:00
Lee Salzman 37f3ecb91c Bug 1689568 - invalidate WR debug overlay before binding. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D103458
2021-01-29 18:57:33 +00:00
Ryan VanderMeulen 06dbf167c9 Backed out changeset ec84f8196c4c (bug 1689316) for regressing macOS font rendering. 2021-01-28 20:59:25 -05:00
Jamie Nicol ecd5b26737 Bug 1689316 - Convert all switch statements to if-elses in webrender shaders. r=jrmuizel
We keep encountering issues on various platforms due to the usage of
switch statements, especially the optimized output produced by
glslopt. Replace all instances with if-else statements instead.

Differential Revision: https://phabricator.services.mozilla.com/D103300
2021-01-28 14:27:13 +00:00
Jamie Nicol 62eb49693e Bug 1688921 - Support GPU cache resize when EXT_color_buffer_float is not supported. r=kvark
Currently when the GPU cache is resized we allocate a new texture and
then copy the contents of the old texture to the new texture. This
copy requires either EXT_copy_image (for glCopyImageSubData) or
EXT_color_buffer_float (to bind the RGBAF32 texture to a framebuffer).

On devices where neither extension is supported, don't attempt to copy
the old texture. Instead mark the entire CPU-side copy of the cache as
dirty, meaning we will subsequently upload the entire contents to the
new texture. (A complete CPU-side copy is only mainted for the
PixelBuffer gpu cache bus type, not for Scatter ones. However, as the
Scatter type also requires EXT_color_buffer_float, we will only be in
this situation for PixelBuffer buses.)

Differential Revision: https://phabricator.services.mozilla.com/D103071
2021-01-27 08:47:11 +00:00
Lee Salzman b9384b091e Bug 1675590 - avoid using alpha-pass version of gradient shader for clip-mask-only cases. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D102999
2021-01-26 03:56:10 +00:00
Lee Salzman 8b4b32c5c1 Bug 1675590 - implement provisional fast-paths for linear and radial gradients. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D103136
2021-01-27 06:00:15 +00:00
Matt Woodrow 2a0c7c976f Bug 1687124 - Pass tile valid rect into invalidate_tile, so that this is available in time for begin_compositing. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D102667
2021-01-27 03:17:41 +00:00
Matt Woodrow eb7fe574cb Bug 1687124 - Make SwCompositor compute the set of opaque rectangles, and forward this to the RenderCompositor. r=gw,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D102665
2021-01-27 03:17:16 +00:00
Bogdan Tara 5eded5baf9 Backed out 3 changesets (bug 1687124) for webrender_bindings related failure CLOSED TREE
Backed out changeset 8832f33fa266 (bug 1687124)
Backed out changeset 27de9357456e (bug 1687124)
Backed out changeset b9ca229672d5 (bug 1687124)
2021-01-27 04:04:10 +02:00
Matt Woodrow 5cbbfdc99f Bug 1687124 - Pass tile valid rect into invalidate_tile, so that this is available in time for begin_compositing. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D102667
2021-01-27 00:48:06 +00:00
Matt Woodrow 1875a8e5ab Bug 1687124 - Make SwCompositor compute the set of opaque rectangles, and forward this to the RenderCompositor. r=gw,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D102665
2021-01-26 06:53:05 +00:00
Glenn Watson 97acc7ed1a Bug 1687863 - Refactor picture cache barriers and scroll bar slice code. r=nical
Instead of keeping a stacking context around for scrollbar containers,
extend and use the tile cache barrier code to create them. This
removes the final remaining code path that creates pass through
picture primitives.

The tile cache barrier changes also form the basis of how we will
make blend containers and backdrop roots work in a follow up patch.

Blend containers and backdrop roots will become redundant stacking
contexts when they exist at the start of a tile cache, which will
save an entire off-screen surface / constant invalidation.

Differential Revision: https://phabricator.services.mozilla.com/D102527
2021-01-26 23:02:37 +00:00
Glenn Watson ece7eb45cc Bug 1687604 - Skip pass through leaf pictures during scene building. r=nical
Previously, a leaf picture would be created unconditionally when
popping a stacking context during scene building. This results in
many pass-through pictures being created that are often not required.

This patch introduces a helper struct that delays creation of a
pass-through wrapping picture until it's known to be needed (and
instead adds the prim_list to a wrapping picture where possible).

In a follow up patch, the last couple of places that create pass
through pictures via pop_stacking_context will be removed.

Differential Revision: https://phabricator.services.mozilla.com/D102381
2021-01-26 23:02:50 +00:00
Dzmitry Malyshau 291f86a68e Bug 1688983 - Rename shared member in WebRender shaders r=gw
just a rename

Differential Revision: https://phabricator.services.mozilla.com/D103103
2021-01-26 22:41:41 +00:00
Lee Salzman 4dac9993b6 Bug 1688323 - refactor WR gradient shaders with gradient_shared. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D102813
2021-01-24 19:51:18 +00:00
Lee Salzman cd4ccd90f8 Bug 1688303 - implement SWGL fast-path for cs_scale. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D102801
2021-01-22 23:23:22 +00:00
Lee Salzman c738dc904e Bug 1688104 - support builtin clip-mask blending in SWGL. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D102701
2021-01-22 20:48:14 +00:00
Jim Blandy d45fbc5a22 Bug 1676554: Decide whether rectangles fall within rounded rectangles more accurately. r=gw
Under software WebRender, performance is substantially improved if we make the approximations in ClipItemKind::get_clip_result more accurate.

That function's job is to decide whether a primitive falls entirely inside a
clip, entirely outside it, or has regions of both. If the primitive is known to
fall entirely inside the clip, WebRender doesn't bother applying the clip to it.
This also saves WR the trouble of rendering the clip mask itself - which is what
the cs_rectangle_clip shader is spending a lot of time on when displaying these
pages.

Before this change, ClipItemKind::get_clip_result handles rounded rectangle clip
regions by computing an 'inner rect', a rectangle inset from the rounded
rectangle on each side by the relevant rounding radii. This is a correct
conservative approximation, but it means that any primitive that lies flush with
one of the flat sides of the clip is considered to only be partially within the
clip, and thus needs to have the clip mask applied - even though simple
rectangle intersection would serve.

With this change, instead of an 'inner rect', we approximate the rounded
rectangle by a rectangle with rectangular chunks taken out of each corner. This
lets us recognize more primitives as being fully within the clip, and apply the
clip mask less often.

Differential Revision: https://phabricator.services.mozilla.com/D102526
2021-01-21 03:59:25 +00:00
Dzmitry Malyshau 404511fd71 Bug 1561358 - Move WR storage module under prim_storage r=gw
the storage logic was made for, and used exclusively in, the prim_store.
Moving it into the sub-module and making it private allows for easier navigation in the code.

Differential Revision: https://phabricator.services.mozilla.com/D102494
2021-01-20 21:54:19 +00:00
Glenn Watson c58d174a1e Bug 1687573 - Add no-op shadow primitives directly to parent prim list. r=nical
This removes another code path that was creating pass through
picture primitives.

Differential Revision: https://phabricator.services.mozilla.com/D102359
2021-01-20 19:31:48 +00:00
Jamie Nicol 9be8a0dec3 Bug 1687554 - Revert to using BGRA8 textures for non-subpixel AA glyphs. r=lsalzman
Bug 1685563 switched to using R8 textures instead of BGRA8 for
non-subpixel AA glyphs. This caused rendering issues on certain
android and linux devices, so switch back temporarily until those
issues are fixed.

Differential Revision: https://phabricator.services.mozilla.com/D102465
2021-01-20 19:25:10 +00:00
Lee Salzman eec3f9ab02 Bug 1677927 - avoid some unnecessary anti-aliasing work in YUV shader SWGL fast-path. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D102462
2021-01-20 19:15:07 +00:00
Lee Salzman e8b01389d1 Bug 1675590 - use the opaque gradient brush shader when no other features are required. r=nical
Differential Revision: https://phabricator.services.mozilla.com/D102387
2021-01-20 17:49:50 +00:00
Lee Salzman 2830a0ac8f Bug 1683084 - add SWGL fast-path for ps_split_composite shader. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D102444
2021-01-20 17:02:34 +00:00
Jamie Nicol 215a74be21 Bug 1687378 - Expire old picture cache tiles at the beginning of the frame. r=gw
Currently we expire old picture cache tiles at the end of the frame,
immediately before garbage collecting them. This means that new
textures have already been allocated for newly-created picture cache
tiles, so we often end up both allocating and destroying textures in
the same frame.

Instead, move the call to expire_old_picture_cache_tiles() to the
beginning of the frame. Picture cache tiles added to the cache during
the frame can then recylce these textures rather than allocate new
ones. Garbage collection still occurs at the end of the frame,
destroying freed textures that were not recycled.

Note that expire_old_picture_cache_tiles() frees picture cache tiles
which were unused in the *previous* as well as the current frame. This
is a legacy from when the function freed all types of texture cache
entries, and could be called throughout the frame. Immediately prior
to this change, it could in fact have just checked for usage during
the *current* frame, as the function was only called at the end of the
frame. However, as this change moves the call to the beginning of the
frame, we do actually now need to check for usage during
the *previous* frame.

Differential Revision: https://phabricator.services.mozilla.com/D102349
2021-01-20 08:52:39 +00:00
Glenn Watson 7db4ab6160 Bug 1687409 - Use offscreen surface for backface visibility + non-preserve3d stacking contexts r=nical
Removes another case of pass through pictures, by handling the rare
case of a stacking context with backface-visibility: false that is
_not_ part of a 3d rendering context as an offscreen surface.

Differential Revision: https://phabricator.services.mozilla.com/D102251
2021-01-19 19:58:48 +00:00
Glenn Watson 8b93f9f4c5 Bug 1687394 - Simplify semantics of `requested_raster_space`. r=nical
Previously, it was possible to request a local/screen raster
space even if the owning stacking context didn't create an
offscreen surface.

This complicates various parts of the code, and also results
in a pass-through picture primitive being created (which we
want to remove as part of the work for #1684781).

With this change, it's only possible to change the raster space
when the enclosing stacking context creates an offscreen surface
for some other reason (e.g. 3d transform, filters etc).

Differential Revision: https://phabricator.services.mozilla.com/D102244
2021-01-19 19:59:14 +00:00
Glenn Watson 7606c9048e Bug 1684781 - Pt 2 - Remove root_pic_index. r=nical
Instead, top level tile cache pictures are stored in the scene.

Follow up tasks in this bug will be simplified by having pictures
only exist when they have Some(..) for requested_composite_mode.

This patch removes one case of a pass-through picture, and
simplfies some of the surrounding code in the process.

Differential Revision: https://phabricator.services.mozilla.com/D101539
2021-01-18 21:32:34 +00:00
Markus Stange 5fac6c2b9b Bug 1686830 - Compute eviction thresholds based on the configured shared texture sizes. r=gw
Depends on D102122

Differential Revision: https://phabricator.services.mozilla.com/D102123
2021-01-18 20:29:16 +00:00
Markus Stange 986f0b2a8d Bug 1686830 - Partition the texture cache so that different texture types have different memory budgets, and don't evict each other. r=gw
All LRU partitions use the same freelist to store the entries, and only have
separate LRU indexes. The shared freelist makes it easier to transfer an entry
from one LRU partition to another. If instead we used different LRUCache
instances, moving entries between partitions would be cumbersome because we
would need to look up the strong handle for the entry so that we could remove it
from the old freelist.

Differential Revision: https://phabricator.services.mozilla.com/D102122
2021-01-18 20:29:31 +00:00
Markus Stange 3234fe164d Bug 1686830 - Manage picture cache entries and manually-evicted entries separately from the LRUCache, so that the LRUCache can focus on automatically-evicted entries. r=gw
When I wrote this patch, I thought that it would simplify the next patch in this
series, but I think it didn't make much of a difference in the end.
I still think this patch improves things and is worth taking, though.

Differential Revision: https://phabricator.services.mozilla.com/D102121
2021-01-18 20:29:39 +00:00
Markus Stange 6c277c41ff Bug 1686810 - Make the fps counter display the number of frames rendered within the last second. r=nical
Differential Revision: https://phabricator.services.mozilla.com/D101824
2021-01-15 16:03:18 +00:00
Markus Stange 1e70deee3e Bug 1686862 - Account for the new A8 glyphs texture in various places. r=jnicol,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D101862
2021-01-15 16:03:18 +00:00
Markus Stange 05284fa0b0 Bug 1685744 - Remove the glyph cache limit. r=lsalzman
The limit wasn't doing anything useful anymore, because one of the recent texture
cache refactorings made it so that we weren't actually evicting these glyphs from
the texture cache. In the future, we can implement a similar limit in the texture
cache itself, by giving it per-cache-type limits rather than a global limit.

Differential Revision: https://phabricator.services.mozilla.com/D101834
2021-01-15 02:57:04 +00:00
Barret Rennie 2d384c7f0e Bug 1683217 - Require non-zero window size for profiler screenshots in WebRender r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D101685
2021-01-14 22:18:54 +00:00
Nicolas Silva be6b2bc8af Bug 1686500 - Update etagere to 0.2.4 r=gfx-reviewers,kvark
The new version contains
 - A bug fix for the bucketed allocator (we don't currently use it)
 - A few fixes that can happen when requesting large enough allocation sizes to cause integer overflows. At the moment we never request an allocation larger than 512px so we are safe but it's still good to stay up to date.

Differential Revision: https://phabricator.services.mozilla.com/D101608
2021-01-14 08:31:40 +00:00
Jamie Nicol 3591b6e8cb Bug 1685563 - Store non-subpixel-AA glyphs in R8 texture rather than BGRA8. r=lsalzman
Add a new texture type alpha8_glyphs to the texture cache and store
alpha glyphs in it. Because the opengl texture format is R8 but the
shader requires to read the texture's alpha channel, we must swizzle
the components. We cannot rely on texture swizzling due to driver
bugs, so add the necessary code to the shader to do so manually.

Differential Revision: https://phabricator.services.mozilla.com/D101643
2021-01-13 22:51:07 +00:00
Jamie Nicol 9cbe014373 Bug 1686528 - Do not round up stride for PBO texture uploads on ANGLE.
ANGLE appears to truncate uploads from a PBO in cases where the
UNPACK_ROW_LENGTH is greater than the width of the upload. We
encounter this due to rounding up the stride of our data to be a
multiple of 4 bytes. Don't do that on ANGLE.

Note that we only hit this issue in wrench, as in Firefox we do not
use PBO uploads with ANGLE.

Differential Revision: https://phabricator.services.mozilla.com/D101663
2021-01-13 23:21:44 +00:00
Glenn Watson f61e781e90 Bug 1686113 - Fix render pass assignment for complex task graphs. r=nical
The previous traversal strategy for assigning render tasks is very
simple and works fine for normal content. However, it's possible to
create graphs with very deep levels of nesting and dependencies
that cause the pass traversal to not terminate quickly.

This patch contains two changes to fix these cases:
 - Recursion in assign_render_pass will early out if a shorter
   path has been found.
 - Remove recursion from assign_free_pass, iterating each task once.

Differential Revision: https://phabricator.services.mozilla.com/D101541
2021-01-13 19:43:35 +00:00
Glenn Watson 68f8f61866 Bug 1684817 - Reduce size of clip masks in transformed primitives. r=nical
In cases where clips are in the same coordinate space as the parent
picture surface (but different from the primitive), we can apply
a simple optimization to reduce the size of clip mask allocations.

In the linked test case, this drastically reduces the size of clip
masks that are drawn (each of the many clip masks drops from approx
1000 x 1000 pixels to approx 64 x 64 pixels).

Differential Revision: https://phabricator.services.mozilla.com/D101298
2021-01-11 19:41:11 +00:00
Nicolas Silva afb6cd7d18 Bug 1684812 - Report texture cache's LRU cache memory. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D100931
2021-01-11 08:58:58 +00:00
Glenn Watson 7c86ad2a4d Bug 1684781 - Pt 1 - Refactor SurfaceRenderTasks r=nical
Restructure how frame building handles building of the surface
render task structures.

In future parts of this bug, a surface may have multiple "sub-passes"
where the rendering is separated into different render tasks that
write to the same target (without clear on subsequent sub-passes).

For example, this will be used to allow mix-blend-mode and
backdrop-filter to issue readbacks directly from picture cache
tiles rather than forcing draws to an intermediate surface.

The `add_child_render_task` method will be expanded to support
the case of a surface having multiple sub-passes, adding the
render task to the correct sub-pass.

Differential Revision: https://phabricator.services.mozilla.com/D101122
2021-01-10 19:39:51 +00:00
Markus Stange 7f2f028bd0 Bug 1685643 - Add a test. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D101123
2021-01-10 20:04:22 +00:00
Dzmitry Malyshau 35c73ab9bc Bug 1640960 - Support OpenGL 3.2 and SSBO in WR renderer r=gw
This is a small extract from a change I tried to land earlier.
It refactors the GL version queries, no functional changes here.

Differential Revision: https://phabricator.services.mozilla.com/D101082
2021-01-08 16:02:42 +00:00
Nicolas Silva aa30ff60cc Bug 1678326 - Add a debug command for forcing picture tile invalidation. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D100885
2021-01-08 13:44:04 +00:00
Nicolas Silva 30d561c26b Bug 1683294 - Update rayon to 1.5 r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D100110
2021-01-07 15:29:27 +00:00
Markus Stange 6d618366d7 Bug 1685643 - Subtract the correct allocation size when freeing items from the shared cache. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D101104
2021-01-08 06:00:34 +00:00
Markus Stange 1434deba5f Bug 1683993 - Convert do_debug_blit() to use origin-top-left coordinates and convert to FramebufferPixel coordinates correctly. r=kvark
This fixes upside-down drawing when the native compositor is used.

Depends on D100962

Differential Revision: https://phabricator.services.mozilla.com/D100963
2021-01-07 20:59:10 +00:00
Markus Stange c4c8bc35ad Bug 1683993 - Forward debug overlay DrawTarget into do_debug_blit so that device.blit_render_target targets the correct framebuffer when the native compositor is used. r=kvark
Differential Revision: https://phabricator.services.mozilla.com/D100962
2021-01-07 20:59:57 +00:00
Markus Stange 8dfc017704 Bug 1683993 - Stop double-drawing debug overlays. r=kvark
render_impl() calls draw_frame(). We were drawing the debug overlays in both
functions, so the overlays were rendered twice.
This patch removes the drawing in draw_frame() and keeps the one in render_impl().

For anything that uses the debug renderer, such as the "epochs" overlay, this
means that the drawing commands were appended twice, and then all commands were
executed at the end of render_impl().
Comparing the "epochs" debug overlay with and without this change, this patch
noticeable]y reduces its opacity from "extra opaque" (due to double drawing) to
"normal translucency".

Also, when the native compositor was used, any debug drawing in draw_frame()
that wasn't using the debug renderer didn't actually work, because it wasn't
going into the debug overlay surface - only render_impl() correctly binds the
debug overlay surface when the native compositor is used.

Differential Revision: https://phabricator.services.mozilla.com/D100961
2021-01-07 20:58:59 +00:00
Dzmitry Malyshau 093ed43459 Bug 1675615 - Move WR shading module into the renderer r=nical
Differential Revision: https://phabricator.services.mozilla.com/D100941
2021-01-07 16:29:55 +00:00
Dzmitry Malyshau 1591316d90 Bug 1685345 - Move WR texture packing into a module r=nical
Differential Revision: https://phabricator.services.mozilla.com/D100950
2021-01-07 16:16:42 +00:00
Dorel Luca ebf35b54b3 Backed out changeset b8e9cf21898a (bug 1685345) for WebRender build bustages. CLOSED TREE 2021-01-07 18:06:59 +02:00
Dzmitry Malyshau 584e10b41c Bug 1685345 - Move WR texture packing into a module r=nical
Differential Revision: https://phabricator.services.mozilla.com/D100950
2021-01-07 15:53:50 +00:00
Dzmitry Malyshau 4fdd3ade6b Bug 1640960 - Add non-instancing code path to WR r=gw
We are adding the "enable_instancing" flag, enabled by default. When it's not `true`,
we are duplicating the per-vertex data and issuing non-instanced draw calls.
This is currently regressing the Talos tests - https://treeherder.mozilla.org/perfherder/compare?originalProject=mozilla-central&newProject=try&newRevision=f5b5e9af53d625826df7d3b7da9ef06960d3c176&framework=1&selectedTimeRange=172800

Differential Revision: https://phabricator.services.mozilla.com/D100932
2021-01-07 15:50:58 +00:00
Jamie Nicol f394063007 Bug 1685276 - Fix and re-enable partial present on Mali-Gxx devices. r=kvark
In bug 1676474 an issue was reported regarding partial present on
Mali-G77 devices. This was introduced in bug 1675159, which refactored
some partial present logic and shifted the order of some OpenGL calls
around. As a precaution, we disabled the feature on all Mali-Gxx
devices.

The bug seems to occur when eglSetDamageRegion is called after
rendering to an offscreen render target (in this case due to texture
cache or GPU cache updates), but without the driver being flushed in
some way. This appears to be a bug in the Mali driver.

This patch moves the eglSetDamageRegion call back to its original
location -- after all offscreen render targets have been rendered,
immediately before rendering to the main framebuffer -- which fixes
the issue. It also re-enables the feature on all Mali-Gxx devices.

Differential Revision: https://phabricator.services.mozilla.com/D101018
2021-01-07 14:47:34 +00:00
Nicolas Silva 9c3c59b547 Bug 1683753 - Don't use the bucketed shelf allocator for glyphs. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D100690
2021-01-07 09:25:34 +00:00
Dzmitry Malyshau 6556e3b939 Bug 1675615 - Move WR debug renderer under the renderer module r=gw
Most of that is *rendering* logic, so the change moves it closer to the renderer.
One tiny bit - `enum DebugItem` - is used in frame building, so I left it in its own small module at the root.

Differential Revision: https://phabricator.services.mozilla.com/D100936
2021-01-07 14:43:15 +00:00
Dzmitry Malyshau 6780419b9c Bug 1685391 - Refactor WR framegraph tests r=gw
This removes unused HTML files, moves the framegraph tests into being unit tests,
and refactors them to use less code.

Differential Revision: https://phabricator.services.mozilla.com/D100956
2021-01-07 14:37:37 +00:00
Razvan Maries 31e501fc5a Backed out 3 changesets (bug 1683753) for WebRender bustages. CLOSED TREE
Backed out changeset 9ecf9ce11807 (bug 1683753)
Backed out changeset df2921234c95 (bug 1683753)
Backed out changeset be651eeda6d3 (bug 1683753)
2021-01-07 11:16:25 +02:00
Nicolas Silva 89229f5f13 Bug 1683753 - Don't use the bucketed shelf allocator for glyphs. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D100690
2021-01-06 17:53:02 +00:00
Markus Stange eb8875ae13 Bug 1685236 - Add an autorelease pool in determine_font_smoothing_mode. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D100854
2021-01-06 04:25:40 +00:00
Cosmin Sabou c5f6472ef5 Backed out 2 changesets (bug 133467, bug 1683753) for wrench failures and landing with wrong bug no.
Backed out changeset 932397657d79 (bug 133467)
Backed out changeset 0ebc6a1d8e51 (bug 1683753)
2021-01-04 18:34:56 +02:00
Nicolas Silva e1e15f1489 Bug 1683753 - Don't use the bucketed shelf allocator for glyphs. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D100690
2021-01-04 14:38:35 +00:00
Nicolas Silva 14c5f5e852 Bug 1680769 - Add a test case. r=jnicol
Differential Revision: https://phabricator.services.mozilla.com/D98944
2020-12-18 09:27:04 +00:00
Jeff Muizelaar e6dad53841 Bug 1683966. Add some more objc autorelease pools. r=mstange
This isn't very systematic as I'm not sure the best approach for that
yet. That being said, this captures the bulk of the autoreleases without
that happen without a pool.

Differential Revision: https://phabricator.services.mozilla.com/D100363
2020-12-23 04:02:43 +00:00
Jamie Nicol 930ec98287 Bug 1683936 - Disable persistently mapped buffers on Adreno devices. r=sotaro
There is a driver bug on old versions of the Adreno driver which
prevents usage of persistenly mapped buffers for texture
uploads. Creating and mapping the buffer works correctly, but
attempting to upload to a texture from the buffer results in an error
due to the buffer still being mapped.

This means that no texture data is uploaded, essentially meaning that
we do not render anything at all.

It appears to affect at least Adreno 4xx and 5xx devices running
Android 6. For now, simply disable persistent mapping on all Adreno
devices, until we know more specifically which are affected.

Differential Revision: https://phabricator.services.mozilla.com/D100391
2020-12-23 12:05:54 +00:00
Jeff Muizelaar 5a90b263f7 Bug 1683418. Add an autoreleasepool to staunch some of the bleeding. r=mstange,aosmond
There are probably other places that have this kind of problem but this
keeps thing simple for now and might be sufficient to get things under
control.

Further work will follow.

Differential Revision: https://phabricator.services.mozilla.com/D100294
2020-12-22 03:05:06 +00:00
Dzmitry Malyshau 69565f935f Bug 1675615 - Move WR gpu cache logic into a renderer submodule r=gw
this is probably the last of the low-hanging fruits in renderer submodules.
I think it would be very useful to try isolating the scene building stuff in a similar way.
So in the end, the root `src` should only contain things that are used by multiple stages of WR.

Differential Revision: https://phabricator.services.mozilla.com/D100263
2020-12-21 22:35:32 +00:00
Dzmitry Malyshau cff7e55d93 Bug 1675615 - Start splitting WR renderer into sub-modules r=gw
This change makes "renderer.rs" a meta-module, and moves out all the vertex-releated stuff, neatly.

Differential Revision: https://phabricator.services.mozilla.com/D100148
2020-12-21 15:53:37 +00:00
Glenn Watson 3f204711b3 Bug 1682365 - Pt 6 - Add new frame graph implementation. r=nical
This patch introduces the new frame graph implementation, which
allows for more advanced and efficient render task graphs.

The goal of this initial work is to achieve feature parity with
the existing render task graph.

Follow up work will take advantage of the new graph functionality
to improve the efficiency of current mix-blend-mode, backdrop-filter
and svg filter operations.

Differential Revision: https://phabricator.services.mozilla.com/D99743
2020-12-20 22:38:27 +00:00
Dorel Luca 7746303e61 Backed out changeset 9e37e5cb4af6 (bug 1682365) on dev's request. 2020-12-20 23:57:13 +02:00
Glenn Watson 74347fd486 Bug 1682365 - Pt 6 - Add new frame graph implementation. r=nical
This patch introduces the new frame graph implementation, which
allows for more advanced and efficient render task graphs.

The goal of this initial work is to achieve feature parity with
the existing render task graph.

Follow up work will take advantage of the new graph functionality
to improve the efficiency of current mix-blend-mode, backdrop-filter
and svg filter operations.

Differential Revision: https://phabricator.services.mozilla.com/D99743
2020-12-20 21:12:52 +00:00
Glenn Watson 34c442b8d8 Bug 1682365 - Pt 5 - Refactor RenderTaskLocation r=jnicol
Once the new graph API is in place, it becomes possible to express
an input dependency on a persistent target (for example, if wanting
to read back from a picture cache tile for a mix-blend, or marking
that a color target depends on a render task in a texture cache).

To make that simpler to express, this patch adds a specific struct
for render target locations that are persistent, and updates the
surrounding code to use it. At the same time, introduce an Unallocated
field for dynamic tasks that are not yet allocated, rather than
using an Option.

Differential Revision: https://phabricator.services.mozilla.com/D99305
2020-12-18 22:23:40 +00:00
Glenn Watson f04971a492 Bug 1682365 - Pt 4 - Add RenderTaskGraphBuilder / RenderTaskGraph split r=jnicol
This patch splits the graph building functionality into
`RenderTaskGraphBuilder` and the graph querying code into
the existing `RenderTaskGraph` struct.

The Builder struct is retained frame to frame, which means
there is no longer a need for the `RenderTaskGraphCounters`
struct. The Graph struct is constructed per-frame by calling
`end_pass` on the Builder.

Although this doesn't do much different internally, it will
make integration with the new task graph changes simpler. It
also enforced during frame building when it is possible
to add / query render tasks.

A few unrelated tidy ups are included in this patch - mostly
removing where the task graph is passed to from a few structs
and methods that no longer require access to the graph.

Differential Revision: https://phabricator.services.mozilla.com/D99297
2020-12-18 22:23:40 +00:00
Glenn Watson 780e30c7a2 Bug 1682365 - Pt 3 - Remove array textures from picture cache tiles. r=nical,jnicol
This patch makes picture cache tiles use normal textures instead
of array textures. With this and the previous patch, WR no longer
uses array textures at all (except when provided by the external
image handler trait).

Differential Revision: https://phabricator.services.mozilla.com/D99013
2020-12-18 22:23:40 +00:00
Lee Salzman 82e7fe6b1e Bug 1669841 - provide 1:1 rendering fast-paths for some SWGL shaders. r=jrmuizel
Mainly this implements a new set of SWGL intrinsics based around swgl_allowTextureNearest
and swgl_commitTextureNearest which can fairly easily provide a further fast-path above
and beyond swgl_commitTextureLinear. This requires the row be from an axis-aligned 1:1
draw so that we can do something not unlike a fast copy of the texture data straight
to the destination in cases where even the linear filter would be essentially doing
the same thing in a more expensive way. For now, only a few WR shaders that were already
using swgl_commitTextureLinear have been fast-pathed with the new intrinsics to see if
this provides significant performance benefit.

Differential Revision: https://phabricator.services.mozilla.com/D100079
2020-12-18 15:55:09 +00:00
Jeff Muizelaar 5fef30be08 Bug 1683399 - Add some dbg if compositor kind doesn't match. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D100160
2020-12-18 20:17:23 +00:00
Glenn Watson 422112d55d Bug 1683242 - Make external_scroll_id required when defining scroll frames. r=nical,aosmond
It's always supplied by Gecko anyway, and being able to rely on this
will make it easier to create stable spatial node IDs that persist
across display lists.

Differential Revision: https://phabricator.services.mozilla.com/D100076
2020-12-18 16:02:55 +00:00
Nicolas Silva ce5d99afc7 Bug 1679751 - Fix cargo test build. r=jnicol. CLOSED TREE
Reviewers: jnicol

Reviewed By: jnicol

Tags: #testing-approved

Bug #: 1679751

Differential Revision: https://phabricator.services.mozilla.com/D100126
2020-12-18 18:29:25 +02:00
Nicolas Silva 316d3394f3 Bug 1624264 - Use different texture cache sizes for popup windows. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D99771
2020-12-18 09:27:19 +00:00
Nicolas Silva 5c4880b319 Bug 1679751 - Use the shelf allocator for alpha8_linear and color8_nearest textures. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D99235
2020-12-18 09:26:44 +00:00
Nicolas Silva 3f1f2756c3 Bug 1679751 - Use a shelf packing allocator for the image atlas. r=gw.
Differential Revision: https://phabricator.services.mozilla.com/D98658
2020-12-18 09:26:36 +00:00
Bogdan Tara c8ed9c4a8c Backed out 3 changesets (bug 1682365) for wrench/reftests failures CLOSED TREE
DONTBUILD
Backed out changeset 66205d10a66a (bug 1682365)
Backed out changeset 3187b453d85a (bug 1682365)
Backed out changeset 54c5a7cbdd7b (bug 1682365)
2020-12-18 05:03:54 +02:00
Glenn Watson 218da8522f Bug 1682365 - Pt 5 - Refactor RenderTaskLocation r=jnicol
Once the new graph API is in place, it becomes possible to express
an input dependency on a persistent target (for example, if wanting
to read back from a picture cache tile for a mix-blend, or marking
that a color target depends on a render task in a texture cache).

To make that simpler to express, this patch adds a specific struct
for render target locations that are persistent, and updates the
surrounding code to use it. At the same time, introduce an Unallocated
field for dynamic tasks that are not yet allocated, rather than
using an Option.

Differential Revision: https://phabricator.services.mozilla.com/D99305
2020-12-17 22:26:29 +00:00
Glenn Watson ea55314445 Bug 1682365 - Pt 4 - Add RenderTaskGraphBuilder / RenderTaskGraph split r=jnicol
This patch splits the graph building functionality into
`RenderTaskGraphBuilder` and the graph querying code into
the existing `RenderTaskGraph` struct.

The Builder struct is retained frame to frame, which means
there is no longer a need for the `RenderTaskGraphCounters`
struct. The Graph struct is constructed per-frame by calling
`end_pass` on the Builder.

Although this doesn't do much different internally, it will
make integration with the new task graph changes simpler. It
also enforced during frame building when it is possible
to add / query render tasks.

A few unrelated tidy ups are included in this patch - mostly
removing where the task graph is passed to from a few structs
and methods that no longer require access to the graph.

Differential Revision: https://phabricator.services.mozilla.com/D99297
2020-12-17 22:26:22 +00:00
Glenn Watson cee05879d4 Bug 1682365 - Pt 3 - Remove array textures from picture cache tiles. r=nical,jnicol
This patch makes picture cache tiles use normal textures instead
of array textures. With this and the previous patch, WR no longer
uses array textures at all (except when provided by the external
image handler trait).

Differential Revision: https://phabricator.services.mozilla.com/D99013
2020-12-17 22:26:19 +00:00
Glenn Watson 56e53f3baf Bug 1682365 - Pt 2 - Remove texture array usage from render task graph. r=nical
With this change, all color/alpha intermediate surfaces are individual
textures, rather than texture arrays.

This can in theory cause more batch breaks in some cases, but this
is likely to be very rare in practice.

Benefits:
 - No more allocating the array at the size of the largest task / slice.
 - Remove a source of many driver bugs on android devices.
 - Simplify integration of future patches with render task graph.

Much of the render target array texture code is still present, since
picture cache tiles in the Draw compositor still make use of texture
arrays. However, once these are switched to normal textures, we can
remove most of the slice layer, blit workaround functionality etc.

Remove the default feature setting for selecting the image sampler
kind. Instead, this must be explicitly specified by the shader or
a dynamic feature define, which makes sampler selection less error prone.

Differential Revision: https://phabricator.services.mozilla.com/D99006
2020-12-17 22:26:10 +00:00
Glenn Watson 49e7b2240b Bug 1682365 - Pt 1 - Remove PrevPassAlpha and PrevPassColor r=nical
Remove usage of the implicit prev pass alpha and color texture
samplers from batching / renderer / shader code. They are replaced
by explicit references to the texture ID for the source task.

Differential Revision: https://phabricator.services.mozilla.com/D98872
2020-12-17 22:26:08 +00:00
Bogdan Tara ac1c8e039b Backed out 5 changesets (bug 1682473, bug 1682498, bug 1682465, bug 1682365) for multi-mix-blend-mode.yaml failures CLOSED TREE
Backed out changeset 0146d623031f (bug 1682498)
Backed out changeset 22981934b3e7 (bug 1682473)
Backed out changeset 46cf4dd9cbb6 (bug 1682465)
Backed out changeset 86db847cfe57 (bug 1682365)
Backed out changeset c3495de132cd (bug 1682365)
2020-12-18 00:01:49 +02:00
Glenn Watson 9cec1624e2 Bug 1682365 - Pt 2 - Remove texture array usage from render task graph. r=nical
With this change, all color/alpha intermediate surfaces are individual
textures, rather than texture arrays.

This can in theory cause more batch breaks in some cases, but this
is likely to be very rare in practice.

Benefits:
 - No more allocating the array at the size of the largest task / slice.
 - Remove a source of many driver bugs on android devices.
 - Simplify integration of future patches with render task graph.

Much of the render target array texture code is still present, since
picture cache tiles in the Draw compositor still make use of texture
arrays. However, once these are switched to normal textures, we can
remove most of the slice layer, blit workaround functionality etc.

Remove the default feature setting for selecting the image sampler
kind. Instead, this must be explicitly specified by the shader or
a dynamic feature define, which makes sampler selection less error prone.

Differential Revision: https://phabricator.services.mozilla.com/D99006
2020-12-17 19:54:02 +00:00
Glenn Watson 378c9b37c4 Bug 1682365 - Pt 1 - Remove PrevPassAlpha and PrevPassColor r=nical
Remove usage of the implicit prev pass alpha and color texture
samplers from batching / renderer / shader code. They are replaced
by explicit references to the texture ID for the source task.

Differential Revision: https://phabricator.services.mozilla.com/D98872
2020-12-17 19:53:54 +00:00
Mike Hommey 84ee1a3dd8 Bug 1682566 - Work around rust miscompilation in webrender on arm64 mac with bug 1682365. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D99986
2020-12-17 10:04:18 +00:00
Nicolas Silva 592d7e6956 Bug 1679751 - Remove glyph-specific slab sizes. r=gw
It is dead code now that glyphs use a shelf allocator.

Differential Revision: https://phabricator.services.mozilla.com/D98656
2020-12-16 14:56:06 +00:00
Nicolas Silva 8eb6f0325e Bug 1679751 - Use a shelf packing allocator for the glyph atlas. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D98655
2020-12-16 14:55:43 +00:00
Nicolas Silva 55628d34c1 Bug 1679751 - Move more atlas allocation logic out of texture_cache.rs. r=gw
This commit moves the code that deals with allocating into a dynamic amount of textures (TextureUnits) out of texture_cache.rs, rename it into AllocatorList and make it generic.

The code also changes some of the profile counters to count pixels and number of textures instead of number of regions and size in bytes.

I had to introduce two traits which is a bit cumbersome but not so bad. AtlasAllocator is needed to implement AllocatorList with multiple allocators and AtlasAllocatorList is a dyn trait to let the texture cache can select between allocator lists of different type signatures.

Differential Revision: https://phabricator.services.mozilla.com/D98371
2020-12-16 09:25:55 +00:00
Ryan VanderMeulen 8654e3e18f Backed out 2 changesets (bug 1682365) for causing bug 1682566.
Backed out changeset 5589923a52c8 (bug 1682365)
Backed out changeset 0c03e3ad5e56 (bug 1682365)
2020-12-15 19:42:08 -05:00
Andrew Osmond 00670ed214 Bug 1682367 - Add crash report annotation for which WebRender shader is being compiled. r=jrmuizel,chutten
This patch adds infrastructure for crash reporter annotations to
WebRender. This is used to expose the new annotation,
GraphicsCompileShader, to indicate which shader we are in the process of
compiling. We often see crash reports when compiling shaders, and it
would be useful to know which one it is compiling.

This also adds another annotation, IsWebRenderResourcePathOverridden,
which is useful to know if someone overrode the shader resource path for
testing purposes. We can likely ignore any crash reports that have this
annotation set.

Differential Revision: https://phabricator.services.mozilla.com/D99736
2020-12-15 16:24:04 +00:00
Jeff Muizelaar 109e9c3b20 Bug 1679578. Memory report RenderTextureHosts in mRenderTextures. r=mattwoodrow
There might be some overlap with memory counted elsewhere and some of
the size calculations could be wrong but it should give us an overall
picture.

Differential Revision: https://phabricator.services.mozilla.com/D99562
2020-12-15 15:37:11 +00:00
Glenn Watson ac7ea425db Bug 1682365 - Pt 2 - Remove texture array usage from render task graph. r=nical
With this change, all color/alpha intermediate surfaces are individual
textures, rather than texture arrays.

This can in theory cause more batch breaks in some cases, but this
is likely to be very rare in practice.

Benefits:
 - No more allocating the array at the size of the largest task / slice.
 - Remove a source of many driver bugs on android devices.
 - Simplify integration of future patches with render task graph.

Much of the render target array texture code is still present, since
picture cache tiles in the Draw compositor still make use of texture
arrays. However, once these are switched to normal textures, we can
remove most of the slice layer, blit workaround functionality etc.

Remove the default feature setting for selecting the image sampler
kind. Instead, this must be explicitly specified by the shader or
a dynamic feature define, which makes sampler selection less error prone.

Differential Revision: https://phabricator.services.mozilla.com/D99006
2020-12-15 00:43:28 +00:00
Brindusan Cristian 33455e97a9 Backed out changeset 15da94c6a7b1 (bug 1682365) for wrench bustage at shadow-transforms.yaml. CLOSED TREE 2020-12-15 02:13:25 +02:00
Glenn Watson d38a041500 Bug 1682365 - Pt 2 - Remove texture array usage from render task graph. r=nical
With this change, all color/alpha intermediate surfaces are individual
textures, rather than texture arrays.

This can in theory cause more batch breaks in some cases, but this
is likely to be very rare in practice.

Benefits:
 - No more allocating the array at the size of the largest task / slice.
 - Remove a source of many driver bugs on android devices.
 - Simplify integration of future patches with render task graph.

Much of the render target array texture code is still present, since
picture cache tiles in the Draw compositor still make use of texture
arrays. However, once these are switched to normal textures, we can
remove most of the slice layer, blit workaround functionality etc.

Remove the default feature setting for selecting the image sampler
kind. Instead, this must be explicitly specified by the shader or
a dynamic feature define, which makes sampler selection less error prone.

Differential Revision: https://phabricator.services.mozilla.com/D99006
2020-12-14 21:48:41 +00:00
Glenn Watson 8c2aad3112 Bug 1682365 - Pt 1 - Remove PrevPassAlpha and PrevPassColor r=nical
Remove usage of the implicit prev pass alpha and color texture
samplers from batching / renderer / shader code. They are replaced
by explicit references to the texture ID for the source task.

Differential Revision: https://phabricator.services.mozilla.com/D98872
2020-12-14 19:38:48 +00:00
Andrew Osmond 61b2c2aedb Bug 1682146 - Fix how ClearCache bits in WebRender were all the same. r=jrmuizel
This should not have a functional change because today nothing uses the
individual flags and instead always uses ClearCache::all().

Differential Revision: https://phabricator.services.mozilla.com/D99598
2020-12-13 14:35:14 +00:00
Lee Salzman 6de14c3441 Bug 1681747 - add SWGL fast-path for composite shader. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D99550
2020-12-11 21:15:22 +00:00
Nicolas Silva c2a9432e61 Bug 1680769 - Fix incorrect returned size in some cases. r=jnicol
When deallocating the last item of the region the region's size is changed in free and we end up returning the wrong value.
The faulty code is actually removed in a later patch from this series but I'd like to fix the regressing now and land the patch that removes the bad code during the next train.

Differential Revision: https://phabricator.services.mozilla.com/D99458
2020-12-11 14:58:54 +00:00
Lee Salzman 5fa44f2fa1 Bug 1680420 - cache CTFontSymbolicTraits in WR CT fonts. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D99396
2020-12-11 01:37:16 +00:00
Jeff Muizelaar 7d3dc07779 Bug 1681862 - Fix up the units for memory counters. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D99407
2020-12-11 01:18:15 +00:00
Matt Woodrow 2b305d3d49 Bug 1679482 - Don't compute external surface dependencies when not using the Draw compositor. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D98272
2020-12-09 22:04:10 +00:00
Matt Woodrow 34c031c1d1 Bug 1679482 - Refactor work for computing external surface dependencies into helper. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D98271
2020-12-09 21:35:35 +00:00
Matt Woodrow dfb187f6e6 Bug 1678954 - The dirty and valid rects of a CompositeTile for an external surface should be the pre-transform rectangles. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D97941
2020-12-09 20:07:12 +00:00
Markus Stange 84b150a119 Bug 1677929 - Stop passing aEpochsBeingRendered to WebRender's APZ sampling callback, because it's now unused. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D99144
2020-12-09 03:38:31 +00:00
Markus Stange 7b0ccf01a3 Bug 1677929 - Add a way to specify an ID for a generated frame, and propagate the ID to the APZSampler. r=gw,kats
This ID allows the compositor to track per-frame information from frame
generation, through APZ sampling, to the NotifyDidRender notification.

Differential Revision: https://phabricator.services.mozilla.com/D97535
2020-12-09 03:35:50 +00:00
Glenn Watson 1437b21b58 Bug 1676559 - Pt 9 - Make clip mask sampler depend on explicit cache texture. r=nical
This is a follow up to the addition of a clip mask texture sampler.

With this patch, that sampler is no longer bound to the PrevPassAlpha
input, but is explicitly bound to any arbitrary texture that the
input render task was drawn into. This is a step towards enabling
the full render task graph.

There's a bit of complexity here in that it's now possible for individual
segments to break a batch, if they have clip masks that ended up on a
different texture. This should be an extremely rare case. However, it
does currently result in (even more) code duplication in some of the
batching code - which can be refactored once the render task graph
changes are in place.

Differential Revision: https://phabricator.services.mozilla.com/D98711
2020-12-08 20:44:51 +00:00
Glenn Watson b059d7c6ba Bug 1676559 - Pt 8 - Move render target pool from renderer to frame building. r=nical,jnicol
This is an incremental but important step to implementing render
tasks as a proper graph.

By moving the render target management to the frame building step,
we know the texture_id of all sub-passes before the batching is
done for any passes that use these as inputs. This means that
we can directly reference the texture_id during batch, rather
that the old `RenderTaskCache` and `PrevPassAlpha` / `PrevPassColor`
enum fields (although removal of all these will be done in the
next patch).

Another advantage of this is that we have much better knowledge
of which targets are required for rendering a given frame, so
these can be allocated up front at the start of a frame. This
may be a better allocation pattern for some drivers. We also
have better knowledge available on when a texture can be
invalidated, and the render target pool management is simpler since
it is the same as the way other texture cache textures are handled.

Differential Revision: https://phabricator.services.mozilla.com/D98547
2020-12-08 20:44:48 +00:00
Ryan VanderMeulen 89d37ef7fd Backed out 3 changesets (bug 1676559) for causing bug 1681244.
Backed out changeset 451f658fce05 (bug 1676559)
Backed out changeset 1297d9265f72 (bug 1676559)
Backed out changeset 95c9143cca21 (bug 1676559)
2020-12-08 09:23:36 -05:00
Glenn Watson 398319830d Bug 1676559 - Pt 10 - Remove PrevPassAlpha and PrevPassColor r=nical
Remove usage of the implicit prev pass alpha and color texture
samplers from batching / renderer / shader code. They are replaced
by explicit references to the texture ID for the source task.

Differential Revision: https://phabricator.services.mozilla.com/D98872
2020-12-07 19:31:27 +00:00
Nicolas Silva cf943de157 Bug 1680769 - Fix the texture cache allocating rectangles multiple times (again). r=jnicol
Differential Revision: https://phabricator.services.mozilla.com/D98941
2020-12-07 17:32:43 +00:00
Xidorn Quan 8799a09b16 Bug 1661961 - Upgrade cstr to 0.2.x. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D98839
2020-12-07 08:01:04 +00:00
Glenn Watson 62b526e960 Bug 1676559 - Pt 9 - Make clip mask sampler depend on explicit cache texture. r=nical
This is a follow up to the addition of a clip mask texture sampler.

With this patch, that sampler is no longer bound to the PrevPassAlpha
input, but is explicitly bound to any arbitrary texture that the
input render task was drawn into. This is a step towards enabling
the full render task graph.

There's a bit of complexity here in that it's now possible for individual
segments to break a batch, if they have clip masks that ended up on a
different texture. This should be an extremely rare case. However, it
does currently result in (even more) code duplication in some of the
batching code - which can be refactored once the render task graph
changes are in place.

Differential Revision: https://phabricator.services.mozilla.com/D98711
2020-12-06 20:59:55 +00:00
Glenn Watson 01cde5084e Bug 1676559 - Pt 8 - Move render target pool from renderer to frame building. r=nical,jnicol
This is an incremental but important step to implementing render
tasks as a proper graph.

By moving the render target management to the frame building step,
we know the texture_id of all sub-passes before the batching is
done for any passes that use these as inputs. This means that
we can directly reference the texture_id during batch, rather
that the old `RenderTaskCache` and `PrevPassAlpha` / `PrevPassColor`
enum fields (although removal of all these will be done in the
next patch).

Another advantage of this is that we have much better knowledge
of which targets are required for rendering a given frame, so
these can be allocated up front at the start of a frame. This
may be a better allocation pattern for some drivers. We also
have better knowledge available on when a texture can be
invalidated, and the render target pool management is simpler since
it is the same as the way other texture cache textures are handled.

Differential Revision: https://phabricator.services.mozilla.com/D98547
2020-12-06 20:59:42 +00:00
Bogdan Tara 03f407d43e Backed out 2 changesets (bug 1679482) for assertion failure at NativeLayerCA CLOSED TREE
Backed out changeset 41fc102c92a3 (bug 1679482)
Backed out changeset f926a9326dd2 (bug 1679482)
2020-12-03 03:46:26 +02:00
Matt Woodrow 8e7853b5d8 Bug 1679482 - Don't compute external surface dependencies when not using the Draw compositor. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D98272
2020-12-02 23:51:34 +00:00
Matt Woodrow 5f271e5e7a Bug 1679482 - Refactor work for computing external surface dependencies into helper. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D98271
2020-12-02 23:51:21 +00:00
Jeff Muizelaar 348522399d Bug 1680118 - Update to mozangle 0.3.2. r=kvark
Differential Revision: https://phabricator.services.mozilla.com/D98379
2020-12-02 01:46:58 +00:00
Glenn Watson 2ce239352c Bug 1679939 - Remove experimental PLS functionality. r=jnicol,nical
The pixel-local-storage functionality was an experiment for faster
drawing of clip masks on low end tiled GPUs. However, it's never
reached a point where it was shippable and showing clear performance
wins.

This patch removes the experimental PLS support - we can always
revive it from git history if we ever want to consider it again.

Differential Revision: https://phabricator.services.mozilla.com/D98290
2020-12-01 19:28:19 +00:00
Nicolas Silva ff3d6efd1a Bug 1679751 - Use an alloc ID instead of origin + region index. r=gw
Another step towards abstracting out slab allocation from the rest of the texture cache and allowing multiple algorithms. All dynamic atlas allocation algorithms will use an AllocId encoded into 32 bits.

Differential Revision: https://phabricator.services.mozilla.com/D98209
2020-12-01 09:40:17 +00:00
Nicolas Silva dc6da43fe3 Bug 1679751 - Rename TextureUnit into SlabAllocator. r=gw
And move texture_id into a TextureUnit structure in the texture_cache.rs that contains the allocator and the id. No behavior changes in this patch.

Depends on D98202

Differential Revision: https://phabricator.services.mozilla.com/D98203
2020-12-01 09:40:22 +00:00
Nicolas Silva e85e12f751 Bug 1679751 - Move the slab allocator code out of texture_cache.rs. r=gw
A bit of cleanup and a step towards having more allocation algorithms in the texture cache. This patch mostly moves code around, and should not change the behavior of the code.

Depends on D98201

Differential Revision: https://phabricator.services.mozilla.com/D98202
2020-12-01 09:40:24 +00:00
Nicolas Silva f7e4be63d5 Bug 1679751 - Rename ArrayAllocationTracker into GuillotineAllocator. r=gw
I'm about to add a couple of new atlas allocation algorithms. This patch renames one of the existing one into something less generic before it gets confusing.

Also fix outdated comments about merging and dynamic allocation which was removed a while ago.

Differential Revision: https://phabricator.services.mozilla.com/D98201
2020-12-01 09:40:58 +00:00
Markus Stange d74d995c13 Bug 1679700 - Cast int parameter in get_yuv_offset_vector to float, to work around a shader compilation bug with integer equality comparisons on macOS Intel. r=jrmuizel
We've encountered similar bugs before, e.g.
https://github.com/servo/webrender/wiki/Driver-issues#3540---mac-glsl-compiler-bug-with-integer-comparison-take-two

We don't want to change this `if` to a `switch` because glsl-opt compiles it
down to an if statement anyway, just a more complicated one (which was triggering
other bugs on other platforms, see bug 1678924).

Differential Revision: https://phabricator.services.mozilla.com/D98208
2020-11-30 19:54:41 +00:00
Glenn Watson ac75b50d8b Bug 1676559 - Pt 7 - Remove PrevPassAlpha use for clip masks. r=nical
Use a specific texture sampler for clip masks. Although this is
always currently set to the PrevPassAlpha texture source, it does
all the plumbing to allow a follow up commit that explcitly
provides a texture id for clip masks per-primitive.

Differential Revision: https://phabricator.services.mozilla.com/D98128
2020-11-30 19:52:20 +00:00
Glenn Watson b102bd4897 Bug 1676559 - Pt 6 - Reduce size of TextureSource / BatchTextures. r=nical
These structs are created and copied around many times during
batching. As PrevPassColor and PrevPassAlpha are removed, the
BatchTextures struct will contain extra fields (such as the clip
mask binding), so it's important to reduce the size of them to
avoid regressiing batching time. This patch reduces the size of
`BatchTextures` from 72 bytes to 24 bytes.

Differential Revision: https://phabricator.services.mozilla.com/D98122
2020-11-30 12:54:03 +00:00
Dorel Luca 5d369b6046 Backed out changeset fdf86dfacb7c (bug 1679700) for Build bustages. CLOSED TREE 2020-11-30 21:44:53 +02:00
Markus Stange 8df14d611b Bug 1679700 - Cast int parameter in get_yuv_offset_vector to float, to work around a shader compilation bug with integer equality comparisons on macOS Intel. r=jrmuizel
We've encountered similar bugs before, e.g.
https://github.com/servo/webrender/wiki/Driver-issues#3540---mac-glsl-compiler-bug-with-integer-comparison-take-two

We don't want to change this `if` to a `switch` because glsl-opt compiles it
down to an if statement anyway, just a more complicated one (which was triggering
other bugs on other platforms, see bug 1678924).

Differential Revision: https://phabricator.services.mozilla.com/D98208
2020-11-30 18:30:07 +00:00
Jamie Nicol 049a4f50c1 Bug 1676390 - Call UploadPBOPool::end_frame() once per frame and at the end of the frame. r=kvark
UploadPBOPool::end_frame() creates a GLsync object for synchronizing
PBO access, which internaly may require flushing the command
stream. Previously this was being called mid-frame, and potentially
multiple times per frame. This overhead caused talos regressions in
cases with very small amounts of texture upload per frame. To fix
this, call UploadPBO::end_frame() only once at the end of the frame.

Differential Revision: https://phabricator.services.mozilla.com/D98003
2020-11-30 16:36:58 +00:00
Jamie Nicol bd85531561 Bug 1676909 - Don't evict items from the texture cache if they were used in the previous frame. r=gw
Webrender uses an LRUCache to hold the items in the texture
cache. When texture usage is over a certain threshold we evict the
least recently used items until we are back under the
threshold. However, this runs in to a problem on pages where the cache
only contains items still in use, but is still over the threshold, as
even the least recently used item is still required. In this scenario
we end up evicting items at the start of the frame, only to reupload
them later in the frame, and repeat the cycle again on the next frame.

To avoid this, tweak the eviction algortithm so that it never evicts
items that were in use in the previous frame. (The eviction step
occurs before we know which items are needed for the current frame, so
using the previous frame is the best approximation.)

Differential Revision: https://phabricator.services.mozilla.com/D98043
2020-11-30 13:42:53 +00:00
Glenn Watson b42e24881d Bug 1676559 - Pt 5 - Refactor `RenderTask` to move creation logic to RenderTaskKind r=nical
With follow up patches, we want to retain the existing logic and
structures in RenderTaskKind, but be able to port and use them in
a new render task graph structure. This is simpler if we move as
much logic out of `RenderTask` as possible.

- Move simple RenderTask create methods into RenderTaskKind
  (complex ones will be done as a separate follow up)
- Move `write_task_data` and `write_gpu_blocks` into RenderTaskKind
- Move some static helper methods (e.g. to `BlurTask`)

Differential Revision: https://phabricator.services.mozilla.com/D97527
2020-11-29 19:34:11 +00:00
Nicolas Silva 1fa5ce325f Bug 1677696 - Use texture array shader variant for clear tiles. r=jnicol
The dummy texture is a texture array. The bug was caused by selecting the non-array version of the shader while binding a texture array.

Differential Revision: https://phabricator.services.mozilla.com/D97991
2020-11-27 15:53:06 +00:00
Jeff Muizelaar 77dfbe7938 Bug 1678924. Lower switch to if-else chain. r=mattwoodrow,jnicol
It looks we hit the same gen6 compiler bug as we did in bug
1663344.

Differential Revision: https://phabricator.services.mozilla.com/D98027
2020-11-26 20:52:39 +00:00
Ryan VanderMeulen bdc73b45bb Backed out changeset e9ac2e3b9176 (bug 1675136) for causing bug 1677691. 2020-11-20 09:49:26 -05:00
Nicolas Silva f1b2faadf6 Bug 1677771 - Fix the texture cache allocating rectangles multiple times. r=jnicol
Differential Revision: https://phabricator.services.mozilla.com/D97574
2020-11-20 12:34:27 +00:00
Jamie Nicol 2bdda4c2d6 Bug 1677757 - Use GL_NEAREST filter when copying texture data with glBlitFramebuffer. r=kvark
Using GL_LINEAR was causing incorrect filtering to occur when copying
the RGBAF32 GPU cache texture on Mali, causing rendering
errors. Switching to GL_NEAREST fixes it.

This is the same bug as bug 1669960, which was believed at the time to
only affect Mali-Gxx. On further testing the bug affects Mali-Txxx
too. Bug 1669960 was worked around at the time by using
glCopyImageSubData instead of glBlitFramebuffer. However, we want to
avoid using glCopyImageSubData on Mali: on Mali-T due to performance
reasons, and on Mali-G due to indefinite hangs. Fixing this filtering
bug allows us to switch both sets of devices to always use
glBlitFramebuffer.

Differential Revision: https://phabricator.services.mozilla.com/D97558
2020-11-19 17:44:10 +00:00
Lee Salzman f6c80461bd Bug 1677872 - reduce division usage in brush shaders. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D97379
2020-11-18 19:08:37 +00:00
Cristina Coroiu b468838f9a Backed out changeset fc06dd6899fc (bug 1677872) for Wr failures at css/css-images/tiled-gradients.html on a CLOSED TREE 2020-11-18 19:07:55 +02:00
Lee Salzman e94ea21e9b Bug 1677872 - reduce division usage in brush shaders. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D97379
2020-11-18 14:39:20 +00:00
Butkovits Atila f16164a1b5 Backed out changeset 029ac94eb369 (bug 1677872) for failure at tiled-gradients.html. CLOSED TREE 2020-11-18 09:59:01 +02:00
Lee Salzman bca1de14ee Bug 1677872 - reduce division usage in brush shaders. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D97379
2020-11-18 04:35:22 +00:00
Lee Salzman 8beb9d08b3 Bug 1675990 - implement SWGL fast-path for WR brush_yuv_image shader. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D97246
2020-11-17 22:12:57 +00:00
Glenn Watson c83a32da91 Bug 1676559 - Pt 4 - Remove RenderPassKind r=nical
The main framebuffer pass is now always a simplified step of
constructing the CompositeState structure, rather than any
complex alpha batching (since a recent change that meant
picture caching is always enabled).

This patch doesn't contain any functional changes. It removes
the main framebuffer render pass kind, simplifying how passes
are built and rendered. A follow up patch will further simplify
this code by moving the CompositeState creation out of the
regular batching code.

Differential Revision: https://phabricator.services.mozilla.com/D97230
2020-11-17 09:17:34 +00:00
Glenn Watson 3170eddbd0 Bug 1675414 - Fix incorrect skipping of composites in some cases. r=nical
In the following circumstances, WR was failing to detect a
composite was required:
 - There is a picture cache slice that is smaller than a single tile.
 - The position of that picture cache slice is changed.
 - No other content invalidations occur.

This clip rect in the composite descriptor must include the
device_valid_rect rather than the tile device_rect. This ensures
that in the case of a picture cache slice that is smaller than a
single tile, the clip rect in the composite descriptor will change
if the position of that slice is changed. Otherwise, WR may conclude
that no composite is needed if the tile itself was not invalidated
due to changing content.

Differential Revision: https://phabricator.services.mozilla.com/D96966
2020-11-17 19:24:16 +00:00
Mihai Alexandru Michis 45708e0ef1 Merge mozilla-central to autoland a=merge
CLOSED TREE
2020-11-17 16:43:37 +02:00
Mihai Alexandru Michis 1b0d5a3a70 Backed out changeset dbcc7614b8f0 (bug 1640960) for causing rendering issues on Linux (Bug 1677728) a=backout 2020-11-17 16:40:05 +02:00
Dzmitry Malyshau 8ffa84e50d Bug 1640960 - Support storage buffers with non-instanced rendering r=gw
This change adds a code path to avoid instancing, enabled (if supported) on non-Intel GPUs.

Side note: we still need a plan on what to do on devices that support neither of base-instance or SSBO.

Differential Revision: https://phabricator.services.mozilla.com/D87826
2020-11-17 00:10:14 +00:00
Csoregi Natalia 8cdde07a53 Backed out changeset 8d61a17c6f6e (bug 1640960) for wrench failures on shadow-transforms.yaml. CLOSED TREE 2020-11-17 01:56:30 +02:00
Nicolas Silva 6a1353fabe Bug 1674443 - Introduce custom slab sizes for glyphs. r=jnicol,gw
This is a modest win on hidpi and a larger win on lowdpi. We can improve further by introducing more granularity between 16 and 32px, this puts in place the basic infrastructure on top of which we can experiment.

Differential Revision: https://phabricator.services.mozilla.com/D95870
2020-11-13 15:16:04 +00:00
Dzmitry Malyshau 414eebcd57 Bug 1640960 - Support storage buffers with non-instanced rendering r=gw
This change adds a code path to avoid instancing, enabled (if supported) on non-Intel GPUs.

Side note: we still need a plan on what to do on devices that support neither of base-instance or SSBO.

Differential Revision: https://phabricator.services.mozilla.com/D87826
2020-11-16 21:58:25 +00:00
Glenn Watson 23f5e8a6f2 Bug 1676559 - Pt 3 - Tidy up some interfaces. r=nical
A couple of minor changes:
 - Don't pass render task graph to resource cache (it's not used).
 - Support an `initial_size` for the texture allocator on creation.

This is a convenience for when the allocation tracker is being used
to track a single surface rather than an array.

Differential Revision: https://phabricator.services.mozilla.com/D96956
2020-11-15 20:22:30 +00:00
Glenn Watson 17aef82927 Bug 1676559 - Pt 2 - Remove ClearMode enum from render tasks. r=nical
It's only used by a small subset of render tasks, it makes more
sense to specialize it for those tasks. This is part of reducing
the fields in RenderTask so it's easier to port to the graph
changes being worked on.

Differential Revision: https://phabricator.services.mozilla.com/D96925
2020-11-15 20:07:51 +00:00
Dorel Luca 6c07eaff3d Backed out 2 changesets (bug 1676559) for WR failures
Backed out changeset dac282083922 (bug 1676559)
Backed out changeset 2d0cf7ff0a20 (bug 1676559)
2020-11-15 22:03:51 +02:00
Glenn Watson 1f66842d2e Bug 1676559 - Pt 3 - Tidy up some interfaces. r=nical
A couple of minor changes:
 - Don't pass render task graph to resource cache (it's not used).
 - Support an `initial_size` for the texture allocator on creation.

This is a convenience for when the allocation tracker is being used
to track a single surface rather than an array.

Differential Revision: https://phabricator.services.mozilla.com/D96956
2020-11-15 19:30:23 +00:00
Glenn Watson 8ab62ca86c Bug 1676559 - Pt 2 - Remove ClearMode enum from render tasks. r=nical
It's only used by a small subset of render tasks, it makes more
sense to specialize it for those tasks. This is part of reducing
the fields in RenderTask so it's easier to port to the graph
changes being worked on.

Differential Revision: https://phabricator.services.mozilla.com/D96925
2020-11-15 19:22:02 +00:00
Nicolas Silva 6b4fae17f8 Bug 1674443 - Refactor the texture cache slab allocator. r=gw
This patch simplifies the slab allocator in various ways, most importantly separating the packing logic and texture cache glue (dealing with swizzling, cache entries, etc.). The former is moved into TextureUnits/TextureUnit and the latter is mostly contained into TextureCache.

This patch should have no functional change. The goal to make it easier to introduce custom slab sizes for glyphs in a followup patch, and later use different packing algorithms.

Differential Revision: https://phabricator.services.mozilla.com/D95869
2020-11-13 15:22:12 +00:00
Nicolas Silva 31793c037c Bug 1674443 - Lay regions out in a grid in the texture cache SVG dump. r=jnicol
Also tweak the visualization in various ways so that having a large amount of regions (glyphs) doesn't bring down simple SVG viewing software.

Differential Revision: https://phabricator.services.mozilla.com/D95758
2020-11-13 15:20:57 +00:00
Nicolas Silva 50265bb6c6 Bug 1674443 - Use 128x128 regions in the glyph atlas. r=jnicol
Since glyphs are rarely larger than 128x128, we can reduce the amount of wasted space from partially used glyph regions by having smaller ones (and more of them).

Differential Revision: https://phabricator.services.mozilla.com/D95757
2020-11-13 15:15:43 +00:00