Merge lp:~andreas-pokorny/mir/nbs-resize-first-stream-of-surface into lp:mir
- nbs-resize-first-stream-of-surface
- Merge into development-branch
Status: | Rejected |
---|---|
Rejected by: | Andreas Pokorny |
Proposed branch: | lp:~andreas-pokorny/mir/nbs-resize-first-stream-of-surface |
Merge into: | lp:mir |
Prerequisite: | lp:~andreas-pokorny/mir/avoid-static-library-ordering-problems |
Diff against target: |
277 lines (+98/-7) 9 files modified
src/client/connection_surface_map.h (+1/-0) src/client/mir_connection.cpp (+10/-0) src/client/mir_connection.h (+1/-0) src/client/mir_surface.cpp (+12/-0) src/client/mir_surface.h (+2/-1) src/client/surface_map.cpp (+14/-0) src/client/surface_map.h (+2/-0) tests/unit-tests/client/test_client_mir_surface.cpp (+50/-6) tests/unit-tests/client/test_protobuf_rpc_channel.cpp (+6/-0) |
To merge this branch: | bzr merge lp:~andreas-pokorny/mir/nbs-resize-first-stream-of-surface |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daniel van Vugt | Abstain | ||
Alan Griffiths | Abstain | ||
Mir CI Bot | continuous-integration | Approve | |
Mir development team | Pending | ||
Review via email: mp+301277@code.launchpad.net |
Commit message
Make NBS behave like OBS - resize the first buffer stream
With OBS mir::scene:
Since we deprecate using mir_surface_
Description of the change
With presentation chains the client handles resizes by submitting buffers in an adjusted size. With BufferStream there is no way a client can resize an existing stream. With OBS the server made sure that upcoming allocations adapt to the window size. Since the BufferStreams functionality moved to mirclient with NBS, the resize is forwarded to the 'default' BufferStream.
This change makes sure that even when the caller uses mir_surface_
- 3616. By Andreas Pokorny
-
spell out the actual expectation: no exception when attempting to resize a presentation chain
Mir CI Bot (mir-ci-bot) wrote : | # |
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3616
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3616
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Alan Griffiths (alan-griffiths) wrote : | # |
I'm not sure enough of the implications to know if this is a good idea. What user visible feature does it effect?
Also "with_potential
Andreas Pokorny (andreas-pokorny) wrote : | # |
> I'm not sure enough of the implications to know if this is a good idea. What
> user visible feature does it effect?
>
> Also "with_potential
Created a bug (lp:1608457) for the problem I observerd with gtk+
- 3617. By Andreas Pokorny
-
rename new method
Kevin DuBois (kdub) wrote : | # |
I think this is fine as a workaround while the definitions are improved in this area.
The physical buffer size is something the client sets, and the onscreen size is something server/shell sets.
The legacy problem has to do with how the sizes (physical and on-screen) were assumed to be the same. The default stream used to just be resized, and now the 1st stream will just be resized.
A function like:
mir_buffer_
might be what's needed to make things in the non-legacy world a bit nicer and clearer.
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3617
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Alan Griffiths (alan-griffiths) wrote : | # |
*Needs Discussion*
It seems that the client API lacks a mir_buffer_
But I'm concerned that clients might want to make an atomic update of size and scale. Is the "correct" approach to create a new buffer stream?
Andreas Pokorny (andreas-pokorny) wrote : | # |
> *Needs Discussion*
>
> It seems that the client API lacks a mir_buffer_
> that would be a better fix than this proposal.
>
> But I'm concerned that clients might want to make an atomic update of size and
> scale. Is the "correct" approach to create a new buffer stream?
Existing behavior with and without mir_surface_
The release-
lp:~andreas-pokorny/mir/fix-buffer-release-requests-after-buffer-stream-destruction
The recreate approach has the advantage that it is immediately clear that the first buffer you get from the buffer stream will have the right size. Additionally the screen update would be tied to the necessary mir_surface_
But a current implementation detail makes the recreate approach a bit more resource intense since on creation three buffers are allocated. With a sequence of resize events two thirds of all created buffers are just allocated and freed without use. I assume that problem can be solved through an implementation change in mirclient.
Daniel van Vugt (vanvugt) wrote : | # |
Do we need to hold 0.23.5 for this?
Andreas Pokorny (andreas-pokorny) wrote : | # |
> I think this is fine as a workaround while the definitions are improved in
> this area.
>
> The physical buffer size is something the client sets, and the onscreen size
> is something server/shell sets.
>
> The legacy problem has to do with how the sizes (physical and on-screen) were
> assumed to be the same. The default stream used to just be resized, and now
> the 1st stream will just be resized.
>
> A function like:
> mir_buffer_
> might be what's needed to make things in the non-legacy world a bit nicer and
> clearer.
What is the unit of the physical size? Is this related to the existing mir_buffer_
Andreas Pokorny (andreas-pokorny) wrote : | # |
> Do we need to hold 0.23.5 for this?
We discussed that yesterday. The combination in which resize does not happen is not used by qt, gtk or sdl. So no need to hold 0.23.5 for now.
Daniel van Vugt (vanvugt) wrote : | # |
Sorry, I don't remember having that discussion. Only asking a few times. Maybe I didn't understand the answer.
Alan Griffiths (alan-griffiths) wrote : | # |
The current special treatment of the first buffer seems inconsistent. So, as it is unused in practice, I'd rather not add this code to replicate it.
> The recreate approach has the advantage that it is immediately clear that the
> first buffer you get from the buffer stream will have the right size.
> Additionally the screen update would be tied to the necessary
> mir_surface_
> arguments to have it happen instantly or only after the next buffer swap..
>
> But a current implementation detail makes the recreate approach a bit more
> resource intense since on creation three buffers are allocated. With a
> sequence of resize events two thirds of all created buffers are just allocated
> and freed without use. I assume that problem can be solved through an
> implementation change in mirclient.
My *preference* would be to make the recreate approach (1) work and (2) work efficiently.
But I don't feel strongly about it today.
Kevin DuBois (kdub) wrote : | # |
> The current special treatment of the first buffer seems inconsistent. So, as
> it is unused in practice, I'd rather not add this code to replicate it.
Right, it is inconsistent, but it is used, iirc. The surface that gets resized by the server has to respond by resizing the 'default' buffer stream. It seemed better to just keep the auto-resizing around for the 'default/legacy' case, instead saying that the first stream gets resized to the size of the surface (as it is in this MP).
Auto-resizing the 1st stream, as opposed to the only a 'legacy' stream, makes it a bit harder to arrange a scene. Like, if I wanted a 200x200 surface with 4 100x100 windows, and then the server resizes the surface to 500x500, the 1st stream would fill the space after the resize message. The current design is a bit broken for other reasons (no atomic scene arrangements), but I think this might complicate the matter (esp if we're going to use 'tips' for this intented purpose).
This region is due for a bit of cleanup with the atomic updates topic that's coming around soon, maybe we WIP the branch until then, and then roll it into a larger fix to make the scene arrangement and sizes more consistent?
Andreas Pokorny (andreas-pokorny) wrote : | # |
> > The current special treatment of the first buffer seems inconsistent. So, as
> > it is unused in practice, I'd rather not add this code to replicate it.
>
> Right, it is inconsistent, but it is used, iirc. The surface that gets resized
> by the server has to respond by resizing the 'default' buffer stream. It
> seemed better to just keep the auto-resizing around for the 'default/legacy'
> case, instead saying that the first stream gets resized to the size of the
> surface (as it is in this MP).
>
> Auto-resizing the 1st stream, as opposed to the only a 'legacy' stream, makes
> it a bit harder to arrange a scene. Like, if I wanted a 200x200 surface with 4
> 100x100 windows, and then the server resizes the surface to 500x500, the 1st
> stream would fill the space after the resize message. The current design is a
> bit broken for other reasons (no atomic scene arrangements), but I think this
> might complicate the matter (esp if we're going to use 'tips' for this
> intented purpose).
>
> This region is due for a bit of cleanup with the atomic updates topic that's
> coming around soon, maybe we WIP the branch until then, and then roll it into
> a larger fix to make the scene arrangement and sizes more consistent?
The reason why I proposed this is because we resized the first stream when old buffer semantics were used. But not without another "but". It only did so for the initial configuration - if the users switches to different "first" stream with another spec update it stopped working
We have so many wrong behaviors that I wasnt sure what to expect when changing gtk+.
I also do not like the auto resizing.. So I guess we should focus on making client driven resizes nicer then.
Daniel van Vugt (vanvugt) wrote : | # |
I don't want to be a blocker here. I didn't realize mir_surface_
All toolkits want is a:
mir_
which they currently have to do via:
mir_
It's already annoying enough. I don't endorse us making it worse. But that's not the fault of this branch.
Andreas Pokorny (andreas-pokorny) wrote : | # |
Rejecting - the fact that OBS with set_streams would resize buffer stream is fishy for the more interesting use cases.
Andreas Pokorny (andreas-pokorny) wrote : | # |
*would resize the first buffer stream*
Unmerged revisions
- 3617. By Andreas Pokorny
-
rename new method
- 3616. By Andreas Pokorny
-
spell out the actual expectation: no exception when attempting to resize a presentation chain
- 3615. By Andreas Pokorny
-
Tests and additional changes to handle the PresentationChain case
- 3614. By Andreas Pokorny
-
Make NBS behave like OBS - resize the first buffer stream
With OBS mir::scene:
:BasicSurface would pull out the first stream as the 'default' stream and forward all resizes to that stream. With NBS this is done by the client library. So if no buffer stream is configured via the mir_surface_ spec_add_ buffer_ stream or mir_surface_ spec_set_ streams API the client side surface will forward the content of resize events to the 'default' stream. Since we deprecate using mir_surface_
get_buffer_ stream users are forces to specify the streams or presentation queues they want for display. But streams buffers lack a resize functionality so switching to the new function would not be a viable option.
Preview Diff
1 | === modified file 'src/client/connection_surface_map.h' | |||
2 | --- src/client/connection_surface_map.h 2016-06-06 11:51:31 +0000 | |||
3 | +++ src/client/connection_surface_map.h 2016-08-01 12:51:16 +0000 | |||
4 | @@ -39,6 +39,7 @@ | |||
5 | 39 | void erase(frontend::SurfaceId surface_id); | 39 | void erase(frontend::SurfaceId surface_id); |
6 | 40 | 40 | ||
7 | 41 | void with_stream_do(frontend::BufferStreamId stream_id, std::function<void(ClientBufferStream*)> const& exec) const override; | 41 | void with_stream_do(frontend::BufferStreamId stream_id, std::function<void(ClientBufferStream*)> const& exec) const override; |
8 | 42 | void if_stream_do(frontend::BufferStreamId stream_id, std::function<void(ClientBufferStream*)> const& exec) const override; | ||
9 | 42 | void with_all_streams_do(std::function<void(ClientBufferStream*)> const&) const override; | 43 | void with_all_streams_do(std::function<void(ClientBufferStream*)> const&) const override; |
10 | 43 | 44 | ||
11 | 44 | void insert(frontend::BufferStreamId stream_id, std::shared_ptr<ClientBufferStream> const& chain); | 45 | void insert(frontend::BufferStreamId stream_id, std::shared_ptr<ClientBufferStream> const& chain); |
12 | 45 | 46 | ||
13 | === modified file 'src/client/mir_connection.cpp' | |||
14 | --- src/client/mir_connection.cpp 2016-06-28 12:18:18 +0000 | |||
15 | +++ src/client/mir_connection.cpp 2016-08-01 12:51:16 +0000 | |||
16 | @@ -1252,3 +1252,13 @@ | |||
17 | 1252 | released_buffer->set_buffer_id(buffer->rpc_id()); | 1252 | released_buffer->set_buffer_id(buffer->rpc_id()); |
18 | 1253 | server.release_buffers(&request, ignored.get(), gp::NewCallback(ignore)); | 1253 | server.release_buffers(&request, ignored.get(), gp::NewCallback(ignore)); |
19 | 1254 | } | 1254 | } |
20 | 1255 | |||
21 | 1256 | void MirConnection::resize_stream(mir::frontend::BufferStreamId const id, mir::geometry::Size const& size) const | ||
22 | 1257 | { | ||
23 | 1258 | surface_map->if_stream_do( | ||
24 | 1259 | id, | ||
25 | 1260 | [size](mcl::ClientBufferStream* stream) | ||
26 | 1261 | { | ||
27 | 1262 | stream->set_size(size); | ||
28 | 1263 | }); | ||
29 | 1264 | } | ||
30 | 1255 | 1265 | ||
31 | === modified file 'src/client/mir_connection.h' | |||
32 | --- src/client/mir_connection.h 2016-06-28 12:18:18 +0000 | |||
33 | +++ src/client/mir_connection.h 2016-08-01 12:51:16 +0000 | |||
34 | @@ -199,6 +199,7 @@ | |||
35 | 199 | mir::geometry::Size size, MirPixelFormat format, MirBufferUsage usage, | 199 | mir::geometry::Size size, MirPixelFormat format, MirBufferUsage usage, |
36 | 200 | mir_buffer_callback callback, void* context); | 200 | mir_buffer_callback callback, void* context); |
37 | 201 | void release_buffer(mir::client::MirBuffer* buffer); | 201 | void release_buffer(mir::client::MirBuffer* buffer); |
38 | 202 | void resize_stream(mir::frontend::BufferStreamId const id, mir::geometry::Size const& size) const; | ||
39 | 202 | 203 | ||
40 | 203 | private: | 204 | private: |
41 | 204 | //google cant have callbacks with more than 2 args | 205 | //google cant have callbacks with more than 2 args |
42 | 205 | 206 | ||
43 | === modified file 'src/client/mir_surface.cpp' | |||
44 | --- src/client/mir_surface.cpp 2016-06-24 07:41:32 +0000 | |||
45 | +++ src/client/mir_surface.cpp 2016-08-01 12:51:16 +0000 | |||
46 | @@ -45,6 +45,7 @@ | |||
47 | 45 | namespace mp = mir::protobuf; | 45 | namespace mp = mir::protobuf; |
48 | 46 | namespace gp = google::protobuf; | 46 | namespace gp = google::protobuf; |
49 | 47 | namespace md = mir::dispatch; | 47 | namespace md = mir::dispatch; |
50 | 48 | namespace mf = mir::frontend; | ||
51 | 48 | 49 | ||
52 | 49 | namespace | 50 | namespace |
53 | 50 | { | 51 | { |
54 | @@ -153,6 +154,13 @@ | |||
55 | 153 | input_platform->create_input_receiver( surface_proto.fd(0), keymapper, handle_event_callback)); | 154 | input_platform->create_input_receiver( surface_proto.fd(0), keymapper, handle_event_callback)); |
56 | 154 | } | 155 | } |
57 | 155 | 156 | ||
58 | 157 | if (spec.streams.is_set() && spec.streams.value().size() >= 1) | ||
59 | 158 | { | ||
60 | 159 | auto first_stream = spec.streams.value().front(); | ||
61 | 160 | window_stream_id = mf::BufferStreamId{first_stream.stream_id}; | ||
62 | 161 | } | ||
63 | 162 | |||
64 | 163 | |||
65 | 156 | std::lock_guard<decltype(handle_mutex)> lock(handle_mutex); | 164 | std::lock_guard<decltype(handle_mutex)> lock(handle_mutex); |
66 | 157 | valid_surfaces.insert(this); | 165 | valid_surfaces.insert(this); |
67 | 158 | } | 166 | } |
68 | @@ -456,6 +464,8 @@ | |||
69 | 456 | size = { mir_resize_event_get_width(resize_event), mir_resize_event_get_height(resize_event) }; | 464 | size = { mir_resize_event_get_width(resize_event), mir_resize_event_get_height(resize_event) }; |
70 | 457 | if (default_stream) | 465 | if (default_stream) |
71 | 458 | default_stream->set_size(size); | 466 | default_stream->set_size(size); |
72 | 467 | else if (window_stream_id.is_set()) | ||
73 | 468 | connection()->resize_stream(window_stream_id.value(), size); | ||
74 | 459 | break; | 469 | break; |
75 | 460 | } | 470 | } |
76 | 461 | default: | 471 | default: |
77 | @@ -604,6 +614,8 @@ | |||
78 | 604 | if (spec.streams.is_set()) | 614 | if (spec.streams.is_set()) |
79 | 605 | { | 615 | { |
80 | 606 | default_stream = nullptr; | 616 | default_stream = nullptr; |
81 | 617 | if (spec.streams.value().size() >= 1) | ||
82 | 618 | window_stream_id = mf::BufferStreamId{spec.streams.value().front().stream_id}; | ||
83 | 607 | for(auto const& stream : spec.streams.value()) | 619 | for(auto const& stream : spec.streams.value()) |
84 | 608 | { | 620 | { |
85 | 609 | auto const new_stream = surface_specification->add_stream(); | 621 | auto const new_stream = surface_specification->add_stream(); |
86 | 610 | 622 | ||
87 | === modified file 'src/client/mir_surface.h' | |||
88 | --- src/client/mir_surface.h 2016-06-09 00:38:26 +0000 | |||
89 | +++ src/client/mir_surface.h 2016-08-01 12:51:16 +0000 | |||
90 | @@ -26,6 +26,7 @@ | |||
91 | 26 | 26 | ||
92 | 27 | #include "mir/client_platform.h" | 27 | #include "mir/client_platform.h" |
93 | 28 | #include "mir/frontend/surface_id.h" | 28 | #include "mir/frontend/surface_id.h" |
94 | 29 | #include "mir/frontend/buffer_stream_id.h" | ||
95 | 29 | #include "mir/optional_value.h" | 30 | #include "mir/optional_value.h" |
96 | 30 | #include "mir/geometry/dimensions.h" | 31 | #include "mir/geometry/dimensions.h" |
97 | 31 | #include "mir/geometry/displacement.h" | 32 | #include "mir/geometry/displacement.h" |
98 | @@ -249,7 +250,7 @@ | |||
99 | 249 | MirPixelFormat format; | 250 | MirPixelFormat format; |
100 | 250 | MirBufferUsage usage; | 251 | MirBufferUsage usage; |
101 | 251 | uint32_t output_id; | 252 | uint32_t output_id; |
103 | 252 | 253 | mir::optional_value<mir::frontend::BufferStreamId> window_stream_id; | |
104 | 253 | }; | 254 | }; |
105 | 254 | 255 | ||
106 | 255 | #endif /* MIR_CLIENT_PRIVATE_MIR_WAIT_HANDLE_H_ */ | 256 | #endif /* MIR_CLIENT_PRIVATE_MIR_WAIT_HANDLE_H_ */ |
107 | 256 | 257 | ||
108 | === modified file 'src/client/surface_map.cpp' | |||
109 | --- src/client/surface_map.cpp 2016-06-06 11:51:31 +0000 | |||
110 | +++ src/client/surface_map.cpp 2016-08-01 12:51:16 +0000 | |||
111 | @@ -76,6 +76,20 @@ | |||
112 | 76 | } | 76 | } |
113 | 77 | } | 77 | } |
114 | 78 | 78 | ||
115 | 79 | void mcl::ConnectionSurfaceMap::if_stream_do( | ||
116 | 80 | mf::BufferStreamId stream_id, std::function<void(ClientBufferStream*)> const& exec) const | ||
117 | 81 | { | ||
118 | 82 | std::shared_lock<decltype(guard)> lk(guard); | ||
119 | 83 | auto const it = streams.find(stream_id); | ||
120 | 84 | if (it != streams.end()) | ||
121 | 85 | { | ||
122 | 86 | auto const stream = it->second; | ||
123 | 87 | lk.unlock(); | ||
124 | 88 | exec(stream.get()); | ||
125 | 89 | } | ||
126 | 90 | } | ||
127 | 91 | |||
128 | 92 | |||
129 | 79 | void mcl::ConnectionSurfaceMap::with_all_streams_do(std::function<void(ClientBufferStream*)> const& fn) const | 93 | void mcl::ConnectionSurfaceMap::with_all_streams_do(std::function<void(ClientBufferStream*)> const& fn) const |
130 | 80 | { | 94 | { |
131 | 81 | std::shared_lock<decltype(guard)> lk(guard); | 95 | std::shared_lock<decltype(guard)> lk(guard); |
132 | 82 | 96 | ||
133 | === modified file 'src/client/surface_map.h' | |||
134 | --- src/client/surface_map.h 2016-06-06 11:51:31 +0000 | |||
135 | +++ src/client/surface_map.h 2016-08-01 12:51:16 +0000 | |||
136 | @@ -44,6 +44,8 @@ | |||
137 | 44 | frontend::SurfaceId surface_id, std::function<void(MirSurface*)> const& exec) const = 0; | 44 | frontend::SurfaceId surface_id, std::function<void(MirSurface*)> const& exec) const = 0; |
138 | 45 | virtual void with_stream_do( | 45 | virtual void with_stream_do( |
139 | 46 | frontend::BufferStreamId stream_id, std::function<void(ClientBufferStream*)> const& exec) const = 0; | 46 | frontend::BufferStreamId stream_id, std::function<void(ClientBufferStream*)> const& exec) const = 0; |
140 | 47 | virtual void if_stream_do( | ||
141 | 48 | frontend::BufferStreamId stream_id, std::function<void(ClientBufferStream*)> const& exec) const = 0; | ||
142 | 47 | virtual void with_all_streams_do(std::function<void(ClientBufferStream*)> const&) const = 0; | 49 | virtual void with_all_streams_do(std::function<void(ClientBufferStream*)> const&) const = 0; |
143 | 48 | virtual std::shared_ptr<MirBuffer> buffer(int buffer_id) const = 0; | 50 | virtual std::shared_ptr<MirBuffer> buffer(int buffer_id) const = 0; |
144 | 49 | virtual void insert(int buffer_id, std::shared_ptr<MirBuffer> const& buffer) = 0; | 51 | virtual void insert(int buffer_id, std::shared_ptr<MirBuffer> const& buffer) = 0; |
145 | 50 | 52 | ||
146 | === modified file 'tests/unit-tests/client/test_client_mir_surface.cpp' | |||
147 | --- tests/unit-tests/client/test_client_mir_surface.cpp 2016-06-08 12:30:14 +0000 | |||
148 | +++ tests/unit-tests/client/test_client_mir_surface.cpp 2016-08-01 12:51:16 +0000 | |||
149 | @@ -27,6 +27,7 @@ | |||
150 | 27 | #include "mir/client_platform.h" | 27 | #include "mir/client_platform.h" |
151 | 28 | #include "mir/client_platform_factory.h" | 28 | #include "mir/client_platform_factory.h" |
152 | 29 | #include "src/client/mir_surface.h" | 29 | #include "src/client/mir_surface.h" |
153 | 30 | #include "src/client/mir_presentation_chain.h" | ||
154 | 30 | #include "src/client/mir_connection.h" | 31 | #include "src/client/mir_connection.h" |
155 | 31 | #include "src/client/default_connection_configuration.h" | 32 | #include "src/client/default_connection_configuration.h" |
156 | 32 | #include "src/client/rpc/null_rpc_report.h" | 33 | #include "src/client/rpc/null_rpc_report.h" |
157 | @@ -73,6 +74,16 @@ | |||
158 | 73 | namespace | 74 | namespace |
159 | 74 | { | 75 | { |
160 | 75 | 76 | ||
161 | 77 | struct StubPresentationChain : MirPresentationChain | ||
162 | 78 | { | ||
163 | 79 | int id; | ||
164 | 80 | StubPresentationChain(int id) : id{id} {} | ||
165 | 81 | void submit_buffer(mir::client::MirBuffer*) override {} | ||
166 | 82 | MirConnection* connection() const override {return nullptr;} | ||
167 | 83 | int rpc_id() const override {return id;} | ||
168 | 84 | char const* error_msg() const override {return nullptr;} | ||
169 | 85 | }; | ||
170 | 86 | |||
171 | 76 | struct MockServerPackageGenerator : public mt::StubServerTool | 87 | struct MockServerPackageGenerator : public mt::StubServerTool |
172 | 77 | { | 88 | { |
173 | 78 | MockServerPackageGenerator() | 89 | MockServerPackageGenerator() |
174 | @@ -503,8 +514,12 @@ | |||
175 | 503 | TEST_F(MirClientSurfaceTest, resizes_streams_and_calls_callback_if_no_customized_streams) | 514 | TEST_F(MirClientSurfaceTest, resizes_streams_and_calls_callback_if_no_customized_streams) |
176 | 504 | { | 515 | { |
177 | 505 | using namespace testing; | 516 | using namespace testing; |
179 | 506 | auto mock_stream = std::make_shared<mtd::MockClientBufferStream>(); | 517 | auto const stream_id = mir::frontend::BufferStreamId(2); |
180 | 518 | auto mock_stream = std::make_shared<mtd::MockClientBufferStream>(); | ||
181 | 507 | auto mock_input_platform = std::make_shared<NiceMock<MockClientInputPlatform>>(); | 519 | auto mock_input_platform = std::make_shared<NiceMock<MockClientInputPlatform>>(); |
182 | 520 | |||
183 | 521 | surface_map->insert(stream_id, mock_stream); | ||
184 | 522 | |||
185 | 508 | ON_CALL(*mock_input_platform, create_input_receiver(_,_,_)) | 523 | ON_CALL(*mock_input_platform, create_input_receiver(_,_,_)) |
186 | 509 | .WillByDefault(Return(std::make_shared<mt::TestDispatchable>([]{}))); | 524 | .WillByDefault(Return(std::make_shared<mt::TestDispatchable>([]{}))); |
187 | 510 | ON_CALL(*mock_stream, rpc_id()).WillByDefault(Return(mir::frontend::BufferStreamId(2))); | 525 | ON_CALL(*mock_stream, rpc_id()).WillByDefault(Return(mir::frontend::BufferStreamId(2))); |
188 | @@ -516,31 +531,60 @@ | |||
189 | 516 | MirSurface surface{connection.get(), *client_comm_channel, nullptr, | 531 | MirSurface surface{connection.get(), *client_comm_channel, nullptr, |
190 | 517 | mock_stream, mock_input_platform, spec, surface_proto, wh}; | 532 | mock_stream, mock_input_platform, spec, surface_proto, wh}; |
191 | 518 | surface.handle_event(*ev); | 533 | surface.handle_event(*ev); |
193 | 519 | surface_map->erase(mir::frontend::BufferStreamId(2)); | 534 | surface_map->erase(stream_id); |
194 | 520 | } | 535 | } |
195 | 521 | 536 | ||
196 | 522 | TEST_F(MirClientSurfaceTest, resizes_streams_and_calls_callback_if_customized_streams) | 537 | TEST_F(MirClientSurfaceTest, resizes_streams_and_calls_callback_if_customized_streams) |
197 | 523 | { | 538 | { |
198 | 524 | using namespace testing; | 539 | using namespace testing; |
199 | 540 | auto const stream_id = mir::frontend::BufferStreamId(2); | ||
200 | 525 | auto mock_stream = std::make_shared<NiceMock<mtd::MockClientBufferStream>>(); | 541 | auto mock_stream = std::make_shared<NiceMock<mtd::MockClientBufferStream>>(); |
201 | 526 | auto mock_input_platform = std::make_shared<NiceMock<MockClientInputPlatform>>(); | 542 | auto mock_input_platform = std::make_shared<NiceMock<MockClientInputPlatform>>(); |
203 | 527 | ON_CALL(*mock_stream, rpc_id()).WillByDefault(Return(mir::frontend::BufferStreamId(2))); | 543 | |
204 | 544 | surface_map->insert(stream_id, mock_stream); | ||
205 | 545 | |||
206 | 546 | ON_CALL(*mock_stream, rpc_id()).WillByDefault(Return(stream_id)); | ||
207 | 528 | ON_CALL(*mock_input_platform, create_input_receiver(_,_,_)) | 547 | ON_CALL(*mock_input_platform, create_input_receiver(_,_,_)) |
208 | 529 | .WillByDefault(Return(std::make_shared<mt::TestDispatchable>([]{}))); | 548 | .WillByDefault(Return(std::make_shared<mt::TestDispatchable>([]{}))); |
209 | 530 | 549 | ||
210 | 531 | geom::Size size(120, 124); | 550 | geom::Size size(120, 124); |
212 | 532 | EXPECT_CALL(*mock_stream, set_size(size)).Times(0); | 551 | EXPECT_CALL(*mock_stream, set_size(size)).Times(1); |
213 | 533 | auto ev = mir::events::make_event(mir::frontend::SurfaceId(2), size); | 552 | auto ev = mir::events::make_event(mir::frontend::SurfaceId(2), size); |
214 | 534 | MirSurface surface{connection.get(), *client_comm_channel, nullptr, | 553 | MirSurface surface{connection.get(), *client_comm_channel, nullptr, |
215 | 535 | mock_stream, mock_input_platform, spec, surface_proto, wh}; | 554 | mock_stream, mock_input_platform, spec, surface_proto, wh}; |
216 | 536 | 555 | ||
217 | 537 | MirSurfaceSpec spec; | 556 | MirSurfaceSpec spec; |
218 | 538 | std::vector<ContentInfo> info = | 557 | std::vector<ContentInfo> info = |
220 | 539 | { ContentInfo{ geom::Displacement{0,0}, 2, geom::Size{1,1}} }; | 558 | { ContentInfo{ geom::Displacement{0,0}, stream_id.as_value(), geom::Size{1,1}} }; |
221 | 540 | spec.streams = info; | 559 | spec.streams = info; |
222 | 541 | surface.modify(spec)->wait_for_all(); | 560 | surface.modify(spec)->wait_for_all(); |
223 | 542 | surface.handle_event(*ev); | 561 | surface.handle_event(*ev); |
225 | 543 | surface_map->erase(mir::frontend::BufferStreamId(2)); | 562 | surface_map->erase(stream_id); |
226 | 563 | } | ||
227 | 564 | |||
228 | 565 | TEST_F(MirClientSurfaceTest, do_not_resize_presentation_chain) | ||
229 | 566 | { | ||
230 | 567 | using namespace testing; | ||
231 | 568 | auto const stream_id = mir::frontend::BufferStreamId(17); | ||
232 | 569 | auto stub_chain = std::make_shared<StubPresentationChain>(stream_id.as_value()); | ||
233 | 570 | auto mock_input_platform = std::make_shared<NiceMock<MockClientInputPlatform>>(); | ||
234 | 571 | |||
235 | 572 | surface_map->insert(stream_id, stub_chain); | ||
236 | 573 | |||
237 | 574 | ON_CALL(*mock_input_platform, create_input_receiver(_,_,_)) | ||
238 | 575 | .WillByDefault(Return(std::make_shared<mt::TestDispatchable>([]{}))); | ||
239 | 576 | |||
240 | 577 | geom::Size size(90, 80); | ||
241 | 578 | auto ev = mir::events::make_event(mir::frontend::SurfaceId(2), size); | ||
242 | 579 | MirSurface surface{connection.get(), *client_comm_channel, nullptr, | ||
243 | 580 | nullptr, mock_input_platform, spec, surface_proto, wh}; | ||
244 | 581 | |||
245 | 582 | MirSurfaceSpec spec; | ||
246 | 583 | std::vector<ContentInfo> info = | ||
247 | 584 | { ContentInfo{ geom::Displacement{0,0}, stream_id.as_value(), geom::Size{1,1}} }; | ||
248 | 585 | spec.streams = info; | ||
249 | 586 | surface.modify(spec)->wait_for_all(); | ||
250 | 587 | EXPECT_NO_THROW(surface.handle_event(*ev);); | ||
251 | 544 | } | 588 | } |
252 | 545 | 589 | ||
253 | 546 | TEST_F(MirClientSurfaceTest, parameters_are_unhooked_from_stream_sizes) | 590 | TEST_F(MirClientSurfaceTest, parameters_are_unhooked_from_stream_sizes) |
254 | 547 | 591 | ||
255 | === modified file 'tests/unit-tests/client/test_protobuf_rpc_channel.cpp' | |||
256 | --- tests/unit-tests/client/test_protobuf_rpc_channel.cpp 2016-06-24 17:52:00 +0000 | |||
257 | +++ tests/unit-tests/client/test_protobuf_rpc_channel.cpp 2016-08-01 12:51:16 +0000 | |||
258 | @@ -63,6 +63,8 @@ | |||
259 | 63 | void(mir::frontend::SurfaceId, std::function<void(MirSurface*)> const&)); | 63 | void(mir::frontend::SurfaceId, std::function<void(MirSurface*)> const&)); |
260 | 64 | MOCK_CONST_METHOD2(with_stream_do, | 64 | MOCK_CONST_METHOD2(with_stream_do, |
261 | 65 | void(mir::frontend::BufferStreamId, std::function<void(mcl::ClientBufferStream*)> const&)); | 65 | void(mir::frontend::BufferStreamId, std::function<void(mcl::ClientBufferStream*)> const&)); |
262 | 66 | MOCK_CONST_METHOD2(if_stream_do, | ||
263 | 67 | void(mir::frontend::BufferStreamId, std::function<void(mcl::ClientBufferStream*)> const&)); | ||
264 | 66 | MOCK_CONST_METHOD1(with_all_streams_do, | 68 | MOCK_CONST_METHOD1(with_all_streams_do, |
265 | 67 | void(std::function<void(mcl::ClientBufferStream*)> const&)); | 69 | void(std::function<void(mcl::ClientBufferStream*)> const&)); |
266 | 68 | MOCK_CONST_METHOD1(buffer, std::shared_ptr<mcl::MirBuffer>(int)); | 70 | MOCK_CONST_METHOD1(buffer, std::shared_ptr<mcl::MirBuffer>(int)); |
267 | @@ -82,6 +84,10 @@ | |||
268 | 82 | mir::frontend::BufferStreamId, std::function<void(mcl::ClientBufferStream*)> const&) const override | 84 | mir::frontend::BufferStreamId, std::function<void(mcl::ClientBufferStream*)> const&) const override |
269 | 83 | { | 85 | { |
270 | 84 | } | 86 | } |
271 | 87 | void if_stream_do(mir::frontend::BufferStreamId, | ||
272 | 88 | std::function<void(mcl::ClientBufferStream*)> const&) const override | ||
273 | 89 | { | ||
274 | 90 | } | ||
275 | 85 | void with_all_streams_do(std::function<void(mcl::ClientBufferStream*)> const&) const override | 91 | void with_all_streams_do(std::function<void(mcl::ClientBufferStream*)> const&) const override |
276 | 86 | { | 92 | { |
277 | 87 | } | 93 | } |
FAILED: Continuous integration, rev:3615 /mir-jenkins. ubuntu. com/job/ mir-ci/ 1357/ /mir-jenkins. ubuntu. com/job/ build-mir/ 1617/console /mir-jenkins. ubuntu. com/job/ build-0- fetch/1670 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= vivid+overlay/ 1661 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial+ overlay/ 1661 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= yakkety/ 1661 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= vivid+overlay/ 1632 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= vivid+overlay/ 1632/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 1632/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 1632/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 1632/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 1632 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 1632/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 1632 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 1632/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /mir-jenkins. ubuntu. com/job/ mir-ci/ 1357/rebuild
https:/