gfx::Factory::CopyDataSourceSurface() was updated so LOCAL_GL_RGBA readFormat and LOCAL_GL_UNSIGNED_BYTE readType is already supported.
Differential Revision: https://phabricator.services.mozilla.com/D118303
This becomes possible as a side effect of making sure that the current
buffer content is always completely valid, by blitting from the
previous buffer, analogous to
`NativeLayerCA::HandlePartialUpdate` and
`WindowSurfaceWaylandMB::HandlePartialUpdate`.
Apart from reducing overpaint, this improves correctness is many
situations, avoiding glitches.
Note: the approach here may not be optimal concerning efficiency yet
and improvements are planed after further refactoring.
Depends on D118925
Differential Revision: https://phabricator.services.mozilla.com/D119015
Instead of using the Wayland EGL platform. The later is very convenient
but has several limitations. Managing FBOs allows to make our code more
similar to that of MacOS as well as the Wayland software backend.
Most importantly, it will allow us to cleanly implement partial damage
by giving us direct acces to previously submitted buffers, allowing us
to blit back from them, similar like in
`NativeLayerCA::HandlePartialUpdate`.
There are several other fields where more control over buffers will
come in handy, too many to describe them here in detail.
Note: we still use individual buffer pools for each tile. However, this
change brings everything into place to allow us to change to a more
`SurfacePoolCA`-style shared pool. That will reduce GPU-memory usage.
Includes some minor cleanups here and there.
Depends on D119013
Differential Revision: https://phabricator.services.mozilla.com/D118925
Very large gradients are rendered at a lower resolution which is fine for most gradients as they tend to be smooth transitions, but looks bad when there are hard stops.
Differential Revision: https://phabricator.services.mozilla.com/D119628
The tile size edtermines the number of pixels we allocate for the gradinrt pattern, and is eventually clamped to a maximum value. Minimizing the tile size after other transformations avoids some cases where we request more area than we need.
Differential Revision: https://phabricator.services.mozilla.com/D119627
Add MixBlend and ComponentTransfer to the picture composite modes that
unconditionally establish a raster root.
All the known bugs with the raster root code have been fixed, so let's
start incrementally enabling raster roots for more picture modes, and
fix any regressions that come from these before making raster roots
the default for all surfaces.
Differential Revision: https://phabricator.services.mozilla.com/D117954
This becomes possible as a side effect of making sure that the current
buffer content is always completely valid, by blitting from the
previous buffer, analogous to
`NativeLayerCA::HandlePartialUpdate` and
`WindowSurfaceWaylandMB::HandlePartialUpdate`.
Apart from reducing overpaint, this improves correctness is many
situations, avoiding glitches.
Note: the approach here may not be optimal concerning efficiency yet
and improvements are planed after further refactoring.
Depends on D118925
Differential Revision: https://phabricator.services.mozilla.com/D119015
Instead of using the Wayland EGL platform. The later is very convenient
but has several limitations. Managing FBOs allows to make our code more
similar to that of MacOS as well as the Wayland software backend.
Most importantly, it will allow us to cleanly implement partial damage
by giving us direct acces to previously submitted buffers, allowing us
to blit back from them, similar like in
`NativeLayerCA::HandlePartialUpdate`.
There are several other fields where more control over buffers will
come in handy, too many to describe them here in detail.
Note: we still use individual buffer pools for each tile. However, this
change brings everything into place to allow us to change to a more
`SurfacePoolCA`-style shared pool. That will reduce GPU-memory usage.
Includes some minor cleanups here and there.
Depends on D119013
Differential Revision: https://phabricator.services.mozilla.com/D118925
If we are re-forwarding a texture that has not been updated then it might still
be read locked. We rely on the read lock for us to know when the Compositor or
Renderer has finished with the texture. So this change copies it to a new
texture, which we can safely read lock.
If the texture is not read locked then we ensure that it is set as updated,
which means we will read lock it as we forward it.
Differential Revision: https://phabricator.services.mozilla.com/D119546
Instead of storing the start time which can be a very large number as f64, keep it in ns as u64 and do the float conversion for the time difference instead.
In addition, the merge function was not behaving synmetrically. It was intended to work as old.merge(new) but we have at least one place in the code where we write it as new.merge(old). In practice takiung the max of the start times when merging two start times does what we want in both direction and makes merging less error prone.
Differential Revision: https://phabricator.services.mozilla.com/D119432
To be more consistent with the rest of the code base and make the
header file easier to read. Also remove an usused function declaration.
Differential Revision: https://phabricator.services.mozilla.com/D119335
Whenever the asr of the deferred transform item differs from the current asr and we are about to enter a new StackingContextHelper (as opposed to just when we enter a transformed frame) flush the deferred transform item, so it's transform doesn't get lost.
This is similar to https://phabricator.services.mozilla.com/D8111. In fact we are extending https://phabricator.services.mozilla.com/D8111 to every time we enter a StackingContextHelper. https://phabricator.services.mozilla.com/D8111 was concerned with solving the case of having two nested transform items with different asrs and making sure we don't lose the outer transform item, here we need to solve the case of an outer transformed item and an inner StackingContextHelper (which is not for a transform) with a different asr and making sure we don't lose the outer transform item.
Note that some of the items I added CreatesStackingContextHelper return true don't always make a new StackingContextHelper. It seemed better to be consistent and I think the only downside is a little less perf because we have to create a few more scrolldata nodes.
Differential Revision: https://phabricator.services.mozilla.com/D118815
Fenix makes use of the default clear color by setting it to a dark
color when the dark theme is enabled to avoid white flashes while
pages are loading. In bug 1663732 we hooked this functionality up to
webrender, however, it was only used by the draw compositor. Now with
software webrender on Android, we sometimes use
RenderCompositorLayersSWGL rather than the draw compositor, and users
are therefore experiencing white flashes during page loads.
This adds a clear_color argument to StartCompositing(), which
RenderCompositorLayersSWGL uses to set the CompositorOGL's clear
color. This patch also makes Renderer::clear_color not an Option
type, as we only ever used it in Some form, and that simplifies the
FFI.
Differential Revision: https://phabricator.services.mozilla.com/D119272
Fenix makes use of the default clear color by setting it to a dark
color when the dark theme is enabled to avoid white flashes while
pages are loading. In bug 1663732 we hooked this functionality up to
webrender, however, it was only used by the draw compositor. Now with
software webrender on Android, we sometimes use
RenderCompositorLayersSWGL rather than the draw compositor, and users
are therefore experiencing white flashes during page loads.
This adds a clear_color argument to StartCompositing(), which
RenderCompositorLayersSWGL uses to set the CompositorOGL's clear
color. This patch also makes Renderer::clear_color not an Option
type, as we only ever used it in Some form, and that simplifies the
FFI.
Differential Revision: https://phabricator.services.mozilla.com/D119272
We sometimes see webrender renderer initialization failing due to an
invalid max texture size being reported. The logcat shows that there
is no current GL context, and as a result glGet returns 0 when
querying the max texture size. This occurs after the
AndroidSharedBlitGL context has been destroyed on the renderer thread,
leaving no context as current.
This patch adds a call to MakeCurrent() for the renderer's OpenGL
context prior to renderer initialzation. This means we successfully
query the texture size and avoid the initialization error.
Differential Revision: https://phabricator.services.mozilla.com/D119334
When calling nsDOMWindowUtils::SetResolutionAndScaleTo in a test it's possible to have a layers update that only updates the zoom and nothing else. NotifyLayersUpdated will update the zoom but not the expected gecko metrics when this happens.
Differential Revision: https://phabricator.services.mozilla.com/D119248
When picture cache tiles were changed to be raster roots, this
broke quantizing of glyph sizes based on current scale. Restore
this behavior for high-quality pinch-zoom mode, and also select
the correct fixed scale for low-quality zoom mode.
Differential Revision: https://phabricator.services.mozilla.com/D119145
Previously, the child primitives of off-screen surfaces were not
being atomically treated as a single unit. This meant that the
primitives may be assigned to different sub-slices, under certain
edge case conditions.
As a short term fix, let the picture cache code know when an off
screen surface is being processed during primitive dependency
updates. This ensures that all child primitives within a surface
will be assigned to the same sub-slice.
Differential Revision: https://phabricator.services.mozilla.com/D119052
This patch launches content processes with the `MOZ_HEADLESS` env var set
if they're using GTK with an X11 display (and there's no other reason
they'd need GTK).
The goal is to avoid exhausting Xorg's default limit of 256 clients if
there are many content processes due to Fission. If these conditions
are met, the content process doesn't need to eagerly connect to the X
server. This does not affect the sandbox policy, and content processes
can still use X if needed for, e.g., WebGL.
The boolean pref `dom.ipc.avoid-gtk`, set by default, controls this
feature. In the future it could also be extended to minimize GTK use
with Wayland displays.
Note that disabling `widget.non-native-theme.enabled`, which is also
enabled by default, will restore the use of X11 in all content processes
even if this pref is set; the alternative is that widgets wouldn't render
in that case.
This change will also save some memory for now-unnecessary instances of
GTK's global state, and improve content process startup time.
Remove also the temp pref dom.ipc.remote-mozIcon because it cannot work
anymore with the content process being headless.
Differential Revision: https://phabricator.services.mozilla.com/D112197
This follows what we're already doing for EGL: a refcounted object
which can own the X connection, where we hold a weak reference from
the library object so that multiple contexts opportunistically share
the display but we close the connection when the last context is
freed/GCed.
In a process where GTK is initialized, we borrow its display instead of
opening a new one, which preserves the existing behavior.
Differential Revision: https://phabricator.services.mozilla.com/D112195
This is useful for debugging problems on systems such as android
or windows which can sometimes be tricky to get reliable console
output logging.
Differential Revision: https://phabricator.services.mozilla.com/D118772
Copy tiles data when tiles are opaque instead of blending them.
RenderCompositorLayersSWGL always blends tiles as premultiplied tiles. But it could not handle clear tiles and caused Bug 1718497. The problem does not happen with RenderCompositorSWGL. It copies tile data when tile is opaque. Then, RenderCompositorSWGL handles clear tiles correctly.
Differential Revision: https://phabricator.services.mozilla.com/D118953
+ Begin to add video tests to ensure we ratchet towards correctness.
+ Test rec709 x (yuv420p, yuv420p10, gbrp) x (tv, pc) x codecs.
+ Just mark fuzziness for now. Better would be e.g. 16_127_233 'bad
references'.
Differential Revision: https://phabricator.services.mozilla.com/D115298
Original patch by Erik Kurzinger: D118304
The following is currently not well-defined by the EGL specification:
1. Create context.
2. Make it current with no default framebuffer (as a surface-less context, ie bind EGL_NO_SURFACE for both surfaces)
3. Make it current with a default framebuffer (ie with some draw/read surfaces)
After Step #3 what is the current draw buffer state? is it GL_NONE or GL_BACK?
With Mesa's EGL implementation, the answer is GL_BACK, and WebRender's EGL
backend currently assumes this behavior. However with the proprietary NVIDIA
driver the answer is actually GL_NONE, meaning any rendering done after step #3
will be lost.
As a fix, Firefox can simple call glDrawBuffer after making a surface current
to set the draw buffer appropriately, either to GL_BACK for a double-buffered
surface or to GL_FRONT for single-buffered. As mentioned above, this is
redundant on Mesa, but should also be harmless.
Differential Revision: https://phabricator.services.mozilla.com/D118743
Original patch by Erik Kurzinger: D118304
The following is currently not well-defined by the EGL specification:
1. Create context.
2. Make it current with no default framebuffer (as a surface-less context, ie bind EGL_NO_SURFACE for both surfaces)
3. Make it current with a default framebuffer (ie with some draw/read surfaces)
After Step #3 what is the current draw buffer state? is it GL_NONE or GL_BACK?
With Mesa's EGL implementation, the answer is GL_BACK, and WebRender's EGL
backend currently assumes this behavior. However with the proprietary NVIDIA
driver the answer is actually GL_NONE, meaning any rendering done after step #3
will be lost.
As a fix, Firefox can simple call glDrawBuffer after making a surface current
to set the draw buffer appropriately, either to GL_BACK for a double-buffered
surface or to GL_FRONT for single-buffered. As mentioned above, this is
redundant on Mesa, but should also be harmless.
Differential Revision: https://phabricator.services.mozilla.com/D118743
Original patch by Erik Kurzinger: D118304
The following is currently not well-defined by the EGL specification:
1. Create context.
2. Make it current with no default framebuffer (as a surface-less context, ie bind EGL_NO_SURFACE for both surfaces)
3. Make it current with a default framebuffer (ie with some draw/read surfaces)
After Step #3 what is the current draw buffer state? is it GL_NONE or GL_BACK?
With Mesa's EGL implementation, the answer is GL_BACK, and WebRender's EGL
backend currently assumes this behavior. However with the proprietary NVIDIA
driver the answer is actually GL_NONE, meaning any rendering done after step #3
will be lost.
As a fix, Firefox can simple call glDrawBuffer after making a surface current
to set the draw buffer appropriately, either to GL_BACK for a double-buffered
surface or to GL_FRONT for single-buffered. As mentioned above, this is
redundant on Mesa, but should also be harmless.
Differential Revision: https://phabricator.services.mozilla.com/D118743
Now that picture cache tiles are raster roots, their scale is
expressed via the device-pixel scale. This means the calculated
scale can be too small when zoom factor is < 1 and a pinch-zoom
is currently active.
This is not a complete fix, it's an interim improvement until we
implement a proper fix. A complete fix will need to include the
device-pixel scale in the quantization process. However, this will
take some time to get right, since the existing code for selecting
a glyph size is quite complex due to different permutations and
how that code has evolved.
Differential Revision: https://phabricator.services.mozilla.com/D118781
+ Begin to add video tests to ensure we ratchet towards correctness.
+ Test rec709 x (yuv420p, yuv420p10, gbrp) x (tv, pc) x codecs.
+ Just mark fuzziness for now. Better would be e.g. 16_127_233 'bad
references'.
Differential Revision: https://phabricator.services.mozilla.com/D115298
Updating raster_scale in post_update can mean that it is
updated one frame too late. This can cause reftest failures
in tests that set the scale factor (without an APZ) and then
capture that frame.
Differential Revision: https://phabricator.services.mozilla.com/D118672
This ensures we get the correct advances for the variation settings that are in use,
not just the font's "default" advances from the hmtx table.
(I'm sad there wasn't a testcase that detected this regression, so added one here.)
Differential Revision: https://phabricator.services.mozilla.com/D118571
Fixes a case where at the end of a pinch-zoom on the Draw compositor
the tiles would be drawn incorrectly (due to the transforms not
being quite right for the local-to-surface case here, which was
affecting the occlusion calculations).
Differential Revision: https://phabricator.services.mozilla.com/D118559
In bug 1717519 we're seeing access violations when writing
to the destination with SWGL. This does some early writes
to try to catch the problem earlier.
Differential Revision: https://phabricator.services.mozilla.com/D118556
This extends on the changes in part 12a and consumes the new PortRef-based API
in all existing process types other than the fork server. The IPDL C++ unit
tests were already broken before this change, and were not updated.
Differential Revision: https://phabricator.services.mozilla.com/D112777
This allows the draw compositor to correctly work with the low
quality pinch-zoom mode.
It also allows handling more external surfaces as compositor
surfaces, by allowing anything with a 2d scale and/or offset.
The y-flip special casing is removed since it's handled by the
general compositor transform support now.
Differential Revision: https://phabricator.services.mozilla.com/D118318
This extends on the changes in part 12a and consumes the new PortRef-based API
in all existing process types other than the fork server. The IPDL C++ unit
tests were already broken before this change, and were not updated.
Differential Revision: https://phabricator.services.mozilla.com/D112777
Actually, APZ's zoomToRect doens't support position: fixed content. If so,
we use PresShell's scrollIntoView instead to scroll focused content if it
isn't visible.
Differential Revision: https://phabricator.services.mozilla.com/D117728
This removes the last use of DefineClip from Gecko, which will
allow removing and simplifying a lot of the clip handing code
during scene building in WR.
Differential Revision: https://phabricator.services.mozilla.com/D118121
Unlike buffer release callbacks, which can't happen after the
corresponding buffer was destroyed, frame callbacks can apparently
arrive even if the corresponding surface was destroyed.
This kinda makes sense as frame callbacks have independent objects
which actually can get destroyed manually.
Also wait for the lock in the destructor to not unref the surface
below our feet.
Differential Revision: https://phabricator.services.mozilla.com/D118274
This caused e.g. WebGL content to get hidden as it always fell out
of bounds. As a side effect clean up the whole custom transform math.
Differential Revision: https://phabricator.services.mozilla.com/D118288
This changes font-family storage to reuse the rust types, removing a
bunch of code while at it. This allows us to, for example, use a single
static font family for -moz-bullet and clone it, rather than creating a
lot of expensive copies.
Differential Revision: https://phabricator.services.mozilla.com/D118011
+ Begin to add video tests to ensure we ratchet towards correctness.
+ Test rec709 x (yuv420p, yuv420p10, gbrp) x (tv, pc) x codecs.
+ Just mark fuzziness for now. Better would be e.g. 16_127_233 'bad
references'.
Differential Revision: https://phabricator.services.mozilla.com/D115298
This means that double tapping on an oop iframe "works" in that we don't try (and fail) to zoom the oop iframe. But it also means it is impossible to zoom to some content inside that oop iframe. Instead the best we can do is zoom to the oop iframe itself. This is consistent with what Chrome and Safari currently do. Allowing zooming to content inside an oop iframe would be decently complicated and it doesn't seem worth it. Bug 1715179 is on file for this.
Differential Revision: https://phabricator.services.mozilla.com/D116925
This was introduced in D106246. Most likely it is only necessary
on uncomposited legacy desktops. So on Linux only enable it for X11,
leaving out Wayland.
Removing it makes `RenderCompositorSWGL` behave (more) equally to
`RenderCompositorOGLSWGL`, massively reducing overpaint on certain
websites like testufo.com and improving frame rates on many low-end
devices.
Differential Revision: https://phabricator.services.mozilla.com/D118192
Over time the render target debug view has accidentally started
displaying other texture cache textures too, and then not actually
showing render targets. This makes it show only render target textures
again, as intended.
Differential Revision: https://phabricator.services.mozilla.com/D118187
Instead of drawing updates into the correct spot in the destination
DataSourceSurface we just use it as scratch space and always
draw in the top-left with stride = bpp*width.
We add a dstOffset to the upload functions to support using
a subsurface.
Differential Revision: https://phabricator.services.mozilla.com/D116501
This means that double tapping on an oop iframe "works" in that we don't try (and fail) to zoom the oop iframe. But it also means it is impossible to zoom to some content inside that oop iframe. Instead the best we can do is zoom to the oop iframe itself. This is consistent with what Chrome and Safari currently do. Allowing zooming to content inside an oop iframe would be decently complicated and it doesn't seem worth it. Bug 1715179 is on file for this.
Differential Revision: https://phabricator.services.mozilla.com/D116925
+ Begin to add video tests to ensure we ratchet towards correctness.
+ Test rec709 x (yuv420p, yuv420p10, gbrp) x (tv, pc) x codecs.
+ Just mark fuzziness for now. Better would be e.g. 16_127_233 'bad
references'.
Differential Revision: https://phabricator.services.mozilla.com/D115298
This means that double tapping on an oop iframe "works" in that we don't try (and fail) to zoom the oop iframe. But it also means it is impossible to zoom to some content inside that oop iframe. Instead the best we can do is zoom to the oop iframe itself. This is consistent with what Chrome and Safari currently do. Allowing zooming to content inside an oop iframe would be decently complicated and it doesn't seem worth it. Bug 1715179 is on file for this.
Differential Revision: https://phabricator.services.mozilla.com/D116925
Currently we prevent partial picture cache tile invalidation on all
Mali devices to workaround a driver bug. (See bug 1663355 and bug
1691955.) This driver bug affects some Mali-G and Mali-T devices, but
currently we apply the workaround for any Mali GPU.
Mali-400 may or may not be affected by the same driver bug, but since
it uses software webrender we certainly do not need to apply this
workaround.
Allowing partial invalidation should allow for smaller texture uploads.
Differential Revision: https://phabricator.services.mozilla.com/D118017
The values in ScaleOffset keys for the spatial node comparer can
often have very small differences that are causing invalidations but
are not going to affect the rendered content in any noticeable way.
This is _probably_ mostly due to inaccuracies in the way we calculate
the results in get_relative_transform. Instead of using the fast
form parent.inverse().accumulate(child), we could instead traverse
the tree from the parent, accumulating the local transforms. This
would be slightly less efficient but could probably be cached.
There may also be other sources of floating point inaccuracy that
is introduced in the calculations, so for now we will ignore any changes
which have a scale/translation change of < 0.001.
Differential Revision: https://phabricator.services.mozilla.com/D117968
Only a cosmetic change. There is a check during initialization that the constants match the sequential order so little room for getting it wrong.
Differential Revision: https://phabricator.services.mozilla.com/D117702
Also expose the information in the profiler HUD and rename some counters to make it more apparent when specific to the atlases as opposed to other textures managed by the texture cache.
Differential Revision: https://phabricator.services.mozilla.com/D117695
TextureImageEGL doesn't seem to provide any value beyond
BasicTextureImage. It's last usage was bug 814159.
Removing this has the side effect of using BasicTextureImage
for small images instead of always using TilingTextureImage.
Differential Revision: https://phabricator.services.mozilla.com/D117904
Only a cosmetic change. There is a check during initialization that the constants match the sequential order so little room for getting it wrong.
Differential Revision: https://phabricator.services.mozilla.com/D117702
Also expose the information in the profiler HUD and rename some counters to make it more apparent when specific to the atlases as opposed to other textures mamanged by the texture cache.
Differential Revision: https://phabricator.services.mozilla.com/D117695
Ensure that we only invalidate tiles if the surface scale changes
in low-quality pinch zoom mode, since it's irrelevant if the
compositor surface scale changes.
Differential Revision: https://phabricator.services.mozilla.com/D117727
vqmovn_u16 is very different semantically then _mm_packus_epi16. _mm_packus_epi16 treats the input as signed 16-bit integers and narrows to unsigned 8-bit.
vqmovn_u16, however, is an unsigned to unsigned narrow. vqmovun_s16 does what we actually need here, which is to treated the input as signed 16-bit and narrow to unsigned 8-bit.
Differential Revision: https://phabricator.services.mozilla.com/D117705
Only a cosmetic change. There is a check during initialization that the constants match the sequential order so little room for getting it wrong.
Differential Revision: https://phabricator.services.mozilla.com/D117702
Also expose the information in the profiler HUD and rename some counters to make it more apparent when specific to the atlases as opposed to other textures mamanged by the texture cache.
Differential Revision: https://phabricator.services.mozilla.com/D117695
Building on previous patches, this adds a preference to enable
a low quality pinch-zoom mode that reuses cached tiles where
possible.
It doesn't currently redraw at the higher quality scale at the
end of a pinch-zoom, and there are some sampling artifacts in some
cases. However, it should be enough to do some performance testing
on low and devices and see if it helps.
Differential Revision: https://phabricator.services.mozilla.com/D117497
Although blob images let us support very large images, it's easiest
avoid things getting way too big by just reusing our existing limit.
Differential Revision: https://phabricator.services.mozilla.com/D117580