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
This patch has a few moving parts. We have to first tell WR that when it
detects the extension that it is actually allowed to use it. We have to make
the glsl-to-cxx translator eat the blend_supports_all_equations layout
qualifier. We have to enable generation of advanced-blend-equation variants
in the SWGL build setup. Then we report the actual extension inside SWGL.
Finally, we actually add all the necessary blend equation enums, hash them
down to a blend key, and implement all the blend modes therein.
Differential Revision: https://phabricator.services.mozilla.com/D103804
This patch has a few moving parts. We have to first tell WR that when it
detects the extension that it is actually allowed to use it. We have to make
the glsl-to-cxx translator eat the blend_supports_all_equations layout
qualifier. We have to enable generation of advanced-blend-equation variants
in the SWGL build setup. Then we report the actual extension inside SWGL.
Finally, we actually add all the necessary blend equation enums, hash them
down to a blend key, and implement all the blend modes therein.
Differential Revision: https://phabricator.services.mozilla.com/D103804
We can disable WebRender because the GPU process crashed, or we
encountered a graceful runtime error in WebRender. This patch adds two
new prefs to control how that fallback works.
gfx.webrender.fallback.software-d3d11 controls if WebRender falls back
to Software WebRender + D3D11 compositing. If true, and the user is
allowed to get Software WebRender, we will fallback to Software
WebRender with the D3D11 compositor first.
gfx.webrender.fallback.software controls if WebRender falls back to
Software WebRender. If true, and the user is allowed to get Software
WebRender, we will fallback to Software WebRender without the D3D11
compositor.
gfx.webrender.fallback.basic controls if WebRender or Software
WebRender falls back to Basic. If true, it falls back to Basic.
Otherwise it continues to use Software WebRender without the D3D11
compositor. Note that this means OpenGL on Android.
This patch also means that gfx.webrender.all=true and MOZ_WEBRENDER=1
no longer disables Software WebRender. It will still prefer (Hardware)
WebRender but we want to allow fallback to Software WebRender for
configurations that forced WebRender on.
Differential Revision: https://phabricator.services.mozilla.com/D103491
We can disable WebRender because the GPU process crashed, or we
encountered a graceful runtime error in WebRender. This patch adds two
new prefs to control how that fallback works.
gfx.webrender.fallback.software-d3d11 controls if WebRender falls back
to Software WebRender + D3D11 compositing. If true, and the user is
allowed to get Software WebRender, we will fallback to Software
WebRender with the D3D11 compositor first.
gfx.webrender.fallback.software controls if WebRender falls back to
Software WebRender. If true, and the user is allowed to get Software
WebRender, we will fallback to Software WebRender without the D3D11
compositor.
gfx.webrender.fallback.basic controls if WebRender or Software
WebRender falls back to Basic. If true, it falls back to Basic.
Otherwise it continues to use Software WebRender without the D3D11
compositor. Note that this means OpenGL on Android.
This patch also means that gfx.webrender.all=true and MOZ_WEBRENDER=1
no longer disables Software WebRender. It will still prefer (Hardware)
WebRender but we want to allow fallback to Software WebRender for
configurations that forced WebRender on.
Differential Revision: https://phabricator.services.mozilla.com/D103491
We can disable WebRender because the GPU process crashed, or we
encountered a graceful runtime error in WebRender. This patch adds two
new prefs to control how that fallback works.
gfx.webrender.fallback.software-d3d11 controls if WebRender falls back
to Software WebRender + D3D11 compositing. If true, and the user is
allowed to get Software WebRender, we will fallback to Software
WebRender with the D3D11 compositor first.
gfx.webrender.fallback.software controls if WebRender falls back to
Software WebRender. If true, and the user is allowed to get Software
WebRender, we will fallback to Software WebRender without the D3D11
compositor.
gfx.webrender.fallback.basic controls if WebRender or Software
WebRender falls back to Basic. If true, it falls back to Basic.
Otherwise it continues to use Software WebRender without the D3D11
compositor. Note that this means OpenGL on Android.
This patch also means that gfx.webrender.all=true and MOZ_WEBRENDER=1
no longer disables Software WebRender. It will still prefer (Hardware)
WebRender but we want to allow fallback to Software WebRender for
configurations that forced WebRender on.
Differential Revision: https://phabricator.services.mozilla.com/D103491
When ShmemTextureHost does not have valid Shmem, RenderBufferTextureHostSWGL::mBuffer is nullptr. RenderBufferTextureHost and RenderExternalTextureHost handle it as fallible.
Differential Revision: https://phabricator.services.mozilla.com/D103427
ClearBeforePaint put the responsibility of clearing the current frame's DrawTarget
onto the widget. This doesn't compose well with WR RenderCompositor that may do
their own internal clearing. Instead, replace this with a GetTransparentRegion API
that can be used by RenderCompositors to limit where they clear so that they are
now fully responsible for clearing.
Differential Revision: https://phabricator.services.mozilla.com/D103253
GL_ARB_clear_texture implements some useful GL entry-points for clears
that can clear arbitrary sub-rects of the screen without having to latch
or disturb GL state. This refactors the glClear implementation to be in
terms of the provided glClearTexSubImage extension which is far more
flexible.
This further allows us to reuse clearing primitives in RenderCompositorSWGL
without having to use more expensive DrawTarget versions.
Differential Revision: https://phabricator.services.mozilla.com/D103252
ClearBeforePaint put the responsibility of clearing the current frame's DrawTarget
onto the widget. This doesn't compose well with WR RenderCompositor that may do
their own internal clearing. Instead, replace this with a GetTransparentRegion API
that can be used by RenderCompositors to limit where they clear so that they are
now fully responsible for clearing.
Differential Revision: https://phabricator.services.mozilla.com/D103253
GL_ARB_clear_texture implements some useful GL entry-points for clears
that can clear arbitrary sub-rects of the screen without having to latch
or disturb GL state. This refactors the glClear implementation to be in
terms of the provided glClearTexSubImage extension which is far more
flexible.
This further allows us to reuse clearing primitives in RenderCompositorSWGL
without having to use more expensive DrawTarget versions.
Differential Revision: https://phabricator.services.mozilla.com/D103252
ClearBeforePaint put the responsibility of clearing the current frame's DrawTarget
onto the widget. This doesn't compose well with WR RenderCompositor that may do
their own internal clearing. Instead, replace this with a GetTransparentRegion API
that can be used by RenderCompositors to limit where they clear so that they are
now fully responsible for clearing.
Differential Revision: https://phabricator.services.mozilla.com/D103253
GL_ARB_clear_texture implements some useful GL entry-points for clears
that can clear arbitrary sub-rects of the screen without having to latch
or disturb GL state. This refactors the glClear implementation to be in
terms of the provided glClearTexSubImage extension which is far more
flexible.
This further allows us to reuse clearing primitives in RenderCompositorSWGL
without having to use more expensive DrawTarget versions.
Differential Revision: https://phabricator.services.mozilla.com/D103252
This patch enables EGL robustness with WebRender. It also tries harder
to get RBAB, favouring KHR+RBAB over EXT-RBAB, as testing with Intel and
NVIDIA Mesa drivers on Ubuntu suggests we can get KHR+RBAB but not
EXT+RBAB. It also adds support for requesting NVIDIA specific resets via
EGL_NV_robustness_video_memory_purge.
Differential Revision: https://phabricator.services.mozilla.com/D102971
When CompositorHwnd does not exist, FLIP_SEQUENTIAL could not be used, since it could cause a problem like Bug 1435995. For example, CompositorHwnd creation could be failed on Win7.
Differential Revision: https://phabricator.services.mozilla.com/D102531
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
In rare cases, WR can invalidate a tile, but still compute a dirty rect that doesn't intersect that tile.
flush_composites expects all updated tiles to have recorded at least one overlap (for itself), so we set this manually (as we in the normal path after the early return).
Differential Revision: https://phabricator.services.mozilla.com/D101427
This change spreads the release asserts to functions that are invoked by other
callers, potentially increasing the cases where the assert will fail. This is
being done intentionally; we want additional information on the reasons for
the crashes.
Differential Revision: https://phabricator.services.mozilla.com/D101063
We need to be able to delay instantiation of the drawing region until after we have the
dirty rects from start_compositing. This was currently not routed to RenderCompositor,
which is required to do this. Further, SwCompositor needs to always keep track of the
RenderCompositor that it is associated with regardless of whether or not it is a native
compositor so that this hook can be properly engaged.
Differential Revision: https://phabricator.services.mozilla.com/D100974
`DisplayListBuilder::PushRoundedRect`, used for unordered list bullets and the
like, draws rounded rectangles as ordinary rectangles with rounded borders that
have a radius of half the rectangle. Unfortunately, this leads to tiny white
dots at the center of the bullet under some magnifications. I haven't diagnosed
why - perhaps there's something somewhere that snaps borders outward.
Increasing the thickness of the borders to (an impossible) 60% of the width of
the rectangle makes the problem go away. If this kludge doesn't work, we could
add a rectangle covering the center.
Differential Revision: https://phabricator.services.mozilla.com/D100753
When ANativeWindow size is too big, EGLSurface creation could fail. And it should not happen on normal use case. But the error situation happens during org.mozilla.geckoview.test.ScreenshotTest.giantScreenshot.
Differential Revision: https://phabricator.services.mozilla.com/D101128
Crash could happen with WebRender rendering when RenderCompositorEGL is not ready for rendering. With the change, RenderCompositorEGL::BeginFrame() is not called when RenderCompositorEGL is not ready.
Differential Revision: https://phabricator.services.mozilla.com/D100871
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
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
These NVIDIA device resets are specific to Linux and trying to handle
them more gracefully is increasingly difficult. There are many
textures/buffers that we need to clear inside WebRender, but attempting
to add them to the list has proved difficult due to the number of places
we need to add, as well as race conditions with clearing them. Given
this shouldn't happen often, it doesn't seem worth optimizing for and we
should treat it just as an innocent device reset.
Testing this revealed an issue during recovery where unflushed device
resets were not handled as expected. When we checked for errors after
creating a new GL context, we would encounter a GL_CONTEXT_LOST error
which we failed to recover from. This is because we called
GLContext::fGetError instead of the GL method directly; the context lost
state was saved in mContextLost, and any subsequent calls to
GLContext::fGetError would continue to return GL_CONTEXT_LOST.
Differential Revision: https://phabricator.services.mozilla.com/D99905
wr_notifier_wake_up uses RenderThread::WakeUp, which in turn just directly
calls Renderer::Update. As a side-effect, this can queue a composite to the
main framebuffer deep inside the renderer, but without having gone through
the normal pathway of Renderer::UpdateAndRender. UpdateAndRender ensures
that any RenderCompositor is properly prepared for the frame by calling
BeginFrame and other hooks as appropriate. But since we went through just
Update instead, there is never any call to BeginFrame and the SWGL framebuffer
never gets a chance to be properly set up in the RenderCompositor. In such
cases that we actually need to composite to the framebuffer, it seems more
appropriate to call UpdateAndRender, which also supports a boolean indicating
whether or not we actually intend to render something. To further simplify,
we just reuse the existing HandleFrameOneDoc handler to avoid needing separate
entry-points into UpdateAndRender.
Differential Revision: https://phabricator.services.mozilla.com/D99733
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
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
If gfx.webrender.allow-partial-present-buffer-age is false then we do
not query the egl buffer age, and always render the entire
backbuffer. However, we were still calling eglSetDamageRegion if
KHR_partial_present is available. Calling eglSetDamageRegion without
first querying the buffer age is an error, which was causing an
assertion failure in debug builds. To fix this, check the value of the
pref before calling eglSetDamageRegion.
Differential Revision: https://phabricator.services.mozilla.com/D99659
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
This reduces some code duplication, and makes it clear which things we want to
do only once per window, and which things we want to do once per pipeline / CompositorBridge.
This change affects the ordering of messages, but hopefully not in a way that
anybody was relying on. Specifically, the image notifications are now sent before
the NotifyDidPaint for the root CompositorBridge is sent.
Differential Revision: https://phabricator.services.mozilla.com/D97533
Aside from on Windows, we do not appear to handle device resets properly
without the GPU process. This patch adds in the necessary plumbing to
handle the device reset properly. It also ensures that whenever we check
for a device reset reason, we handle all of the reasons (e.g. not just
the NV video memory purge reset reason) to ensure they are not lost, and
handles them all consistently in the same manner.
It also tracks the number of device resets for thresholding purposes
with an in process compositor. While it will only disable WebRender on
Linux at this time, it will put a note in the critical log if the
threshold was exceeded on all platforms. This may prove useful in
evaluating whether or not we should do the same everywhere.
Differential Revision: https://phabricator.services.mozilla.com/D98705
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
The composite code uses the size of the dest rect to determine scaling, and we don't want this to be affected by the clip.
Differential Revision: https://phabricator.services.mozilla.com/D97707
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
Fix an unintentional bug where I had not originally anticipated the renderer
thread to be waiting on the jobs available condition, so had avoided trying to
signal the condition. Later revisions of the patch then made the thread wait on
the condition, so it is always necessary to signal from either thread sending
jobs to make sure either thread wakes up when necessary to process jobs.
Differential Revision: https://phabricator.services.mozilla.com/D97194
There appears to be a substantial overhead for trying to wake cold threads
from a thread pool (especially with rayon), so for now let's leave the existing
thread spawning in place, but reduce the stack size for individual threads.
Since these threads only call into SWGL's composite routines and do little else,
there isn't much harm in having a small stack size.
Differential Revision: https://phabricator.services.mozilla.com/D96748
We seem to be spending a significant amount of time inside crossbeam channels
sending jobs across. Sending multiple bands for a given job tends to relock the
channel multiple times when ideally we only want to queue the job once, or lock
the channel once (neither of which we can conveniently do with crossbeam). To
alleviate this, I've implemented a more custom solution with a mutexed VecDeque
and some Condvars.
Differential Revision: https://phabricator.services.mozilla.com/D96520
Move the calculation of the dirty rects array earlier in frame
drawing, and supply that to the `start_compositing` method of
the compositor trait.
For now, it's assumed that the native compositor wants a single
dirty rect, and doesn't use buffer-age functionality. These
params will be configurable as part of the compositor capabilities
struct in follow up patches.
Differential Revision: https://phabricator.services.mozilla.com/D95828
Implementing the Draw compositor via the native compositor interface
is simpler if the buffer age is passed into the top level render method.
Differential Revision: https://phabricator.services.mozilla.com/D95824
Implementing the Draw compositor via the native compositor interface
is simpler if the buffer age is passed into the top level render method.
Differential Revision: https://phabricator.services.mozilla.com/D95824
This removes some of the complexity in the renderer associated with
drawing multiple document layers in a single render. It retains
the rest of the document API, which will be used to implement the
functionality in bug #1654938.
Differential Revision: https://phabricator.services.mozilla.com/D95478
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Make some ad-hoc manual updates to `testing/marionette/client/setup.py`, `testing/marionette/harness/setup.py`, and `testing/firefox-ui/harness/setup.py`, which have hard-coded regexes that break after the reformat.
5. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Make some ad-hoc manual updates to `testing/marionette/client/setup.py`, `testing/marionette/harness/setup.py`, and `testing/firefox-ui/harness/setup.py`, which have hard-coded regexes that break after the reformat.
5. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
The code always assumed that the size of the image with the Y plane dimensions, which, while often the case, isn't correct.
We remove the assertions that the display offset was always (0,0) and properly carry the actual data over IPC.
Remoting the theora decoder and enabling fast video copy exposed several other related issues in the various D3D11 image types.
Various WPT uses theora YUV44 images (because we do not support YUV444 H264 ones). Those images are made of 32 pixels planes with a display size set to 20 pixels. Prior P1D the backend image was a ShareYCbCrPlanar image which correctly handled the size settings.
Like the image serializer, the various D3D11 images always assumed that the Y plane size was the image size.
This however expose existing issues where the offset position of the display is completely ignored for some image type. See bug 1669054
All those problems explain why sometimes we displayed more pixels than we should have.
Depends on D91914
Differential Revision: https://phabricator.services.mozilla.com/D92233
In a (large-ish) nutshell:
- Consolidate all counters under a single type.
- Counters are all arranged in an array and referred to via index.
- All counters can be displayed as average+max (float/int), graph, and change indicator.
- Specify what to show and in what form via a pref.
- All counters and visualizations support not having values every frame.
- GPU time queries visualization is easier to read relative to the frame budget:
- If the maximum value is under 16ms, the right side of the graph is fixed at 16ms.
- If the maximum value is above 16ms, draw a vertical bar at 16ms.
- Added a few new profile counters:
- Total frame CPU time (from API send to the end of GPU command submission).
- Visibility, Prepare, Batching and Glyph resolve times.
The main change is how profile counters are represented. Instead of having different types for different visualizations, every counter is represented the same way, tracking average/max values over half a ms and optionally recording a graph over a number of frames. Counters are stored in a vector and referred to via index (See constants at the top of profiler.rs).
The main motivation for this storage is to facilitate adding counters without having to think too much about where to store them and how to pass them to the renderer.
The profiler's UI is defined by a string with with a single syntax:
- Comma separated list of tokens (leading and trailing spaces ignored), which can be:
- A counter name:
- If prefixed with a '#' character, the counter is shown as a graph.
- If prefixed with a '*' character, the counter is shown as a change indicator
- By default (counter name without prefix), the counter is shown as average and max over half a second.
- A preset name:
- A preset is a builtin UI string in the same syntax that can be nested in the main UI string.
- Presets are defined towards the top of profiler.rs and can also refer to other presets.
- An empty token adds a bit of vertical space.
- A '|' token begins a new column.
- A '_' token begins a new row.
Differential Revision: https://phabricator.services.mozilla.com/D93603
In a (large-ish) nutshell:
- Consolidate all counters under a single type.
- Counters are all arranged in an array and referred to via index.
- All counters can be displayed as average+max (float/int), graph, and change indicator.
- Specify what to show and in what form via a pref.
- All counters and visualizations support not having values every frame.
- GPU time queries visualization is easier to read relative to the frame budget:
- If the maximum value is under 16ms, the right side of the graph is fixed at 16ms.
- If the maximum value is above 16ms, draw a vertical bar at 16ms.
- Added a few new profile counters:
- Total frame CPU time (from API send to the end of GPU command submission).
- Visibility, Prepare, Batching and Glyph resolve times.
The main change is how profile counters are represented. Instead of having different types for different visualizations, every counter is represented the same way, tracking average/max values over half a ms and optionally recording a graph over a number of frames. Counters are stored in a vector and referred to via index (See constants at the top of profiler.rs).
The main motivation for this storage is to facilitate adding counters without having to think too much about where to store them and how to pass them to the renderer.
The profiler's UI is defined by a string with with a single syntax:
- Comma separated list of tokens (leading and trailing spaces ignored), which can be:
- A counter name:
- If prefixed with a '#' character, the counter is shown as a graph.
- If prefixed with a '*' character, the counter is shown as a change indicator
- By default (counter name without prefix), the counter is shown as average and max over half a second.
- A preset name:
- A preset is a builtin UI string in the same syntax that can be nested in the main UI string.
- Presets are defined towards the top of profiler.rs and can also refer to other presets.
- An empty token adds a bit of vertical space.
- A '|' token begins a new column.
- A '_' token begins a new row.
Differential Revision: https://phabricator.services.mozilla.com/D93603
This patch removes the public API and high level logic for
disabling picture caching for debugging and pinch-zoom in
some cases.
Follow up patches will remove and simplify the internal parts
of WR that remain to handle the disabled picture caching
code path.
Differential Revision: https://phabricator.services.mozilla.com/D93446
NativeLayerCA only understands how to extract the IOSurface from a RenderMacIOSurfaceTextureHost.
Rather than trying to support both types, this just merges them, as they are both just an IOSurface pointer and some associated helper functions.
Differential Revision: https://phabricator.services.mozilla.com/D93181
This interface is never used directly, and the only consumers of the virtual functions are by the derived classes themselves.
Differential Revision: https://phabricator.services.mozilla.com/D93180
When using the native RenderCompositor+SWGL on MacOS, we don't support passing buffer textures directly to the compositor.
Differential Revision: https://phabricator.services.mozilla.com/D93179
Currently we query the backbuffer age in
RenderCompositor::BeginFrame(). Querying the age on android requires
the driver to dequeue a new backbuffer. By doing this right at the
start of the frame, we may cause the driver to block until a buffer is
ready.
We don't actually need the buffer age until part way through
rendering, in Renderer::composite_simple(), by which point there is a
better chance the buffer is available. So move the query to there instead.
Differential Revision: https://phabricator.services.mozilla.com/D92950
It is possible that when the ImageBridge received a new image to composite, that image hasn't yet been registered via the VideoBridge.
This can happen if the decoding occurs in the different process than the content process. Even though the VideoBridge registration message was sent earlier by the RDD process, the ImageBridge message sent by the content process reached the compositor earlier.
So we only attempt to use the TextureHost if it is valid and the underlying image has been properly registered. Otherwise we will continue to use the previous image.
Some methods are modified to lazily perform their action only once the image has been registered from the PVideoBridge.
Differential Revision: https://phabricator.services.mozilla.com/D92234
The DisplayListBuilder::PushRoundedRect function is used for <li> bullets and a
few other decorations. It draws a rounded rectangle as an ordinary rectangle
with a rounded rect clip.
However, you can get the same effect by drawing a box border with rounded
corners around a box with zero width and height. This, WebRender can cache as a
bitmap and draw as an image. Clips are not cached in this way, and require extra
attention from WebRender to process.
Differential Revision: https://phabricator.services.mozilla.com/D92984
Previously we used a single texture array for a given tile size,
and resized the texture array as more tiles were needed.
However, this results in expensive driver stalls and GPU copy times
when resizing the array.
Instead, use a fixed slice count for each texture array, and support
multiple textures with the same tile size.
This may result in slightly more draw calls during compositing of
picture cache tiles due to batch breaks, but will remain a small
number due to the limited number of picture cache tiles that are
allocated at any one time.
Differential Revision: https://phabricator.services.mozilla.com/D92715
When ANGLE detects device reset, GetDeviceOfEGLDisplay() returns nullptr. It is not handled as device reset in current RenderCompositorANGLE::ShutdownEGLLibraryIfNecessary(). It should be handled as device reset.
Differential Revision: https://phabricator.services.mozilla.com/D92543
While we measuered somewhat surprisingly high performance improvements on linux when replacing standard channels with crossbeam ones on Linux, there has been a CONTENT_FRAME_TIME regression on Windows around the same time. In doubt, this patch makes us use standard channels on Windows to see if it fixes the regression. This patch will be reverted if it doesn't turn out restore the CONTENT_FRAME_TIME numbers.
Swgl needs to continue using crossbeam because it depends on select which doesn't exist in standard channels.
Differential Revision: https://phabricator.services.mozilla.com/D92383
KHR_partial_update allows us to avoid rerendering the entire
backbuffer every frame, and instead only render what has changed on
the current frame, as well as the difference between the current
backbuffer and the current frontbuffer. It works similarily to
EXT_buffer_age, which we already support, with the additional
requirement that we must call eglSetDamageRegion each frame before
rendering to the backbuffer.
Modify GLContextEGL::GetBufferAge() so that it queries the age if
either EXT_buffer_age or KHR_partial_update are available. This will
now automatically be queried by webrender through the
PartialPresentCompositor trait. Add a new function to that trait,
set_buffer_damage_region(), whose RenderCompositorEGL implementation
calls eglSetDamageRegion(). Call this from composite_simple(), once
the damage rect has been calculated but before rendering to the
backbuffer.
Additionally, change both RenderCompositorEGL and
RenderCompositorOGL's implementations of
ShouldDrawPreviousPartialPresentRegions() to unconditionally return
true, rather than checking for the existence of EXT_buffer_age (or
adding a new check for KHR_partial_update). The lack of these
extensions does not mean that webrender is able to skip rendering
previous frames' damage. Rather the opposite, it means we cannot
render *only* the previous frames' damage, and must instead always
render the entire buffer.
Differential Revision: https://phabricator.services.mozilla.com/D91203
Add a trait PartialPresentCompositor with a function get_buffer_age(),
and allow gecko to pass an implementation to webrender during
initialization. This allows webrender to query the age of the current
backbuffer during compositing.
Make webrender track the previous 2 frame's dirty rects, rather than
just the previous 1 frame's, allowing it to calculate the total damage
rect for buffer ages of up to 3. If the age is greater than 3, treat
the entire buffer as invalid. Also handle special cases of ages 0 and
1, 0 meaning the entire buffer is invalid, and 1 meaning the entire
buffer is valid. Make gecko stop requesting a full render for buffer
ages other than 2, as webrender can now handle these cases itself.
Differential Revision: https://phabricator.services.mozilla.com/D91202
KHR_partial_update allows us to avoid rerendering the entire
backbuffer every frame, and instead only render what has changed on
the current frame, as well as the difference between the current
backbuffer and the current frontbuffer. It works similarily to
EXT_buffer_age, which we already support, with the additional
requirement that we must call eglSetDamageRegion each frame before
rendering to the backbuffer.
Modify GLContextEGL::GetBufferAge() so that it queries the age if
either EXT_buffer_age or KHR_partial_update are available. This will
now automatically be queried by webrender through the
PartialPresentCompositor trait. Add a new function to that trait,
set_buffer_damage_region(), whose RenderCompositorEGL implementation
calls eglSetDamageRegion(). Call this from composite_simple(), once
the damage rect has been calculated but before rendering to the
backbuffer.
Additionally, change both RenderCompositorEGL and
RenderCompositorOGL's implementations of
ShouldDrawPreviousPartialPresentRegions() to unconditionally return
true, rather than checking for the existence of EXT_buffer_age (or
adding a new check for KHR_partial_update). The lack of these
extensions does not mean that webrender is able to skip rendering
previous frames' damage. Rather the opposite, it means we cannot
render *only* the previous frames' damage, and must instead always
render the entire buffer.
Differential Revision: https://phabricator.services.mozilla.com/D91203
Add a trait PartialPresentCompositor with a function get_buffer_age(),
and allow gecko to pass an implementation to webrender during
initialization. This allows webrender to query the age of the current
backbuffer during compositing.
Make webrender track the previous 2 frame's dirty rects, rather than
just the previous 1 frame's, allowing it to calculate the total damage
rect for buffer ages of up to 3. If the age is greater than 3, treat
the entire buffer as invalid. Also handle special cases of ages 0 and
1, 0 meaning the entire buffer is invalid, and 1 meaning the entire
buffer is valid. Make gecko stop requesting a full render for buffer
ages other than 2, as webrender can now handle these cases itself.
Differential Revision: https://phabricator.services.mozilla.com/D91202
The `category.WithOptions(...)` syntax was a bit strange and difficult to explain.
Now the category and options are separate parameters. Default options can be specified with `MarkerOptions{}` or just `{}`.
As a special case, defaulted-NoPayload functions don't need `<>`, and defaulted-NoPayload functions and macros don't even need `{}` for default options, e.g.:
`profiler_add_marker("name", OTHER); PROFILER_MARKER_UNTYPED("name", OTHER);`
Differential Revision: https://phabricator.services.mozilla.com/D91680
The `category.WithOptions(...)` syntax was a bit strange and difficult to explain.
Now the category and options are separate parameters. Default options can be specified with `MarkerOptions{}` or just `{}`.
As a special case, defaulted-NoPayload functions don't need `<>`, and defaulted-NoPayload functions and macros don't even need `{}` for default options, e.g.:
`profiler_add_marker("name", OTHER); PROFILER_MARKER_UNTYPED("name", OTHER);`
Differential Revision: https://phabricator.services.mozilla.com/D91680
Webrender provides dirty rects with a top-left origin, whereas EGL
requires bottom-left. We also clamp the region to the framebuffer size
prior to passing it to EGL. There was a bug in this calculation when
the dirty rect had a negative y-offset and a height greater than the
framebuffer's height. This was causing too little of the screen to be
updated in some circumstances, resulting in stale content.
Note that this is only an issue when
gfx.webrender.max-partial-present-rects != 0.
Differential Revision: https://phabricator.services.mozilla.com/D91714
For performance, it is better to use eglWaitSyncKHR() for andoid fence if possible.
This change is not used by gecko yet.
Differential Revision: https://phabricator.services.mozilla.com/D89882
When EGLSync is created from fence file descriptor, gecko should not close it. It should be closed by gecko only when EGLSync creation is failed.
Differential Revision: https://phabricator.services.mozilla.com/D91702
I liked the separation, but having everything in RendererOGL.cpp makes the next patch easier.
One nice effect of this patch is that all the recorder-related wr_renderer_* functions
are now called from the same file. Previously, most of them were called in
WebRenderCompositionRecorder.cpp, but the cleanup function
wr_renderer_release_composition_recorder_structures was called from RendererOGL.cpp.
Differential Revision: https://phabricator.services.mozilla.com/D89867
Rather than having two windowID -> [something] hash tables, this reduces it to
one: The renderer is already per-window so we just put the recorder into the
renderer.
Differential Revision: https://phabricator.services.mozilla.com/D89866
This requires passing down the window size down in a different way, because the
NativeLayerRootSnapshotter does not know the window size otherwise.
At the same time, this patch also removes WindowNLRS and makes the NativeLayerRoot
implement the profiler_screenshots::Window interface directly.
Differential Revision: https://phabricator.services.mozilla.com/D89864
This requires passing down the window size down in a different way, because the
NativeLayerRootSnapshotter does not know the window size otherwise.
At the same time, this patch also removes WindowNLRS and makes the NativeLayerRoot
implement the profiler_screenshots::Window interface directly.
Depends on D89863
Differential Revision: https://phabricator.services.mozilla.com/D89864
Mostly mechanical changes, with some work needed to convert the different payloads (with optional timestamps, inner window id, and/or backtrace) to the equivalent MarkerOptions.
Differential Revision: https://phabricator.services.mozilla.com/D89587
Use ID3D11VideoProcessor for video frame rendering.
WebRenderError::VIDEO_OVERLAY does not cause disabling WebRender. It just change gfxVars::UseWebRenderDCompVideoOverlayWin() to false.
Differential Revision: https://phabricator.services.mozilla.com/D88763
We don't know why we see initialization failures in the telemetry which
makes it hard to investigate why users aren't getting WebRender and
instead fallback to basic. Let's expose the detailed error message
WebRender already generates and puts in the critical log.
Differential Revision: https://phabricator.services.mozilla.com/D89185
Release fence is delivered from RenderCompositorEGL to WebRenderImageHost via AsyncImagePipelineManager. And the fence is sent to client side by ImageBridgeParent.
Differential Revision: https://phabricator.services.mozilla.com/D88158
Previously, it was possible to instruct WR to find the closest
scroll node, and apply a scroll delta to that. However, it's
generally the case that there is more context required that
the application applies in selecting which frame to scroll.
This patch removes the unused APIs, which simplifies some of
the hit-testing code. In turn, this simplifies some in-progress
optimization and refactoring of the hit-test internals.
Differential Revision: https://phabricator.services.mozilla.com/D88234
The following functions are asynchronously called by a bit different ways. It seems not good. It seems better to unify them.
PrepareForUse()
NofityForUse()
NotifyNotUsed()
Differential Revision: https://phabricator.services.mozilla.com/D87709
Specifically:
- Remove hit test tag from common display item properties.
- Simplify WR bindings to use hit-test items exclusively.
- Remove support for transparent rectangles to be hit-test items.
- Remove support for any primitive to be a hit-test item.
Differential Revision: https://phabricator.services.mozilla.com/D87421