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

2019 Коммитов

Автор SHA1 Сообщение Дата
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