Merge lp:~kdub/mir/fix-1597717 into lp:mir
- fix-1597717
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Kevin DuBois |
Approved revision: | 3569 |
Merged at revision: | 3575 |
Proposed branch: | lp:~kdub/mir/fix-1597717 |
Merge into: | lp:mir |
Diff against target: |
268 lines (+207/-0) 2 files modified
src/server/graphics/nested/mir_client_host_connection.cpp (+6/-0) tests/acceptance-tests/test_nested_mir.cpp (+201/-0) |
To merge this branch: | bzr merge lp:~kdub/mir/fix-1597717 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir CI Bot | continuous-integration | Approve | |
Chris Halse Rogers | Approve | ||
Andreas Pokorny (community) | Approve | ||
Daniel d'Andrada (community) | test | Approve | |
Cemil Azizoglu (community) | Approve | ||
Review via email:
|
Commit message
Description of the change

Mir CI Bot (mir-ci-bot) wrote : | # |

Daniel d'Andrada (dandrader) wrote : | # |
Fixes the issue I was experiencing when trying to run qtmir+unity8 with lp:mir/0.24

Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/

Alexandros Frantzis (afrantzis) wrote : | # |
CI failure seems unrelated, filed as https:/

Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/

Chris Halse Rogers (raof) wrote : | # |
I assume that there's some godawful Qt-ish reason why we're doing this rather than just throwing an exception if the shell tries to set a 0x0 cursor and then fixing QtMir?
Assuming there is such a reason, +1.

Mir CI Bot (mir-ci-bot) : | # |

Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Autolanding.
Approved revid is not set in launchpad. This is most likely a launchpad issue and re-approve should fix it. There is also a chance (although a very small one) this is a permission problem of the ps-jenkins bot.
https:/
Executed test runs:
SUCCESS: https:/
None: 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:/

Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
SUCCESS: https:/
FAILURE: https:/
None: 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:/

Kevin DuBois (kdub) wrote : | # |
> I assume that there's some godawful Qt-ish reason why we're doing this rather
> than just throwing an exception if the shell tries to set a 0x0 cursor and
> then fixing QtMir?
>
> Assuming there is such a reason, +1.
Right, it appears that they want to disable us showing our cursor, as well as set a Qt-specific cursor name for their renderer to use.

Kevin DuBois (kdub) wrote : | # |
CI error was "DEBUG: Approved revid is not set (maybe a permission problem?). Failing autolanding."
retriggering.

Mir CI Bot (mir-ci-bot) : | # |
Preview Diff
1 | === modified file 'src/server/graphics/nested/mir_client_host_connection.cpp' |
2 | --- src/server/graphics/nested/mir_client_host_connection.cpp 2016-06-09 13:15:34 +0000 |
3 | +++ src/server/graphics/nested/mir_client_host_connection.cpp 2016-07-01 14:28:05 +0000 |
4 | @@ -127,6 +127,12 @@ |
5 | auto const image_width = image.size().width.as_int(); |
6 | auto const image_height = image.size().height.as_int(); |
7 | |
8 | + if ((image_width <= 0) || (image_height <= 0)) |
9 | + { |
10 | + hide_cursor(); |
11 | + return; |
12 | + } |
13 | + |
14 | MirGraphicsRegion g; |
15 | |
16 | if (cursor) |
17 | |
18 | === modified file 'tests/acceptance-tests/test_nested_mir.cpp' |
19 | --- tests/acceptance-tests/test_nested_mir.cpp 2016-06-02 08:19:38 +0000 |
20 | +++ tests/acceptance-tests/test_nested_mir.cpp 2016-07-01 14:28:05 +0000 |
21 | @@ -24,11 +24,14 @@ |
22 | #include "mir/graphics/display_configuration.h" |
23 | #include "mir/graphics/display_configuration_policy.h" |
24 | #include "mir/graphics/display_configuration_report.h" |
25 | +#include "mir/shell/shell.h" |
26 | #include "mir/input/cursor_listener.h" |
27 | #include "mir/cached_ptr.h" |
28 | #include "mir/main_loop.h" |
29 | #include "mir/scene/session_coordinator.h" |
30 | #include "mir/scene/session.h" |
31 | +#include "mir/scene/surface.h" |
32 | +#include "mir/scene/null_surface_observer.h" |
33 | #include "mir/shell/display_configuration_controller.h" |
34 | #include "mir/shell/host_lifecycle_event_listener.h" |
35 | |
36 | @@ -57,6 +60,7 @@ |
37 | namespace mt = mir::test; |
38 | namespace mtd = mir::test::doubles; |
39 | namespace mtf = mir_test_framework; |
40 | +namespace msc = mir::scene; |
41 | |
42 | using namespace testing; |
43 | using namespace std::chrono_literals; |
44 | @@ -206,6 +210,171 @@ |
45 | MOCK_METHOD1(configure, void (mg::DisplayConfiguration const&)); |
46 | }; |
47 | |
48 | + |
49 | +struct StubSurfaceObserver : msc::NullSurfaceObserver |
50 | +{ |
51 | + void cursor_image_set_to(mg::CursorImage const&) override {} |
52 | + void cursor_image_removed() override |
53 | + { |
54 | + std::unique_lock<decltype(mutex)> lk(mutex); |
55 | + removed = true; |
56 | + cv.notify_all(); |
57 | + } |
58 | + |
59 | + bool wait_for_removal() |
60 | + { |
61 | + using namespace std::chrono_literals; |
62 | + std::unique_lock<decltype(mutex)> lk(mutex); |
63 | + auto rc = cv.wait_for(lk, 4s, [this] { return removed; }); |
64 | + return rc; |
65 | + } |
66 | + std::mutex mutex; |
67 | + std::condition_variable cv; |
68 | + bool removed = false; |
69 | +}; |
70 | + |
71 | +struct ObservantShell : msh::Shell |
72 | +{ |
73 | + ObservantShell( |
74 | + std::shared_ptr<msh::Shell> const& wrapped, |
75 | + std::shared_ptr<msc::SurfaceObserver> const& surface_observer) : |
76 | + wrapped(wrapped), |
77 | + surface_observer(surface_observer) |
78 | + { |
79 | + } |
80 | + |
81 | + void add_display(geom::Rectangle const& area) override |
82 | + { |
83 | + return wrapped->add_display(area); |
84 | + } |
85 | + |
86 | + void remove_display(geom::Rectangle const& area) override |
87 | + { |
88 | + return wrapped->remove_display(area); |
89 | + } |
90 | + |
91 | + bool handle(MirEvent const& event) override |
92 | + { |
93 | + return wrapped->handle(event); |
94 | + } |
95 | + |
96 | + void focus_next_session() override |
97 | + { |
98 | + wrapped->focus_next_session(); |
99 | + } |
100 | + |
101 | + auto focused_session() const -> std::shared_ptr<msc::Session> |
102 | + { |
103 | + return wrapped->focused_session(); |
104 | + } |
105 | + |
106 | + void set_focus_to( |
107 | + std::shared_ptr<msc::Session> const& focus_session, |
108 | + std::shared_ptr<msc::Surface> const& focus_surface) override |
109 | + { |
110 | + return wrapped->set_focus_to(focus_session, focus_surface); |
111 | + } |
112 | + |
113 | + std::shared_ptr<msc::Surface> focused_surface() const override |
114 | + { |
115 | + return wrapped->focused_surface(); |
116 | + } |
117 | + |
118 | + auto surface_at(geom::Point cursor) const -> std::shared_ptr<msc::Surface> override |
119 | + { |
120 | + return wrapped->surface_at(cursor); |
121 | + } |
122 | + |
123 | + void raise(msh::SurfaceSet const& surfaces) override |
124 | + { |
125 | + wrapped->raise(surfaces); |
126 | + } |
127 | + |
128 | + std::shared_ptr<msc::Session> open_session( |
129 | + pid_t client_pid, |
130 | + std::string const& name, |
131 | + std::shared_ptr<mf::EventSink> const& sink) override |
132 | + { |
133 | + return wrapped->open_session(client_pid, name, sink); |
134 | + } |
135 | + |
136 | + void close_session(std::shared_ptr<msc::Session> const& session) override |
137 | + { |
138 | + wrapped->close_session(session); |
139 | + } |
140 | + |
141 | + std::shared_ptr<msc::PromptSession> start_prompt_session_for( |
142 | + std::shared_ptr<msc::Session> const& session, |
143 | + msc::PromptSessionCreationParameters const& params) override |
144 | + { |
145 | + return wrapped->start_prompt_session_for(session, params); |
146 | + } |
147 | + |
148 | + void add_prompt_provider_for( |
149 | + std::shared_ptr<msc::PromptSession> const& prompt_session, |
150 | + std::shared_ptr<msc::Session> const& session) override |
151 | + { |
152 | + wrapped->add_prompt_provider_for(prompt_session, session); |
153 | + } |
154 | + |
155 | + void stop_prompt_session(std::shared_ptr<msc::PromptSession> const& prompt_session) override |
156 | + { |
157 | + wrapped->stop_prompt_session(prompt_session); |
158 | + } |
159 | + |
160 | + mf::SurfaceId create_surface( |
161 | + std::shared_ptr<msc::Session> const& session, |
162 | + msc::SurfaceCreationParameters const& params, |
163 | + std::shared_ptr<mf::EventSink> const& sink) override |
164 | + { |
165 | + auto id = wrapped->create_surface(session, params, sink); |
166 | + auto surface = session->surface(id); |
167 | + surface->add_observer(surface_observer); |
168 | + return id; |
169 | + } |
170 | + |
171 | + void modify_surface( |
172 | + std::shared_ptr<msc::Session> const& session, |
173 | + std::shared_ptr<msc::Surface> const& surface, |
174 | + msh::SurfaceSpecification const& modifications) override |
175 | + { |
176 | + wrapped->modify_surface(session, surface, modifications); |
177 | + } |
178 | + |
179 | + void destroy_surface(std::shared_ptr<msc::Session> const& session, mf::SurfaceId surface) override |
180 | + { |
181 | + wrapped->destroy_surface(session, surface); |
182 | + } |
183 | + |
184 | + int set_surface_attribute( |
185 | + std::shared_ptr<msc::Session> const& session, |
186 | + std::shared_ptr<msc::Surface> const& surface, |
187 | + MirSurfaceAttrib attrib, |
188 | + int value) override |
189 | + { |
190 | + return wrapped->set_surface_attribute(session, surface, attrib, value); |
191 | + } |
192 | + |
193 | + int get_surface_attribute( |
194 | + std::shared_ptr<msc::Surface> const& surface, |
195 | + MirSurfaceAttrib attrib) override |
196 | + { |
197 | + return wrapped->get_surface_attribute(surface, attrib); |
198 | + } |
199 | + |
200 | + void raise_surface( |
201 | + std::shared_ptr<msc::Session> const& session, |
202 | + std::shared_ptr<msc::Surface> const& surface, |
203 | + uint64_t timestamp) override |
204 | + { |
205 | + return wrapped->raise_surface(session, surface, timestamp); |
206 | + } |
207 | + |
208 | +private: |
209 | + std::shared_ptr<msh::Shell> const wrapped; |
210 | + std::shared_ptr<msc::SurfaceObserver> const surface_observer; |
211 | +}; |
212 | + |
213 | class NestedMirRunner : public mtf::HeadlessNestedServerRunner |
214 | { |
215 | public: |
216 | @@ -264,6 +433,7 @@ |
217 | |
218 | std::shared_ptr<MockSessionMediatorReport> mock_session_mediator_report; |
219 | NiceMock<MockDisplay> display{display_geometry}; |
220 | + std::shared_ptr<StubSurfaceObserver> stub_observer = std::make_shared<StubSurfaceObserver>(); |
221 | |
222 | void SetUp() override |
223 | { |
224 | @@ -279,6 +449,11 @@ |
225 | |
226 | server.wrap_cursor([this](std::shared_ptr<mg::Cursor> const&) { return the_mock_cursor(); }); |
227 | |
228 | + server.wrap_shell([&, this](auto const& wrapped) |
229 | + { |
230 | + return std::make_shared<ObservantShell>(wrapped, stub_observer); |
231 | + }); |
232 | + |
233 | mtf::HeadlessInProcessServer::SetUp(); |
234 | } |
235 | |
236 | @@ -832,6 +1007,32 @@ |
237 | Mock::VerifyAndClearExpectations(mock_cursor.get()); |
238 | } |
239 | |
240 | +//LP: #1597717 |
241 | +TEST_F(NestedServer, showing_a_0x0_cursor_image_sets_disabled_cursor) |
242 | +{ |
243 | + NestedMirRunner nested_mir{new_connection()}; |
244 | + |
245 | + ClientWithAPaintedSurfaceAndABufferStream client(nested_mir); |
246 | + auto const mock_cursor = the_mock_cursor(); |
247 | + |
248 | + server.the_cursor_listener()->cursor_moved_to(489, 9); |
249 | + |
250 | + //see NamedCursor in qtmir |
251 | + struct EmptyImage : mg::CursorImage |
252 | + { |
253 | + const void *as_argb_8888() const override { return nullptr; } |
254 | + geom::Size size() const override { return {0,0}; } |
255 | + geom::Displacement hotspot() const override { return {0,0}; } |
256 | + } empty_image; |
257 | + nested_mir.cursor_wrapper->show(empty_image); |
258 | + |
259 | + EXPECT_TRUE(stub_observer->wait_for_removal()); |
260 | + |
261 | + // Need to verify before test server teardown deletes the |
262 | + // surface as the host cursor then reverts to default. |
263 | + Mock::VerifyAndClearExpectations(mock_cursor.get()); |
264 | +} |
265 | + |
266 | TEST_F(NestedServer, applies_display_config_on_startup) |
267 | { |
268 | mt::Signal condition; |
FAILED: Continuous integration, rev:3569 /mir-jenkins. ubuntu. com/job/ mir-ci/ 1222/ /mir-jenkins. ubuntu. com/job/ build-mir/ 1405/console /mir-jenkins. ubuntu. com/job/ build-0- fetch/1456 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= vivid+overlay/ 1447 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial/ 1447 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= vivid+overlay/ 1419 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= vivid+overlay/ 1419/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial/ 1419 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial/ 1419/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 1419 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 1419/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 1419 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 1419/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial/ 1419/console
https:/
Executed test runs:
FAILURE: 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: /mir-jenkins. ubuntu. com/job/ mir-ci/ 1222/rebuild
https:/