Closed Bug 1255703 Opened 8 years ago Closed 8 years ago

Investigate using an image surfaces instead of win32 surfaces for basic compositor

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed
relnote-firefox --- 49+

People

(Reporter: jrmuizel, Assigned: sotaro)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 6 obsolete files)

Once we're using a dibsection for the backbuffer I don't think we have anything to gain from using win32 surfaces to do the actual composition. In all of the cases where we actually use gdi, I expect pixman is actually faster.
Depends on: 1254897
Component: Audio/Video → Graphics
Depends on: 1255342
Blocks: 1258640
Blocks: 1255303
Attachment #8738434 - Attachment is obsolete: true
Update nits.
Attachment #8738482 - Attachment is obsolete: true
Assignee: nobody → sotaro.ikeda.g
Fix assert.
Attachment #8738484 - Attachment is obsolete: true
https://treeherder.mozilla.org/perf.html#/compare?originalProject=try&originalRevision=a8991a5d5450&newProject=try&newRevision=d692ed4a02ec&framework=1&showOnlyImportant=0

compare performance with/without patch applied with BasicCompositor. It seemed to improve "tscrollx opt e10s" and  "tresize opt" a lot. But there are some tests that decreased performance a little bit.
:jrmuizel, can you comment to comment 5?
Flags: needinfo?(jmuizelaar)
I'm quite surprised by tscrollx opt e10s improvements. We should not be using basic compositor in the win7 and win8 cases.
Flags: needinfo?(jmuizelaar)
(In reply to Jeff Muizelaar [:jrmuizel] from comment #7)
> I'm quite surprised by tscrollx opt e10s improvements. We should not be
> using basic compositor in the win7 and win8 cases.

The Tryserver push just enabled BasicCompositor in all cases to check BasicCompositor's performance.
(In reply to Sotaro Ikeda [:sotaro] from comment #8)
> (In reply to Jeff Muizelaar [:jrmuizel] from comment #7)
> > I'm quite surprised by tscrollx opt e10s improvements. We should not be
> > using basic compositor in the win7 and win8 cases.
> 
> The Tryserver push just enabled BasicCompositor in all cases to check
> BasicCompositor's performance.

Ah. That talos numbers look good then.
Attachment #8738902 - Flags: review?(matt.woodrow)
Comment on attachment 8738902 [details] [diff] [review]
patch - Use image surfaces for basic compositor

Review of attachment 8738902 [details] [diff] [review]:
-----------------------------------------------------------------

This feels a bit awkward to me.

Can we instead just have windows/nsWindow override nsBaseWidget::GetBackBufferDrawTarget, call the nsBaseWidget version and then add the CreateDrawTargetForData code to the end?

That would mean the ClearRect call would still go through GDI (which I doubt matters), but if we really care then we could factor the nsBaseWidget version out into a few helpers and call those from nsWindow instead.

::: widget/nsIWidget.h
@@ +1326,5 @@
> +    virtual already_AddRefed<mozilla::gfx::DrawTarget> GetBackBufferDrawTarget(mozilla::gfx::DrawTarget* aScreenTarget,
> +                                                                               const LayoutDeviceIntRect& aRect,
> +                                                                               const LayoutDeviceIntRect& aClearRect) = 0;
> +
> +    virtual mozilla::gfx::DrawTarget* EndRemoteBackBufferDrawing() = 0;

Might as well return a SourceSurface from this, since that's what the callers want.

Drop the word 'Remote' from this, or add it to GetBackBufferDrawTarget so that it's clearer that they are a pair and need to be matched (a comment would be good too).
Attachment #8738902 - Flags: review?(matt.woodrow)
Thanks for the advice. I agree the patch is a bit awkward. I rethink about it related to bug 1263527.
Apply the comment.
Attachment #8738902 - Attachment is obsolete: true
Attachment #8751182 - Attachment is obsolete: true
Attachment #8751185 - Flags: review?(matt.woodrow)
Comment on attachment 8751185 [details] [diff] [review]
patch - Use image surfaces for basic compositor on Windows

Review of attachment 8751185 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/layers/basic/BasicCompositor.cpp
@@ +173,5 @@
>    RefPtr<BasicCompositingRenderTarget> rt;
>    IntRect rect = aRect.ToUnknownRect();
>  
>    if (aBufferMode != BufferMode::BUFFER_NONE) {
> +    RefPtr<DrawTarget> target = mWidget->GetBackBufferDrawTarget(mDrawTarget, aRect, aClearRect);

Can you please either assert that target != mDrawTarget, or add a 'mNeedsEndBackBufferDrawing' var, so that it's obvious that we always call EndBackBufferDrawing if we called GetBackBufferDrawTarget.

The current code relies on the implementation of GetBackBufferDrawTarget to not return aDrawTarget to be correct. I know that should always be true, but it requires looking up that function to know.

::: widget/windows/WinCompositorWidgetProxy.cpp
@@ +107,5 @@
>  
>  void
>  WinCompositorWidgetProxy::EndRemoteDrawing()
>  {
> +  if (mLockedBackBufferData) {

Should we just make BasicCompositor call EndBackBufferDrawing from AbortFrame (if required), and then just assert that this never happens?
Attachment #8751185 - Flags: review?(matt.woodrow) → review+
Apply the comment. Carry "r=mattwoodrow".
Attachment #8751185 - Attachment is obsolete: true
Attachment #8751579 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/8e945d8c30dd
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
Depends on: 1276403
This brings general performance improvements when not using hardware acceleration on Windows.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: