Mir

Merge lp://qastaging/~kdub/mir/nested-db-link-to-streams into lp://qastaging/mir

Proposed by Kevin DuBois
Status: Work in progress
Proposed branch: lp://qastaging/~kdub/mir/nested-db-link-to-streams
Merge into: lp://qastaging/mir
Diff against target: 310 lines (+197/-11)
5 files modified
src/server/graphics/nested/display_buffer.cpp (+52/-3)
src/server/graphics/nested/display_buffer.h (+9/-0)
src/server/graphics/nested/host_stream.h (+47/-0)
tests/include/mir_test_doubles/mock_host_stream.h (+43/-0)
tests/unit-tests/graphics/nested/test_nested_display_buffer.cpp (+46/-8)
To merge this branch: bzr merge lp://qastaging/~kdub/mir/nested-db-link-to-streams
Reviewer Review Type Date Requested Status
Alan Griffiths Needs Fixing
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+256181@code.qastaging.launchpad.net

Commit message

nested: add a currently-unused way to link the nested MirBufferStream abstraction to a mgn::DisplayBuffer, and have the buffer associate incoming renderables with linked streams to see if an optimized render is possible.

Description of the change

nested: add a currently-unused way to link the nested MirBufferStream abstraction to a mgn::DisplayBuffer, and have the buffer associate incoming renderables with linked streams to see if an optimized render is possible.

note: mgn::HostStream will have to expand a bit, depending on how that RFC branch shapes up. mgn::DisplayBuffer::post_renderables_if_optimizable() will then use those positioning functions to arrange and commit the scene to the host in sync.

To post a comment you must log in.
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 :

281+TEST_F(NestedDisplayBufferTest, post_optimized_success)

"post_optimized_success" is not a very clear test name. It is worth considering the "given/when/then" rule. (E.g. http://martinfowler.com/bliki/GivenWhenThen.html)

given_an_optimizable_stream_when_post_if_optimizable_then_result_is_success

Or more succinctly:

given_an_optimizable_stream_post_if_optimizable_succeeds

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Actually, I misunderstood the test:

when_linked_with_a_stream_post_if_optimizable_succeeds

review: Needs Fixing
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

39+ //validate that we have a host-allocated stream for every renderable we're given
40+ for(auto const& renderable : renderables)
41+ {
42+ auto buffer = renderable->buffer();
43+ auto stream_it = std::find_if(streams.begin(), streams.end(),
44+ [&buffer](HostStream* stream){ return buffer_is_current_in_stream(*buffer, stream); });
45+ //if we have any stream that needs to be rendered but we don't have a stream associated
46+ //we can't passthrough the render
47+ if (stream_it == streams.end())
48+ return false;
49+ }
50+
51+ //TODO: work out how to submit changes synchronously to the client API
52+ for(auto const& renderable : renderables)
53+ {
54+ //TODO: arrange the surfaces via the api according to how RenderableList is structured
55+ auto buffer = renderable->buffer();
56+ auto stream_it = std::find_if(streams.begin(), streams.end(),
57+ [&buffer](HostStream* stream){ return buffer_is_current_in_stream(*buffer, stream); });
58+ (*stream_it)->swap();59+ }

I've not thought it through, but this code has the ugliness I associate with choosing the wrong data structure (or algorithm).

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

> I've not thought it through, but this code has the ugliness I associate with
> choosing the wrong data structure (or algorithm).

Fair enough. At a high level though, the linkage between the BufferQueue and the DisplayBuffer is needed. The BufferQueue has to get its buffers from MirBufferStream, and the DisplayBuffer has to sort and arrange those streams to paint the desired picture.

It does become nicer if the client isn't so locked into its choices of buffers to use (currently the client has 1 buffer it can use). If the client could allocate more than one buffer, it could simply use those as the buffers in BufferQueue, and mgn::DisplayBuffer could figure out which which buffer to set as the 'active one' when it goes to post, as well as arrange appropriately.

Maybe I'll explore that route a bit more.

Unmerged revisions

2484. By Kevin DuBois

merge mir

2483. By Kevin DuBois

cleanups

2482. By Kevin DuBois

missing files

2481. By Kevin DuBois

test to pass

2480. By Kevin DuBois

another test

2479. By Kevin DuBois

test to compile

2478. By Kevin DuBois

add tests for nested posting for nested db

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