Commit Graph

1310 Commits

Author SHA1 Message Date
Jean-Yves Avenard
8fd158d479 Bug 1649684 - Use the current nsISerialEventTarget with the various process hosts. r=nika
In all those cases, the current nsISerialEventTarget is either the main thread or the MessageChannel's nsISerialEventTarget (since bug 1634846)

Differential Revision: https://phabricator.services.mozilla.com/D81966
2020-07-02 22:59:24 +00:00
Jeff Gilbert
017fc801d8 Bug 1647167 - Run pre/post transaction triggers in BasicCanvasLayer::Paint. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D82116
2020-07-02 22:55:48 +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
Sylvestre Ledru
85c05f3a47 Bug 1519636 - Reformat recent changes to the Google coding style r=andi
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D79795
2020-06-16 14:37:23 +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
Kartikaya Gupta
c840d0f81a Bug 1627716 - Remove now-unused SetRenderOffset code related to DynamicToolbarAnimator. r=jrmuizel
Depends on D71776

Differential Revision: https://phabricator.services.mozilla.com/D71777
2020-04-22 11:50:40 +00:00
Andrew Osmond
91b071ed14 Bug 1618345 - Enforce proper color management by splitting gfx::Color into sRGBColor and DeviceColor types. r=jrmuizel
gfx::Color is currently misused in many places. The DrawTargets expect
the color space to be in device space, e.g. what we are actually going
to draw using. Everything sitting above generally deals with sRGB, as
specified in CSS. Sometimes we missed the conversion from sRGB to device
space when issuing draw calls, and similarly sometimes we converted the
color to device space twice.

This patch splits the type in two. sRGBColor and DeviceColor now
represent sRGB and device color spaces respectively. DrawTarget only
accepts DeviceColor, and one can get a DeviceColor from an sRGBColor via
the ToDeviceColor helper API. The reftests now pass with color
management enabled for everything (e.g. CSS) instead of just tagged
raster images.

There will be a follow up patch to enable color management everywhere by
default on all supported platforms.

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

--HG--
extra : moz-landing-system : lando
2020-03-09 14:16:17 +00:00
Simon Giesecke
dce1e48caf Bug 1613985 - Use default for equivalent-to-default constructors/destructors in gfx. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D65288

--HG--
extra : moz-landing-system : lando
2020-03-04 15:39:20 +00:00
Simon Giesecke
9350e6b741 Bug 1613985 - Use MOZ_COUNTED_DEFAULT_CTOR_*/MOZ_COUNTED_DTOR_* macros. r=froydnj
This removes the need for explicit #ifdef NS_BUILD_REFCNT_LOGGING without
introducing user-defined destructors when it is not defined.

Also, some uses of virtual for declaring destructors are replaced by the
appropriate override declaration through these changes.

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

--HG--
extra : moz-landing-system : lando
2020-02-20 11:40:14 +00:00
Dorel Luca
d5f9df8ee1 Backed out 2 changesets (bug 1613985) for Build bustage on Windows2012. CLOSED TREE
Backed out changeset fd177b40b561 (bug 1613985)
Backed out changeset fb6d62b7f28d (bug 1613985)
2020-02-19 22:22:41 +02:00
Simon Giesecke
59b23375c0 Bug 1613985 - Use MOZ_COUNTED_DEFAULT_CTOR_*/MOZ_COUNTED_DTOR_* macros. r=froydnj
This removes the need for explicit #ifdef NS_BUILD_REFCNT_LOGGING without
introducing user-defined destructors when it is not defined.

Also, some uses of virtual for declaring destructors are replaced by the
appropriate override declaration through these changes.

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

--HG--
extra : moz-landing-system : lando
2020-02-19 18:05:38 +00:00
Sylvestre Ledru
cc2040bf21 Bug 1605934 - Use nested namespaces r=sg
Done with:
./mach static-analysis check --checks="-*, modernize-concat-nested-namespaces" --fix .
and then clang-format on the files

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

