Closed Bug 1386966 Opened 7 years ago Closed 7 years ago

Investigate coalescing flushes

Categories

(Core :: Graphics: Layers, enhancement)

40 Branch
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: dvander, Assigned: mchang)

References

Details

Attachments

(1 file)

Right now we gather drawing commands per-quadrant, send them to the paint thread, and continue on to the next quadrant. This means we could flush four times on the paint thread. We should do a quick measurement to see if that matters, and if so, see if it's possible to coalesce the flushes somehow.
Assignee: nobody → mchang
Coalesce DrawTarget flushes. We do this by storing which unique DTs get an Async paint call. Then the ClientPaintedLayer tosses a new event on the event loop, so it should come AFTER all the async paints, which we then flush the DTs. This should be sequentially  consistent since the main thread paints one layer at a time and we call flush DTs after the layer has finished recording.
Attachment #8893979 - Flags: review?(dvander)
Comment on attachment 8893979 [details] [diff] [review]
Coalesce DT Flushes

This doesn't quite work because BeginAsyncPaint and EndAsyncPaint are now imbalanced. BeginAsyncPaint is called before every region we draw, but EndAsyncPaint is always called at the end. Thus mOutstandingAsyncPaints in CompositorBridgeChild might never be zero [1].

I think the fix is to call BeginAsyncPaint once per layer, which shouldn't be difficult. r+ing assuming that pans out.

[1] http://searchfox.org/mozilla-central/source/gfx/layers/PaintThread.cpp#165
Attachment #8893979 - Flags: review?(dvander) → review+
(In reply to David Anderson [:dvander] (PTO 8/7 to 8/25, not reviewing) from comment #2)
> Comment on attachment 8893979 [details] [diff] [review]
> Coalesce DT Flushes
> 
> This doesn't quite work because BeginAsyncPaint and EndAsyncPaint are now
> imbalanced. BeginAsyncPaint is called before every region we draw, but
> EndAsyncPaint is always called at the end. Thus mOutstandingAsyncPaints in
> CompositorBridgeChild might never be zero [1].
> 
> I think the fix is to call BeginAsyncPaint once per layer, which shouldn't
> be difficult. r+ing assuming that pans out.
> 
> [1]
> http://searchfox.org/mozilla-central/source/gfx/layers/PaintThread.cpp#165

BeginAsyncPaint is still called before every region we draw. EndAsyncPaint is also still always called at the end during AutoCapturedPaint destructor, so that's still balanced. We just took out the part about flushing when mOutstandingAsyncPaints = 0 [1]

[1] http://searchfox.org/mozilla-central/source/gfx/layers/ipc/CompositorBridgeChild.cpp#1160
Pushed by mchang@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/c038cbe88566
Coalesce OMTP drawtarget flushes until finished painting a layer. r=dvander
https://hg.mozilla.org/mozilla-central/rev/c038cbe88566
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: