Closed Bug 1574745 Opened 3 months ago Closed 3 months ago

Preparations for native layers that only cover part of the window

Categories

(Core :: Graphics: Layers, task)

task
Not set

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: mstange, Assigned: mstange)

References

Details

Attachments

(15 files, 3 obsolete files)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
No description provided.
Attached file Bug 1574745 - Two random cleanups. (obsolete) —
Depends on: 1576499

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, this was dealt with using the transform on the root render target's
mDrawTarget, which gets set in CreateRenderTargetForWindow (renamed to
CreateRootRenderTarget in this patch). Render targets created in the regular
CreateRenderTarget did not have a 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.
Attachment #9086258 - Attachment description: Bug 1574745 - Prepare CompositorOGL for native layers that are not located at (0, 0), part one. → Bug 1574745 - Prepare CompositorOGL for native layers that are not located at (0, 0).

TransformAndClipBounds already clips destRect to renderBounds. However, if the
resulting rect is empty, the Inflate call would make it non-empty again. And now
the decision whether we would cull would depend on the rect's position:
Sometimes TransformAndClipBounds would place the empty rect at a position along
an edge of renderBounds, and then the inflated-from-nothingness 2x2 rect would
overlap and we wouldn't cull.

Depends on D43869

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.

Depends on D43870

This will let us render into multiple layers within one compositor frame.

Depends on D43872

This makes profiler screenshots and frame recording work again, when native
layers are used.

Depends on D43876

This change groups the work that has to be done per compositing tile.

Depends on D43877

Attachment #9086259 - Attachment is obsolete: true
Attachment #9086256 - Attachment is obsolete: true
Attachment #9086257 - Attachment is obsolete: true
Attachment #9088908 - Attachment description: Bug 1574745 - Use an explicit offset to deal with the fact that aClipRect in DrawGeometry is relative to (0, 0) for the root render target, and not in the render target's device space. → 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
Attachment #9088909 - Attachment description: Bug 1574745 - Prepare BasicCompositor for layers that are not located at (0, 0). → Bug 1574745 - Prepare BasicCompositor for layers that are not located at (0, 0). r=mattwoodrow
Attachment #9088910 - Attachment description: Bug 1574745 - Treat aClipRect in CompositorOGL::DrawGeometry correctly when drawing to a root render target that's not at (0, 0). → Bug 1574745 - Treat aClipRect in CompositorOGL::DrawGeometry correctly when drawing to a root render target that's not at (0, 0). r=mattwoodrow
Attachment #9086258 - Attachment description: Bug 1574745 - Prepare CompositorOGL for native layers that are not located at (0, 0). → Bug 1574745 - Prepare CompositorOGL for native layers that are not located at (0, 0). r=mattwoodrow
Attachment #9088911 - Attachment description: Bug 1574745 - Respect render target clip during DrawGeometry culling and overdraw pixel counting. → Bug 1574745 - Respect render target clip during DrawGeometry culling and overdraw pixel counting. r=mattwoodrow
Attachment #9088912 - Attachment description: Bug 1574745 - Make DrawGeometry culling work more reliably. → Bug 1574745 - Make DrawGeometry culling work more reliably. r=mattwoodrow
Attachment #9088913 - Attachment description: Bug 1574745 - Rename BeginFrame to BeginFrameForWindow. → Bug 1574745 - Rename BeginFrame to BeginFrameForWindow. r=mattwoodrow
Attachment #9088914 - Attachment description: Bug 1574745 - Add BeginFrameForTarget. This removes any *TargetContext methods from the Compositor interface and moves mTarget tracking into the compositor implementations. → Bug 1574745 - Add BeginFrameForTarget and replace Set/ClearTargetContext. r=mattwoodrow
Attachment #9088915 - Attachment description: Bug 1574745 - Add BeginFrameForNativeLayers() and Begin/EndRenderingToNativeLayer. → Bug 1574745 - Add BeginFrameForNativeLayers() and Begin/EndRenderingToNativeLayer. r=mattwoodrow
Attachment #9088916 - Attachment description: Bug 1574745 - Calculate mShouldInvalidateWindow at the beginning of the frame so that we can invalidate all layers when screenshot profiling has started, and not just the first layer. → Bug 1574745 - Calculate mShouldInvalidateWindow at the beginning of the frame. r=mattwoodrow
Attachment #9088917 - Attachment description: Bug 1574745 - Move ShouldRecordFrames() from BasicCompositor to Compositor because CompositorOGL will need it. → Bug 1574745 - Move ShouldRecordFrames() from BasicCompositor to Compositor because CompositorOGL will need it. r=mattwoodrow
Attachment #9088919 - Attachment description: Bug 1574745 - Maintain a full window render target when rendering to native layers with CompositorOGL. → Bug 1574745 - Maintain a full window render target when rendering to native layers with CompositorOGL. r=mattwoodrow
Attachment #9088920 - Attachment description: Bug 1574745 - Reorder layer rendering invocations. → Bug 1574745 - Reorder layer rendering invocations. r=mattwoodrow
Attachment #9088921 - Attachment description: Bug 1574745 - Get everything ready for rendering into multiple native layers. → Bug 1574745 - Get everything ready for rendering into multiple native layers. r=mattwoodrow
Attachment #9088918 - Attachment description: Bug 1574745 - Add BlitFrameBufferToFrameBuffer variant that supports rects. Keep the existing API that takes sizes. r=jgilbert → Bug 1574745 - Change BlitFrameBufferToFrameBuffer to take rects instead of sizes. r=jgilbert
Pushed by mstange@themasta.com:
https://hg.mozilla.org/integration/autoland/rev/610cc17c5832
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
https://hg.mozilla.org/integration/autoland/rev/8a64ef16fc2e
Prepare BasicCompositor for layers that are not located at (0, 0). r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/de0fadd41dc3
Treat aClipRect in CompositorOGL::DrawGeometry correctly when drawing to a root render target that's not at (0, 0). r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/dd092bce314d
Prepare CompositorOGL for native layers that are not located at (0, 0). r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/f988e453af00
Respect render target clip during DrawGeometry culling and overdraw pixel counting. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/cc84a0e9d5dd
Make DrawGeometry culling work more reliably. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/6035e8ef4f82
Rename BeginFrame to BeginFrameForWindow. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/1591247f9ce8
Add BeginFrameForTarget and replace Set/ClearTargetContext. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/4fcd04e8261e
Add BeginFrameForNativeLayers() and Begin/EndRenderingToNativeLayer. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/ee0a3838c5c1
Calculate mShouldInvalidateWindow at the beginning of the frame. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/6d1b97aed6f0
Move ShouldRecordFrames() from BasicCompositor to Compositor because CompositorOGL will need it. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/29be5f4832ca
Change BlitFrameBufferToFrameBuffer to take rects instead of sizes. r=jgilbert
https://hg.mozilla.org/integration/autoland/rev/ea690c643c8c
Maintain a full window render target when rendering to native layers with CompositorOGL. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/1db2a705c75c
Reorder layer rendering invocations. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/56928dc94586
Get everything ready for rendering into multiple native layers. r=mattwoodrow
Pushed by malexandru@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/25005fcdb106
Fix bustages on OS X Cross Compiled. a=bustage-fix CLOSED TREE

(In reply to Alexandru Michis [:malexandru] from comment #21)

I made a quick fix for the bustages

Thank you!! I'm not sure how this happened. I suppose I must have always compiled when I had the patch from bug 1574586 applied as well, which removes the offending line.

Flags: needinfo?(mstange)
Regressions: 1578100
You need to log in before you can comment on or make changes to this bug.