--HG--
extra : moz-landing-system : lando
2020-01-18 13:48:34 +00:00
Dorel Luca
506e65bcab Backed out changeset bbb39655cf71 (bug 1605934) for build bustage in widget/gtk/mozwayland/mozwayland.c 2020-01-18 15:39:55 +02:00
Sylvestre Ledru
6689a37527 Bug 1605934 - Use nested namespaces r=sg
Done with:
./mach static-analysis check --checks="-*, modernize-concat-nested-namespaces" --fix .
and then clang-format on the files

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

--HG--
extra : moz-landing-system : lando
2020-01-18 13:16:39 +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
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
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
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
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
96d209cbf3 Bug 1578099 - Use NativeLayer::NextSurfaceAsDrawTarget in BasicCompositor and remove #ifdefs. r=mattwoodrow
Depends on D44322

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

--HG--
extra : moz-landing-system : lando
2019-09-01 21:37:08 +00:00
Markus Stange
e9142df968 Bug 1574745 - Move ShouldRecordFrames() from BasicCompositor to Compositor because CompositorOGL will need it. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D43875

--HG--
extra : moz-landing-system : lando
2019-08-30 19:52:15 +00:00
Markus Stange
8490842d2f Bug 1574745 - Calculate mShouldInvalidateWindow at the beginning of the frame. r=mattwoodrow
This is so that we can invalidate all layers when screenshot profiling has
started, and not just the first layer.

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

--HG--
extra : moz-landing-system : lando
2019-08-30 19:52:13 +00:00
Markus Stange
611b0edd41 Bug 1574745 - Add BeginFrameForNativeLayers() and Begin/EndRenderingToNativeLayer. r=mattwoodrow
This will let us render into multiple layers within one compositor frame.

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

--HG--
extra : moz-landing-system : lando
2019-08-30 21:37:55 +00:00
Markus Stange
603b907093 Bug 1574745 - Add BeginFrameForTarget and replace Set/ClearTargetContext. r=mattwoodrow
This removes any *TargetContext methods from the Compositor interface and moves
 mTarget tracking into the compositor implementations.

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

--HG--
extra : moz-landing-system : lando
2019-08-30 19:51:59 +00:00
Markus Stange
5dc3f8c82a Bug 1574745 - Rename BeginFrame to BeginFrameForWindow. r=mattwoodrow
In the end we want to have BeginFrameForWindow, BeginFrameForTarget, and
BeginFrameForNativeLayers, the latter with multiple Begin/EndRenderingToNativeLayer
pairs nested inside.

This is the first step.

CompositorOGL and CompositorD3D11 keep their internal BeginFrame method but make
it private.

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

--HG--
extra : moz-landing-system : lando
2019-08-30 19:51:55 +00:00
Markus Stange
e8fb08f553 Bug 1574745 - Prepare BasicCompositor for layers that are not located at (0, 0). r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D43867

--HG--
extra : moz-landing-system : lando
2019-08-30 19:49:27 +00:00
Markus Stange
c9db8b17d1 Bug 1574745 - Use an explicit offset to deal with the fact that aClipRect in Compositor::DrawGeometry is relative to (0, 0) for the root render target, and not in the render target's device space. r=mattwoodrow
aClipRect is relative to
closestAncestorContainerLayerWithIntermediateSurface->GetVisibleRegion().GetBounds().TopLeft()
or (0, 0) if there is no ancestor with an intermediate surface.
It gets computed by Layer::CalculateScissorRect.
So if there is an intermediate surface, that origin matches the render target
origin. But if there is no intermediate surface, it does not always match: the
root render target's origin is not necessarily (0, 0).

In the past, BasicCompositor dealt with this by using the transform on the root
render target's mDrawTarget, which gets set in CreateRenderTargetAndClear
(renamed to CreateRootRenderTarget in this patch). Render targets created in the
regular CreateRenderTarget did not have a transform.
This allowed DrawGeometry to only conditionally apply an offset to aClipRect;
the offset was applied by calling PushClipRect before resetting the transform.
Now all render targets have a translation by -offset on their DrawTarget, not
just the root render target.

I went with an explicit "clip space origin" field on the render target.
Other alternatives would have been:
 - Having a bool IsRootRenderTarget() and using that to conditionally offset
   aClipRect by the render target origin or not.
 - Changing Layer::CalculateScissorRect so that the clip space origin is always
   (0, 0). I actually tried this first but ran into trouble with the MLGPU code.
   We can do it later.

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

--HG--
extra : moz-landing-system : lando
2019-08-30 19:49:14 +00:00
Markus Stange
371563a53d Bug 1576499 - Remove BasicCompositor::mInvalidRect. r=mattwoodrow
It was only used in BeginFrame.

Depends on D43384

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

--HG--
extra : moz-landing-system : lando
2019-08-28 21:51:46 +00:00
Markus Stange
15208cabec Bug 1576499 - Clarify dest and buffer a little. r=mattwoodrow
The old code was making an autoRestoreTransform around dest and then quickly
overwriting dest with something new. I prefer creating the autoRestoreTransform
for buffer, which doesn't change over the course of this function.

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

--HG--
extra : moz-landing-system : lando
2019-08-28 21:50:27 +00:00
Markus Stange
044cc84a21 Bug 1576499 - Two random cleanups. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D43383

--HG--
extra : moz-landing-system : lando
2019-08-28 21:47:47 +00:00
Markus Stange
7d2a67390b Bug 1576499 - Eliminate mDrawTarget and mDrawTargetBounds. Add mFrontBuffer which is only used when drawing to a back buffer. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D43382

--HG--
extra : moz-landing-system : lando
2019-08-28 21:46:38 +00:00
Markus Stange
5726bb939e Bug 1576499 - Use mRenderTarget->mDrawTarget to create similar draw targets in CreateDrawTarget. r=mattwoodrow
This removes one user of mDrawTarget.

This change only makes a difference when we have a backbuffer; now we will create
DrawTargets that are similar to the back buffer instead of the front buffer.

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

--HG--
extra : moz-landing-system : lando
2019-08-27 20:35:44 +00:00
Markus Stange
2e7bfc34bb Bug 1576499 - Move back buffer creation out of CreateRenderTargetForWindow into BeginFrame. r=mattwoodrow
This makes it clear that only one of the possible call paths of
CreateRenderTargetForWindow can use a back buffer.
It causes some unfortunate duplication of the clear region computation.

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

--HG--
extra : moz-landing-system : lando
2019-08-27 08:20:49 +00:00
Markus Stange
c94dc585ca Bug 1576499 - Split off EndRemoteDrawing from TryToEndRemoteDrawing and call it directly instead of calling TryToEndRemoteDrawing(true). r=mattwoodrow
This eliminates a boolean parameter whose meaning is not immediately obvious at the call site.

Depends on D43378

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

--HG--
extra : moz-landing-system : lando
2019-08-27 08:17:21 +00:00
Markus Stange
24bf8a7ca3 Bug 1576499 - Don't call TryToEndRemoteDrawing() in EndFrame when rendering to a copy target. r=mattwoodrow
None of the three main if branches in TryToEndRemoteDrawing were entered in that case:
 - if (!aForceToEnd && !mTarget && NeedsToDeferEndRemoteDrawing()) wasn't entered because
   mTarget was non-null.
 - if (mRenderTarget->mDrawTarget != mDrawTarget) wasn't entered because mTarget
   drawing doesn't use a back buffer.
 - if (aForceToEnd || !mTarget) wasn't entered because aForceToEnd was false and
   mTarget was non-null.

Depends on D43377

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

--HG--
extra : moz-landing-system : lando
2019-08-27 08:16:39 +00:00
Markus Stange
9c65656d3a Bug 1576499 - Move all mFullWindowRenderTarget maintenance to NormalDrawingDone(). r=mattwoodrow
It turns out there's not much benefit to creating the DrawTarget at the beginning of the frame.
It's only needed between NormalDrawingDone() and EndFrame().

Depends on D43376

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

--HG--
extra : moz-landing-system : lando
2019-08-27 08:15:08 +00:00
Markus Stange
05e96272fa Bug 1576499 - Turn aRenderBoundsOut outparam into a Maybe<> return value. r=mattwoodrow
Depends on D43375

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

--HG--
extra : moz-landing-system : lando
2019-08-26 00:58:45 +00:00
Markus Stange
865a952e99 Bug 1576499 - Turn aClipRectIn into a Maybe and rename it to aClipRect, now that aClipRectOut is gone. r=mattwoodrow
Depends on D43372

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

--HG--
extra : moz-landing-system : lando
2019-08-26 00:58:44 +00:00
Markus Stange
833a05e47e Bug 1576499 - Remove aClipRectOut parameter from Compositor::BeginFrame(). r=mattwoodrow
Whenever *aRenderBoundsOut was non-empty and aClipRectOut was non-null,
*aClipRectOut was set to the same value as *aRenderBoundsOut.

Depends on D43368

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

--HG--
extra : moz-landing-system : lando
2019-08-26 00:58:43 +00:00
Markus Stange
ec9eb77ab3 Bug 1576499 - Change where aClipRectOut is set, in two BeginFrame implementations. r=mattwoodrow
There are three circumstances that make these transformations equivalent:
 - aClipRectIn and aClipRectOut are never both non-null.
 - The value of *aClipRectOut is ignored if *aRenderBoundsOut is empty.
 - aRenderBounds.TopLeft() is always (0, 0) because the ClientLayerManager
   calls targetBounds.MoveTo(0, 0) on the rect that eventually becomes
   aRenderBounds.
   (targetBounds -> Transaction::mTargetBounds -> TargetConfig::naturalBounds()
    -> LayerManagerComposite::mRenderBounds)

Depends on D43367

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

--HG--
extra : moz-landing-system : lando
2019-08-26 00:58:43 +00:00
Markus Stange
4b62be12b9 Bug 1576499 - Improve various rect things in BeginFrame implementations, no functional changes. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D43367

--HG--
extra : moz-landing-system : lando
2019-08-26 00:58:43 +00:00
Sylvestre Ledru
843fae6aee Bug 1577236 - clang-10: Fix -Wimplicit-int-float-conversion warnings in gfx/ r=nical
Differential Revision: https://phabricator.services.mozilla.com/D43776

--HG--
extra : moz-landing-system : lando
2019-08-28 21:31:26 +00:00
Markus Stange
e0e54098e9 Bug 1574592 - Move NativeLayer management out of nsChildView and into LayerManagerComposite and RendererOGL. r=mattwoodrow
It looks like a big patch but it's mostly just moved code, with some duplication:
 - Layer creation and destruction moves to LayerManagerComposite and RendererOGL.
 - BasicCompositor IOSurface setup code moves to BasicCompositor.cpp.
 - OpenGL IOSurface setup code moves to CompositorOGL and RenderCompositorOGL.

The duplication is a bit unfortunate but the LayerManagerComposite code will
diverge from the WebRender code soon.

BeginFrame gets a new argument aNativeLayer. This argument will go away again
over the course of this patch queue. But for now, BeginFrame is the best place
to do the layer setup because it's a very close place to PreRender which is
where that code was previously.

I wasn't able to think of a nice way to give CompositorOGL and BasicCompositor
platform-specific behavior without #ifdefs. So now LayerManagerComposite uses
the "cross-platform" NativeLayer interface, but CompositorOGL and
BasicCompositor use NativeLayerCA because they actually need the IOSurface, and
they do that in #ifdef'd code.
Luckily, NativeLayerCA.h can be included in both .cpp files and in .mm files.

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

--HG--
extra : moz-landing-system : lando
2019-08-25 17:43:42 +00:00
Markus Stange
529ee470f1 Bug 1573343 - Destroy mFullWindowRenderTarget in a different place. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D42415

--HG--
extra : moz-landing-system : lando
2019-08-19 22:41:27 +00:00