Closed
Bug 1191971
Opened 9 years ago
Closed 7 years ago
Use DirectComposition for compositing when possible
Categories
(Core :: Graphics: WebRender, defect, P3)
Core
Graphics: WebRender
Tracking
()
RESOLVED
FIXED
mozilla61
Tracking | Status | |
---|---|---|
firefox61 | --- | fixed |
People
(Reporter: jrmuizel, Assigned: sotaro)
References
(Blocks 1 open bug, )
Details
(Whiteboard: [wr-reserve] [gfx-noted])
Attachments
(2 files, 16 obsolete files)
(deleted),
patch
|
bas.schouten
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
bas.schouten
:
review+
|
Details | Diff | Splinter Review |
This is similar to bug 1191965. It's less clear whether it's possible to do this with DirectComposition.
There's no obvious way to take an existing surface and turn it into something that DirectComposition can use. However, it does seem to possible to do that with a SwapChain using IDCompositionDevice::CreateSurfaceFromHandle.
There's also MF_MEDIA_ENGINE_PLAYBACK_VISUAL which seems used for getting DXVA stuff into a DirectComposition visual
Reporter | ||
Updated•9 years ago
|
Updated•9 years ago
|
Whiteboard: [gfx-noted]
Updated•7 years ago
|
Priority: -- → P3
Assignee | ||
Comment 1•7 years ago
|
||
I take this bug as to enable DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL usage of Bug 1419293. The flag usage make composition performance better.
Assignee: nobody → sotaro.ikeda.g
Assignee | ||
Updated•7 years ago
|
Assignee | ||
Updated•7 years ago
|
Component: Graphics: Layers → Graphics: WebRender
Updated•7 years ago
|
Status: NEW → ASSIGNED
Priority: P3 → P1
Whiteboard: [gfx-noted] → [wr-reserve] [gfx-noted]
Updated•7 years ago
|
Priority: P1 → P3
Assignee | ||
Comment 2•7 years ago
|
||
Direct Composition could have 3 pars.
[1] Enable DirectComposition on Windows if possible.
[2] Separate Chrome and content compositions to different CompositionSurface
[3] Render video as overlays if possible.
This bug only handle [1]. It could improve performance and power consumption.
Updated•7 years ago
|
Blocks: stage-wr-next
Assignee | ||
Comment 3•7 years ago
|
||
Assignee | ||
Updated•7 years ago
|
Attachment #8939771 -
Attachment is patch: true
Attachment #8939771 -
Attachment mime type: text/x-patch → text/plain
Assignee | ||
Comment 4•7 years ago
|
||
Attachment #8939771 -
Attachment is obsolete: true
Assignee | ||
Comment 5•7 years ago
|
||
Assignee | ||
Comment 6•7 years ago
|
||
Attachment #8943138 -
Attachment is obsolete: true
Assignee | ||
Comment 7•7 years ago
|
||
Attachment #8945716 -
Attachment is obsolete: true
Assignee | ||
Updated•7 years ago
|
Attachment #8943114 -
Attachment is obsolete: true
Assignee | ||
Comment 8•7 years ago
|
||
Assignee | ||
Comment 9•7 years ago
|
||
Attachment #8952300 -
Attachment is obsolete: true
Assignee | ||
Updated•7 years ago
|
Attachment #8952301 -
Attachment description: patch - Create child window in gpu process → patch part 1 - Create child window in gpu process
Assignee | ||
Comment 10•7 years ago
|
||
Attachment #8952060 -
Attachment is obsolete: true
Assignee | ||
Updated•7 years ago
|
Attachment #8952312 -
Attachment description: patch - Add capatiblity to enable DComp → patch part 2 - Add capatiblity to enable DComp
Assignee | ||
Comment 11•7 years ago
|
||
attachment 8952301 [details] [diff] [review] add capability to create child window in GPU process. It is necessary for DirectComposition. IDCompositionDevice::CreateTargetForHwnd() requests that window must belong to the calling process.
https://msdn.microsoft.com/en-us/library/windows/desktop/hh437396(v=vs.85).aspx
Assignee | ||
Comment 12•7 years ago
|
||
attachment 8952312 [details] [diff] [review] adds capability to enable DirectComposition if gfx.webrender.dcomp-win.enabled pref is true and platform supports it.
attachment 8952301 [details] [diff] [review] just enable DirectComposition. But with it, we could get performance improvement by using DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL. I tried to enable DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL without using DirectComposition, but it caused a problem like Bug 1435995 and disabled now.
Assignee | ||
Comment 13•7 years ago
|
||
Current DirectComposition is very basic and it mimics how ANGLE uses DirectComposition
https://dxr.mozilla.org/mozilla-central/source/gfx/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.cpp#68
Assignee | ||
Comment 14•7 years ago
|
||
Comment on attachment 8952301 [details] [diff] [review]
patch part 1 - Create child window in gpu process
:jrmuizel, can you feedback to the patches?
Attachment #8952301 -
Flags: feedback?(jmuizelaar)
Assignee | ||
Updated•7 years ago
|
Attachment #8952312 -
Flags: feedback?(jmuizelaar)
Reporter | ||
Comment 15•7 years ago
|
||
Sotaro, do you know why weren't creating a child window in the gpu process before? i.e. even when not using DirectComposition wouldn't it be valuable to create a child window in that process?
Assignee | ||
Comment 16•7 years ago
|
||
(In reply to Jeff Muizelaar [:jrmuizel] from comment #15)
> Sotaro, do you know why weren't creating a child window in the gpu process
> before? i.e. even when not using DirectComposition wouldn't it be valuable
> to create a child window in that process?
I do not know the reason. But gpu process use HWND just to create swap chain and to get window size when d3d is used for composite. In these cases, we do not need to create child window in gpu process. I do not know if there could be another reason to create the child window other than for DirectComposition.
Chromium also seems to create child window only for DirectComposition in gpu process.
https://cs.chromium.org/chromium/src/gpu/ipc/service/direct_composition_surface_win.h?l=100
https://cs.chromium.org/chromium/src/gpu/ipc/service/child_window_win.cc?l=156
Reporter | ||
Comment 17•7 years ago
|
||
Comment on attachment 8952312 [details] [diff] [review]
patch part 2 - Add capatiblity to enable DComp
Review of attachment 8952312 [details] [diff] [review]:
-----------------------------------------------------------------
I haven't looked to closely but this seems fine.
Attachment #8952312 -
Flags: feedback?(jmuizelaar) → feedback+
Reporter | ||
Comment 18•7 years ago
|
||
Comment on attachment 8952301 [details] [diff] [review]
patch part 1 - Create child window in gpu process
Review of attachment 8952301 [details] [diff] [review]:
-----------------------------------------------------------------
I've looked even less closely at this, but the basic idea seems sound.
Attachment #8952301 -
Flags: feedback?(jmuizelaar) → feedback+
Assignee | ||
Comment 19•7 years ago
|
||
(In reply to Jeff Muizelaar [:jrmuizel] from comment #15)
> even when not using DirectComposition wouldn't it be valuable to create a child window in that process?
I noticed that it seems valuable to use child window on gpu process to prevent jiggle during resizing. The some jiggling still exists during resizing with WebRender. When child window was used, the jiggling becomes really smaller.
Assignee | ||
Comment 20•7 years ago
|
||
The patch has a problem of handling multiple windows.
Attachment #8952301 -
Attachment is obsolete: true
Assignee | ||
Comment 21•7 years ago
|
||
Fixed multiple windows bug.
Attachment #8962269 -
Attachment is obsolete: true
Assignee | ||
Comment 23•7 years ago
|
||
Some clean ups.
Attachment #8962614 -
Attachment is obsolete: true
Assignee | ||
Comment 24•7 years ago
|
||
Fixed CompositorBridgeParent::DeallocPWebRenderBridgeParent().
Attachment #8962617 -
Attachment is obsolete: true
Assignee | ||
Comment 27•7 years ago
|
||
Fixed build failure on linux.
Attachment #8962621 -
Attachment is obsolete: true
Assignee | ||
Comment 29•7 years ago
|
||
Assignee | ||
Comment 30•7 years ago
|
||
Fixed debug build.
Attachment #8962649 -
Attachment is obsolete: true
Assignee | ||
Updated•7 years ago
|
Attachment #8962645 -
Flags: review?(jmuizelaar)
Assignee | ||
Updated•7 years ago
|
Attachment #8962705 -
Flags: review?(jmuizelaar)
Reporter | ||
Comment 31•7 years ago
|
||
Comment on attachment 8962705 [details] [diff] [review]
patch part 2 - Add capatiblity to enable DComp
Review of attachment 8962705 [details] [diff] [review]:
-----------------------------------------------------------------
Bas is probably a better reviewer for these than me.
Attachment #8962705 -
Flags: review?(jmuizelaar) → review?(bas)
Reporter | ||
Comment 32•7 years ago
|
||
Comment on attachment 8962645 [details] [diff] [review]
patch part 1 - Create child window in gpu process
Review of attachment 8962645 [details] [diff] [review]:
-----------------------------------------------------------------
Bumping to Bas
Attachment #8962645 -
Flags: review?(jmuizelaar) → review?(bas)
Assignee | ||
Updated•7 years ago
|
Blocks: document-splitting
Assignee | ||
Updated•7 years ago
|
Assignee | ||
Comment 33•7 years ago
|
||
Comment 34•7 years ago
|
||
Comment on attachment 8962645 [details] [diff] [review]
patch part 1 - Create child window in gpu process
Review of attachment 8962645 [details] [diff] [review]:
-----------------------------------------------------------------
::: widget/windows/WinCompositorWindowThread.cpp
@@ +62,5 @@
> + RefPtr<WinCompositorWindowThread>(sWinCompositorWindowThread.get()),
> + &WinCompositorWindowThread::ShutDownTask,
> + &task);
> + sWinCompositorWindowThread->Loop()->PostTask(runnable.forget());
> + task.Wait();
It's not clear to me how this actually shuts the compositor thread down? As far as I can tell all this function does is ensure all messages currently queued have been processed.
Attachment #8962645 -
Flags: review?(bas) → review+
Comment 35•7 years ago
|
||
Comment on attachment 8962705 [details] [diff] [review]
patch part 2 - Add capatiblity to enable DComp
Review of attachment 8962705 [details] [diff] [review]:
-----------------------------------------------------------------
::: gfx/layers/ipc/CompositorBridgeParent.cpp
@@ +1752,5 @@
> MOZ_ASSERT(!mCompositorScheduler);
> MOZ_ASSERT(mWidget);
>
> #ifdef XP_WIN
> + if (DeviceManagerDx::Get()->CanUseDComp() && mWidget) {
How does this now ensure we only do this in the GPU process?
::: gfx/webrender_bindings/RenderCompositor.h
@@ +7,5 @@
> #ifndef MOZILLA_GFX_RENDERCOMPOSITOR_H
> #define MOZILLA_GFX_RENDERCOMPOSITOR_H
>
> #include "mozilla/RefPtr.h"
> +#include "mozilla/UniquePtr.h"
I assume this was just a fix for unified builds somehow?
Attachment #8962705 -
Flags: review?(bas) → review+
Assignee | ||
Comment 36•7 years ago
|
||
(In reply to Bas Schouten (:bas.schouten) from comment #34)
>
> It's not clear to me how this actually shuts the compositor thread down? As
> far as I can tell all this function does is ensure all messages currently
> queued have been processed.
Compositor thread was shut down by CompositorThreadHolder::Shutdown(). It is called before RenderThread::ShutDown().
Assignee | ||
Comment 37•7 years ago
|
||
(In reply to Bas Schouten (:bas.schouten) from comment #35)
> Comment on attachment 8962705 [details] [diff] [review]
> patch part 2 - Add capatiblity to enable DComp
>
> Review of attachment 8962705 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: gfx/layers/ipc/CompositorBridgeParent.cpp
> @@ +1752,5 @@
> > MOZ_ASSERT(!mCompositorScheduler);
> > MOZ_ASSERT(mWidget);
> >
> > #ifdef XP_WIN
> > + if (DeviceManagerDx::Get()->CanUseDComp() && mWidget) {
>
> How does this now ensure we only do this in the GPU process?
DCompositionDevice is created only in "GPU process + WebRender enabled" for now.
>
> ::: gfx/webrender_bindings/RenderCompositor.h
> @@ +7,5 @@
> > #ifndef MOZILLA_GFX_RENDERCOMPOSITOR_H
> > #define MOZILLA_GFX_RENDERCOMPOSITOR_H
> >
> > #include "mozilla/RefPtr.h"
> > +#include "mozilla/UniquePtr.h"
>
> I assume this was just a fix for unified builds somehow?
Yes.
Comment 38•7 years ago
|
||
Pushed by sikeda@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/19142efa84a5
part 1 - Create child window in gpu process r=bas
https://hg.mozilla.org/integration/mozilla-inbound/rev/d328d8eda8e6
part 2 - Add capatiblity to enable DComp r=bas
Assignee | ||
Comment 39•7 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #36)
> (In reply to Bas Schouten (:bas.schouten) from comment #34)
> >
> > It's not clear to me how this actually shuts the compositor thread down? As
> > far as I can tell all this function does is ensure all messages currently
> > queued have been processed.
>
> Compositor thread was shut down by CompositorThreadHolder::Shutdown(). It is
> called before RenderThread::ShutDown().
Oh, I misunderstood your question. WinCompositorWindowThread was shut down by clearing sWinCompositorWindowThread. It mimics how RenderThread is shut down.
> static StaticRefPtr<WinCompositorWindowThread> sWinCompositorWindowThread;
Comment 40•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/19142efa84a5
https://hg.mozilla.org/mozilla-central/rev/d328d8eda8e6
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox61:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in
before you can comment on or make changes to this bug.
Description
•