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

2175 Коммитов

Автор SHA1 Сообщение Дата
Nicolas Silva 1f87bb2116 Bug 1696905 - Store composite tiles in a single array. r=gfx-reviewers,bradwerth
It used to be more convenient to store them in separate arrays but with the new occlusion culling code we don't benefit from it and have to undo it to traverse tiles from front to back.
This is a cleanup patch that should not change the behavior of the code.

Differential Revision: https://phabricator.services.mozilla.com/D113989
2021-05-04 12:54:52 +00:00
Nicolas Silva 67286e28c2 Bug 1696905 - CPU-side occlusion culling for picture cache tiles. r=gfx-reviewers,lsalzman,gw
This patch introduces a simple culling algorithm that splits compositor tiles into only their visible parts, removing the need for a depth buffer. This reduces the draw-call count as well well as the memory usage and bandwidth associated with the depth buffer.

Differential Revision: https://phabricator.services.mozilla.com/D113532
2021-05-04 12:54:52 +00:00
Glenn Watson 759e747d77 Bug 1708337 - Fix rounded clips on root iframe tile caches. r=gfx-reviewers,lsalzman
If an iframe has complex clips, we need to skip including them
in the iframe specific clip applied to the tile cache, as that
path only supports rectangle clips.

Differential Revision: https://phabricator.services.mozilla.com/D114190
2021-05-04 03:37:38 +00:00
Glenn Watson 6bfb59cac9 Bug 1708444 - Don't create compositor surfaces inside blend containers. r=gfx-reviewers,bradwerth
If we optimize a root level blend container to be a tile cache, we
need to ensure we don't promote compositor surfaces within this slice
as it can result in incorrect blending.

Differential Revision: https://phabricator.services.mozilla.com/D114176
2021-05-04 00:02:45 +00:00
Jeff Muizelaar 3e6d79347c Bug 1708937. Work around a gen6 shader compiler bug. r=gw
This was found through experimentation. Hopefully,
we'll get a better understanding of what's going on in the future.

Differential Revision: https://phabricator.services.mozilla.com/D114166
2021-05-03 21:35:49 +00:00
Nicolas Silva ab62b81a1f Bug 1707930 - Account for reversed stops in the gradient cache key. r=gfx-reviewers,lsalzman
WebRender internally reverses gradient stops when they are ordered from right to left. This is done while building the GPU data and the gradient cache key stored the reversed stops without sepcifying if they were revered or originally in that order. This meant that if a page had two similar gradients with the only difference being that on was reversed but not the other, they could end up using the same cache key and one of the two would not be rendered properly.

This patch includes a boolean in the cache key to make sure reversed gradients don't accidentally use the same key as similar non-reversed gradients.

Differential Revision: https://phabricator.services.mozilla.com/D113975
2021-05-03 09:12:43 +00:00
Nicolas Silva 06ef812482 Bug 1707744 - Avoid far gradient endpoints causing large gradient segments. r=gfx-reviewers,lsalzman
Large segment bounds trip an assertion when casting coordinates to integers. Clipping early also reduces the amount of cached pixels.

Differential Revision: https://phabricator.services.mozilla.com/D113819
2021-05-03 09:12:42 +00:00
Nicolas Silva 720d336a44 Bug 1706678 - Fix cached gradient scaling. r=gfx-reviewers,lsalzman
Large gradients are cached scaled down and stretched back by the image brush. Because the scaling factor is non-uniform the shader has to take it into account. The previous implementation was incorrectly accounting for the scale.

Differential Revision: https://phabricator.services.mozilla.com/D113753
2021-05-03 09:12:42 +00:00
Lee Salzman 565bba41e8 Bug 1708590 - Don't call add_surface or start_compositing unless actually rendering. r=sotaro
Rather than have SwCompositor or the individual RenderCompositors track this, it seems easier
to just have WR itself avoid calling add_surface or start_compositing if we're inside an update.

Differential Revision: https://phabricator.services.mozilla.com/D113953
2021-04-30 12:26:53 +00:00
Dorel Luca dbd079f286 Backed out changeset 8a51e4315c4f (bug 1706678) for Webrench failures. CLOSED TREE 2021-04-29 23:53:43 +03:00
Nicolas Silva 6f87c8e46e Bug 1706678 - Fix cached gradient scaling. r=gfx-reviewers,lsalzman
Large gradients are cached scaled down and stretched back by the image brush. Because the scaling factor is non-uniform the shader has to take it into account. The previous implementation was incorrectly accounting for the scale.

Differential Revision: https://phabricator.services.mozilla.com/D113753
2021-04-29 20:08:03 +00:00
Lee Salzman 9c947c8891 Bug 1707798 - Use rough clipping in cs_clip_image. r=aosmond
We were already clipping off most of the AA inside cs_clip_image previously anyway.
Given that it is too unpredictable in what situations the little bit of remaining
AA was actually applying, and that it causes visual artifacts sometimes when it
activates where it shouldn't, we're better off just using a rough clip inside this
shader for everything so that it is always predictable.

Differential Revision: https://phabricator.services.mozilla.com/D113545
2021-04-27 17:03:49 +00:00
Nicolas Silva 28cb8bdbd1 Bug 1707460 - Better handle reversed gradient stops. r=gfx-reviewers,bradwerth
The code that decompose linear gradients inserts fake gradient stops to deal with the potential constant color areas before and after the gradient endpoints. The offsets of these extra stops were computed without accounting for the transformation the loop does in the case of reversed stops. This patch fixes that.

Differential Revision: https://phabricator.services.mozilla.com/D113290
2021-04-27 07:44:26 +00:00
Nicolas Silva 4ae4ba4201 WIP: Bug 1707181 - Avoid zero-sized gradient tasks. r=gfx-reviewers,lsalzman
Add missing check for linear gradients. Also, instead of just casting to int round out the task size.

Differential Revision: https://phabricator.services.mozilla.com/D113289
2021-04-27 07:44:25 +00:00
Lee Salzman edf1e67938 Bug 1707228 - Check for no perspective dependency on Z component on axis-aligned transforms. r=aosmond
Recent changes in cs_clip_image are exposing some cases where we are letting rectangles being warped
by perspective transform get considered as axis-aligned. This makes the axis-alignment check stronger
for clipping to guard against the Z dependency in the W coordinate that is messing up clipping.

Differential Revision: https://phabricator.services.mozilla.com/D113259
2021-04-26 18:49:24 +00:00
Robert Mader 003138f3e9 Bug 1707202 - Remove surface_origin_is_top_left support from NativeSurface again, r=nical
Using native compositor integration should imply the y-flip can be
done by the system compositor - this is true for CA, DC and Wayland.
As the Wayland backend now does so, remove the
surface_origin_is_top_left support again, making sure
the Wayland backend uses the same code paths as CA/DC backends do.

Note:
 - In order to not regress bug 1680128, do not revert the override
   of `SurfaceOriginIsTopLeft()` in `RenderCompositorNative.h`
 - Explicitely set `surface_origin_is_top_left: false` in the example
   compositor. This is the default, however setting it explicitely
   would have helped me bring up the Wayland example compositor.
   This is purely a hint for potential future backends.

Differential Revision: https://phabricator.services.mozilla.com/D113217
2021-04-26 12:48:39 +00:00
Lee Salzman f6a009e6e3 Bug 1706846 - Verify that total clip transform is axis-aligned rather than just the primitive transform. r=gfx-reviewers,aosmond
It's possible that the overall clip transform isn't axis-aligned even if the primitive transform is. So we rather
need to verify that this overall transform is axis-aligned.

Differential Revision: https://phabricator.services.mozilla.com/D113188
2021-04-22 22:57:30 +00:00
Miko Mynttinen f3891ac138 Bug 1676657 - Port paint phase weight histograms to WebRender r=nical
Differential Revision: https://phabricator.services.mozilla.com/D108043
2021-04-22 13:31:42 +00:00
Nicolas Silva 9bde5de742 Bug 1702228 - Check gradient parameters. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D112969
2021-04-22 10:34:55 +00:00
Nicolas Silva 9b31d6c49b Bug 1702228 - Cache linear gradients by default. r=gw
This patch breaks linear gradients into two primitives:
 - LinearGradient is always rendered via the brush shader. It is only used with SWGL.
 - CachedLinearGradient is always rendered via a cached render task and the brush image shader. Its implementation is very similar to conic and radial gradients, with the addition of a fast-path for axis aligned gradients with two stops.

In addition the following changes are made:
 - The gradient fast path is simpler (only deals with two gradient stops).
 - Decomposing axis-aligned gradients into parts eligible for the fast path happens during scene building instead of frame building.

Differential Revision: https://phabricator.services.mozilla.com/D112018
2021-04-22 10:34:54 +00:00
Nicolas Silva a5f12f2a34 Bug 1702638 - Apply the local clip early for cached gradient primitives. r=gfx-reviewers,gw
It avoids rasterizing large cached gradients that are mostly clipped out later.

Differential Revision: https://phabricator.services.mozilla.com/D111395
2021-04-22 10:34:54 +00:00
Glenn Watson ba81b408e0 Bug 1706827 - Remove unused shaders. r=gfx-reviewers,lsalzman
The pathfinder prototype shaders are not currently used, so they
can be removed for now.

Differential Revision: https://phabricator.services.mozilla.com/D113053
2021-04-22 02:47:25 +00:00
Glenn Watson d23fc2d663 Bug 1706801 - Invalidate dirty rect state when an external compositor surface is removed r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D113041
2021-04-22 00:43:12 +00:00
Lee Salzman 96cf843676 Bug 1706537 - Silence SwCompositor tsan warning. r=aosmond
This forces current_job to null as soon as it is known whether there are no more
bands available so that current_job is always null if job_count is zero.

Differential Revision: https://phabricator.services.mozilla.com/D112891
2021-04-21 15:56:14 +00:00
Alexandru Michis 1b2962d3ec Backed out changeset ca4d87f2ec7b (bug 1676657) for causing webrender bustages.
CLOSED TREE
2021-04-21 18:41:23 +03:00
Miko Mynttinen 8249149314 Bug 1676657 - Port paint phase weight histograms to WebRender r=nical
Differential Revision: https://phabricator.services.mozilla.com/D108043
2021-04-21 15:13:42 +00:00
Glenn Watson 5daecc2aad Bug 1700235 - Apply iframe clips on tile caches instead of prims. r=gfx-reviewers,kvark
Differential Revision: https://phabricator.services.mozilla.com/D112728
2021-04-20 23:59:45 +00:00
Butkovits Atila 70de203efd Merge mozilla-central to autoland. CLOSED TREE 2021-04-20 19:03:13 +03:00
Jamie Nicol a603deeb55 Bug 1706277 - Remove blit_workaround_buffer from webrender. r=nical
This was required to workaround a driver bug on Adreno devices when
blitting to texture arrays. It is no longer required as we have
stopped using texture arrays, due to all the driver bugs.

It's currently just dead code as we stopped initializing the buffers
when we removed texture array support. This patch just removes the
dead code.

Differential Revision: https://phabricator.services.mozilla.com/D112697
2021-04-20 12:23:36 +00:00
Jamie Nicol 56f9b83c08 Bug 1705433 - Pack more varyings in vectors to work around Adreno 3xx bug. r=kvark
In bug 1630356 we found a driver bug on some Adreno 3xx devices where
flat scalar varyings in shaders incorrectly caused the output of every
fragment in the triangle to be calculated as if flat. To work around
the bug, we pack the scalar varyings in a vector. At the time we
believed it may be limited to varyings used to calculate UV
coordinates, however, we have now seen more cases of this bug (in box
shadows, gradients, and svg filters).

Unfortunately it is not yet clear what precise conditions are required
to trigger this bug, so for now we just apply the workaround to the
varyings we know are affected due to failing wrench tests on the device.

Differential Revision: https://phabricator.services.mozilla.com/D112334
2021-04-20 07:08:40 +00:00
Sebastian Hengst 389332c42a Backed out changeset 8a4eff9d5f94 (bug 1700235) for painting regressions. a=backout 2021-04-19 22:37:10 +02:00
Glenn Watson 93a6a5e91f Bug 1700235 - Apply iframe clips on tile caches instead of prims. r=nical,kvark
Differential Revision: https://phabricator.services.mozilla.com/D112142
2021-04-18 22:05:37 +00:00
Glenn Watson 26344c3634 Bug 1705569 - Prevent non-premultiplied alpha images being promoted to compositor surfaces r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D112300
2021-04-16 01:53:20 +00:00
Glenn Watson f0adb01cd3 Bug 1705270 - Fix assert when compositor surface is in a pass-through picture r=gfx-reviewers,lsalzman
We don't currently handle the case where a compositor surface is inside a
picture primitive that is a pass through (has composite mode of None),
because we only count required compositor surfaces at the top level prim
list of a tile cache.

However, the code to promote a surface was only checking if it existed on
the same physical surface, not the root picture cache.

This patch prevents compositor surfaces being promoted in this case (which
only occurs if inside a backdrop-filter container, or a 3d transform root).

Differential Revision: https://phabricator.services.mozilla.com/D112153
2021-04-15 20:08:51 +00:00
Brad Werth 8474c82f86 Bug 1675375 Part 4: Perform the polygon hit test in WebRender, and add unit tests. r=gw
This performs a winding number calculation on the polygon and matches the
result against the fill rule of the supplied polygon.

Differential Revision: https://phabricator.services.mozilla.com/D109946
2021-04-15 18:54:39 +00:00
Brad Werth 7155ccc182 Bug 1675375 Part 3: Stub in polygon clipping in WebRender. r=gw
This defines a PolygonKey and includes it in ClipItemKind::ImageMask. The
actual process of clipping is just a stub.

Differential Revision: https://phabricator.services.mozilla.com/D105548
2021-04-15 18:54:38 +00:00
Brad Werth 06dadaa7a6 Bug 1675375 Part 2: Add a polygon clips to image masks. r=gw
This patch augments the pushing of an image mask to allow a polygon clip
region to be attached to it.

Differential Revision: https://phabricator.services.mozilla.com/D105397
2021-04-15 18:54:38 +00:00
Brad Werth 4b4228f562 Bug 1675375 Part 1: Define WebRender structures for polygons. r=gw
This patch defines a SetPoints DisplayItem for providing polygon mask points
associated with a ImageMaskClipDisplayItem. It also defines a WR enum for the
polygon fill rule. The method to provide these values to WR is mere scaffolding
until later patches in this series.

Differential Revision: https://phabricator.services.mozilla.com/D105396
2021-04-15 18:54:37 +00:00
Jamie Nicol 01ae1699e6 Bug 1705349 - Avoid confusing usage of supports_texture_storage variable. r=kvark
The variable supports_texture_storage during webrender device
initialization has 2 different meanings depending on whether we are
running GL or GLES. For GL, it indeed indicates whether glTexStorage
is supported. For GLES, however, it indicates whether the extension
GL_EXT_texture_storage is supported.

In GLES 3, glTexStorage is always supported for most formats. The
relevance of whether the GL_EXT_texture_storage extension is supported
is that it means glTexStorage can be used with GL_BGRA8. (This is
because the GL_EXT_texture_format_BGRA8888 extension was written
against GLES 2 + GL_EXT_texture_storage, and has never been updated
for GLES 3.)

This is why in the GL case we must check supports_texture_storage
before allowing texture storage usage, but in the GLES case we do not
bother checking, except for when using BGRA. This is confusing.

To make this less confusing, this patch checks directly for the
extension support in the GLES + BGRA case. We do not bother checking
the value of supports_texture_storage in any non-BGRA GLES cases, as
it is always true and would only further complicate logic that is
already too complex. If this is required in the future (eg to work
around a buggy glTexStorage implementation) we can always add it then.

Differential Revision: https://phabricator.services.mozilla.com/D112172
2021-04-15 15:05:55 +00:00
Jamie Nicol 3bbb2fccca Bug 1696039 - Align texture upload stride to multiples of 128 bytes on Adreno 3xx r=kvark
On Adreno 3xx we see intermittently corrupted or missing glyphs due to
texture uploads failing. This has only started occuring since glyphs
were switched to using R8 format textures, from RGBA8.

Due to performance reasons on other Adreno devices, we currently
ensure texture data has a stride aligned to 64 pixels. So the effect
of switching texture format is that the alignment switched from 256
bytes to 64 bytes.

It appears that PBO texture uploads must be performed with an
alignment of 128 bytes on Adreno 3xx, otherwise this corruption may
occur. Additionally, the 64 pixel requirement to hit the fast path
does not seem to apply to Adreno 3xx. Therefore this patch sets the
requirement to 128 bytes on Adreno 3xx, and leaves it as 64 pixels on
other Adreno devices.

It also renames optimal_pbo_stride to required_pbo_stride, to better
reflect the fact that this is now sometimes required for correctness
reasons, not just performance.

Differential Revision: https://phabricator.services.mozilla.com/D112058
2021-04-14 19:03:01 +00:00
Jamie Nicol db97bf93e3 Bug 1704783 - Disable texture swizzling support on PowerVR Rogue devices. r=kvark
Running webrender on PowerVR Rogue devices results in some images
being rendered with swapped R and B channels. This is because we use
texture swizzling for images in the shared texture cache, and
presumably the driver has a buggy implementation. This patch disables
texture swizzling on all PowerVR Rogue devices as a precaution.

It also ensures that we always use BGRA format textures in cases where
texture swizzling is unsupported, otherwise we encounter GL errors
when attempting to upload BGRA data to RGBA format textures, as GLES
does not support format conversion during upload. Furthermore, we make
it so that using RGBA+glTexStorage+swizzling is preferred to
BGRA+glTexImage in cases where swizzling is actually supported, as we
generally want to prefer glTexStorage to glTexImage.

Lastly, in cases where neither BGRA or swizzling are supported, rather
than attempting to upload BGRA data to RGBA textures (which will
result in a GL error) we pretend the BGRA data is RGBA. This will
result in the channels being swapped when rendering, but that is
preferable to the alternative of images not being uploaded at
all. This configuration shouldn't actually exist in the wild anyway.

Differential Revision: https://phabricator.services.mozilla.com/D111840
2021-04-14 18:42:36 +00:00
Dorel Luca f41135212c Backed out 7 changesets (bug 1675375) for Mochitest failures in gfx/layers/apz/test/mochitest/test_group_hittest-2.html. CLOSED TREE
Backed out changeset 1a2cb51e0573 (bug 1675375)
Backed out changeset e1ec44a75cd0 (bug 1675375)
Backed out changeset a628a5fa5291 (bug 1675375)
Backed out changeset 5fbf7f44c382 (bug 1675375)
Backed out changeset 053073e36e53 (bug 1675375)
Backed out changeset ae13d5fc65ba (bug 1675375)
Backed out changeset 1a8ae9663eb0 (bug 1675375)
2021-04-14 21:38:20 +03:00
Glenn Watson 9557b60499 Bug 1705151 - Fix a leak of native compositor surfaces when sub-slice count changes r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D112065
2021-04-14 17:45:16 +00:00
Brad Werth 306cb2674d Bug 1675375 Part 4: Perform the polygon hit test in WebRender, and add unit tests. r=gw
This performs a winding number calculation on the polygon and matches the
result against the fill rule of the supplied polygon.

Differential Revision: https://phabricator.services.mozilla.com/D109946
2021-04-14 17:17:15 +00:00
Brad Werth ade4bd1b00 Bug 1675375 Part 3: Stub in polygon clipping in WebRender. r=gw
This defines a PolygonKey and includes it in ClipItemKind::ImageMask. The
actual process of clipping is just a stub.

Differential Revision: https://phabricator.services.mozilla.com/D105548
2021-04-14 17:17:15 +00:00
Brad Werth d2b048063e Bug 1675375 Part 2: Add a polygon clips to image masks. r=gw
This patch augments the pushing of an image mask to allow a polygon clip
region to be attached to it.

Differential Revision: https://phabricator.services.mozilla.com/D105397
2021-04-14 17:17:15 +00:00
Brad Werth a4639d5ca0 Bug 1675375 Part 1: Define WebRender structures for polygons. r=gw
This patch defines a SetPoints DisplayItem for providing polygon mask points
associated with a ImageMaskClipDisplayItem. It also defines a WR enum for the
polygon fill rule. The method to provide these values to WR is mere scaffolding
until later patches in this series.

Differential Revision: https://phabricator.services.mozilla.com/D105396
2021-04-14 17:17:14 +00:00
Glenn Watson 3b61ffb2f6 Bug 1704956 - Support non-opaque compositor surfaces. r=gfx-reviewers,lsalzman
This patch enables the sub-slice support landed in previous
patches, to allow non-opaque external images to be treated as
native compositor surfaces.

Each picture cache has one or more sub-slices, which form the
tile grid of picture cache targets. Sub-slices are added as
required based on the number of compositor surfaces that are
found during scene building.

As primitives are added to the picture cache dependencies, the
appropriate sub-slice to add the primitive to is calculated. This
depends on whether the primitive intersects any of the compositor
surface rects (and thus must be drawn after that surface). Prims
are added to the earliest sub-slice possible, to maximize the
chance that the primitive is on the primary sub-slice. This means
the prim can be rendered with subpixel AA due to an opaque background
in most cases, and also reduces the number of alpha tiles that are
allocated and must be composited.

Creating extra sub-slices and tile grids is relatively cheap - the
backing surface for a tile is only allocated once there are prims
in that tile to draw. The valid rect tracked for each tile also
ensures that a minimum rect is used during drawing and compositing.

Differential Revision: https://phabricator.services.mozilla.com/D111967
2021-04-14 10:39:38 +00:00
smolnar 786fd6128a Backed out changeset 82b5b3dfe2ba (bug 1704956) for causing android wrench bustages. CLOSED TREE 2021-04-14 13:18:47 +03:00
Glenn Watson 177be1a3be Bug 1704956 - Support non-opaque compositor surfaces. r=gfx-reviewers,lsalzman
This patch enables the sub-slice support landed in previous
patches, to allow non-opaque external images to be treated as
native compositor surfaces.

Each picture cache has one or more sub-slices, which form the
tile grid of picture cache targets. Sub-slices are added as
required based on the number of compositor surfaces that are
found during scene building.

As primitives are added to the picture cache dependencies, the
appropriate sub-slice to add the primitive to is calculated. This
depends on whether the primitive intersects any of the compositor
surface rects (and thus must be drawn after that surface). Prims
are added to the earliest sub-slice possible, to maximize the
chance that the primitive is on the primary sub-slice. This means
the prim can be rendered with subpixel AA due to an opaque background
in most cases, and also reduces the number of alpha tiles that are
allocated and must be composited.

Creating extra sub-slices and tile grids is relatively cheap - the
backing surface for a tile is only allocated once there are prims
in that tile to draw. The valid rect tracked for each tile also
ensures that a minimum rect is used during drawing and compositing.

Differential Revision: https://phabricator.services.mozilla.com/D111967
2021-04-14 09:34:50 +00:00