Closed Bug 1679482 Opened 4 years ago Closed 4 years ago

RenderDXGITextureHost::MapPlane() is called even when RenderCompositorD3D11SWGL uses external compositing for video rendering(sw-wr)

Categories

(Core :: Graphics: WebRender, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
85 Branch
Tracking Status
firefox85 --- fixed

People

(Reporter: sotaro, Assigned: mattwoodrow)

References

(Blocks 1 open bug)

Details

(Keywords: perf-alert)

Attachments

(2 files)

It seems that we do not need to call RenderDXGITextureHost::MapPlane() when external compositing is used video rendering. The MapPlane() seems to add extra cost.

Blocks: sw-wr-perf

:mattwoodrow, can you comment to the bug?

Flags: needinfo?(matt.woodrow)

What's the callstack to MapPlane()?

Are you seeing it happen during the same frames as we call AttachExternalImage, or does it just happen occasionally?

Flags: needinfo?(matt.woodrow) → needinfo?(sotaro.ikeda.g)

When I tested with the followings, I saw it during the same frames as we call AttachExternalImage.

call sequence was like the following.

RenderCompositorD3D11SWGL::BeginFrame() this 00000145916A2D40
RenderCompositorD3D11SWGL::AttachExternalImage() host 000001459D9EDDF0 this 00000145916A2D40
RenderDXGITextureHost::MapPlane() mSize(3840, 2160) this 000001459D9EDDF0
RenderDXGITextureHost::MapPlane() mSize(3840, 2160) this 000001459D9EDDF0
RenderCompositorD3D11SWGL::CompositorEndFrame() this 00000145916A2D40
RenderCompositorD3D11SWGL::CompositorEndFrame() host 000001459D9EDDF0 size(3840, 2160) this 00000145916A2D40
RenderCompositorD3D11SWGL::EndFrame() this 00000145916A2D40

Callstack was like the following

RenderDXGITextureHost::MapPlane()
RenderTextureHostSWGL::UpdatePlanes()
RenderTextureHostSWGL::LockSWGL()
wr_renderer_lock_external_image()
webrender_bindings::bindings::{{impl}}::lock()
Renderer::update_deferred_resolves()
Renderer::prepare_gpu_cache(w)
Renderer::render_impl()
webrender_bindings::bindings::wr_renderer_render()
RendererOGL::UpdateAndRender()

Flags: needinfo?(sotaro.ikeda.g)

We're definitely calling resolve_image for all external_surfaces, even ones that are drawn by the native compositor - https://searchfox.org/mozilla-central/source/gfx/wr/webrender/src/composite.rs#659

Glenn, do you know which bits of this we can skip when we've promoted to a compositor external image (naming here is confusing).

Flags: needinfo?(gwatson)

The resolve_image call is to get the texture id / layer / uv rect, which is used when the Draw compositor is active.

I'm not too sure how / when / where we know that the external image itself is being handled by the compositor, but it does seem like we should be able to skip the resolve_image and store different information in the external_surfaces array in this case.

I think this will probably look a lot simpler when we eventually implement the Draw compositor in terms of the main Compositor trait, but I'm not sure when we'll have time to get to this.

It might be easier to discuss the details on matrix.

Flags: needinfo?(gwatson)
Assignee: nobody → matt.woodrow
Pushed by mwoodrow@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f926a9326dd2 Refactor work for computing external surface dependencies into helper. r=gw https://hg.mozilla.org/integration/autoland/rev/41fc102c92a3 Don't compute external surface dependencies when not using the Draw compositor. r=gw

Backed out 2 changesets (bug 1679482) for assertion failure at NativeLayerCA.

Push with failure: https://treeherder.mozilla.org/jobs?repo=autoland&group_state=expanded&selectedTaskRun=S_iAhBnRQIibGphISRR1TQ.0&fromchange=54c0122f62a8b32b2adad47761781cede0e47e1d&searchStr=OS%2CX%2CWebGL&tochange=2c61fdd0277b7ebb43c25258b92397308bbfdcca

Backout link: https://hg.mozilla.org/integration/autoland/rev/8b5f6151cb49ea19426bc55a36d9b031ead97d3d

Failure log: https://treeherder.mozilla.org/logviewer?job_id=323386812&repo=autoland&lineNumber=2936

[task 2020-12-03T01:14:27.785Z] 01:14:27     INFO - TEST-START | dom/canvas/test/webgl-conf/generated/test_conformance__context__context-attribute-preserve-drawing-buffer.html
[task 2020-12-03T01:14:27.856Z] 01:14:27     INFO - GECKO(1319) | [Parent 1319, IPDL Background] WARNING: Cannot record shutdown step, mConnection is nullptr: file /builds/worker/checkouts/gecko/dom/localstorage/ActorsParent.cpp:8039
[task 2020-12-03T01:14:27.856Z] 01:14:27     INFO - GECKO(1319) | [Child 1321, Main Thread] WARNING: Attempt to __delete__ missing or closed actor: file /builds/worker/workspace/obj-build/ipc/ipdl/PWebGLChild.cpp:117
[task 2020-12-03T01:14:27.856Z] 01:14:27     INFO - GECKO(1319) | [Child 1321, Main Thread] WARNING: Attempt to __delete__ missing or closed actor: file /builds/worker/workspace/obj-build/ipc/ipdl/PWebGLChild.cpp:117
[task 2020-12-03T01:14:27.856Z] 01:14:27     INFO - GECKO(1319) | [Child 1321, Main Thread] WARNING: Attempt to __delete__ missing or closed actor: file /builds/worker/workspace/obj-build/ipc/ipdl/PWebGLChild.cpp:117
[task 2020-12-03T01:14:27.856Z] 01:14:27     INFO - GECKO(1319) | [Child 1321, Main Thread] WARNING: Attempt to __delete__ missing or closed actor: file /builds/worker/workspace/obj-build/ipc/ipdl/PWebGLChild.cpp:117
[task 2020-12-03T01:14:27.891Z] 01:14:27     INFO - GECKO(1319) | [Parent 1319, IPDL Background] WARNING: Cannot record shutdown step, mConnection is nullptr: file /builds/worker/checkouts/gecko/dom/localstorage/ActorsParent.cpp:8039
[task 2020-12-03T01:14:27.954Z] 01:14:27     INFO - GECKO(1319) | [Child 1321, Main Thread] WARNING: IPC message discarded: actor cannot send: file /builds/worker/checkouts/gecko/ipc/glue/ProtocolUtils.cpp:512
[task 2020-12-03T01:14:27.954Z] 01:14:27     INFO - GECKO(1319) | [Child 1321, Main Thread] WARNING: Error sending reply: file /builds/worker/workspace/obj-build/ipc/ipdl/PDocumentChannelChild.cpp:288
[task 2020-12-03T01:14:28.019Z] 01:14:28     INFO - GECKO(1319) | [Child 1321, Main Thread] WARNING: Attempt to __delete__ missing or closed actor: file /builds/worker/workspace/obj-build/ipc/ipdl/PWebGLChild.cpp:117
[task 2020-12-03T01:14:28.019Z] 01:14:28     INFO - GECKO(1319) | [Parent 1319, IPDL Background] WARNING: Cannot record shutdown step, mConnection is nullptr: file /builds/worker/checkouts/gecko/dom/localstorage/ActorsParent.cpp:8039
[task 2020-12-03T01:14:28.069Z] 01:14:28     INFO - GECKO(1319) | Assertion failure: aTransform.Is2DIntegerTranslation(), at /builds/worker/checkouts/gecko/gfx/layers/NativeLayerCA.mm:895
[task 2020-12-03T01:14:28.073Z] 01:14:28     INFO -  Initializing stack-fixing for the first stack frame, this may take a while...
[task 2020-12-03T01:14:35.825Z] 01:14:35     INFO - GECKO(1319) | #01: mozilla::layers::NativeLayerCA::ApplyChanges(mozilla::layers::NativeLayerRootCA::WhichRepresentation) [gfx/layers/NativeLayerCA.mm:813]
[task 2020-12-03T01:14:35.825Z] 01:14:35     INFO - GECKO(1319) | #02: mozilla::layers::NativeLayerRootCA::Representation::Commit(mozilla::layers::NativeLayerRootCA::WhichRepresentation, nsTArray<RefPtr<mozilla::layers::NativeLayerCA> > const&) [gfx/layers/NativeLayerCA.mm:293]
[task 2020-12-03T01:14:35.825Z] 01:14:35     INFO - GECKO(1319) | #03: mozilla::layers::NativeLayerRootCA::CommitToScreen() [gfx/layers/NativeLayerCA.mm:232]
[task 2020-12-03T01:14:35.825Z] 01:14:35     INFO - GECKO(1319) | #04: mozilla::wr::RenderCompositorNative::CompositorEndFrame() [gfx/webrender_bindings/RenderCompositorNative.cpp:283]
[task 2020-12-03T01:14:35.827Z] 01:14:35     INFO - GECKO(1319) | #05: webrender::renderer::Renderer::render_impl [gfx/wr/webrender/src/renderer.rs:3799]
[task 2020-12-03T01:14:35.827Z] 01:14:35     INFO - GECKO(1319) | #06: webrender::renderer::Renderer::render [gfx/wr/webrender/src/renderer.rs:3414]
[task 2020-12-03T01:14:35.827Z] 01:14:35     INFO - GECKO(1319) | #07: wr_renderer_render [gfx/webrender_bindings/src/bindings.rs:615]
[task 2020-12-03T01:14:35.827Z] 01:14:35     INFO - GECKO(1319) | #08: mozilla::wr::RendererOGL::UpdateAndRender(mozilla::Maybe<mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits> > const&, mozilla::Maybe<mozilla::wr::ImageFormat> const&, mozilla::Maybe<mozilla::Range<unsigned char> > const&, bool*, mozilla::wr::RendererStats*) [gfx/webrender_bindings/RendererOGL.cpp:193]
[task 2020-12-03T01:14:35.827Z] 01:14:35     INFO - GECKO(1319) | #09: mozilla::wr::RenderThread::UpdateAndRender(mozilla::wr::WrWindowId, mozilla::layers::BaseTransactionId<mozilla::VsyncIdType> const&, mozilla::TimeStamp const&, bool, mozilla::Maybe<mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits> > const&, mozilla::Maybe<mozilla::wr::ImageFormat> const&, mozilla::Maybe<mozilla::Range<unsigned char> > const&, bool*) [gfx/webrender_bindings/RenderThread.cpp:488]
[task 2020-12-03T01:14:35.827Z] 01:14:35     INFO - GECKO(1319) | #10: mozilla::wr::RenderThread::HandleFrameOneDoc(mozilla::wr::WrWindowId, bool) [gfx/webrender_bindings/RenderThread.cpp:325]
[task 2020-12-03T01:14:35.829Z] 01:14:35     INFO - GECKO(1319) | #11: mozilla::detail::RunnableMethodImpl<mozilla::wr::RenderThread*, void (mozilla::wr::RenderThread::*)(mozilla::wr::WrWindowId, bool), true, (mozilla::RunnableKind)0, mozilla::wr::WrWindowId, bool>::Run() [xpcom/threads/nsThreadUtils.h:1151]
[task 2020-12-03T01:14:35.829Z] 01:14:35     INFO - GECKO(1319) | #12: MessageLoop::RunTask(already_AddRefed<nsIRunnable>) [ipc/chromium/src/base/message_loop.cc:466]
[task 2020-12-03T01:14:35.829Z] 01:14:35     INFO - GECKO(1319) | #13: MessageLoop::DeferOrRunPendingTask(MessageLoop::PendingTask&&) [ipc/chromium/src/base/message_loop.cc:473]
[task 2020-12-03T01:14:35.829Z] 01:14:35     INFO - GECKO(1319) | #14: MessageLoop::DoWork() [ipc/chromium/src/base/message_loop.cc:548]
[task 2020-12-03T01:14:35.829Z] 01:14:35     INFO - GECKO(1319) | #15: base::MessagePumpDefault::Run(base::MessagePump::Delegate*) [ipc/chromium/src/base/message_pump_default.cc:35]
[task 2020-12-03T01:14:35.829Z] 01:14:35     INFO - GECKO(1319) | #16: MessageLoop::Run() [ipc/chromium/src/base/message_loop.cc:310]
[task 2020-12-03T01:14:35.829Z] 01:14:35     INFO - GECKO(1319) | #17: base::Thread::ThreadMain() [ipc/chromium/src/base/thread.cc:194]
[task 2020-12-03T01:14:35.829Z] 01:14:35     INFO - GECKO(1319) | #18: ThreadFunc(void*) [ipc/chromium/src/base/platform_thread_posix.cc:41]
[task 2020-12-03T01:14:35.831Z] 01:14:35     INFO -  fix-stacks: error: failed to parse `/usr/lib/system/libsystem_pthread.dylib`
[task 2020-12-03T01:14:35.831Z] 01:14:35     INFO -  fix-stacks: unsupported object file format
[task 2020-12-03T01:14:35.831Z] 01:14:35     INFO - GECKO(1319) | #19: _pthread_body [/usr/lib/system/libsystem_pthread.dylib + 0x32eb]
[task 2020-12-03T01:14:35.831Z] 01:14:35     INFO - GECKO(1319) | #20: _pthread_start [/usr/lib/system/libsystem_pthread.dylib + 0x6249]
[task 2020-12-03T01:14:35.831Z] 01:14:35     INFO - GECKO(1319) | [GFX1-]: Receive IPC close with reason=AbnormalShutdown
[task 2020-12-03T01:14:35.832Z] 01:14:35     INFO - GECKO(1319) | Exiting due to channel error.
[task 2020-12-03T01:14:35.832Z] 01:14:35     INFO - GECKO(1319) | Exiting due to channel error.
[task 2020-12-03T01:14:35.832Z] 01:14:35     INFO - GECKO(1319) | Exiting due to channel error.
[task 2020-12-03T01:14:35.835Z] 01:14:35     INFO - GECKO(1319) | Exiting due to channel error.
[task 2020-12-03T01:14:35.890Z] 01:14:35     INFO - TEST-INFO | Main app process: exit 1
[task 2020-12-03T01:14:35.890Z] 01:14:35     INFO - Buffered messages logged at 01:14:27
[task 2020-12-03T01:14:35.891Z] 01:14:35     INFO - TEST-PASS | dom/canvas/test/webgl-conf/generated/test_conformance__context__context-attribute-preserve-drawing-buffer.html | A valid string reason is expected 
[task 2020-12-03T01:14:35.891Z] 01:14:35     INFO - TEST-PASS | dom/canvas/test/webgl-conf/generated/test_conformance__context__context-attribute-preserve-drawing-buffer.html | Reason cannot be empty 
[task 2020-12-03T01:14:35.891Z] 01:14:35     INFO - Buffered messages logged at 01:14:28
[task 2020-12-03T01:14:35.891Z] 01:14:35     INFO - TEST-PASS | dom/canvas/test/webgl-conf/generated/test_conformance__context__context-attribute-preserve-drawing-buffer.html | successfullyParsed is true 
[task 2020-12-03T01:14:35.891Z] 01:14:35     INFO - Buffered messages finished
[task 2020-12-03T01:14:35.891Z] 01:14:35    ERROR - TEST-UNEXPECTED-FAIL | dom/canvas/test/webgl-conf/generated/test_conformance__context__context-attribute-preserve-drawing-buffer.html | application terminated with exit code 1
[task 2020-12-03T01:14:35.891Z] 01:14:35     INFO - runtests.py | Application ran for: 0:00:47.495735
Flags: needinfo?(matt.woodrow)
Pushed by mwoodrow@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/71a5b77cbbf4 Refactor work for computing external surface dependencies into helper. r=gw https://hg.mozilla.org/integration/autoland/rev/cfaa73a15e66 Don't compute external surface dependencies when not using the Draw compositor. r=gw
Flags: needinfo?(matt.woodrow)
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 85 Branch

(In reply to Pulsebot from comment #8)

Pushed by mwoodrow@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/41fc102c92a3
Don't compute external surface dependencies when not using the Draw
compositor. r=gw

== Change summary for alert #28040 (as of Thu, 10 Dec 2020 11:14:01 GMT) ==

Regressions:

Ratio Suite Test Platform Options Absolute values (old vs new)
25% glterrain windows10-64-qr e10s stylo webgl-ipc webrender 1.61 -> 2.01

For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=28040

(In reply to Pulsebot from comment #11)

Pushed by mwoodrow@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/71a5b77cbbf4
Refactor work for computing external surface dependencies into helper. r=gw
https://hg.mozilla.org/integration/autoland/rev/cfaa73a15e66
Don't compute external surface dependencies when not using the Draw
compositor. r=gw

== Change summary for alert #28039 (as of Thu, 10 Dec 2020 11:13:53 GMT) ==

Improvements:

Ratio Suite Test Platform Options Absolute values (old vs new)
18% glterrain windows10-64-qr e10s stylo webgl-ipc webrender 2.04 -> 1.68

For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=28039

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: