Merge lp:~albaguirre/unity-system-compositor/silo-virtual-output into lp:unity-system-compositor/ubuntu

Proposed by Alberto Aguirre
Status: Rejected
Rejected by: Alberto Aguirre
Proposed branch: lp:~albaguirre/unity-system-compositor/silo-virtual-output
Merge into: lp:unity-system-compositor/ubuntu
Diff against target: 282 lines (+79/-27)
6 files modified
CMakeLists.txt (+2/-2)
debian/changelog (+6/-0)
src/mir_screen.cpp (+59/-17)
src/mir_screen.h (+4/-4)
tests/include/usc/test/mock_display.h (+4/-0)
tests/integration-tests/test_deadlock_lp1491566.cpp (+4/-4)
To merge this branch: bzr merge lp:~albaguirre/unity-system-compositor/silo-virtual-output
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Unity System Compositor Development Team Pending
Review via email: mp+284992@code.launchpad.net

Commit message

DO NOT MERGE: silo test

Description of the change

DO NOT MERGE: silo test

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

Unmerged revisions

277. By Alberto Aguirre

update version

276. By Alberto Aguirre

merge lp:mir/ubuntu

275. By Alberto Aguirre

mocks: Implement new method added to mir::graphics::Display

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2016-01-21 17:43:12 +0000
3+++ CMakeLists.txt 2016-02-03 23:41:34 +0000
4@@ -16,8 +16,8 @@
5
6 project(UnitySystemCompositor)
7 set(USC_VERSION_MAJOR 0)
8-set(USC_VERSION_MINOR 3)
9-set(USC_VERSION_PATCH 1)
10+set(USC_VERSION_MINOR 5)
11+set(USC_VERSION_PATCH 0)
12 set(USC_VERSION "${USC_VERSION_MAJOR}.${USC_VERSION_MINOR}.${USC_VERSION_PATCH}")
13
14 cmake_minimum_required(VERSION 2.8)
15
16=== modified file 'debian/changelog'
17--- debian/changelog 2016-01-28 14:20:54 +0000
18+++ debian/changelog 2016-02-03 23:41:34 +0000
19@@ -1,3 +1,9 @@
20+unity-system-compositor (0.5.0) UNRELEASED; urgency=medium
21+
22+ * Test release server abi break
23+
24+ -- Alberto Aguirre <alberto.aguirre@canonical.com> Wed, 03 Feb 2016 17:39:47 -0600
25+
26 unity-system-compositor (0.4.0+16.04.20160128.1-0ubuntu1) xenial; urgency=medium
27
28 [ Brandon Schaefer ]
29
30=== modified file 'src/mir_screen.cpp'
31--- src/mir_screen.cpp 2015-09-30 10:53:54 +0000
32+++ src/mir_screen.cpp 2016-02-03 23:41:34 +0000
33@@ -24,8 +24,13 @@
34 #include <mir/graphics/display.h>
35 #include <mir/graphics/display_configuration.h>
36 #include <mir/input/touch_visualizer.h>
37+#include <mir/log.h>
38+#include <mir/report_exception.h>
39
40 #include <cstdio>
41+#include <sstream>
42+
43+#include <assert.h>
44 #include "screen_hardware.h"
45 #include "power_state_change_reason.h"
46 #include "server.h"
47@@ -33,6 +38,18 @@
48 namespace mi = mir::input;
49 namespace mg = mir::graphics;
50
51+namespace
52+{
53+void log_exception_in(char const* const func)
54+{
55+ static char const* const warning_format = "%s failed: %s";
56+ std::stringstream buffer;
57+
58+ mir::report_exception(buffer);
59+ mir::log(::mir::logging::Severity::warning, "usc::MirScreen", warning_format, func, buffer.str().c_str());
60+}
61+}
62+
63 class usc::MirScreen::LockableCallback : public mir::LockableCallback
64 {
65 public:
66@@ -48,8 +65,7 @@
67
68 void unlock() override
69 {
70- if (guard_lock.owns_lock())
71- guard_lock.unlock();
72+ guard_lock.unlock();
73 }
74
75 protected:
76@@ -63,7 +79,11 @@
77
78 void operator()() override
79 {
80- mir_screen->power_off_alarm_notification();
81+ // We need to hold the lock before calling power_off_alarm_notification_l()
82+ // (and not acquire it in that function) as we override the function to
83+ // test for deadlock conditions. C.f. test_deadlock_lp1491566.cpp
84+ assert(guard_lock.owns_lock());
85+ mir_screen->power_off_alarm_notification_l();
86 }
87 };
88
89@@ -73,7 +93,11 @@
90
91 void operator()() override
92 {
93- mir_screen->dimmer_alarm_notification();
94+ // We need to hold the lock before calling dimmer_alarm_notification_l()
95+ // (and not acquire it in that function) as we override the function to
96+ // test for deadlock conditions. C.f. test_deadlock_lp1491566.cpp
97+ assert(guard_lock.owns_lock());
98+ mir_screen->dimmer_alarm_notification_l();
99 }
100 };
101
102@@ -106,13 +130,21 @@
103 allow_proximity_to_turn_on_screen{false},
104 turned_on_by_user{true}
105 {
106- /*
107- * Make sure the compositor is running as certain conditions can
108- * cause Mir to tear down the compositor threads before we get
109- * to this point. See bug #1410381.
110- */
111- compositor->start();
112- reset_timers_l(PowerStateChangeReason::inactivity);
113+ try
114+ {
115+ /*
116+ * Make sure the compositor is running as certain conditions can
117+ * cause Mir to tear down the compositor threads before we get
118+ * to this point. See bug #1410381.
119+ */
120+ compositor->start();
121+ reset_timers_l(PowerStateChangeReason::inactivity);
122+ }
123+ catch (...)
124+ {
125+ log_exception_in(__func__);
126+ throw;
127+ }
128 }
129
130 usc::MirScreen::~MirScreen() = default;
131@@ -186,8 +218,9 @@
132 }
133
134 void usc::MirScreen::set_screen_power_mode_l(MirPowerMode mode, PowerStateChangeReason reason)
135+try
136 {
137- if (!is_screen_change_allowed(mode, reason))
138+ if (!is_screen_change_allowed_l(mode, reason))
139 return;
140
141 // Notifications don't turn on the screen directly, they rely on proximity events
142@@ -233,8 +266,13 @@
143 configure_display_l(mode, reason);
144 }
145 }
146+catch (std::exception const&)
147+{
148+ log_exception_in(__func__);
149+}
150
151 void usc::MirScreen::configure_display_l(MirPowerMode mode, PowerStateChangeReason reason)
152+try
153 {
154 if (reason != PowerStateChangeReason::proximity)
155 {
156@@ -292,6 +330,10 @@
157 if (!power_on)
158 screen_hardware->allow_suspend();
159 }
160+catch (std::exception const&)
161+{
162+ log_exception_in(__func__);
163+}
164
165 void usc::MirScreen::cancel_timers_l(PowerStateChangeReason reason)
166 {
167@@ -320,7 +362,7 @@
168 if (!restart_timers)
169 return;
170
171- auto const timeouts = timeouts_for(reason);
172+ auto const timeouts = timeouts_for_l(reason);
173 auto const now = clock->now();
174
175 if (timeouts.power_off_timeout.count() > 0)
176@@ -362,7 +404,7 @@
177 cancel_timers_l(PowerStateChangeReason::inactivity);
178 }
179
180-usc::MirScreen::Timeouts usc::MirScreen::timeouts_for(PowerStateChangeReason reason)
181+usc::MirScreen::Timeouts usc::MirScreen::timeouts_for_l(PowerStateChangeReason reason)
182 {
183 if (reason == PowerStateChangeReason::notification ||
184 reason == PowerStateChangeReason::proximity ||
185@@ -380,7 +422,7 @@
186 }
187 }
188
189-bool usc::MirScreen::is_screen_change_allowed(MirPowerMode mode, PowerStateChangeReason reason)
190+bool usc::MirScreen::is_screen_change_allowed_l(MirPowerMode mode, PowerStateChangeReason reason)
191 {
192 if (mode == MirPowerMode::mir_power_mode_on &&
193 reason == PowerStateChangeReason::proximity &&
194@@ -392,13 +434,13 @@
195 return true;
196 }
197
198-void usc::MirScreen::power_off_alarm_notification()
199+void usc::MirScreen::power_off_alarm_notification_l()
200 {
201 configure_display_l(MirPowerMode::mir_power_mode_off, PowerStateChangeReason::inactivity);
202 next_power_off = {};
203 }
204
205-void usc::MirScreen::dimmer_alarm_notification()
206+void usc::MirScreen::dimmer_alarm_notification_l()
207 {
208 if (current_power_mode != MirPowerMode::mir_power_mode_off)
209 screen_hardware->set_dim_backlight();
210
211=== modified file 'src/mir_screen.h'
212--- src/mir_screen.h 2015-09-30 10:53:54 +0000
213+++ src/mir_screen.h 2016-02-03 23:41:34 +0000
214@@ -76,8 +76,8 @@
215
216 protected:
217 // These are protected virtual because we need to override them in tests
218- virtual void power_off_alarm_notification();
219- virtual void dimmer_alarm_notification();
220+ virtual void power_off_alarm_notification_l();
221+ virtual void dimmer_alarm_notification_l();
222
223 private:
224 enum class ForceResetTimers { no, yes };
225@@ -92,8 +92,8 @@
226 void reset_timers_l(PowerStateChangeReason reason);
227 void reset_timers_ignoring_power_mode_l(PowerStateChangeReason reason, ForceResetTimers force);
228 void enable_inactivity_timers_l(bool flag);
229- Timeouts timeouts_for(PowerStateChangeReason reason);
230- bool is_screen_change_allowed(MirPowerMode mode, PowerStateChangeReason reason);
231+ Timeouts timeouts_for_l(PowerStateChangeReason reason);
232+ bool is_screen_change_allowed_l(MirPowerMode mode, PowerStateChangeReason reason);
233
234 void long_press_alarm_notification();
235
236
237=== modified file 'tests/include/usc/test/mock_display.h'
238--- tests/include/usc/test/mock_display.h 2015-11-12 12:28:17 +0000
239+++ tests/include/usc/test/mock_display.h 2016-02-03 23:41:34 +0000
240@@ -20,6 +20,7 @@
241 #include "usc/test/stub_display_configuration.h"
242
243 #include <mir/graphics/display.h>
244+#include <mir/graphics/virtual_output.h>
245 #include <gmock/gmock.h>
246
247 namespace usc
248@@ -60,6 +61,9 @@
249
250 std::unique_ptr<mir::graphics::GLContext> create_gl_context() override
251 { return std::unique_ptr<mir::graphics::GLContext>{};};
252+
253+ std::unique_ptr<mir::graphics::VirtualOutput> create_virtual_output(int,int) override
254+ { return nullptr; }
255 };
256 }
257 }
258
259=== modified file 'tests/integration-tests/test_deadlock_lp1491566.cpp'
260--- tests/integration-tests/test_deadlock_lp1491566.cpp 2015-11-12 12:53:39 +0000
261+++ tests/integration-tests/test_deadlock_lp1491566.cpp 2016-02-03 23:41:34 +0000
262@@ -80,16 +80,16 @@
263 public:
264 using usc::MirScreen::MirScreen;
265
266- void dimmer_alarm_notification() override
267+ void dimmer_alarm_notification_l() override
268 {
269 before_dimmer_alarm_func();
270- usc::MirScreen::dimmer_alarm_notification();
271+ usc::MirScreen::dimmer_alarm_notification_l();
272 }
273
274- void power_off_alarm_notification() override
275+ void power_off_alarm_notification_l() override
276 {
277 before_power_off_alarm_func();
278- usc::MirScreen::power_off_alarm_notification();
279+ usc::MirScreen::power_off_alarm_notification_l();
280 }
281
282 std::function<void()> before_dimmer_alarm_func = []{};

Subscribers

People subscribed via source and target branches