Mir

Merge lp:~kdub/mir/fix-1563278 into lp:mir

Proposed by Kevin DuBois
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 3458
Proposed branch: lp:~kdub/mir/fix-1563278
Merge into: lp:mir
Prerequisite: lp:~kdub/mir/require-streams-when-creating-surface
Diff against target: 1298 lines (+188/-200)
22 files modified
examples/render_surfaces.cpp (+1/-1)
include/server/mir/scene/surface_factory.h (+3/-1)
playground/mir_demo_client_prerendered_frames.c (+1/-6)
src/server/scene/application_session.cpp (+14/-2)
src/server/scene/basic_surface.cpp (+19/-5)
src/server/scene/basic_surface.h (+2/-2)
src/server/scene/surface_allocator.cpp (+3/-5)
src/server/scene/surface_allocator.h (+1/-1)
tests/acceptance-tests/throwback/test_presentation_chain.cpp (+1/-2)
tests/include/mir/test/doubles/mock_surface.h (+4/-2)
tests/include/mir/test/doubles/stub_surface_factory.h (+1/-1)
tests/integration-tests/surface_composition.cpp (+5/-4)
tests/integration-tests/test_error_reporting.cpp (+1/-1)
tests/integration-tests/test_session.cpp (+7/-6)
tests/integration-tests/test_surface_stack_with_compositor.cpp (+13/-9)
tests/unit-tests/scene/test_abstract_shell.cpp (+1/-2)
tests/unit-tests/scene/test_application_session.cpp (+15/-14)
tests/unit-tests/scene/test_basic_surface.cpp (+11/-36)
tests/unit-tests/scene/test_session_manager.cpp (+1/-1)
tests/unit-tests/scene/test_surface.cpp (+4/-9)
tests/unit-tests/scene/test_surface_impl.cpp (+5/-4)
tests/unit-tests/scene/test_surface_stack.cpp (+75/-86)
To merge this branch: bzr merge lp:~kdub/mir/fix-1563278
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve
Alan Griffiths Approve
Cemil Azizoglu (community) Approve
Review via email: mp+291647@code.launchpad.net

Commit message

fix LP: #1563278 by allowing Surfaces to be created with non-default streams.

This allows the user of MirPresentationChains to set up the MirSurface so that no MirBufferStream is created at MirSurface startup, or allows the user of mir_surface_spec_set_streams to set a non-default configuration at startup.

Description of the change

fix LP: #1563278 by allowing Surfaces to be created with non-default streams.

This allows the user of MirPresentationChains to set up the MirSurface so that no MirBufferStream is created at MirSurface startup, or allows the user of mir_surface_spec_set_streams to set a non-default configuration at startup.

To post a comment you must log in.
Revision history for this message
Kevin DuBois (kdub) wrote :

portending a suggestion to change std::list to std::vector... This reflects the existing set_streams() function that takes a std::list.

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3450
https://mir-jenkins.ubuntu.com/job/mir-ci/817/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/820
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/857
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/848
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/848
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/830
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/830/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/830
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/830/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/830
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/830/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/830
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/830/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/830
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/830/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/817/rebuild

review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Just nits:

 }
-
TEST_F(SurfaceStack, occludes_not_rendered_surface)

I'd like to keep that whitespace.

~~~~

+ stub_buffer_stream1 = std::make_shared<mtd::StubBufferStream>();
+ stub_buffer_stream2 = std::make_shared<mtd::StubBufferStream>();
+ stub_buffer_stream3 = std::make_shared<mtd::StubBufferStream>();
...
+ std::shared_ptr<mc::BufferStream> stub_buffer_stream1;
+ std::shared_ptr<mc::BufferStream> stub_buffer_stream2;
+ std::shared_ptr<mc::BufferStream> stub_buffer_stream3;

I think test fixtures are a great place for in-class initializers - half the lines used here and only one place to look.

~~~~

 }
-
//test associated with lp:1290306, 1293896, 1294048, 1294051, 1294053

I'd like to keep that whitespace.

review: Needs Fixing
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3452
https://mir-jenkins.ubuntu.com/job/mir-ci/828/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/833/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/870
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/861
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/861
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/843/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/843
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/843/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/843
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/843/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/843
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/843/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/843/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/828/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

unrelated, retriggering.

Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

Looks good

review: Approve
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3452
https://mir-jenkins.ubuntu.com/job/mir-ci/829/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/834/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/871
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/862
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/862
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/844
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/844/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/844
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/844/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/844/console
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/844/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/844
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/844/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/844/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/829/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

19:23:52 [ RUN ] MirSurfaceVisibilityEvent.exposed_received_when_surface_raised_over_occluding_surface

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

Probably a slow test environment - a generous 10s timeout and a test taking 30s to run!

18:51:00 11: [ RUN ] ApplicationNotRespondingDetection.failure_to_pong_is_noticed
18:51:00 11: [2016-04-13 18:50:59.936136] mirserver: Starting
18:51:00 11: [2016-04-13 18:51:00.526634] mirserver: Selected driver: dummy (version 0.22.0)
18:51:02 11: [2016-04-13 18:51:02.694384] mirserver: Using software cursor
18:51:03 11: [2016-04-13 18:51:03.829134] mirserver: Initial display configuration:
18:51:03 11: [2016-04-13 18:51:03.876013] mirserver: 1.1: VGA 0.0" 0x0mm
18:51:03 11: [2016-04-13 18:51:03.894852] mirserver: Current mode 1600x1600 60.00Hz
18:51:03 11: [2016-04-13 18:51:03.897768] mirserver: Preferred mode 1600x1600 60.00Hz
18:51:03 11: [2016-04-13 18:51:03.900158] mirserver: Logical position +0+0
18:51:05 11: [2016-04-13 18:51:05.590816] mirserver: Selected input driver: mir:stub-input (version: 0.22.0)
18:51:05 11: [2016-04-13 18:51:05.932306] mirserver: Mir version 0.22.0
18:51:26 11: /��BUILDDIR��/mir-0.22.0+xenial862bzr3452/tests/acceptance-tests/test_application_not_responding_detection.cpp:115: Failure
18:51:26 11: Value of: marked_as_unresponsive.wait_for(10s)
18:51:26 11: Actual: false
18:51:26 11: Expected: true
18:51:28 11: [2016-04-13 18:51:28.042141] mirserver: Stopping
18:51:30 11: [ FAILED ] ApplicationNotRespondingDetection.failure_to_pong_is_noticed (30224 ms)

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

OK

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

> Probably a slow test environment - a generous 10s timeout and a test taking
> 30s to run!

Logged as lp:1570327

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3452
https://mir-jenkins.ubuntu.com/job/mir-ci/835/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/843/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/880
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/871
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/871
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/853/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/853
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/853/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/853/console
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/853/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/853
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/853/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/853
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/853/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/835/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/render_surfaces.cpp'
2--- examples/render_surfaces.cpp 2016-03-23 06:39:56 +0000
3+++ examples/render_surfaces.cpp 2016-04-13 15:56:18 +0000
4@@ -377,7 +377,7 @@
5
6 auto const stream = buffer_stream_factory->create_buffer_stream(
7 mf::BufferStreamId{}, std::make_shared<NullBufferSink>(), properties);
8- auto const surface = surface_factory->create_surface(stream, params);
9+ auto const surface = surface_factory->create_surface({ ms::StreamInfo{ stream, {0, 0}, {} } }, params);
10 surface_stack->add_surface(surface, params.input_mode);
11
12 {
13
14=== modified file 'include/server/mir/scene/surface_factory.h'
15--- include/server/mir/scene/surface_factory.h 2015-06-17 05:20:42 +0000
16+++ include/server/mir/scene/surface_factory.h 2016-04-13 15:56:18 +0000
17@@ -21,6 +21,7 @@
18
19 #include "mir/scene/surface_creation_parameters.h"
20 #include <memory>
21+#include <list>
22
23 namespace mir
24 {
25@@ -28,6 +29,7 @@
26 namespace scene
27 {
28 class Surface;
29+class StreamInfo;
30
31 class SurfaceFactory
32 {
33@@ -36,7 +38,7 @@
34 virtual ~SurfaceFactory() = default;
35
36 virtual std::shared_ptr<Surface> create_surface(
37- std::shared_ptr<compositor::BufferStream> const&,
38+ std::list<scene::StreamInfo> const& streams,
39 SurfaceCreationParameters const& params) = 0;
40
41 private:
42
43=== modified file 'playground/mir_demo_client_prerendered_frames.c'
44--- playground/mir_demo_client_prerendered_frames.c 2016-03-23 06:39:56 +0000
45+++ playground/mir_demo_client_prerendered_frames.c 2016-04-13 15:56:18 +0000
46@@ -159,14 +159,9 @@
47 }
48
49 MirSurfaceSpec* spec = mir_connection_create_spec_for_normal_surface(connection, width, height, format);
50- MirSurface* surface = mir_surface_create_sync(spec);
51- mir_surface_spec_release(spec);
52-
53- //reassociate for advanced control
54- spec = mir_create_surface_spec(connection);
55 mir_surface_spec_add_presentation_chain(
56 spec, width, height, displacement_x, displacement_y, chain);
57- mir_surface_apply_spec(surface, spec);
58+ MirSurface* surface = mir_surface_create_sync(spec);
59 mir_surface_spec_release(spec);
60
61 int num_prerendered_frames = 20;
62
63=== modified file 'src/server/scene/application_session.cpp'
64--- src/server/scene/application_session.cpp 2016-04-12 14:10:00 +0000
65+++ src/server/scene/application_session.cpp 2016-04-13 15:56:18 +0000
66@@ -111,11 +111,23 @@
67 if (params.parent_id.is_set())
68 params.parent = checked_find(the_params.parent_id.value())->second;
69
70- auto buffer_stream = checked_find(params.content_id.value())->second;
71+ auto buffer_stream = checked_find(stream_id)->second;
72 if (params.size != buffer_stream->stream_size())
73 buffer_stream->resize(params.size);
74
75- auto surface = surface_factory->create_surface(buffer_stream, params);
76+ std::list<StreamInfo> streams;
77+ if (the_params.content_id.is_set())
78+ {
79+ streams.push_back({checked_find(the_params.content_id.value())->second, {0,0}, {}});
80+ }
81+ else
82+ {
83+ for (auto& stream : params.streams.value())
84+ streams.push_back({checked_find(stream.stream_id)->second, stream.displacement, stream.size});
85+ }
86+
87+ auto surface = surface_factory->create_surface(streams, params);
88+
89 surface_stack->add_surface(surface, params.input_mode);
90
91 if (params.state.is_set())
92
93=== modified file 'src/server/scene/basic_surface.cpp'
94--- src/server/scene/basic_surface.cpp 2016-04-04 18:19:17 +0000
95+++ src/server/scene/basic_surface.cpp 2016-04-13 15:56:18 +0000
96@@ -199,12 +199,26 @@
97 geom::Displacement hotspot;
98 };
99
100+namespace
101+{
102+//TODO: the concept of default stream is going away very soon.
103+std::shared_ptr<mc::BufferStream> default_stream(std::list<ms::StreamInfo> const& layers)
104+{
105+ //There's not a good reason, other than soon-to-be-deprecated api to disallow contentless surfaces
106+ if (layers.empty())
107+ BOOST_THROW_EXCEPTION(std::logic_error("Surface must have content"));
108+ else
109+ return layers.front().stream;
110+}
111+
112+}
113+
114 ms::BasicSurface::BasicSurface(
115 std::string const& name,
116 geometry::Rectangle rect,
117 std::weak_ptr<Surface> const& parent,
118 bool nonrectangular,
119- std::shared_ptr<mc::BufferStream> const& buffer_stream,
120+ std::list<StreamInfo> const& layers,
121 std::shared_ptr<mi::InputChannel> const& input_channel,
122 std::shared_ptr<input::InputSender> const& input_sender,
123 std::shared_ptr<mg::CursorImage> const& cursor_image,
124@@ -216,13 +230,13 @@
125 input_mode(mi::InputReceptionMode::normal),
126 nonrectangular(nonrectangular),
127 custom_input_rectangles(),
128- surface_buffer_stream(buffer_stream),
129+ surface_buffer_stream(default_stream(layers)),
130 server_input_channel(input_channel),
131 input_sender(input_sender),
132 cursor_image_(cursor_image),
133 report(report),
134 parent_(parent),
135- layers({StreamInfo{buffer_stream, {0,0}, {}}}),
136+ layers(layers),
137 cursor_stream_adapter{std::make_unique<ms::CursorStreamImageAdapter>(*this)},
138 input_validator([this](MirEvent const& ev) { this->input_sender->send_event(ev, server_input_channel); })
139 {
140@@ -233,12 +247,12 @@
141 std::string const& name,
142 geometry::Rectangle rect,
143 bool nonrectangular,
144- std::shared_ptr<mc::BufferStream> const& buffer_stream,
145+ std::list<StreamInfo> const& layers,
146 std::shared_ptr<mi::InputChannel> const& input_channel,
147 std::shared_ptr<input::InputSender> const& input_sender,
148 std::shared_ptr<mg::CursorImage> const& cursor_image,
149 std::shared_ptr<SceneReport> const& report) :
150- BasicSurface(name, rect, std::shared_ptr<Surface>{nullptr}, nonrectangular,buffer_stream,
151+ BasicSurface(name, rect, std::shared_ptr<Surface>{nullptr}, nonrectangular, layers,
152 input_channel, input_sender, cursor_image, report)
153 {
154 }
155
156=== modified file 'src/server/scene/basic_surface.h'
157--- src/server/scene/basic_surface.h 2016-01-29 08:18:22 +0000
158+++ src/server/scene/basic_surface.h 2016-04-13 15:56:18 +0000
159@@ -65,7 +65,7 @@
160 std::string const& name,
161 geometry::Rectangle rect,
162 bool nonrectangular,
163- std::shared_ptr<compositor::BufferStream> const& buffer_stream,
164+ std::list<scene::StreamInfo> const& streams,
165 std::shared_ptr<input::InputChannel> const& input_channel,
166 std::shared_ptr<input::InputSender> const& sender,
167 std::shared_ptr<graphics::CursorImage> const& cursor_image,
168@@ -76,7 +76,7 @@
169 geometry::Rectangle rect,
170 std::weak_ptr<Surface> const& parent,
171 bool nonrectangular,
172- std::shared_ptr<compositor::BufferStream> const& buffer_stream,
173+ std::list<scene::StreamInfo> const& streams,
174 std::shared_ptr<input::InputChannel> const& input_channel,
175 std::shared_ptr<input::InputSender> const& sender,
176 std::shared_ptr<graphics::CursorImage> const& cursor_image,
177
178=== modified file 'src/server/scene/surface_allocator.cpp'
179--- src/server/scene/surface_allocator.cpp 2015-06-17 05:20:42 +0000
180+++ src/server/scene/surface_allocator.cpp 2016-04-13 15:56:18 +0000
181@@ -48,19 +48,17 @@
182 }
183
184 std::shared_ptr<ms::Surface> ms::SurfaceAllocator::create_surface(
185- std::shared_ptr<compositor::BufferStream> const& buffer_stream,
186+ std::list<ms::StreamInfo> const& streams,
187 SurfaceCreationParameters const& params)
188 {
189- auto actual_size = geom::Rectangle{params.top_left, buffer_stream->stream_size()};
190-
191 bool nonrectangular = has_alpha(params.pixel_format);
192 auto input_channel = input_factory->make_input_channel();
193 auto const surface = std::make_shared<BasicSurface>(
194 params.name,
195- actual_size,
196+ geom::Rectangle{params.top_left, params.size},
197 params.parent,
198 nonrectangular,
199- buffer_stream,
200+ streams,
201 input_channel,
202 input_sender,
203 default_cursor_image,
204
205=== modified file 'src/server/scene/surface_allocator.h'
206--- src/server/scene/surface_allocator.h 2015-06-17 05:20:42 +0000
207+++ src/server/scene/surface_allocator.h 2016-04-13 15:56:18 +0000
208@@ -47,7 +47,7 @@
209 std::shared_ptr<SceneReport> const& report);
210
211 std::shared_ptr<Surface> create_surface(
212- std::shared_ptr<compositor::BufferStream> const& buffer_stream,
213+ std::list<scene::StreamInfo> const& streams,
214 SurfaceCreationParameters const& params) override;
215
216 private:
217
218=== modified file 'tests/acceptance-tests/throwback/test_presentation_chain.cpp'
219--- tests/acceptance-tests/throwback/test_presentation_chain.cpp 2016-03-23 06:39:56 +0000
220+++ tests/acceptance-tests/throwback/test_presentation_chain.cpp 2016-04-13 15:56:18 +0000
221@@ -268,8 +268,7 @@
222 EXPECT_THAT(region.pixel_format, Eq(pf));
223 }
224
225-//needs an ABI break to fix
226-TEST_F(PresentationChain, DISABLED_submission_will_eventually_call_callback)
227+TEST_F(PresentationChain, submission_will_eventually_call_callback)
228 {
229 SurfaceWithChainFromStart surface(connection, size, pf);
230
231
232=== modified file 'tests/include/mir/test/doubles/mock_surface.h'
233--- tests/include/mir/test/doubles/mock_surface.h 2016-01-29 08:18:22 +0000
234+++ tests/include/mir/test/doubles/mock_surface.h 2016-04-13 15:56:18 +0000
235@@ -43,14 +43,15 @@
236 {},
237 {{},{}},
238 true,
239- std::make_shared<testing::NiceMock<MockBufferStream>>(),
240+ { { std::make_shared<testing::NiceMock<MockBufferStream>>(), {0, 0}, {} } },
241 std::make_shared<StubInputChannel>(),
242 {},
243 {},
244 mir::report::null_scene_report())
245 {
246 ON_CALL(*this, primary_buffer_stream())
247- .WillByDefault(testing::Return(std::make_shared<testing::NiceMock<MockBufferStream>>()));
248+ .WillByDefault(testing::Invoke([this]
249+ { return scene::BasicSurface::primary_buffer_stream(); }));
250 }
251
252 ~MockSurface() noexcept {}
253@@ -76,6 +77,7 @@
254 MOCK_CONST_METHOD0(primary_buffer_stream, std::shared_ptr<frontend::BufferStream>());
255 MOCK_METHOD1(set_streams, void(std::list<scene::StreamInfo> const&));
256
257+ std::shared_ptr<MockBufferStream> const stream;
258 };
259
260 }
261
262=== modified file 'tests/include/mir/test/doubles/stub_surface_factory.h'
263--- tests/include/mir/test/doubles/stub_surface_factory.h 2016-01-29 08:18:22 +0000
264+++ tests/include/mir/test/doubles/stub_surface_factory.h 2016-04-13 15:56:18 +0000
265@@ -34,7 +34,7 @@
266 {
267 public:
268 std::shared_ptr<scene::Surface> create_surface(
269- std::shared_ptr<compositor::BufferStream> const&,
270+ std::list<scene::StreamInfo> const&,
271 scene::SurfaceCreationParameters const& params) override
272 {
273 using namespace testing;
274
275=== modified file 'tests/integration-tests/surface_composition.cpp'
276--- tests/integration-tests/surface_composition.cpp 2015-06-26 08:00:59 +0000
277+++ tests/integration-tests/surface_composition.cpp 2016-04-13 15:56:18 +0000
278@@ -42,14 +42,14 @@
279 {
280 struct SurfaceComposition : Test
281 {
282- auto create_surface() const
283+ auto create_surface(std::shared_ptr<mc::BufferStream> const& stream) const
284 -> std::shared_ptr<ms::Surface>
285 {
286 return std::make_shared<ms::BasicSurface>(
287 std::string("SurfaceComposition"),
288 geom::Rectangle{{},{}},
289 false,
290- create_buffer_stream(),
291+ std::list<ms::StreamInfo> { { stream, {0,0}, {} } },
292 create_input_channel(),
293 create_input_sender(),
294 create_cursor_image(),
295@@ -98,7 +98,8 @@
296 // Presumptive cause of lp:1376324
297 TEST_F(SurfaceComposition, does_not_send_client_buffers_to_dead_surfaces)
298 {
299- auto surface = create_surface();
300+ auto stream = create_buffer_stream();
301+ auto surface = create_surface(stream);
302
303 mg::Buffer* old_buffer{nullptr};
304
305@@ -117,7 +118,7 @@
306 while (called_back)
307 {
308 called_back = false;
309- surface->primary_buffer_stream()->swap_buffers(old_buffer, callback);
310+ stream->swap_buffers(old_buffer, callback);
311 }
312
313 auto const renderables = surface->generate_renderables(this);
314
315=== modified file 'tests/integration-tests/test_error_reporting.cpp'
316--- tests/integration-tests/test_error_reporting.cpp 2016-01-29 08:18:22 +0000
317+++ tests/integration-tests/test_error_reporting.cpp 2016-04-13 15:56:18 +0000
318@@ -113,7 +113,7 @@
319 {
320 std::shared_ptr<mir::scene::Surface>
321 create_surface(
322- std::shared_ptr<mir::compositor::BufferStream> const&,
323+ std::list<mir::scene::StreamInfo> const&,
324 mir::scene::SurfaceCreationParameters const&) override
325 {
326 throw std::runtime_error{test_exception_text};
327
328=== modified file 'tests/integration-tests/test_session.cpp'
329--- tests/integration-tests/test_session.cpp 2016-03-29 17:29:46 +0000
330+++ tests/integration-tests/test_session.cpp 2016-04-13 15:56:18 +0000
331@@ -68,13 +68,13 @@
332 }
333 };
334
335-void swap_buffers_blocking(mf::Surface& surf, mg::Buffer*& buffer)
336+void swap_buffers_blocking(mf::BufferStream& stream, mg::Buffer*& buffer)
337 {
338 std::mutex mutex;
339 std::condition_variable cv;
340 bool done = false;
341
342- surf.primary_buffer_stream()->swap_buffers(buffer,
343+ stream.swap_buffers(buffer,
344 [&](mg::Buffer* new_buffer)
345 {
346 std::unique_lock<decltype(mutex)> lock(mutex);
347@@ -128,8 +128,9 @@
348 };
349
350 mg::BufferProperties properties(geom::Size{1,1}, mir_pixel_format_abgr_8888, mg::BufferUsage::software);
351+ auto stream_id = session.create_buffer_stream(properties);
352 session.create_surface(
353- ms::a_surface().with_buffer_stream(session.create_buffer_stream(properties)),
354+ ms::a_surface().with_buffer_stream(stream_id),
355 std::make_shared<mtd::NullEventSink>());
356
357 auto compositor = conf.the_compositor();
358@@ -138,13 +139,13 @@
359 session.default_surface()->configure(mir_surface_attrib_swapinterval, 0);
360
361 std::thread client_thread{
362- [&session]
363+ [&session, stream_id]
364 {
365 mg::Buffer* buffer{nullptr};
366 for (int i = 0; i < 500; ++i)
367 {
368- auto surface = session.default_surface();
369- swap_buffers_blocking(*surface, buffer);
370+ auto stream = session.get_buffer_stream(stream_id);
371+ swap_buffers_blocking(*stream, buffer);
372 std::this_thread::sleep_for(std::chrono::microseconds{50});
373 }
374 }};
375
376=== modified file 'tests/integration-tests/test_surface_stack_with_compositor.cpp'
377--- tests/integration-tests/test_surface_stack_with_compositor.cpp 2016-01-29 08:18:22 +0000
378+++ tests/integration-tests/test_surface_stack_with_compositor.cpp 2016-04-13 15:56:18 +0000
379@@ -122,11 +122,13 @@
380 SurfaceStackCompositor() :
381 timeout{std::chrono::system_clock::now() + std::chrono::seconds(5)},
382 mock_buffer_stream(std::make_shared<testing::NiceMock<mtd::MockBufferBundle>>()),
383+ stream(std::make_shared<mc::BufferStreamSurfaces>(mock_buffer_stream)),
384+ streams({ { stream, {0,0}, {} } }),
385 stub_surface{std::make_shared<ms::BasicSurface>(
386 std::string("stub"),
387 geom::Rectangle{{0,0},{1,1}},
388 false,
389- std::make_shared<mc::BufferStreamSurfaces>(mock_buffer_stream),
390+ streams,
391 std::shared_ptr<mir::input::InputChannel>(),
392 std::shared_ptr<mtd::StubInputSender>(),
393 std::shared_ptr<mg::CursorImage>(),
394@@ -142,6 +144,8 @@
395 StubRendererFactory renderer_factory;
396 std::chrono::system_clock::time_point timeout;
397 std::shared_ptr<mtd::MockBufferBundle> mock_buffer_stream;
398+ std::shared_ptr<mc::BufferStream> stream;
399+ std::list<ms::StreamInfo> const streams;
400 std::shared_ptr<ms::BasicSurface> stub_surface;
401 ms::SurfaceCreationParameters default_params;
402 mtd::StubBuffer stubbuf{geom::Size{1,1}};
403@@ -197,7 +201,7 @@
404 mt_compositor.start();
405
406 stack.add_surface(stub_surface, default_params.input_mode);
407- stub_surface->primary_buffer_stream()->swap_buffers(&stubbuf, [](mg::Buffer*){});
408+ stream->swap_buffers(&stubbuf, [](mg::Buffer*){});
409
410 EXPECT_TRUE(stub_primary_db.has_posted_at_least(1, timeout));
411 EXPECT_TRUE(stub_secondary_db.has_posted_at_least(1, timeout));
412@@ -219,7 +223,7 @@
413 mt_compositor.start();
414
415 stack.add_surface(stub_surface, default_params.input_mode);
416- stub_surface->primary_buffer_stream()->swap_buffers(&stubbuf, [](mg::Buffer*){});
417+ streams.front().stream->swap_buffers(&stubbuf, [](auto){});
418
419 EXPECT_TRUE(stub_primary_db.has_posted_at_least(5, timeout));
420 EXPECT_TRUE(stub_secondary_db.has_posted_at_least(5, timeout));
421@@ -242,7 +246,7 @@
422 mt_compositor.start();
423
424 stack.add_surface(stub_surface, default_params.input_mode);
425- stub_surface->primary_buffer_stream()->swap_buffers(&stubbuf, [](mg::Buffer*){});
426+ streams.front().stream->swap_buffers(&stubbuf, [](mg::Buffer*){});
427
428 EXPECT_TRUE(stub_primary_db.has_posted_at_least(5, timeout));
429 EXPECT_TRUE(stub_secondary_db.has_posted_at_least(5, timeout));
430@@ -263,7 +267,7 @@
431 mt_compositor.start();
432
433 stack.add_surface(stub_surface, default_params.input_mode);
434- stub_surface->primary_buffer_stream()->swap_buffers(&stubbuf, [](mg::Buffer*){});
435+ streams.front().stream->swap_buffers(&stubbuf, [](mg::Buffer*){});
436
437 EXPECT_TRUE(stub_primary_db.has_posted_at_least(1, timeout));
438 EXPECT_TRUE(stub_secondary_db.has_posted_at_least(1, timeout));
439@@ -276,7 +280,7 @@
440
441 TEST_F(SurfaceStackCompositor, moving_a_surface_triggers_composition)
442 {
443- stub_surface->primary_buffer_stream()->swap_buffers(&stubbuf, [](mg::Buffer*){});
444+ streams.front().stream->swap_buffers(&stubbuf, [](mg::Buffer*){});
445 stack.add_surface(stub_surface, default_params.input_mode);
446
447 mc::MultiThreadedCompositor mt_compositor(
448@@ -295,7 +299,7 @@
449
450 TEST_F(SurfaceStackCompositor, removing_a_surface_triggers_composition)
451 {
452- stub_surface->primary_buffer_stream()->swap_buffers(&stubbuf, [](mg::Buffer*){});
453+ streams.front().stream->swap_buffers(&stubbuf, [](mg::Buffer*){});
454 stack.add_surface(stub_surface, default_params.input_mode);
455
456 mc::MultiThreadedCompositor mt_compositor(
457@@ -318,7 +322,7 @@
458 ON_CALL(*mock_buffer_stream, buffers_ready_for_compositor(_))
459 .WillByDefault(testing::Return(1));
460 stack.add_surface(stub_surface, default_params.input_mode);
461- stub_surface->primary_buffer_stream()->swap_buffers(&stubbuf, [](mg::Buffer*){});
462+ streams.front().stream->swap_buffers(&stubbuf, [](mg::Buffer*){});
463
464 mc::MultiThreadedCompositor mt_compositor(
465 mt::fake_shared(stub_display),
466@@ -328,7 +332,7 @@
467 null_comp_report, default_delay, false);
468
469 mt_compositor.start();
470- stub_surface->primary_buffer_stream()->swap_buffers(&stubbuf, [](mg::Buffer*){});
471+ streams.front().stream->swap_buffers(&stubbuf, [](mg::Buffer*){});
472
473 EXPECT_TRUE(stub_primary_db.has_posted_at_least(1, timeout));
474 EXPECT_TRUE(stub_secondary_db.has_posted_at_least(1, timeout));
475
476=== modified file 'tests/unit-tests/scene/test_abstract_shell.cpp'
477--- tests/unit-tests/scene/test_abstract_shell.cpp 2016-03-29 19:07:35 +0000
478+++ tests/unit-tests/scene/test_abstract_shell.cpp 2016-04-13 15:56:18 +0000
479@@ -95,8 +95,7 @@
480 struct MockSurfaceFactory : public ms::SurfaceFactory
481 {
482 MOCK_METHOD2(create_surface, std::shared_ptr<ms::Surface>(
483- std::shared_ptr<mir::compositor::BufferStream> const&,
484- ms::SurfaceCreationParameters const&));
485+ std::list<ms::StreamInfo> const&, ms::SurfaceCreationParameters const&));
486 };
487
488 using NiceMockWindowManager = NiceMock<mtd::MockWindowManager>;
489
490=== modified file 'tests/unit-tests/scene/test_application_session.cpp'
491--- tests/unit-tests/scene/test_application_session.cpp 2016-04-12 14:10:00 +0000
492+++ tests/unit-tests/scene/test_application_session.cpp 2016-04-13 15:56:18 +0000
493@@ -229,7 +229,7 @@
494 struct MockSurfaceFactory : ms::SurfaceFactory
495 {
496 MOCK_METHOD2(create_surface, std::shared_ptr<ms::Surface>(
497- std::shared_ptr<mc::BufferStream> const&, ms::SurfaceCreationParameters const& params));
498+ std::list<ms::StreamInfo> const&, ms::SurfaceCreationParameters const& params));
499 };
500 }
501
502@@ -653,6 +653,15 @@
503 session->destroy_buffer_stream(id);
504 }
505
506+MATCHER_P(HasSingleStream, value, "")
507+{
508+ using namespace testing;
509+ EXPECT_THAT(arg.size(), Eq(1));
510+ if (arg.size() < 1 ) return false;
511+ EXPECT_THAT(arg.front().stream.get(), Eq(value.get()));
512+ return !(::testing::Test::HasFailure());
513+}
514+
515 TEST_F(ApplicationSession, surface_uses_prexisting_buffer_stream_if_set)
516 {
517 using namespace testing;
518@@ -669,25 +678,17 @@
519 mt::fake_shared(mock_surface_factory));
520
521 auto id = session->create_buffer_stream(properties);
522+ auto stream = session->get_buffer_stream(id);
523
524- EXPECT_CALL(mock_surface_factory, create_surface(Eq(session->get_buffer_stream(id)),_))
525- .WillOnce(Invoke([&](auto bs, auto)
526- {
527- auto surface = make_mock_surface();
528- ON_CALL(*surface, primary_buffer_stream())
529- .WillByDefault(Return(bs));
530- return surface;
531- }));
532+ EXPECT_CALL(mock_surface_factory, create_surface(HasSingleStream(stream),_))
533+ .WillOnce(Return(make_mock_surface()));
534
535 ms::SurfaceCreationParameters params = ms::SurfaceCreationParameters{}
536 .of_name("Aardavks")
537 .of_type(mir_surface_type_normal)
538 .with_buffer_stream(id);
539
540- auto surface_id = session->create_surface(params, event_sink);
541- auto surface = session->get_surface(surface_id);
542-
543- EXPECT_THAT(surface->primary_buffer_stream(), Eq(session->get_buffer_stream(id)));
544+ session->create_surface(params, event_sink);
545 }
546
547 namespace
548@@ -770,7 +771,7 @@
549 {
550 public:
551 std::shared_ptr<ms::Surface> create_surface(
552- std::shared_ptr<mir::compositor::BufferStream> const&,
553+ std::list<ms::StreamInfo> const&,
554 mir::scene::SurfaceCreationParameters const& params) override
555 {
556 using namespace testing;
557
558=== modified file 'tests/unit-tests/scene/test_basic_surface.cpp'
559--- tests/unit-tests/scene/test_basic_surface.cpp 2016-03-23 06:39:56 +0000
560+++ tests/unit-tests/scene/test_basic_surface.cpp 2016-04-13 15:56:18 +0000
561@@ -72,17 +72,6 @@
562 MOCK_METHOD0(cursor_image_removed, void());
563 };
564
565-void post_a_frame(ms::BasicSurface& surface)
566-{
567- /*
568- * Make sure there's a frame ready. Otherwise visible()==false and the
569- * input_area will never report it containing anything for all the tests
570- * that use it.
571- */
572- mtd::StubBuffer buffer;
573- surface.primary_buffer_stream()->swap_buffers(&buffer, [&](mir::graphics::Buffer*){});
574-}
575-
576 struct BasicSurfaceTest : public testing::Test
577 {
578 std::string const name{"aa"};
579@@ -99,21 +88,17 @@
580 std::make_shared<ms::LegacySurfaceChangeNotification>(mock_change_cb, [this](int){mock_change_cb();});
581 std::shared_ptr<mi::InputSender> const stub_input_sender = std::make_shared<mtd::StubInputSender>();
582 testing::NiceMock<mtd::MockInputSender> mock_sender;
583+ std::list<ms::StreamInfo> streams { { mock_buffer_stream, {}, {} } };
584
585 ms::BasicSurface surface{
586 name,
587 rect,
588 false,
589- mock_buffer_stream,
590+ streams,
591 std::shared_ptr<mi::InputChannel>(),
592 stub_input_sender,
593 std::shared_ptr<mg::CursorImage>(),
594 report};
595-
596- BasicSurfaceTest()
597- {
598- post_a_frame(surface);
599- }
600 };
601
602 }
603@@ -127,11 +112,6 @@
604 EXPECT_FALSE(renderable->shaped());
605 }
606
607-TEST_F(BasicSurfaceTest, primary_buffer_stream)
608-{
609- EXPECT_THAT(surface.primary_buffer_stream(), Eq(mock_buffer_stream));
610-}
611-
612 TEST_F(BasicSurfaceTest, buffer_stream_ids_always_unique)
613 {
614 int const n = 10;
615@@ -141,7 +121,9 @@
616 for (auto& surface : surfaces)
617 {
618 surface = std::make_unique<ms::BasicSurface>(
619- name, rect, false, std::make_shared<testing::NiceMock<mtd::MockBufferStream>>(),
620+ name, rect, false,
621+ std::list<ms::StreamInfo> {
622+ { std::make_shared<testing::NiceMock<mtd::MockBufferStream>>(), {}, {} } },
623 std::shared_ptr<mi::InputChannel>(), stub_input_sender,
624 std::shared_ptr<mg::CursorImage>(), report);
625 for (auto& renderable : surface->generate_renderables(this))
626@@ -160,7 +142,7 @@
627 for (auto& surface : surfaces)
628 {
629 surface = std::make_unique<ms::BasicSurface>(
630- name, rect, false, mock_buffer_stream,
631+ name, rect, false, streams,
632 std::shared_ptr<mi::InputChannel>(), stub_input_sender,
633 std::shared_ptr<mg::CursorImage>(), report);
634
635@@ -175,7 +157,6 @@
636 .Times(1);
637
638 surface.add_observer(observer);
639- post_a_frame(surface);
640
641 EXPECT_EQ(rect.top_left, surface.top_left());
642
643@@ -192,7 +173,6 @@
644 .Times(1);
645
646 surface.add_observer(observer);
647- post_a_frame(surface);
648
649 EXPECT_EQ(rect.size, surface.size());
650 EXPECT_NE(new_size, surface.size());
651@@ -233,7 +213,6 @@
652 .Times(1);
653
654 surface.add_observer(observer);
655- post_a_frame(surface);
656
657 auto renderables = surface.generate_renderables(compositor_id);
658 ASSERT_THAT(renderables.size(), testing::Eq(1));
659@@ -258,7 +237,6 @@
660 .Times(1);
661
662 surface.add_observer(observer);
663- post_a_frame(surface);
664
665 float alpha = 0.5f;
666 surface.set_alpha(0.5f);
667@@ -288,7 +266,7 @@
668 name,
669 rect,
670 false,
671- mock_buffer_stream,
672+ streams,
673 std::shared_ptr<mi::InputChannel>(),
674 stub_input_sender,
675 std::shared_ptr<mg::CursorImage>(),
676@@ -315,7 +293,6 @@
677 .Times(1);
678
679 surface.add_observer(observer);
680- post_a_frame(surface);
681
682 surface.set_hidden(true);
683 }
684@@ -329,14 +306,13 @@
685 name,
686 geom::Rectangle{pt, one_by_one},
687 false,
688- mock_buffer_stream,
689+ streams,
690 std::shared_ptr<mi::InputChannel>(),
691 stub_input_sender,
692 std::shared_ptr<mg::CursorImage>(),
693 report};
694
695 surface.add_observer(observer);
696- post_a_frame(surface);
697
698 std::vector<geom::Point> contained_pt
699 {
700@@ -371,7 +347,7 @@
701 name,
702 geom::Rectangle{{0,0}, {100,100}},
703 false,
704- mock_buffer_stream,
705+ streams,
706 std::shared_ptr<mi::InputChannel>(),
707 stub_input_sender,
708 std::shared_ptr<mg::CursorImage>(),
709@@ -511,7 +487,7 @@
710 geom::Rectangle{{0,0}, {100,100}},
711 parent,
712 false,
713- mock_buffer_stream,
714+ streams,
715 std::shared_ptr<mi::InputChannel>(),
716 stub_input_sender,
717 std::shared_ptr<mg::CursorImage>(),
718@@ -698,7 +674,7 @@
719 name,
720 rect,
721 false,
722- mock_buffer_stream,
723+ streams,
724 std::shared_ptr<mi::InputChannel>(),
725 mt::fake_shared(mock_sender),
726 nullptr,
727@@ -1130,7 +1106,6 @@
728
729 EXPECT_THAT(observer->exposes(), Eq(0));
730 EXPECT_THAT(observer->hides(), Eq(0));
731- post_a_frame(surface);
732 surface.configure(mir_surface_attrib_visibility, mir_surface_visibility_exposed);
733
734 EXPECT_THAT(observer->exposes(), Eq(1));
735
736=== modified file 'tests/unit-tests/scene/test_session_manager.cpp'
737--- tests/unit-tests/scene/test_session_manager.cpp 2016-03-29 19:17:37 +0000
738+++ tests/unit-tests/scene/test_session_manager.cpp 2016-04-13 15:56:18 +0000
739@@ -83,7 +83,7 @@
740 std::string("stub"),
741 geom::Rectangle{{},{}},
742 false,
743- std::make_shared<mtd::StubBufferStream>(),
744+ std::list<ms::StreamInfo> { { std::make_shared<mtd::StubBufferStream>(), {}, {} } },
745 std::shared_ptr<mi::InputChannel>(),
746 std::shared_ptr<mi::InputSender>(),
747 std::shared_ptr<mg::CursorImage>(),
748
749=== modified file 'tests/unit-tests/scene/test_surface.cpp'
750--- tests/unit-tests/scene/test_surface.cpp 2016-03-24 22:06:39 +0000
751+++ tests/unit-tests/scene/test_surface.cpp 2016-04-13 15:56:18 +0000
752@@ -193,7 +193,7 @@
753 {
754 SurfaceCreation()
755 : surface(surface_name,
756- rect, false, mock_buffer_stream,
757+ rect, false, streams,
758 std::make_shared<mtd::StubInputChannel>(),
759 std::make_shared<mtd::StubInputSender>(),
760 nullptr /* cursor_image */, report)
761@@ -215,6 +215,7 @@
762 }
763
764 std::shared_ptr<testing::NiceMock<mtd::MockBufferStream>> mock_buffer_stream = std::make_shared<testing::NiceMock<mtd::MockBufferStream>>();
765+ std::list<ms::StreamInfo> streams{ { mock_buffer_stream, {}, {} } };
766 std::function<void()> change_notification;
767 int notification_count = 0;
768 mtd::StubBuffer stub_buffer;
769@@ -240,12 +241,6 @@
770 EXPECT_EQ(size, surface.size());
771 }
772
773-TEST_F(SurfaceCreation, constructed_stream_is_primary)
774-{
775- using namespace testing;
776- EXPECT_THAT(surface.primary_buffer_stream(), Eq(mock_buffer_stream));
777-}
778-
779 TEST_F(SurfaceCreation, test_surface_gets_top_left)
780 {
781 auto ret_top_left = surface.top_left();
782@@ -383,7 +378,7 @@
783 surface_name,
784 rect,
785 false,
786- mock_buffer_stream,
787+ streams,
788 mt::fake_shared(channel),
789 std::make_shared<mtd::StubInputSender>(),
790 std::shared_ptr<mg::CursorImage>(),
791@@ -401,7 +396,7 @@
792 surface_name,
793 rect,
794 false,
795- mock_buffer_stream,
796+ streams,
797 std::make_shared<mtd::StubInputChannel>(),
798 mt::fake_shared(mock_sender),
799 std::shared_ptr<mg::CursorImage>(),
800
801=== modified file 'tests/unit-tests/scene/test_surface_impl.cpp'
802--- tests/unit-tests/scene/test_surface_impl.cpp 2016-04-04 03:30:04 +0000
803+++ tests/unit-tests/scene/test_surface_impl.cpp 2016-04-13 15:56:18 +0000
804@@ -82,9 +82,10 @@
805 ON_CALL(*buffer_stream, acquire_client_buffer(_))
806 .WillByDefault(InvokeArgument<0>(nullptr));
807
808- surface = std::make_shared<ms::BasicSurface>(std::string("stub"), geom::Rectangle{{},{}}, false,
809- buffer_stream, nullptr /* input_channel */, stub_input_sender,
810- nullptr /* cursor_image */, report);
811+ surface = std::make_shared<ms::BasicSurface>(
812+ std::string("stub"), geom::Rectangle{{},{}}, false,
813+ std::list<ms::StreamInfo> { { buffer_stream, {}, {} } },
814+ nullptr, stub_input_sender, nullptr, report);
815 }
816
817 mf::SurfaceId stub_id;
818@@ -280,7 +281,7 @@
819 std::string("stub"),
820 geom::Rectangle{{},{}},
821 false,
822- buffer_stream,
823+ std::list<ms::StreamInfo> { { buffer_stream, {}, {} } },
824 std::shared_ptr<mi::InputChannel>(),
825 stub_input_sender,
826 std::shared_ptr<mg::CursorImage>(),
827
828=== modified file 'tests/unit-tests/scene/test_surface_stack.cpp'
829--- tests/unit-tests/scene/test_surface_stack.cpp 2016-03-23 06:39:56 +0000
830+++ tests/unit-tests/scene/test_surface_stack.cpp 2016-04-13 15:56:18 +0000
831@@ -56,10 +56,10 @@
832 namespace
833 {
834
835-void post_a_frame(ms::Surface& s)
836+void post_a_frame(mc::BufferStream& s)
837 {
838 mtd::StubBuffer old_buffer;
839- s.primary_buffer_stream()->swap_buffers(&old_buffer, [](mg::Buffer*){});
840+ s.swap_buffers(&old_buffer, [](mg::Buffer*){});
841 }
842
843 MATCHER_P(SurfaceWithInputReceptionMode, mode, "")
844@@ -67,11 +67,6 @@
845 return arg->reception_mode() == mode;
846 }
847
848-MATCHER_P(SceneElementForSurface, surface, "")
849-{
850- return arg->renderable()->id() == surface->primary_buffer_stream().get();
851-}
852-
853 MATCHER_P(SceneElementForStream, stream, "")
854 {
855 return arg->renderable()->id() == stream.get();
856@@ -133,43 +128,39 @@
857 std::string("stub"),
858 geom::Rectangle{{},{}},
859 false,
860- std::make_shared<mtd::StubBufferStream>(),
861+ std::list<ms::StreamInfo> { { stub_buffer_stream1, {}, {} } },
862 std::shared_ptr<mir::input::InputChannel>(),
863 std::shared_ptr<mir::input::InputSender>(),
864 std::shared_ptr<mg::CursorImage>(),
865 report);
866
867- post_a_frame(*stub_surface1);
868-
869 stub_surface2 = std::make_shared<ms::BasicSurface>(
870 std::string("stub"),
871 geom::Rectangle{{},{}},
872 false,
873- std::make_shared<mtd::StubBufferStream>(),
874+ std::list<ms::StreamInfo> { { stub_buffer_stream2, {}, {} } },
875 std::shared_ptr<mir::input::InputChannel>(),
876 std::shared_ptr<mir::input::InputSender>(),
877 std::shared_ptr<mg::CursorImage>(),
878 report);
879
880- post_a_frame(*stub_surface2);
881-
882+
883 stub_surface3 = std::make_shared<ms::BasicSurface>(
884 std::string("stub"),
885 geom::Rectangle{{},{}},
886 false,
887- std::make_shared<mtd::StubBufferStream>(),
888+ std::list<ms::StreamInfo> { { stub_buffer_stream3, {}, {} } },
889 std::shared_ptr<mir::input::InputChannel>(),
890 std::shared_ptr<mir::input::InputSender>(),
891 std::shared_ptr<mg::CursorImage>(),
892 report);
893
894- post_a_frame(*stub_surface3);
895-
896+
897 invisible_stub_surface = std::make_shared<ms::BasicSurface>(
898 std::string("stub"),
899 geom::Rectangle{{},{}},
900 false,
901- std::make_shared<mtd::StubBufferStream>(),
902+ std::list<ms::StreamInfo> { { std::make_shared<mtd::StubBufferStream>(), {}, {} } },
903 std::shared_ptr<mir::input::InputChannel>(),
904 std::shared_ptr<mir::input::InputSender>(),
905 std::shared_ptr<mg::CursorImage>(),
906@@ -178,6 +169,10 @@
907 }
908
909 ms::SurfaceCreationParameters default_params;
910+ std::shared_ptr<mc::BufferStream> stub_buffer_stream1 = std::make_shared<mtd::StubBufferStream>();
911+ std::shared_ptr<mc::BufferStream> stub_buffer_stream2 = std::make_shared<mtd::StubBufferStream>();
912+ std::shared_ptr<mc::BufferStream> stub_buffer_stream3 = std::make_shared<mtd::StubBufferStream>();
913+
914 std::shared_ptr<ms::BasicSurface> stub_surface1;
915 std::shared_ptr<ms::BasicSurface> stub_surface2;
916 std::shared_ptr<ms::BasicSurface> stub_surface3;
917@@ -216,9 +211,9 @@
918 EXPECT_THAT(
919 stack.scene_elements_for(compositor_id),
920 ElementsAre(
921- SceneElementForSurface(stub_surface1),
922- SceneElementForSurface(stub_surface2),
923- SceneElementForSurface(stub_surface3)));
924+ SceneElementForStream(stub_buffer_stream1),
925+ SceneElementForStream(stub_buffer_stream2),
926+ SceneElementForStream(stub_buffer_stream3)));
927 }
928
929 TEST_F(SurfaceStack, stacking_order_with_multiple_buffer_streams)
930@@ -228,7 +223,7 @@
931 auto stub_stream1 = std::make_shared<mtd::StubBufferStream>();
932 auto stub_stream2 = std::make_shared<mtd::StubBufferStream>();
933 std::list<ms::StreamInfo> streams = {
934- { stub_surface1->buffer_stream(), {0,0}, {} },
935+ { stub_buffer_stream1, {0,0}, {} },
936 { stub_stream0, {2,2}, {} },
937 { stub_stream1, {2,3}, {} },
938 };
939@@ -236,7 +231,7 @@
940
941 streams = {
942 { stub_stream2, {2,4}, {} },
943- { stub_surface3->buffer_stream(), {0,0}, {} }
944+ { stub_buffer_stream3, {0,0}, {} }
945 };
946 stub_surface3->set_streams(streams);
947
948@@ -244,16 +239,15 @@
949 stack.add_surface(stub_surface2, default_params.input_mode);
950 stack.add_surface(stub_surface3, default_params.input_mode);
951
952-
953 EXPECT_THAT(
954 stack.scene_elements_for(compositor_id),
955 ElementsAre(
956- SceneElementForSurface(stub_surface1),
957+ SceneElementForStream(stub_buffer_stream1),
958 SceneElementForStream(stub_stream0),
959 SceneElementForStream(stub_stream1),
960- SceneElementForSurface(stub_surface2),
961+ SceneElementForStream(stub_buffer_stream2),
962 SceneElementForStream(stub_stream2),
963- SceneElementForSurface(stub_surface3)
964+ SceneElementForStream(stub_buffer_stream3)
965 ));
966 }
967
968@@ -268,8 +262,8 @@
969 EXPECT_THAT(
970 stack.scene_elements_for(compositor_id),
971 ElementsAre(
972- SceneElementForSurface(stub_surface1),
973- SceneElementForSurface(stub_surface2)));
974+ SceneElementForStream(stub_buffer_stream1),
975+ SceneElementForStream(stub_buffer_stream2)));
976 }
977
978 TEST_F(SurfaceStack, decor_name_is_surface_name)
979@@ -281,7 +275,7 @@
980 std::string("Mary had a little lamb"),
981 geom::Rectangle{{},{}},
982 false,
983- std::make_shared<mtd::StubBufferStream>(),
984+ std::list<ms::StreamInfo> { { std::make_shared<mtd::StubBufferStream>(), {}, {} } },
985 std::shared_ptr<mir::input::InputChannel>(),
986 std::shared_ptr<mir::input::InputSender>(),
987 std::shared_ptr<mg::CursorImage>(),
988@@ -289,8 +283,7 @@
989 stack.add_surface(surface, default_params.input_mode);
990 surface->configure(mir_surface_attrib_visibility,
991 mir_surface_visibility_exposed);
992- post_a_frame(*surface);
993-
994+
995 auto elements = stack.scene_elements_for(compositor_id);
996 ASSERT_EQ(1, elements.size());
997
998@@ -311,7 +304,7 @@
999 std::string("username@hostname: /"),
1000 geom::Rectangle{{},{}},
1001 false,
1002- std::make_shared<mtd::StubBufferStream>(),
1003+ std::list<ms::StreamInfo> { { std::make_shared<mtd::StubBufferStream>(), {}, {} } },
1004 std::shared_ptr<mir::input::InputChannel>(),
1005 std::shared_ptr<mir::input::InputSender>(),
1006 std::shared_ptr<mg::CursorImage>(),
1007@@ -319,8 +312,7 @@
1008 stack.add_surface(surface, default_params.input_mode);
1009 surface->configure(mir_surface_attrib_visibility,
1010 mir_surface_visibility_exposed);
1011- post_a_frame(*surface);
1012-
1013+
1014 // (change directory in shell app)
1015 surface->rename("username@hostname: ~/Documents");
1016
1017@@ -350,11 +342,12 @@
1018 ON_CALL(*mock_queue, compositor_acquire(_))
1019 .WillByDefault(InvokeWithoutArgs([&]{ready--; return mt::fake_shared(stub_buffer); }));
1020
1021+ auto stream = std::make_shared<mc::BufferStreamSurfaces>(mock_queue);
1022 auto surface = std::make_shared<ms::BasicSurface>(
1023 std::string("stub"),
1024 geom::Rectangle{{},{}},
1025 false,
1026- std::make_shared<mc::BufferStreamSurfaces>(mock_queue),
1027+ std::list<ms::StreamInfo> { { stream, {}, {} } },
1028 std::shared_ptr<mir::input::InputChannel>(),
1029 std::shared_ptr<mir::input::InputSender>(),
1030 std::shared_ptr<mg::CursorImage>(),
1031@@ -364,9 +357,9 @@
1032 mir_surface_visibility_exposed);
1033
1034 EXPECT_EQ(0, stack.frames_pending(this));
1035- post_a_frame(*surface);
1036- post_a_frame(*surface);
1037- post_a_frame(*surface);
1038+ post_a_frame(*stream);
1039+ post_a_frame(*stream);
1040+ post_a_frame(*stream);
1041 EXPECT_EQ(3, stack.frames_pending(this));
1042
1043 for (int expect = 3; expect >= 0; --expect)
1044@@ -386,11 +379,12 @@
1045
1046 ms::SurfaceStack stack{report};
1047 stack.register_compositor(this);
1048+ auto stream = std::make_shared<mtd::StubBufferStream>();
1049 auto surface = std::make_shared<ms::BasicSurface>(
1050 std::string("stub"),
1051 geom::Rectangle{{},{}},
1052 false,
1053- std::make_shared<mtd::StubBufferStream>(),
1054+ std::list<ms::StreamInfo> { { stream, {}, {} } },
1055 std::shared_ptr<mir::input::InputChannel>(),
1056 std::shared_ptr<mir::input::InputSender>(),
1057 std::shared_ptr<mg::CursorImage>(),
1058@@ -402,9 +396,9 @@
1059 elem->occluded();
1060
1061 EXPECT_EQ(0, stack.frames_pending(this));
1062- post_a_frame(*surface);
1063- post_a_frame(*surface);
1064- post_a_frame(*surface);
1065+ post_a_frame(*stream);
1066+ post_a_frame(*stream);
1067+ post_a_frame(*stream);
1068 EXPECT_EQ(0, stack.frames_pending(this));
1069 }
1070
1071@@ -419,20 +413,21 @@
1072
1073 stack.register_compositor(comp1);
1074 stack.register_compositor(comp2);
1075+ auto stream = std::make_shared<mtd::StubBufferStream>();
1076 auto surface = std::make_shared<ms::BasicSurface>(
1077 std::string("stub"),
1078 geom::Rectangle{{},{}},
1079 false,
1080- std::make_shared<mtd::StubBufferStream>(),
1081+ std::list<ms::StreamInfo> { { stream, {}, {} } },
1082 std::shared_ptr<mir::input::InputChannel>(),
1083 std::shared_ptr<mir::input::InputSender>(),
1084 std::shared_ptr<mg::CursorImage>(),
1085 report);
1086
1087 stack.add_surface(surface, default_params.input_mode);
1088- post_a_frame(*surface);
1089- post_a_frame(*surface);
1090- post_a_frame(*surface);
1091+ post_a_frame(*stream);
1092+ post_a_frame(*stream);
1093+ post_a_frame(*stream);
1094
1095 EXPECT_EQ(3, stack.frames_pending(comp1));
1096 EXPECT_EQ(3, stack.frames_pending(comp2));
1097@@ -464,9 +459,9 @@
1098 EXPECT_THAT(
1099 stack.scene_elements_for(compositor_id),
1100 ElementsAre(
1101- SceneElementForSurface(stub_surface1),
1102- SceneElementForSurface(stub_surface3),
1103- SceneElementForSurface(stub_surface2)));
1104+ SceneElementForStream(stub_buffer_stream1),
1105+ SceneElementForStream(stub_buffer_stream3),
1106+ SceneElementForStream(stub_buffer_stream2)));
1107 }
1108
1109
1110@@ -500,18 +495,18 @@
1111 EXPECT_THAT(
1112 stack.scene_elements_for(compositor_id),
1113 ElementsAre(
1114- SceneElementForSurface(stub_surface1),
1115- SceneElementForSurface(stub_surface2),
1116- SceneElementForSurface(stub_surface3)));
1117+ SceneElementForStream(stub_buffer_stream1),
1118+ SceneElementForStream(stub_buffer_stream2),
1119+ SceneElementForStream(stub_buffer_stream3)));
1120
1121 stack.raise(stub_surface1);
1122
1123 EXPECT_THAT(
1124 stack.scene_elements_for(compositor_id),
1125 ElementsAre(
1126- SceneElementForSurface(stub_surface2),
1127- SceneElementForSurface(stub_surface3),
1128- SceneElementForSurface(stub_surface1)));
1129+ SceneElementForStream(stub_buffer_stream2),
1130+ SceneElementForStream(stub_buffer_stream3),
1131+ SceneElementForStream(stub_buffer_stream1)));
1132 }
1133
1134 TEST_F(SurfaceStack, raise_throw_behavior)
1135@@ -537,13 +532,12 @@
1136 std::string("stub"),
1137 geom::Rectangle{geom::Point{3 * i, 4 * i},geom::Size{1 * i, 2 * i}},
1138 true,
1139- std::make_shared<mtd::StubBufferStream>(),
1140+ std::list<ms::StreamInfo> { { std::make_shared<mtd::StubBufferStream>(), {}, {} } },
1141 std::shared_ptr<mir::input::InputChannel>(),
1142 std::shared_ptr<mir::input::InputSender>(),
1143 std::shared_ptr<mg::CursorImage>(),
1144 report);
1145- post_a_frame(*surface);
1146-
1147+
1148 surfaces.emplace_back(surface);
1149 stack.add_surface(surface, default_params.input_mode);
1150 }
1151@@ -723,7 +717,7 @@
1152 std::string("stub"),
1153 geom::Rectangle{geom::Point{3 * i, 4 * i},geom::Size{1 * i, 2 * i}},
1154 true,
1155- std::make_shared<mtd::StubBufferStream>(),
1156+ std::list<ms::StreamInfo> { { std::make_shared<mtd::StubBufferStream>(), {}, {} } },
1157 std::shared_ptr<mir::input::InputChannel>(),
1158 std::shared_ptr<mir::input::InputSender>(),
1159 std::shared_ptr<mg::CursorImage>(),
1160@@ -756,13 +750,12 @@
1161 std::string("stub"),
1162 geom::Rectangle{geom::Point{3, 4},geom::Size{1, 2}},
1163 true,
1164- mock_stream,
1165+ std::list<ms::StreamInfo> { { mock_stream, {}, {} } },
1166 std::shared_ptr<mir::input::InputChannel>(),
1167 std::shared_ptr<mir::input::InputSender>(),
1168 std::shared_ptr<mg::CursorImage>(),
1169 report);
1170- post_a_frame(*surface);
1171- stack.add_surface(surface, default_params.input_mode);
1172+ stack.add_surface(surface, default_params.input_mode);
1173
1174 auto const elements = stack.scene_elements_for(compositor_id);
1175
1176@@ -787,13 +780,12 @@
1177 std::string("stub"),
1178 geom::Rectangle{geom::Point{3, 4},geom::Size{1, 2}},
1179 true,
1180- mock_stream,
1181+ std::list<ms::StreamInfo> { { mock_stream, {}, {} } },
1182 std::shared_ptr<mir::input::InputChannel>(),
1183 std::shared_ptr<mir::input::InputSender>(),
1184 std::shared_ptr<mg::CursorImage>(),
1185 report);
1186- post_a_frame(*surface);
1187- stack.add_surface(surface, default_params.input_mode);
1188+ stack.add_surface(surface, default_params.input_mode);
1189
1190 auto const elements = stack.scene_elements_for(compositor_id);
1191 ASSERT_THAT(elements.size(), Eq(1u));
1192@@ -811,7 +803,7 @@
1193 {},
1194 {{},{}},
1195 true,
1196- std::make_shared<mtd::StubBufferStream>(),
1197+ std::list<ms::StreamInfo> { { std::make_shared<mtd::StubBufferStream>(), {}, {} } },
1198 {},
1199 {},
1200 {},
1201@@ -833,8 +825,7 @@
1202
1203 auto const mock_surface = std::make_shared<MockConfigureSurface>();
1204 mock_surface->show();
1205- post_a_frame(*mock_surface);
1206-
1207+
1208 stack.add_surface(mock_surface, default_params.input_mode);
1209
1210 auto const elements = stack.scene_elements_for(compositor_id);
1211@@ -858,8 +849,7 @@
1212 stack.register_compositor(compositor_id2);
1213
1214 auto const mock_surface = std::make_shared<MockConfigureSurface>();
1215- post_a_frame(*mock_surface);
1216- stack.add_surface(mock_surface, default_params.input_mode);
1217+ stack.add_surface(mock_surface, default_params.input_mode);
1218
1219 auto const elements = stack.scene_elements_for(compositor_id);
1220 ASSERT_THAT(elements.size(), Eq(1u));
1221@@ -884,7 +874,6 @@
1222 stack.register_compositor(compositor_id3);
1223
1224 auto const mock_surface = std::make_shared<MockConfigureSurface>();
1225- post_a_frame(*mock_surface);
1226 stack.add_surface(mock_surface, default_params.input_mode);
1227
1228 auto const elements = stack.scene_elements_for(compositor_id);
1229@@ -1014,8 +1003,8 @@
1230 EXPECT_THAT(
1231 stack.scene_elements_for(compositor_id),
1232 ElementsAre(
1233- SceneElementForSurface(stub_surface1),
1234- SceneElementForSurface(stub_surface2),
1235+ SceneElementForStream(stub_buffer_stream1),
1236+ SceneElementForStream(stub_buffer_stream2),
1237 SceneElementForStream(mt::fake_shared(r))));
1238 }
1239
1240@@ -1032,8 +1021,8 @@
1241 EXPECT_THAT(
1242 stack.scene_elements_for(compositor_id),
1243 ElementsAre(
1244- SceneElementForSurface(stub_surface1),
1245- SceneElementForSurface(stub_surface2),
1246+ SceneElementForStream(stub_buffer_stream1),
1247+ SceneElementForStream(stub_buffer_stream2),
1248 SceneElementForStream(mt::fake_shared(r))));
1249
1250 stack.remove_input_visualization(mt::fake_shared(r));
1251@@ -1041,8 +1030,8 @@
1252 EXPECT_THAT(
1253 stack.scene_elements_for(compositor_id),
1254 ElementsAre(
1255- SceneElementForSurface(stub_surface1),
1256- SceneElementForSurface(stub_surface2)));
1257+ SceneElementForStream(stub_buffer_stream1),
1258+ SceneElementForStream(stub_buffer_stream2)));
1259 }
1260
1261 TEST_F(SurfaceStack, scene_observers_notified_of_generic_scene_change)
1262@@ -1140,9 +1129,9 @@
1263 EXPECT_THAT(
1264 stack.scene_elements_for(compositor_id),
1265 ElementsAre(
1266- SceneElementForSurface(stub_surface2),
1267- SceneElementForSurface(stub_surface1),
1268- SceneElementForSurface(stub_surface3)));
1269+ SceneElementForStream(stub_buffer_stream2),
1270+ SceneElementForStream(stub_buffer_stream1),
1271+ SceneElementForStream(stub_buffer_stream3)));
1272
1273 Mock::VerifyAndClearExpectations(&observer);
1274 EXPECT_CALL(observer, surfaces_reordered()).Times(1);
1275@@ -1151,9 +1140,9 @@
1276 EXPECT_THAT(
1277 stack.scene_elements_for(compositor_id),
1278 ElementsAre(
1279- SceneElementForSurface(stub_surface1),
1280- SceneElementForSurface(stub_surface2),
1281- SceneElementForSurface(stub_surface3)));
1282+ SceneElementForStream(stub_buffer_stream1),
1283+ SceneElementForStream(stub_buffer_stream2),
1284+ SceneElementForStream(stub_buffer_stream3)));
1285
1286 Mock::VerifyAndClearExpectations(&observer);
1287 EXPECT_CALL(observer, surfaces_reordered()).Times(0);
1288@@ -1162,7 +1151,7 @@
1289 EXPECT_THAT(
1290 stack.scene_elements_for(compositor_id),
1291 ElementsAre(
1292- SceneElementForSurface(stub_surface1),
1293- SceneElementForSurface(stub_surface2),
1294- SceneElementForSurface(stub_surface3)));
1295+ SceneElementForStream(stub_buffer_stream1),
1296+ SceneElementForStream(stub_buffer_stream2),
1297+ SceneElementForStream(stub_buffer_stream3)));
1298 }

Subscribers

People subscribed via source and target branches