Mir

Merge lp://staging/~vanvugt/mir/fix-buffers_ready_for_compositor into lp://staging/mir

Proposed by Daniel van Vugt
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 2289
Proposed branch: lp://staging/~vanvugt/mir/fix-buffers_ready_for_compositor
Merge into: lp://staging/mir
Diff against target: 874 lines (+297/-63)
34 files modified
examples/render_overlays.cpp (+0/-5)
include/platform/mir/graphics/renderable.h (+0/-1)
include/server/mir/compositor/scene.h (+10/-0)
include/server/mir/scene/surface.h (+1/-0)
platform-ABI-sha1sums (+1/-1)
server-ABI-sha1sums (+3/-3)
src/include/server/mir/compositor/buffer_stream.h (+1/-1)
src/server/compositor/buffer_bundle.h (+1/-1)
src/server/compositor/buffer_queue.cpp (+10/-6)
src/server/compositor/buffer_queue.h (+1/-1)
src/server/compositor/buffer_stream_surfaces.cpp (+2/-2)
src/server/compositor/buffer_stream_surfaces.h (+1/-1)
src/server/compositor/multi_threaded_compositor.cpp (+12/-1)
src/server/graphics/software_cursor.cpp (+0/-5)
src/server/input/touchspot_controller.cpp (+0/-5)
src/server/scene/basic_surface.cpp (+12/-4)
src/server/scene/basic_surface.h (+1/-0)
src/server/scene/surface_stack.cpp (+31/-2)
src/server/scene/surface_stack.h (+2/-0)
src/server/symbols.map (+1/-0)
tests/include/mir_test_doubles/fake_renderable.h (+0/-5)
tests/include/mir_test_doubles/mock_buffer_bundle.h (+1/-1)
tests/include/mir_test_doubles/mock_buffer_stream.h (+3/-3)
tests/include/mir_test_doubles/mock_renderable.h (+0/-3)
tests/include/mir_test_doubles/mock_scene.h (+3/-0)
tests/include/mir_test_doubles/stub_buffer_stream.h (+4/-1)
tests/include/mir_test_doubles/stub_renderable.h (+0/-5)
tests/include/mir_test_doubles/stub_scene.h (+5/-1)
tests/include/mir_test_doubles/stub_scene_surface.h (+1/-0)
tests/integration-tests/test_exchange_buffer.cpp (+1/-1)
tests/integration-tests/test_surface_stack_with_compositor.cpp (+5/-4)
tests/unit-tests/compositor/test_buffer_queue.cpp (+66/-0)
tests/unit-tests/compositor/test_multi_threaded_compositor.cpp (+85/-0)
tests/unit-tests/scene/test_surface_stack.cpp (+33/-0)
To merge this branch: bzr merge lp://staging/~vanvugt/mir/fix-buffers_ready_for_compositor
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Kevin DuBois (community) Approve
Alan Griffiths Abstain
Alberto Aguirre (community) Approve
Review via email: mp+247124@code.staging.launchpad.net

Commit message

Fix dangerous underestimate of buffers_ready_for_compositor(). This is
an immediate problem when you start experimenting with double buffers,
and see occasional random freezes. (LP: #1395581)

It could also possibly affect the current triple buffering used for
multimonitor and bypass/overlays.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alberto Aguirre (albaguirre) wrote :

OK. LGTM.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Ugg. Same tests failing for all proposals :(

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

I need to think through what happens when the compositor drops renderables. But this seem promising.

review: Abstain
Revision history for this message
Kevin DuBois (kdub) wrote :

#1
I don't like mg::Renderables::buffers_ready_for_compositor(), and am happy to see it going away, but it is a bit entrenched in qtmir, so we should have a way to transition the downstream.

http://bazaar.launchpad.net/~mir-team/qtmir/trunk/view/head:/src/modules/Unity/Application/mirsurfaceitem.cpp#L446

#2
This does circumvent the observer architecture by requiring feedback from the BufferQueues. I see how the arch is wrong in the case described, but before we were telling the compositors to composite so many times, but now we're telling them to composite so many times, and then asking if they really meant it. The BufferQueue doesn't have all the information about how many compositions are needed to drain because of things like position-only-updates, and the BasicSurface cant give the information that is needed to drain the queue completely. Maybe we should improve our concept of 'damage' of the stack, and then have every composition reduce the scheduled damage by one.

review: Needs Information
Revision history for this message
Kevin DuBois (kdub) wrote :

to elaborate a bit further #1 is the bigger concern, #2 is to point out in the review that mc::Scene now is somewhat strange in that we have two routes to observe the damage

//frames-pending method
virtual int frames_pending(CompositorID id) const = 0;

//observer method
virtual void add_observer(std::shared_ptr<scene::Observer> const& observer) = 0;
virtual void remove_observer(std::weak_ptr<scene::Observer> const& observer) = 0;

and that the observer method (public api) is still broken in that it can't drain the queue properly.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

#1
Yeah I knew about QtMir already. It will need fixing. Hopefully without reintroducing the old Renderable method but we'll see. It's a simple matter of code but needs the involvement of Unity8 guys more to test the changes.

#2
The observer architecture obviously doesn't solve all problems. Compositors can and will occasionally skip over some renderable and not consume its buffer. Compositors are free to make their own decisions, so we should support any outcome from that.
  I don't think this is strange or inconsistent though. A compositor's default state is to be asleep. We _need_ the observer stuff to wake it up. And we _need_ a separate counter to cover the case of rendering N frames after N were scheduled might not be enough (due to occlusions whatever). Callback-based observers can not solve this problem, but semaphore-based observers could, so read on...
  I did consider a more unified approach that might work. That is a singular counter (like a semaphore) stored in the scene where each surface adds to the counter when it has something new not consumed. And critically, only the surface/producer can then remove its count from the scene total when it's flushed. But that's an architectural rework, bigger than this proposal and possibly could end up more complicated with some new coupling too. So first a fix, and later maybe redesign.

Revision history for this message
Kevin DuBois (kdub) wrote :

#2: Fair enough, I think the unified approach is something to work towards, but in the meantime, we may as well use this approach to solve the problem. Keeping track of whether the stack is damaged seems a better concept than what's in trunk or the wakeup and keep-running-until-drained approach.

#1: I guess I'd like to pause this branch to avoid breaking downstream in a way that we don't have a fix for yet. Its mostly just a timing issue, but I'd guess that the Belgium sprinters might want to integrate the tip of mir with the tip of the other components.

So anyways, approve from me, but would appreciate pausing the branch until we have a downstream update available.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

#1: I'm sitting next to Gerry and talking to him about it :)

Revision history for this message
Kevin DuBois (kdub) wrote :

As long as we can work towards a more unified approach, and there's a branch forthcoming downstream, lgtm.

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Fortunately we've branched 0.11 already so landing this for 0.12 puts us in no hurry to sync downstreams.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Robert Carr (robertcarr) wrote :

UNTaed until qtmir branch is available so we can release tomorrow.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches