Commit Graph

60 Commits

Author SHA1 Message Date
Markus Stange
df2a007c4c Bug 1689237 - Disable CALayer edge anti-aliasing. r=mattwoodrow
We currently don't ever set non-rectilinear transforms on our CALayers, so there
is no need for anti-aliasing. Explicitly disabling edge anti-aliasing means that
there are no seams between tiles when the window server draws our window with a
transform, such as during Mission Control.

Differential Revision: https://phabricator.services.mozilla.com/D103740
2021-02-03 05:26:32 +00:00
Brad Werth
f5e4b487c9 Bug 1686834: Increase the specificity of a release assert in NextSurfaceAsFramebuffer. r=jrmuizel
Some callers of NextSurface can tolerate a false return value. This moves the
release assert one level lower (more specific) towards
RenderCompositorNativeOGL::Bind, which can't handle a missing surface.

Differential Revision: https://phabricator.services.mozilla.com/D102344
2021-01-19 21:31:45 +00:00
Brad Werth
3e6d3530c3 Bug 1685046: Hoist release asserts in RenderCompositorNativeOGL::Bind to crash earlier. r=jrmuizel
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
2021-01-11 15:49:09 +00:00
Matt Woodrow
5487b02f9e Bug 1666055 - Remove RenderTextureHostOGL. r=lsalzman
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
2020-10-14 07:58:18 +00:00
Markus Stange
6d2642e09e Bug 1664047 - Only call UpdateSnapshot when ScreenshotGrabber calls GetWindowContents, which it only does if the profiler is running (and Screenshots are enabled). r=mattwoodrow
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
2020-09-15 20:47:19 +00:00
Mihai Alexandru Michis
a75aa1f3ed Backed out 2 changesets (bug 1664047, bug 1664135) for causing dt failures in ScreenshotGrabber.cpp
CLOSED TREE

Backed out changeset d8996fcd3568 (bug 1664047)
Backed out changeset 070815d3ff02 (bug 1664135)
2020-09-15 03:09:08 +03:00
Markus Stange
b2cdbc6d3e Bug 1664047 - Only call UpdateSnapshot when ScreenshotGrabber calls GetWindowContents, which it only does if the profiler is running (and Screenshots are enabled). r=mattwoodrow
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
2020-09-13 21:41:24 +00:00
Markus Stange
a7d49adfc1 Bug 1592031 - Add profiler screenshots functionality to NativeLayerSnapshotter. r=mattwoodrow
Depends on D59157

Differential Revision: https://phabricator.services.mozilla.com/D59158
2020-08-27 03:55:53 +00:00
Narcis Beleuzu
c259d84931 Backed out 4 changesets (bug 1658856, bug 1592031) for bustages on ScreenshotGrabber.h . CLOSED TREE
Backed out changeset 6d54a1050bbd (bug 1658856)
Backed out changeset 19145f742503 (bug 1592031)
Backed out changeset 5db68a6a5bc2 (bug 1592031)
Backed out changeset 925e3b179b9b (bug 1592031)
2020-08-22 02:06:39 +03:00
Markus Stange
1191e4de06 Bug 1592031 - Add profiler screenshots functionality to NativeLayerSnapshotter. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D59158
2020-08-21 22:44:26 +00:00
Markus Stange
a66383c120 Bug 1658407 - Set correct transforms on the opaqueness tinting layers. r=mattwoodrow
mOpaquenessTintLayer is a sibling layer of mContentCALayer, so the two layers
need the same transform and bounds.

This patch also removes an unnecessary twiddling of the position property.

Differential Revision: https://phabricator.services.mozilla.com/D86610
2020-08-11 14:37:56 +00:00
Matt Woodrow
8cc57f6b55 Bug 1657428 - Use correct interpolation mode for native compositing layers. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D86090
2020-08-06 21:14:45 +00:00
Matt Woodrow
87db131e32 Bug 1653048 - Add support for external images in the wr::Compositor API, and implement it for MacOS IOSurfaces. r=mstange,gw
Differential Revision: https://phabricator.services.mozilla.com/D84638
2020-08-04 01:19:59 +00:00
Matt Woodrow
01b5738a5d Bug 1653166 - Add transforms to WebRender Compositor API. r=gw,mstange,sotaro
Differential Revision: https://phabricator.services.mozilla.com/D84328
2020-08-04 01:19:59 +00:00
Markus Stange
4c8b889f5e Bug 1646066 - Make partial valid rects work properly in NativeLayerCA. r=jrmuizel
This moves the clipping responsibility into the layer. It also brings back
assertions that make sure that no invalid content reaches the screen.
On the layer side I'm renaming validRect to displayRect, because at the time
NextSurface* is called, that rect is not yet valid.
This implementation also allows having valid content outside of the display
rect. So, for example, if you grow and shrink the display rect multiple times
but most of the outer parts are transparent, in theory this allows you to paint
the transparent pixels only once rather than every time the display rect
expands.

Differential Revision: https://phabricator.services.mozilla.com/D79842
2020-06-18 22:15:22 +00:00
Jeff Gilbert
a97c615de2 Bug 1632249 - Support compositing out-of-process WebGL. r=handyman,lsalzman,nical,geckoview-reviewers,agi,imanol
* Majorly simplity CanvasRenderer
* Replace GLScreenBuffer with trivial GLSwapChain
* Use descriptor structs so that future SharedSurface changes aren't so painful
  to propagate
* Mortgage/strip out more OffscreenCanvas code for now

Differential Revision: https://phabricator.services.mozilla.com/D75055
2020-06-15 18:25:55 +00:00
Dorel Luca
255f146f14 Backed out 7 changesets (bug 1632249) for Gtest perma chrash in [@ mozilla::BlockingResourceBase::CheckAcquire()]. CLOSED TREE
Backed out changeset 4ff99aab3ee8 (bug 1632249)
Backed out changeset d5b7fe789001 (bug 1632249)
Backed out changeset 64fbb616a0f3 (bug 1632249)
Backed out changeset 6f19f43e0a0b (bug 1632249)
Backed out changeset 073302d26c5e (bug 1632249)
Backed out changeset 7c94d37c446e (bug 1632249)
Backed out changeset 204b899f436d (bug 1632249)
2020-06-11 19:44:20 +03:00
Jeff Gilbert
cf3c8fedea Bug 1632249 - Support compositing out-of-process WebGL. r=handyman,lsalzman,nical,geckoview-reviewers,agi,imanol
* Majorly simplity CanvasRenderer
* Replace GLScreenBuffer with trivial GLSwapChain
* Use descriptor structs so that future SharedSurface changes aren't so painful
  to propagate
* Mortgage/strip out more OffscreenCanvas code for now

Differential Revision: https://phabricator.services.mozilla.com/D75055
2020-06-11 06:37:35 +00:00
Mihai Alexandru Michis
59ad7ed333 Backed out 6 changesets (bug 1632249) for causing bustages in CanvasRenderingContext2D.cpp
CLOSED TREE

Backed out changeset c93972b05d4f (bug 1632249)
Backed out changeset 04f5127c85d5 (bug 1632249)
Backed out changeset b15d91e64a25 (bug 1632249)
Backed out changeset 71ad2ed8e9ba (bug 1632249)
Backed out changeset 6e9a89ead3a5 (bug 1632249)
Backed out changeset dd00e2da3a0f (bug 1632249)
2020-06-11 02:43:35 +03:00
Jeff Gilbert
9b09e54345 Bug 1632249 - Support compositing out-of-process WebGL. r=handyman,lsalzman,nical,geckoview-reviewers,agi,imanol
* Majorly simplity CanvasRenderer
* Replace GLScreenBuffer with trivial GLSwapChain
* Use descriptor structs so that future SharedSurface changes aren't so painful
  to propagate
* Mortgage/strip out more OffscreenCanvas code for now

Differential Revision: https://phabricator.services.mozilla.com/D75055
2020-06-10 22:21:02 +00:00
Dorel Luca
7289b66d6f Backed out 4 changesets (bug 1632249) for Build bustages and mda failures. CLOSED TREE
Backed out changeset cdaa8a4e9e36 (bug 1632249)
Backed out changeset 9ff26bcc580c (bug 1632249)
Backed out changeset 16d84439756f (bug 1632249)
Backed out changeset bbfe23c61add (bug 1632249)
2020-06-09 03:19:48 +03:00
Jeff Gilbert
de6377896c Bug 1632249 - Support compositing out-of-process WebGL. r=handyman,lsalzman,nical,geckoview-reviewers,agi,imanol
* Majorly simplity CanvasRenderer
* Replace GLScreenBuffer with trivial GLSwapChain
* Use descriptor structs so that future SharedSurface changes aren't so painful
  to propagate
* Mortgage/strip out more OffscreenCanvas code for now

Differential Revision: https://phabricator.services.mozilla.com/D75055
2020-06-08 20:34:15 +00:00
Glenn Watson
31585fc1e6 Bug 1608717 - Support per-tile clip (valid) region for native compositor implementations. r=sotaro,mstange
For Draw (non-native) and CA modes, we include the per-tile
valid rect in the clip rect from the surface.

For DC (non-virtual) mode, a per-tile clip rect is set on the
visual for each tile, separate from the overall clip rect that
is set on the surface visual.

For DC (virtual) mode, the Trim API is used to remove pixels
in the virtual tile area that are outside the valid / clipped
region.

Note: Although the valid rect is now applied in the native
compositors, it's currently only based on the overall picture
cache bounding rect. Thus, with this patch there isn't any
noticeable performance improvement. Once this lands and is
working correctly, the follow up patch to calculate a smaller
valid region per-tile is a small amount of work.

Differential Revision: https://phabricator.services.mozilla.com/D61424

--HG--
extra : moz-landing-system : lando
2020-02-12 04:27:15 +00:00
Markus Stange
19bbc2e73c Bug 1607777 - Clear areas that CARenderer repaints, so that old content doesn't accomulate in transparent areas such as the tab bar. r=jrmuizel
I consider this to be a bug in CARenderer. According to https://stackoverflow.com/questions/56150363/rendering-animated-calayer-off-screen-using-carenderer-with-mtltexture the Metal implementation has the same bug.

Differential Revision: https://phabricator.services.mozilla.com/D59156

--HG--
extra : moz-landing-system : lando
2020-01-29 12:48:03 +00:00
Markus Stange
0a370169dc Bug 1607777 - Fix CARenderer invalidation when the buffer size changes. r=jrmuizel
addUpdateRect needs to be called after beginFrame, otherwise it doesn't do anything.

Differential Revision: https://phabricator.services.mozilla.com/D59155

--HG--
extra : moz-landing-system : lando
2020-01-29 12:47:22 +00:00
Markus Stange
40367ae22a Bug 1607777 - When using CARenderer on HiDPI, pass device pixels to the glOrtho call and use a sublayerTransform on the root CALayer. r=jrmuizel
The CARenderer documentation does not provide any guidance on how to use CARenderer with different resolutions.
In the initial implementation I simply tried the following: Make a device-pixel sized framebuffer, call glViewport with the device pixel size, and then call glOrtho with the "point" size. And this seemed to work.
However, it doesn't always work. When hooking up profiler screenshots, I noticed that in some cases, some layers would just not be rendered. Sometimes I even saw layers show up in wrong places.
After this patch, these problems no longer appear.

Differential Revision: https://phabricator.services.mozilla.com/D59154

--HG--
extra : moz-landing-system : lando
2020-01-29 12:46:44 +00:00
Markus Stange
adfb18b9ed Bug 1592026 - Add a NativeLayerRootSnapshotter API and implement it with CARenderer. r=jrmuizel
Suggestions for a better name than "snapshotter" are welcome.
This is a separate object so that the lifetime of its GLContext isn't governed by the lifetime of the NativeLayerRootCA.
The NativeLayerRootCA gets destroyed on the main thread, but GLContext uses non-threadsafe weak pointer support, so it wants to be destroyed on the same thread that it was created on.
So now the GLContext lives on the snapshotter, which is created and destroyed on the renderer thread.

Differential Revision: https://phabricator.services.mozilla.com/D57068

--HG--
extra : moz-landing-system : lando
2019-12-29 12:20:28 +00:00
Markus Stange
ea3d0df95b Bug 1592026 - Make NativeLayer(Root)CA build two representations: an onscreen representation and an offscreen representation. r=jrmuizel
The onscreen representation is attached to the NSView.
The offscreen representation is free-floating but will be used in a CARenderer in an upcoming patch.

Each representation is only updated on demand.

Differential Revision: https://phabricator.services.mozilla.com/D57067

--HG--
extra : moz-landing-system : lando
2019-12-29 12:20:09 +00:00
Markus Stange
0a274af543 Bug 1592026 - Move the responsibility of applying NativeLayerCA changes to native CALayers into a Representation struct. r=jrmuizel
This will allow us to have two representations per NativeLayerCA in the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D57066

--HG--
extra : moz-landing-system : lando
2019-12-29 12:19:51 +00:00
Markus Stange
f3af2c5fa0 Bug 1592026 - Replace separate mReadySurface field with a bool mMutatedFrontSurface. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D57065

--HG--
extra : moz-landing-system : lando
2019-12-29 12:19:31 +00:00
Markus Stange
7385a343e6 Bug 1592026 - Clear sublayers on layer root destruction. This addresses a fixme. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D57064

--HG--
extra : moz-landing-system : lando
2019-12-29 12:19:14 +00:00
Markus Stange
5b30e92ef7 Bug 1592026 - Create AutoCATransaction. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D57063

--HG--
extra : moz-landing-system : lando
2019-12-29 12:18:56 +00:00
Markus Stange
c96a136f94 Bug 1592026 - Move AsyncCATransaction suspension into NativeLayerRootCA. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D57061

--HG--
extra : moz-landing-system : lando
2019-12-29 12:18:32 +00:00
Markus Stange
a090f2ff17 Bug 1592026 - Reorder some methods and add a getter for the backing scale. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D57060

--HG--
extra : moz-landing-system : lando
2019-12-29 12:18:30 +00:00
Markus Stange
b1b5061130 Bug 1599251 - Don't keep surfaces which never become unused in NativeLayer::mSurfaces. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D55578

--HG--
extra : moz-landing-system : lando
2019-12-18 20:34:43 +00:00
Markus Stange
d1c4429158 Bug 1599251 - Don't leave unused surfaces in the swap chain. r=jrmuizel
When updating the layer at 60fps, the surface that we would be leaving behind
here would usually still be in use at the time this method was called.
But when some time has passed since the last update, usually all surfaces in
mSurfaces are no longer "in use" so we can "compress" the swap chain to be
double-buffered.

Differential Revision: https://phabricator.services.mozilla.com/D54860

--HG--
extra : moz-landing-system : lando
2019-12-18 20:34:28 +00:00
Markus Stange
0f70058b6f Bug 1592044 - Reduce the frequency of IOSurface and framebuffer creation and destruction with the help of a surface pool. r=jgilbert
There are multiple SurfacePools: Main thread painting and the non-WebRender compositors create a new pool per window, and WebRender creates one shared pool across all windows. The non-WebRender users set the pool size limit to zero, i.e. no recycling across paints. This preserves the pre-existing behavior.
WebRender's pool size is configurable with the gfx.webrender.compositor.surface-pool-size pref.
Every window holds on to a SurfacePoolHandle. A SurfacePoolHandle has an owning reference to the pool, via a surface pool wrapper. Once all handles are gone, the surface pool goes away, too.
The SurfacePool holds on to IOSurfaces and MozFramebuffers. Both are created on demand, independently, but are associated with each other.
A given NativeLayer uses only one surface pool handle during its lifetime. The native layer no longer influences which GLContext its framebuffers are created for; the GL context is now managed by the surface pool handle.
As a result, a NativeLayer can no longer change which GLContext its framebuffers are created by.
So in the future, if we ever need to migrate a window frome one GLContext to another, we will need to recreate the NativeLayers inside it. I think that's ok.

Differential Revision: https://phabricator.services.mozilla.com/D54859

--HG--
extra : moz-landing-system : lando
2019-12-18 21:01:51 +00:00
Markus Stange
27710815d4 Bug 1596955 - Add opaqueness tinting to NativeLayerCA. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D53289

--HG--
extra : moz-landing-system : lando
2019-11-25 19:06:16 +00:00
Markus Stange
3faf29b5c5 Bug 1592150 - Remove CurrentSurfaceInvalidRegion(). Callers now always just repaint the update region that they supplied. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D51761

--HG--
extra : moz-landing-system : lando
2019-11-19 03:11:26 +00:00
Markus Stange
274b0d6329 Bug 1592150 - Make NativeLayer::NextSurfaceAs* copy existing drawing from previous buffers so that only the update region needs to be drawn. r=jrmuizel
There are three reasons for doing this.
1. It makes the NativeLayer API more compatible with DirectComposition.
2. Copying existing content may be faster than redrawing those pixels. Redrawing
   might have some amount of overdraw which takes up more memory bandwidth.
3. Most importantly: Partial updates now have "unidirectional flow of information":
   The renderer decides which area to redraw, and it redraws exactly that area.

In the past, partial updates required the following dance:
 - Figure out what area changed in this frame. Call that area A.
 - Invalidate that area in the NativeLayer.
 - Get the next surface for drawing from the layer.
 - Request the actual invalid area in the current surface. Call that area B.
 - Redraw B.

Now with this change, the renderer no longer needs to care about B, and can just
redraw what changed in the current frame (A).
This is useful for WebRender because WebRender prepares drawing commands on a separate thread
before it executes them on the render thread. And at the time of preparation, WebRender does
not have access to the native layer. It needs to know what to draw ahead of time.

Differential Revision: https://phabricator.services.mozilla.com/D51760

--HG--
extra : moz-landing-system : lando
2019-11-19 03:11:13 +00:00
Markus Stange
334a48fd7d Bug 1592150 - Move a step in the NativeLayerCA swap chain from mSurfaces to a new field called mFrontSurface. r=jrmuizel
This gives us easy access to a surface that has valid content. In the next patch,
we will use this surface to copy valid content from.

Differential Revision: https://phabricator.services.mozilla.com/D51759

--HG--
extra : moz-landing-system : lando
2019-11-19 03:10:58 +00:00
Markus Stange
4c5a3f3272 Bug 1594950 - Remove unused SurfaceRegistry API. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D51758

--HG--
extra : moz-landing-system : lando
2019-11-13 18:33:24 +00:00
Markus Stange
ba013d0f42 Bug 1594950 - Change NextSurface APIs to accept a dirty region, and remove the public method InvalidateRegionThroughoutSwapchain. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D50878

--HG--
extra : moz-landing-system : lando
2019-11-13 18:55:18 +00:00
Markus Stange
80c235777f Bug 1594950 - Bake the layer size and its opaqueness into the layer, don't allow mutating it. r=jrmuizel
These settings are now supplied during layer creation and never change.
Consumers must now create new NativeLayer objects if they want to change size or toggle opaqueness.
This aligns the NativeLayer API with DirectComposition's capabilities. It also simplifies swap chain
management.

Differential Revision: https://phabricator.services.mozilla.com/D51757

--HG--
extra : moz-landing-system : lando
2019-11-13 18:46:02 +00:00
Cosmin Sabou
1d71e9f510 Backed out 4 changesets (bug 1594950) for turning bug 1405083 into permafail.
Backed out changeset 684a87e91d94 (bug 1594950)
Backed out changeset adea6912c3a3 (bug 1594950)
Backed out changeset aea7108204e9 (bug 1594950)
Backed out changeset 15baea8520de (bug 1594950)
2019-11-13 06:44:24 +02:00
Markus Stange
012de1a3a6 Bug 1594950 - Remove unused SurfaceRegistry API. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D51758

--HG--
extra : moz-landing-system : lando
2019-11-12 19:50:26 +00:00
Markus Stange
2db4b324b7 Bug 1594950 - Change NextSurface APIs to accept a dirty region, and remove the public method InvalidateRegionThroughoutSwapchain. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D50878

--HG--
extra : moz-landing-system : lando
2019-11-12 19:50:26 +00:00
Markus Stange
82452d888a Bug 1594950 - Bake the layer size and its opaqueness into the layer, don't allow mutating it. r=jrmuizel
These settings are now supplied during layer creation and never change.
Consumers must now create new NativeLayer objects if they want to change size or toggle opaqueness.
This aligns the NativeLayer API with DirectComposition's capabilities. It also simplifies swap chain
management.

Differential Revision: https://phabricator.services.mozilla.com/D51757

--HG--
extra : moz-landing-system : lando
2019-11-12 19:50:25 +00:00
Markus Stange
e8d0a3ca81 Bug 1593325 - Use NextSurfaceAsDrawTarget in nsChildView. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D50876

--HG--
extra : moz-landing-system : lando
2019-11-05 18:59:36 +00:00
Markus Stange
e2f8c029aa Bug 1591523 - Add NativeLayerRoot::SetLayers. r=jrmuizel
This allows us to somewhat cheaply swap out the entire set of layers.
It also means that clearing the array of layers no longer has quadratic complexity;
in the past, you would do this by calling RemoveLayer once per layer, and RemoveLayer
does a linear scan through the array.

Differential Revision: https://phabricator.services.mozilla.com/D50725

--HG--
extra : moz-landing-system : lando
2019-10-29 20:31:44 +00:00