Mir

Merge lp:mir/0.11 into lp:mir/ubuntu

Proposed by Alberto Aguirre
Status: Rejected
Rejected by: Alberto Aguirre
Proposed branch: lp:mir/0.11
Merge into: lp:mir/ubuntu
Diff against target: 1850 lines (+470/-173)
53 files modified
debian/changelog (+23/-0)
debian/control (+10/-10)
debian/libmirserver30.install (+1/-1)
debian/mir-client-platform-android2.install (+1/-1)
debian/mir-client-platform-mesa2.install (+1/-1)
debian/mir-platform-graphics-android1.install (+1/-1)
debian/mir-platform-graphics-mesa1.install (+1/-1)
include/server/mir/time/timer.h (+28/-4)
server-ABI-sha1sums (+1/-1)
src/CMakeLists.txt (+5/-2)
src/client/CMakeLists.txt (+1/-2)
src/common/sharedlibrary/shared_library_prober.cpp (+9/-1)
src/include/server/mir/compositor/frame_dropping_policy_factory.h (+22/-5)
src/include/server/mir/glib_main_loop.h (+11/-6)
src/include/server/mir/glib_main_loop_sources.h (+3/-1)
src/platform/graphics/platform_probe.cpp (+1/-1)
src/platforms/CMakeLists.txt (+8/-1)
src/platforms/android/client/CMakeLists.txt (+1/-0)
src/platforms/android/server/CMakeLists.txt (+1/-0)
src/platforms/mesa/client/CMakeLists.txt (+1/-0)
src/platforms/mesa/server/CMakeLists.txt (+1/-0)
src/server/CMakeLists.txt (+1/-1)
src/server/compositor/buffer_queue.cpp (+28/-13)
src/server/compositor/buffer_queue.h (+12/-4)
src/server/compositor/timeout_frame_dropping_policy_factory.cpp (+17/-9)
src/server/compositor/timeout_frame_dropping_policy_factory.h (+6/-2)
src/server/glib_main_loop.cpp (+23/-6)
src/server/glib_main_loop_sources.cpp (+15/-3)
src/server/symbols.map (+1/-1)
tests/acceptance-tests/test_symbols_required_by_mesa.cpp (+1/-1)
tests/include/mir_test_doubles/mock_frame_dropping_policy_factory.h (+23/-4)
tests/include/mir_test_doubles/mock_main_loop.h (+14/-6)
tests/include/mir_test_doubles/mock_timer.h (+7/-5)
tests/include/mir_test_doubles/stub_frame_dropping_policy_factory.h (+7/-3)
tests/include/mir_test_doubles/stub_timer.h (+3/-3)
tests/include/mir_test_doubles/triggered_main_loop.h (+1/-1)
tests/include/mir_test_framework/client_platform_factory.h (+2/-2)
tests/mir_test_doubles/mock_frame_dropping_policy_factory.cpp (+12/-4)
tests/mir_test_doubles/mock_timer.cpp (+38/-15)
tests/mir_test_doubles/triggered_main_loop.cpp (+3/-2)
tests/mir_test_framework/CMakeLists.txt (+2/-0)
tests/mir_test_framework/executable_path.cpp (+12/-2)
tests/unit-tests/client/test_client_platform.cpp (+2/-2)
tests/unit-tests/client/test_probing_client_platform_factory.cpp (+2/-2)
tests/unit-tests/compositor/test_buffer_queue.cpp (+10/-1)
tests/unit-tests/compositor/test_timeout_frame_dropping_policy.cpp (+36/-9)
tests/unit-tests/graphics/android/test_platform.cpp (+2/-2)
tests/unit-tests/graphics/mesa/test_platform.cpp (+2/-2)
tests/unit-tests/graphics/test_platform_prober.cpp (+2/-2)
tests/unit-tests/shared_library_test.cpp (+1/-1)
tests/unit-tests/test_glib_main_loop.cpp (+29/-26)
tests/unit-tests/test_raii.cpp (+20/-0)
tests/unit-tests/test_shared_library_prober.cpp (+5/-0)
To merge this branch: bzr merge lp:mir/0.11
Reviewer Review Type Date Requested Status
Alberto Aguirre (community) Disapprove
Daniel van Vugt Needs Fixing
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+250680@code.launchpad.net

Commit message

Release 0.11.1

Description of the change

Release 0.11.1

Backport of fixes for LP: #1423591 and LP: #1421255

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Whoa, we broke several ABIs. That's not meant to happen at all in maintenance branches.

As this will require that all downstreams get rebuilt, why not just do a 0.12.0 release instead?

review: Needs Information
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Hmm, we've actually branched ABIs, so mirserver30 should be "mirserver29.1".

review: Needs Fixing
Revision history for this message
Alberto Aguirre (albaguirre) wrote :

Several ABIs? Only server as far as I'm aware. But yeah it's a bit strange to break ABI on a point release.

Revision history for this message
Alberto Aguirre (albaguirre) wrote :

So yeah let's release as 0.12.0

review: Disapprove

Unmerged revisions

2294. By Daniel van Vugt

Revert back to r2289 removing unreleased experiments.
So this maintenance branch now correctly reflects what's actually been
released.

2293. By Alberto Aguirre

Update changelog

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2015-02-09 21:27:35 +0000
3+++ debian/changelog 2015-02-23 20:59:44 +0000
4@@ -1,7 +1,30 @@
5+mir (0.11.1) UNRELEASED; urgency=medium
6+
7+ * New upstream release 0.11.1 (https://launchpad.net/mir/+milestone/0.11.1)
8+ - Packaging changes:
9+ . Client platform packages now include the Mir client platform ABI
10+ number. Thusly, mir-client-platform-(mesa|android) is replaced by
11+ mir-client-platform-(mesa|android)2
12+ . Server graphics platform packages now include the Mir graphics
13+ platform ABI number. Thusly, mir-platform-graphics-(mesa|android)
14+ is replaced by mir-platform-graphics-(mesa|android)1
15+ - Bug fixes:
16+ . [regression] Platform libraries and packages are not versioned thus
17+ are not installable in parallel (LP: #1423591)
18+ . [regression] Deadlock in TimeoutFrameDroppingPolicy logic (LP: #1421255)
19+
20+ -- Alberto Aguirre <alberto.aguirre@canonical.com> Mon, 23 Feb 2015 14:22:40 -0600
21+
22 mir (0.11.0+15.04.20150209.1-0ubuntu1) vivid; urgency=medium
23
24 [ Daniel van Vugt ]
25 * New upstream release 0.11.0 (https://launchpad.net/mir/+milestone/0.11.0)
26+ - Packaging changes:
27+ . Due to changes in the Mir driver model the client platforms are no
28+ longer versioned by soname. Thusly libmirplatform5driver-(mesa|android) is
29+ replaced by mir-client-platform-(mesa-android). A new package
30+ mir-client-platform-mesa-dev is introduced containing headers
31+ previously in mirplatform-dev.
32 - Enhancements:
33 . Lots more major plumbing in the Android code, on the path to
34 supporting external displays.
35
36=== modified file 'debian/control'
37--- debian/control 2015-01-27 03:02:22 +0000
38+++ debian/control 2015-02-23 20:59:44 +0000
39@@ -61,7 +61,7 @@
40
41 #TODO: Packaging infrastructure for better dependency generation,
42 # ala pkg-xorg's xviddriver:Provides and ABI detection.
43-Package: libmirserver29
44+Package: libmirserver30
45 Section: libs
46 Architecture: i386 amd64 armhf arm64
47 Multi-Arch: same
48@@ -128,7 +128,7 @@
49 Architecture: i386 amd64 armhf arm64
50 Multi-Arch: same
51 Pre-Depends: ${misc:Pre-Depends}
52-Depends: libmirserver29 (= ${binary:Version}),
53+Depends: libmirserver30 (= ${binary:Version}),
54 libmirplatform-dev (= ${binary:Version}),
55 libmircommon-dev (= ${binary:Version}),
56 libglm-dev,
57@@ -268,7 +268,7 @@
58 Contains the shared libraries required for the Mir server and client.
59
60 # Longer-term these drivers should move out-of-tree
61-Package: mir-platform-graphics-mesa
62+Package: mir-platform-graphics-mesa1
63 Section: libs
64 Architecture: i386 amd64 armhf arm64
65 Multi-Arch: same
66@@ -282,7 +282,7 @@
67 Contains the shared libraries required for the Mir server to interact with
68 the hardware platform using the Mesa drivers.
69
70-Package: mir-platform-graphics-android
71+Package: mir-platform-graphics-android1
72 Section: libs
73 Architecture: i386 amd64 armhf
74 Multi-Arch: same
75@@ -296,7 +296,7 @@
76 Contains the shared libraries required for the Mir server to interact with
77 the hardware platform using the Android drivers.
78
79-Package: mir-client-platform-mesa
80+Package: mir-client-platform-mesa2
81 Section: libs
82 Architecture: i386 amd64 armhf arm64
83 Multi-Arch: same
84@@ -325,7 +325,7 @@
85 Contains header files required to use the platform specific capabilities of
86 the Mir Mesa backend.
87
88-Package: mir-client-platform-android
89+Package: mir-client-platform-android2
90 Section: libs
91 Architecture: i386 amd64 armhf
92 Multi-Arch: same
93@@ -345,8 +345,8 @@
94 Multi-Arch: same
95 Pre-Depends: ${misc:Pre-Depends}
96 Depends: ${misc:Depends},
97- mir-platform-graphics-mesa,
98- mir-client-platform-mesa,
99+ mir-platform-graphics-mesa1,
100+ mir-client-platform-mesa2,
101 Description: Display server for Ubuntu - desktop driver metapackage
102 Mir is a display server running on linux systems, with a focus on efficiency,
103 robust operation and a well-defined driver model.
104@@ -360,8 +360,8 @@
105 Multi-Arch: same
106 Pre-Depends: ${misc:Pre-Depends}
107 Depends: ${misc:Depends},
108- mir-platform-graphics-android,
109- mir-client-platform-android,
110+ mir-platform-graphics-android1,
111+ mir-client-platform-android2,
112 Description: Display server for Ubuntu - android driver metapackage
113 Mir is a display server running on linux systems, with a focus on efficiency,
114 robust operation and a well-defined driver model.
115
116=== renamed file 'debian/libmirserver29.install' => 'debian/libmirserver30.install'
117--- debian/libmirserver29.install 2015-01-21 09:03:53 +0000
118+++ debian/libmirserver30.install 2015-02-23 20:59:44 +0000
119@@ -1,1 +1,1 @@
120-usr/lib/*/libmirserver.so.29
121+usr/lib/*/libmirserver.so.30
122
123=== renamed file 'debian/mir-client-platform-android.install' => 'debian/mir-client-platform-android2.install'
124--- debian/mir-client-platform-android.install 2015-01-21 07:34:50 +0000
125+++ debian/mir-client-platform-android2.install 2015-02-23 20:59:44 +0000
126@@ -1,1 +1,1 @@
127-usr/lib/*/mir/client-platform/android.so
128+usr/lib/*/mir/client-platform/android.so.2
129
130=== renamed file 'debian/mir-client-platform-mesa.install' => 'debian/mir-client-platform-mesa2.install'
131--- debian/mir-client-platform-mesa.install 2015-01-21 07:34:50 +0000
132+++ debian/mir-client-platform-mesa2.install 2015-02-23 20:59:44 +0000
133@@ -1,1 +1,1 @@
134-usr/lib/*/mir/client-platform/mesa.so
135+usr/lib/*/mir/client-platform/mesa.so.2
136
137=== renamed file 'debian/mir-platform-graphics-android.install' => 'debian/mir-platform-graphics-android1.install'
138--- debian/mir-platform-graphics-android.install 2015-01-14 13:09:48 +0000
139+++ debian/mir-platform-graphics-android1.install 2015-02-23 20:59:44 +0000
140@@ -1,1 +1,1 @@
141-usr/lib/*/mir/server-platform/graphics-android.so
142+usr/lib/*/mir/server-platform/graphics-android.so.1
143
144=== renamed file 'debian/mir-platform-graphics-mesa.install' => 'debian/mir-platform-graphics-mesa1.install'
145--- debian/mir-platform-graphics-mesa.install 2015-01-14 13:09:48 +0000
146+++ debian/mir-platform-graphics-mesa1.install 2015-02-23 20:59:44 +0000
147@@ -1,1 +1,1 @@
148-usr/lib/*/mir/server-platform/graphics-mesa.so
149+usr/lib/*/mir/server-platform/graphics-mesa.so.1
150
151=== modified file 'include/server/mir/time/timer.h'
152--- include/server/mir/time/timer.h 2015-01-21 07:34:50 +0000
153+++ include/server/mir/time/timer.h 2015-02-23 20:59:44 +0000
154@@ -1,5 +1,5 @@
155 /*
156- * Copyright © 2014 Canonical Ltd.
157+ * Copyright © 2014-2015 Canonical Ltd.
158 *
159 * This program is free software: you can redistribute it and/or modify it
160 * under the terms of the GNU General Public License version 3,
161@@ -14,6 +14,7 @@
162 * along with this program. If not, see <http://www.gnu.org/licenses/>.
163 *
164 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
165+ * Alberto Aguirre <alberto.aguirre@canonical.com>
166 */
167
168
169@@ -47,7 +48,7 @@
170 * \return A handle to an Alarm that will fire after delay ms.
171 */
172 virtual std::unique_ptr<Alarm> notify_in(std::chrono::milliseconds delay,
173- std::function<void()> callback) = 0;
174+ std::function<void()> const& callback) = 0;
175 /**
176 * \brief Create an Alarm that calls the callback at the specified time
177 *
178@@ -57,7 +58,7 @@
179 * \return A handle to an Alarm that will fire after delay ms.
180 */
181 virtual std::unique_ptr<Alarm> notify_at(Timestamp time_point,
182- std::function<void()> callback) = 0;
183+ std::function<void()> const& callback) = 0;
184 /**
185 * \brief Create an Alarm that will not fire until scheduled
186 *
187@@ -65,7 +66,30 @@
188 *
189 * \return A handle to an Alarm that can later be scheduled
190 */
191- virtual std::unique_ptr<Alarm> create_alarm(std::function<void()> callback) = 0;
192+ virtual std::unique_ptr<Alarm> create_alarm(std::function<void()> const& callback) = 0;
193+
194+ /**
195+ * \brief Create an Alarm that will not fire until scheduled
196+ *
197+ * The lock/unlock functions allow the user to preserve lock ordering
198+ * in situations where Alarm methods need to be called under external lock
199+ * and the callback implementation needs to run code protected by the same
200+ * lock. An alarm implementation may have internal locks of its own, which
201+ * maybe acquired during callback dispatching; to preserve lock ordering
202+ * the given lock function will be invoked during callback dispatch before
203+ * any internal locks are acquired.
204+ *
205+ * \param callback Function to call when the Alarm signals
206+ * \param lock Function called within callback dispatching context
207+ * before the alarm implementation acquires any internal
208+ * lock
209+ * \param unlock Function called within callback dispatching context after
210+ * the alarm implementation releases any internal lock
211+ *
212+ * \return A handle to an Alarm that can later be scheduled
213+ */
214+ virtual std::unique_ptr<Alarm> create_alarm(std::function<void()> const& callback,
215+ std::function<void()> const& lock, std::function<void()> const& unlock) = 0;
216
217 Timer(Timer const&) = delete;
218 Timer& operator=(Timer const&) = delete;
219
220=== modified file 'server-ABI-sha1sums'
221--- server-ABI-sha1sums 2015-02-03 15:07:44 +0000
222+++ server-ABI-sha1sums 2015-02-23 20:59:44 +0000
223@@ -114,4 +114,4 @@
224 e4786cdcd111bd6270db25d40129c4e415cb4347 include/server/mir/shell/shell_wrapper.h
225 114cc8c0b12ee4fd78d86c8f3309546e4dc68c9f include/server/mir/terminate_with_current_exception.h
226 1b8c2a763c8f5f00b737c3a187db2304676f8076 include/server/mir/time/alarm.h
227-a134c7b86e9c3b191f1004abe7bbdceed8ac42ee include/server/mir/time/timer.h
228+1a42680df4952714537e4e7c6bb5a03bc7fa3f38 include/server/mir/time/timer.h
229
230=== modified file 'src/CMakeLists.txt'
231--- src/CMakeLists.txt 2015-01-27 03:02:22 +0000
232+++ src/CMakeLists.txt 2015-02-23 20:59:44 +0000
233@@ -1,5 +1,4 @@
234-# We need MIRPLATFORM_ABI and MIR_PLATFORM_DRIVER_BINARY in both libmirplatform
235-# and the platform implementations.
236+# We need MIRPLATFORM_ABI in both libmirplatform and the platform implementations.
237 set(MIRPLATFORM_ABI 6)
238
239 # We need MIR_CLIENT_PLATFORM_PATH in both libmirclient and the platform
240@@ -42,3 +41,7 @@
241 set(MIR_COMMON_REFERENCES ${MIR_COMMON_REFERENCES} PARENT_SCOPE)
242 set(MIR_CLIENT_PLATFORM_PATH ${MIR_CLIENT_PLATFORM_PATH} PARENT_SCOPE)
243 set(MIR_SERVER_PLATFORM_PATH ${MIR_SERVER_PLATFORM_PATH} PARENT_SCOPE)
244+
245+# We need the ABI versions in the tests
246+set(MIR_SERVER_GRAPHICS_PLATFORM_ABI ${MIR_SERVER_GRAPHICS_PLATFORM_ABI} PARENT_SCOPE)
247+set(MIR_CLIENT_PLATFORM_ABI ${MIR_CLIENT_PLATFORM_ABI} PARENT_SCOPE)
248
249=== modified file 'src/client/CMakeLists.txt'
250--- src/client/CMakeLists.txt 2015-01-27 03:02:22 +0000
251+++ src/client/CMakeLists.txt 2015-02-23 20:59:44 +0000
252@@ -24,11 +24,10 @@
253 )
254
255 set(MIRCLIENT_ABI 8)
256-set(CLIENT_PLATFORM_VERSION "MIR_CLIENT_PLATFORM_2")
257 set(symbol_map ${CMAKE_SOURCE_DIR}/src/client/symbols.map)
258
259 add_definitions(-DMIR_CLIENT_PLATFORM_PATH="${MIR_CLIENT_PLATFORM_PATH}/")
260-add_definitions(-DCLIENT_PLATFORM_VERSION="${CLIENT_PLATFORM_VERSION}")
261+add_definitions(-DCLIENT_PLATFORM_VERSION="${MIR_CLIENT_PLATFORM_VERSION}")
262 add_definitions(-DMIR_LOGGING_COMPONENT_FALLBACK="mirclient")
263
264 add_subdirectory(rpc/)
265
266=== modified file 'src/common/sharedlibrary/shared_library_prober.cpp'
267--- src/common/sharedlibrary/shared_library_prober.cpp 2014-09-02 00:28:47 +0000
268+++ src/common/sharedlibrary/shared_library_prober.cpp 2015-02-23 20:59:44 +0000
269@@ -37,6 +37,14 @@
270 }
271 return std::error_code{};
272 }
273+
274+// Libraries can be of the form libname.so(.X.Y)
275+bool path_has_library_extension(boost::filesystem::path const& path)
276+{
277+ return path.extension().string() == ".so" ||
278+ path.string().find(".so.") != std::string::npos;
279+}
280+
281 }
282
283 std::vector<std::shared_ptr<mir::SharedLibrary>>
284@@ -57,7 +65,7 @@
285 std::vector<std::shared_ptr<mir::SharedLibrary>> libraries;
286 for (; iterator != boost::filesystem::directory_iterator() ; ++iterator)
287 {
288- if (iterator->path().extension().string() == ".so")
289+ if (path_has_library_extension(iterator->path()))
290 {
291 try
292 {
293
294=== modified file 'src/include/server/mir/compositor/frame_dropping_policy_factory.h'
295--- src/include/server/mir/compositor/frame_dropping_policy_factory.h 2015-01-21 07:34:50 +0000
296+++ src/include/server/mir/compositor/frame_dropping_policy_factory.h 2015-02-23 20:59:44 +0000
297@@ -1,5 +1,5 @@
298 /*
299- * Copyright © 2014 Canonical Ltd.
300+ * Copyright © 2014-2015 Canonical Ltd.
301 *
302 * This program is free software: you can redistribute it and/or modify it
303 * under the terms of the GNU General Public License version 3,
304@@ -14,6 +14,7 @@
305 * along with this program. If not, see <http://www.gnu.org/licenses/>.
306 *
307 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
308+ * Alberto Aguirre <alberto.aguirre@canonical.com>
309 */
310
311 #ifndef MIR_COMPOSITOR_FRAME_DROPPING_POLICY_FACTORY_H_
312@@ -44,11 +45,27 @@
313 FrameDroppingPolicyFactory& operator=(FrameDroppingPolicyFactory const&) = delete;
314
315 /**
316- * \brief Create a FrameDroppingPolicy that will call \a drop_frame when it decides to drop a frame
317- * \param drop_frame Function to call when a frame needs to be dropped
318- * \return The policy object.
319+ * \brief Create a FrameDroppingPolicy that will call \a drop_frame when it
320+ * decides to drop a frame
321+ *
322+ * The lock/unlock functions allow the user to preserve lock ordering
323+ * in situations where FrameDroppingPolicy methods need to be called under
324+ * external lock and the callback implementation needs to run code protected
325+ * by the same lock. A FrameDroppingPolicy implementation may have internal
326+ * locks of its own, which maybe acquired during callback dispatching;
327+ * to preserve lock ordering the given lock function will be invoked during
328+ * callback dispatch before any internal locks are acquired.
329+ *
330+ * \param drop_frame Function to call when a frame needs to be dropped
331+ * \param lock Function called within the callback dispatcher context
332+ * before any internal locks are acquired.
333+ * \param unlock Function called within the callback dispatcher context
334+ * after any internal locks are released.
335 */
336- virtual std::unique_ptr<FrameDroppingPolicy> create_policy(std::function<void(void)> drop_frame) const = 0;
337+ virtual std::unique_ptr<FrameDroppingPolicy> create_policy(
338+ std::function<void()> const& drop_frame,
339+ std::function<void()> const& lock,
340+ std::function<void()> const& unlock) const = 0;
341 };
342
343 }
344
345=== modified file 'src/include/server/mir/glib_main_loop.h'
346--- src/include/server/mir/glib_main_loop.h 2015-01-21 07:34:50 +0000
347+++ src/include/server/mir/glib_main_loop.h 2015-02-23 20:59:44 +0000
348@@ -1,5 +1,5 @@
349 /*
350- * Copyright © 2014 Canonical Ltd.
351+ * Copyright © 2014-2015 Canonical Ltd.
352 *
353 * This program is free software: you can redistribute it and/or modify it
354 * under the terms of the GNU General Public License version 3,
355@@ -72,14 +72,19 @@
356
357 std::unique_ptr<mir::time::Alarm> notify_in(
358 std::chrono::milliseconds delay,
359- std::function<void()> callback) override;
360+ std::function<void()> const& callback) override;
361
362 std::unique_ptr<mir::time::Alarm> notify_at(
363 mir::time::Timestamp t,
364- std::function<void()> callback) override;
365-
366- std::unique_ptr<mir::time::Alarm> create_alarm(
367- std::function<void()> callback) override;
368+ std::function<void()> const& callback) override;
369+
370+ std::unique_ptr<mir::time::Alarm> create_alarm(
371+ std::function<void()> const& callback) override;
372+
373+ std::unique_ptr<mir::time::Alarm> create_alarm(
374+ std::function<void()> const& callback,
375+ std::function<void()> const& lock,
376+ std::function<void()> const& unlock) override;
377
378 void reprocess_all_sources();
379
380
381=== modified file 'src/include/server/mir/glib_main_loop_sources.h'
382--- src/include/server/mir/glib_main_loop_sources.h 2015-01-21 07:34:50 +0000
383+++ src/include/server/mir/glib_main_loop_sources.h 2015-02-23 20:59:44 +0000
384@@ -1,5 +1,5 @@
385 /*
386- * Copyright © 2014 Canonical Ltd.
387+ * Copyright © 2014-2015 Canonical Ltd.
388 *
389 * This program is free software: you can redistribute it and/or modify it
390 * under the terms of the GNU General Public License version 3,
391@@ -65,6 +65,8 @@
392 GMainContext* main_context,
393 std::shared_ptr<time::Clock> const& clock,
394 std::function<void()> const& handler,
395+ std::function<void()> const& lock,
396+ std::function<void()> const& unlock,
397 time::Timestamp target_time);
398
399 class FdSources
400
401=== modified file 'src/platform/graphics/platform_probe.cpp'
402--- src/platform/graphics/platform_probe.cpp 2014-12-17 13:48:10 +0000
403+++ src/platform/graphics/platform_probe.cpp 2015-02-23 20:59:44 +0000
404@@ -47,7 +47,7 @@
405 {
406 // Tried to probe a SharedLibrary that isn't a platform module?
407 ml::log(ml::Severity::warning,
408- std::string{"Failed to probe module. Not a platform library? Error: "} + err.what(),
409+ std::string{"Failed to probe module. Not a platform library or incorrect ABI version? Error: "} + err.what(),
410 "Platform Probing");
411 }
412 }
413
414=== modified file 'src/platforms/CMakeLists.txt'
415--- src/platforms/CMakeLists.txt 2015-01-27 03:02:22 +0000
416+++ src/platforms/CMakeLists.txt 2015-02-23 20:59:44 +0000
417@@ -3,7 +3,9 @@
418 # This ABI is much smaller than the full libmirplatform ABI.
419 #
420 # TODO: Add an extra driver-ABI check target.
421-set(MIR_SERVER_GRAPHICS_PLATFORM_VERSION "MIR_GRAPHICS_PLATFORM_1")
422+set(MIR_SERVER_GRAPHICS_PLATFORM_ABI 1)
423+set(MIR_SERVER_GRAPHICS_PLATFORM_ABI ${MIR_SERVER_GRAPHICS_PLATFORM_ABI} PARENT_SCOPE)
424+set(MIR_SERVER_GRAPHICS_PLATFORM_VERSION "MIR_GRAPHICS_PLATFORM_${MIR_SERVER_GRAPHICS_PLATFORM_ABI}")
425 set(MIR_SERVER_GRAPHICS_PLATFORM_VERSION ${MIR_SERVER_GRAPHICS_PLATFORM_VERSION} PARENT_SCOPE)
426
427 set(MIR_SERVER_PLATFORM_PATH
428@@ -14,6 +16,11 @@
429 PARENT_SCOPE
430 )
431
432+set(MIR_CLIENT_PLATFORM_ABI 2)
433+set(MIR_CLIENT_PLATFORM_ABI ${MIR_CLIENT_PLATFORM_ABI} PARENT_SCOPE)
434+set(MIR_CLIENT_PLATFORM_VERSION "MIR_CLIENT_PLATFORM_${MIR_CLIENT_PLATFORM_ABI}")
435+set(MIR_CLIENT_PLATFORM_VERSION ${MIR_CLIENT_PLATFORM_VERSION} PARENT_SCOPE)
436+
437 set(server_common_include_dirs
438 ${PROJECT_SOURCE_DIR}/include/platform
439 )
440
441=== modified file 'src/platforms/android/client/CMakeLists.txt'
442--- src/platforms/android/client/CMakeLists.txt 2015-01-27 03:02:22 +0000
443+++ src/platforms/android/client/CMakeLists.txt 2015-02-23 20:59:44 +0000
444@@ -26,6 +26,7 @@
445 OUTPUT_NAME android
446 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/client-modules
447 PREFIX ""
448+ SUFFIX ".so.${MIR_CLIENT_PLATFORM_ABI}"
449 LINK_FLAGS "-Wl,--version-script,${symbol_map}"
450 )
451
452
453=== modified file 'src/platforms/android/server/CMakeLists.txt'
454--- src/platforms/android/server/CMakeLists.txt 2015-01-27 03:02:22 +0000
455+++ src/platforms/android/server/CMakeLists.txt 2015-02-23 20:59:44 +0000
456@@ -63,6 +63,7 @@
457 OUTPUT_NAME graphics-android
458 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/server-modules
459 PREFIX ""
460+ SUFFIX ".so.${MIR_SERVER_GRAPHICS_PLATFORM_ABI}"
461 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"
462 )
463
464
465=== modified file 'src/platforms/mesa/client/CMakeLists.txt'
466--- src/platforms/mesa/client/CMakeLists.txt 2015-01-22 09:00:14 +0000
467+++ src/platforms/mesa/client/CMakeLists.txt 2015-02-23 20:59:44 +0000
468@@ -28,6 +28,7 @@
469 OUTPUT_NAME mesa
470 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/client-modules
471 PREFIX ""
472+ SUFFIX ".so.${MIR_CLIENT_PLATFORM_ABI}"
473 LINK_FLAGS "-Wl,--version-script,${symbol_map}"
474 )
475
476
477=== modified file 'src/platforms/mesa/server/CMakeLists.txt'
478--- src/platforms/mesa/server/CMakeLists.txt 2015-01-27 03:02:22 +0000
479+++ src/platforms/mesa/server/CMakeLists.txt 2015-02-23 20:59:44 +0000
480@@ -64,6 +64,7 @@
481 OUTPUT_NAME graphics-mesa
482 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/server-modules
483 PREFIX ""
484+ SUFFIX ".so.${MIR_SERVER_GRAPHICS_PLATFORM_ABI}"
485 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"
486 )
487
488
489=== modified file 'src/server/CMakeLists.txt'
490--- src/server/CMakeLists.txt 2015-02-02 12:18:18 +0000
491+++ src/server/CMakeLists.txt 2015-02-23 20:59:44 +0000
492@@ -106,7 +106,7 @@
493 ${CMAKE_SOURCE_DIR}/include/server/mir DESTINATION "include/mirserver"
494 )
495
496-set(MIRSERVER_ABI 29) # Be sure to increment MIR_VERSION_MINOR at the same time
497+set(MIRSERVER_ABI 30) # Be sure to increment MIR_VERSION_MINOR at the same time
498 set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map)
499
500 set_target_properties(
501
502=== modified file 'src/server/compositor/buffer_queue.cpp'
503--- src/server/compositor/buffer_queue.cpp 2015-01-22 09:12:04 +0000
504+++ src/server/compositor/buffer_queue.cpp 2015-02-23 20:59:44 +0000
505@@ -1,5 +1,5 @@
506 /*
507- * Copyright © 2014 Canonical Ltd.
508+ * Copyright © 2014-2015 Canonical Ltd.
509 *
510 * This program is free software: you can redistribute it and/or modify it
511 * under the terms of the GNU General Public License version 3,
512@@ -132,11 +132,18 @@
513 if (nbuffers == 1)
514 free_buffers.push_back(current_compositor_buffer);
515
516+ // A lock_guard will be created by the policy dispatcher invoking the given "lock" lambda
517+ // before it acquires any internal locks of its own.
518 framedrop_policy = policy_provider.create_policy([this]
519 {
520- std::unique_lock<decltype(guard)> lock{guard};
521- drop_frame(std::move(lock));
522- });
523+ // We ignore any ongoing snapshotting as it could lead to deadlock.
524+ // In order to wait the guard_lock needs to be released; a BufferQueue::release
525+ // call can sneak in at that time from a different thread which
526+ // can invoke framedrop_policy methods
527+ drop_frame(guard_lock, ignore_snapshot);
528+ },
529+ [this] { guard_lock = std::move(std::unique_lock<decltype(guard)>{guard}); },
530+ [this] { if (guard_lock.owns_lock()) guard_lock.unlock(); });
531 }
532
533 void mc::BufferQueue::client_acquire(mc::BufferQueue::Callback complete)
534@@ -149,7 +156,7 @@
535 {
536 auto const buffer = free_buffers.back();
537 free_buffers.pop_back();
538- give_buffer_to_client(buffer, std::move(lock));
539+ give_buffer_to_client(buffer, lock);
540 return;
541 }
542
543@@ -162,14 +169,14 @@
544 {
545 auto const& buffer = gralloc->alloc_buffer(the_properties);
546 buffers.push_back(buffer);
547- give_buffer_to_client(buffer.get(), std::move(lock));
548+ give_buffer_to_client(buffer.get(), lock);
549 return;
550 }
551
552 /* Last resort, drop oldest buffer from the ready queue */
553 if (frame_dropping_enabled)
554 {
555- drop_frame(std::move(lock));
556+ drop_frame(lock, wait_for_snapshot);
557 return;
558 }
559
560@@ -342,7 +349,7 @@
561 {
562 free_buffers.push_back(pop(ready_to_composite_queue));
563 }
564- give_buffer_to_client(buffer, std::move(lock));
565+ give_buffer_to_client(buffer, lock, ignore_snapshot);
566 }
567 }
568
569@@ -382,7 +389,15 @@
570
571 void mc::BufferQueue::give_buffer_to_client(
572 mg::Buffer* buffer,
573- std::unique_lock<std::mutex> lock)
574+ std::unique_lock<std::mutex>& lock)
575+{
576+ give_buffer_to_client(buffer, lock, wait_for_snapshot);
577+}
578+
579+void mc::BufferQueue::give_buffer_to_client(
580+ mg::Buffer* buffer,
581+ std::unique_lock<std::mutex>& lock,
582+ SnapshotWait wait_type)
583 {
584 /* Clears callback */
585 auto give_to_client_cb = std::move(pending_client_notifications.front());
586@@ -402,7 +417,7 @@
587 }
588
589 /* Don't give to the client just yet if there's a pending snapshot */
590- if (!resize_buffer && contains(buffer, pending_snapshots))
591+ if (wait_type == wait_for_snapshot && !resize_buffer && contains(buffer, pending_snapshots))
592 {
593 snapshot_released.wait(lock,
594 [&]{ return !contains(buffer, pending_snapshots); });
595@@ -439,7 +454,7 @@
596 if (!pending_client_notifications.empty())
597 {
598 framedrop_policy->swap_unblocked();
599- give_buffer_to_client(buffer, std::move(lock));
600+ give_buffer_to_client(buffer, lock);
601 }
602 else if (!frame_dropping_enabled && buffers.size() > size_t(nbuffers))
603 {
604@@ -465,7 +480,7 @@
605 free_buffers.push_back(buffer);
606 }
607
608-void mc::BufferQueue::drop_frame(std::unique_lock<std::mutex> lock)
609+void mc::BufferQueue::drop_frame(std::unique_lock<std::mutex>& lock, SnapshotWait wait_type)
610 {
611 // Make sure there is a client waiting for the frame before we drop it.
612 // If not, then there's nothing to do.
613@@ -517,7 +532,7 @@
614 buffer_to_give = buffer.get();
615 }
616
617- give_buffer_to_client(buffer_to_give, std::move(lock));
618+ give_buffer_to_client(buffer_to_give, lock, wait_type);
619 }
620
621 void mc::BufferQueue::drop_old_buffers()
622
623=== modified file 'src/server/compositor/buffer_queue.h'
624--- src/server/compositor/buffer_queue.h 2015-01-21 08:53:28 +0000
625+++ src/server/compositor/buffer_queue.h 2015-02-23 20:59:44 +0000
626@@ -1,5 +1,5 @@
627 /*
628- * Copyright © 2014 Canonical Ltd.
629+ * Copyright © 2014-2015 Canonical Ltd.
630 *
631 * This program is free software: you can redistribute it and/or modify it
632 * under the terms of the GNU General Public License version 3,
633@@ -66,13 +66,21 @@
634 void drop_client_requests() override;
635
636 private:
637- void give_buffer_to_client(graphics::Buffer* buffer,
638- std::unique_lock<std::mutex> lock);
639+ enum SnapshotWait
640+ {
641+ wait_for_snapshot,
642+ ignore_snapshot
643+ };
644+ void give_buffer_to_client(graphics::Buffer* buffer,
645+ std::unique_lock<std::mutex>& lock);
646+ void give_buffer_to_client(graphics::Buffer* buffer,
647+ std::unique_lock<std::mutex>& lock, SnapshotWait wait_type);
648 void release(graphics::Buffer* buffer,
649 std::unique_lock<std::mutex> lock);
650- void drop_frame(std::unique_lock<std::mutex> lock);
651+ void drop_frame(std::unique_lock<std::mutex>& lock, SnapshotWait wait_type);
652
653 mutable std::mutex guard;
654+ std::unique_lock<decltype(guard)> guard_lock;
655
656 std::vector<std::shared_ptr<graphics::Buffer>> buffers;
657 std::deque<graphics::Buffer*> ready_to_composite_queue;
658
659=== modified file 'src/server/compositor/timeout_frame_dropping_policy_factory.cpp'
660--- src/server/compositor/timeout_frame_dropping_policy_factory.cpp 2015-01-21 07:34:50 +0000
661+++ src/server/compositor/timeout_frame_dropping_policy_factory.cpp 2015-02-23 20:59:44 +0000
662@@ -1,5 +1,5 @@
663 /*
664- * Copyright © 2014 Canonical Ltd.
665+ * Copyright © 2014-2015 Canonical Ltd.
666 *
667 * This program is free software: you can redistribute it and/or modify it
668 * under the terms of the GNU General Public License version 3,
669@@ -14,6 +14,7 @@
670 * along with this program. If not, see <http://www.gnu.org/licenses/>.
671 *
672 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
673+ * Alberto Aguirre <alberto.aguirre@canonical.com>
674 */
675
676 #include "mir/compositor/frame_dropping_policy.h"
677@@ -34,7 +35,9 @@
678 public:
679 TimeoutFrameDroppingPolicy(std::shared_ptr<mir::time::Timer> const& timer,
680 std::chrono::milliseconds timeout,
681- std::function<void(void)> drop_frame);
682+ std::function<void()> const& drop_frame,
683+ std::function<void()> const& lock,
684+ std::function<void()> const& unlock);
685
686 void swap_now_blocking() override;
687 void swap_unblocked() override;
688@@ -50,7 +53,9 @@
689
690 TimeoutFrameDroppingPolicy::TimeoutFrameDroppingPolicy(std::shared_ptr<mir::time::Timer> const& timer,
691 std::chrono::milliseconds timeout,
692- std::function<void(void)> drop_frame)
693+ std::function<void()> const& drop_frame,
694+ std::function<void()> const& lock,
695+ std::function<void()> const& unlock)
696 : timeout{timeout},
697 pending_swaps{0},
698 alarm{timer->create_alarm([this, drop_frame]
699@@ -59,7 +64,7 @@
700 drop_frame();
701 if (--pending_swaps > 0)
702 alarm->reschedule_in(this->timeout);
703- })}
704+ }, lock, unlock)}
705 {
706 }
707
708@@ -81,15 +86,18 @@
709 }
710 }
711
712-mc::TimeoutFrameDroppingPolicyFactory::TimeoutFrameDroppingPolicyFactory(std::shared_ptr<mir::time::Timer> const& timer,
713- std::chrono::milliseconds timeout)
714+mc::TimeoutFrameDroppingPolicyFactory::TimeoutFrameDroppingPolicyFactory(
715+ std::shared_ptr<mir::time::Timer> const& timer,
716+ std::chrono::milliseconds timeout)
717 : timer{timer},
718 timeout{timeout}
719 {
720 }
721
722-
723-std::unique_ptr<mc::FrameDroppingPolicy> mc::TimeoutFrameDroppingPolicyFactory::create_policy(std::function<void ()> drop_frame) const
724+std::unique_ptr<mc::FrameDroppingPolicy>
725+mc::TimeoutFrameDroppingPolicyFactory::create_policy(std::function<void()> const& drop_frame,
726+ std::function<void()> const& lock,
727+ std::function<void()> const& unlock) const
728 {
729- return std::unique_ptr<mc::FrameDroppingPolicy>{new TimeoutFrameDroppingPolicy{timer, timeout, drop_frame}};
730+ return std::unique_ptr<mc::FrameDroppingPolicy>{new TimeoutFrameDroppingPolicy{timer, timeout, drop_frame, lock, unlock}};
731 }
732
733=== modified file 'src/server/compositor/timeout_frame_dropping_policy_factory.h'
734--- src/server/compositor/timeout_frame_dropping_policy_factory.h 2014-05-22 20:48:20 +0000
735+++ src/server/compositor/timeout_frame_dropping_policy_factory.h 2015-02-23 20:59:44 +0000
736@@ -1,5 +1,5 @@
737 /*
738- * Copyright © 2014 Canonical Ltd.
739+ * Copyright © 2014-2015 Canonical Ltd.
740 *
741 * This program is free software: you can redistribute it and/or modify it
742 * under the terms of the GNU General Public License version 3,
743@@ -14,6 +14,7 @@
744 * along with this program. If not, see <http://www.gnu.org/licenses/>.
745 *
746 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
747+ * Alberto Aguirre <alberto.aguirre@canonical.com>
748 */
749
750
751@@ -44,7 +45,10 @@
752 TimeoutFrameDroppingPolicyFactory(std::shared_ptr<mir::time::Timer> const& timer,
753 std::chrono::milliseconds timeout);
754
755- std::unique_ptr<FrameDroppingPolicy> create_policy(std::function<void(void)> drop_frame) const override;
756+ std::unique_ptr<FrameDroppingPolicy> create_policy(
757+ std::function<void()> const& drop_frame,
758+ std::function<void()> const& lock,
759+ std::function<void()> const& unlock) const override;
760 private:
761 std::shared_ptr<mir::time::Timer> const timer;
762 std::chrono::milliseconds timeout;
763
764=== modified file 'src/server/glib_main_loop.cpp'
765--- src/server/glib_main_loop.cpp 2015-01-21 07:34:50 +0000
766+++ src/server/glib_main_loop.cpp 2015-02-23 20:59:44 +0000
767@@ -1,5 +1,5 @@
768 /*
769- * Copyright © 2014 Canonical Ltd.
770+ * Copyright © 2014-2015 Canonical Ltd.
771 *
772 * This program is free software: you can redistribute it and/or modify it
773 * under the terms of the GNU General Public License version 3,
774@@ -14,6 +14,7 @@
775 * along with this program. If not, see <http://www.gnu.org/licenses/>.
776 *
777 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
778+ * Alberto Aguirre <alberto.aguirre@canonical.com>
779 */
780
781 #include "mir/glib_main_loop.h"
782@@ -33,10 +34,14 @@
783 AlarmImpl(
784 GMainContext* main_context,
785 std::shared_ptr<mir::time::Clock> const& clock,
786- std::function<void()> const& callback)
787+ std::function<void()> const& callback,
788+ std::function<void()> const& lock,
789+ std::function<void()> const& unlock)
790 : main_context{main_context},
791 clock{clock},
792 callback{callback},
793+ ext_lock{lock},
794+ ext_unlock{unlock},
795 state_{State::cancelled}
796 {
797 }
798@@ -70,6 +75,8 @@
799 main_context,
800 clock,
801 [&] { state_ = State::triggered; callback(); },
802+ ext_lock,
803+ ext_unlock,
804 time_point);
805
806 return true;
807@@ -80,6 +87,8 @@
808 GMainContext* main_context;
809 std::shared_ptr<mir::time::Clock> const clock;
810 std::function<void()> const callback;
811+ std::function<void()> const ext_lock;
812+ std::function<void()> const ext_unlock;
813 State state_;
814 mir::detail::GSourceHandle gsource;
815 };
816@@ -223,7 +232,7 @@
817
818 std::unique_ptr<mir::time::Alarm> mir::GLibMainLoop::notify_in(
819 std::chrono::milliseconds delay,
820- std::function<void()> callback)
821+ std::function<void()> const& callback)
822 {
823 auto alarm = create_alarm(callback);
824
825@@ -234,7 +243,7 @@
826
827 std::unique_ptr<mir::time::Alarm> mir::GLibMainLoop::notify_at(
828 mir::time::Timestamp t,
829- std::function<void()> callback)
830+ std::function<void()> const& callback)
831 {
832 auto alarm = create_alarm(callback);
833
834@@ -244,7 +253,15 @@
835 }
836
837 std::unique_ptr<mir::time::Alarm> mir::GLibMainLoop::create_alarm(
838- std::function<void()> callback)
839+ std::function<void()> const& callback)
840+{
841+ return create_alarm(callback, []{}, []{});
842+}
843+
844+std::unique_ptr<mir::time::Alarm> mir::GLibMainLoop::create_alarm(
845+ std::function<void()> const& callback,
846+ std::function<void()> const& lock,
847+ std::function<void()> const& unlock)
848 {
849 auto const callback_with_exception_handling =
850 [this, callback]
851@@ -254,7 +271,7 @@
852 };
853
854 return std::unique_ptr<mir::time::Alarm>{
855- new AlarmImpl(main_context, clock, callback_with_exception_handling)};
856+ new AlarmImpl(main_context, clock, callback_with_exception_handling, lock, unlock)};
857 }
858
859 void mir::GLibMainLoop::reprocess_all_sources()
860
861=== modified file 'src/server/glib_main_loop_sources.cpp'
862--- src/server/glib_main_loop_sources.cpp 2015-01-21 07:34:50 +0000
863+++ src/server/glib_main_loop_sources.cpp 2015-02-23 20:59:44 +0000
864@@ -1,5 +1,5 @@
865 /*
866- * Copyright © 2014 Canonical Ltd.
867+ * Copyright © 2014-2015 Canonical Ltd.
868 *
869 * This program is free software: you can redistribute it and/or modify it
870 * under the terms of the GNU General Public License version 3,
871@@ -14,11 +14,13 @@
872 * along with this program. If not, see <http://www.gnu.org/licenses/>.
873 *
874 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
875+ * Alberto Aguirre <alberto.aguirre@canonical.com>
876 */
877
878 #include "mir/glib_main_loop_sources.h"
879 #include "mir/recursive_read_write_mutex.h"
880 #include "mir/thread_safe_list.h"
881+#include "mir/raii.h"
882
883 #include <algorithm>
884 #include <atomic>
885@@ -233,18 +235,25 @@
886 GMainContext* main_context,
887 std::shared_ptr<time::Clock> const& clock,
888 std::function<void()> const& handler,
889+ std::function<void()> const& lock,
890+ std::function<void()> const& unlock,
891 time::Timestamp target_time)
892 {
893 struct TimerContext
894 {
895 TimerContext(std::shared_ptr<time::Clock> const& clock,
896 std::function<void()> const& handler,
897+ std::function<void()> const& lock,
898+ std::function<void()> const& unlock,
899 time::Timestamp target_time)
900- : clock{clock}, handler{handler}, target_time{target_time}, enabled{true}
901+ : clock{clock}, handler{handler}, lock{lock}, unlock{unlock},
902+ target_time{target_time}, enabled{true}
903 {
904 }
905 std::shared_ptr<time::Clock> clock;
906 std::function<void()> handler;
907+ std::function<void()> lock;
908+ std::function<void()> unlock;
909 time::Timestamp target_time;
910 bool enabled;
911 mir::RecursiveReadWriteMutex mutex;
912@@ -284,6 +293,9 @@
913 {
914 auto& ctx = reinterpret_cast<TimerGSource*>(source)->ctx;
915
916+ // Caller may pass std::function objects to preserve locking
917+ // order during callback dispatching, so aquire them first.
918+ auto caller_lock = mir::raii::paired_calls(std::ref(ctx.lock), std::ref(ctx.unlock));
919 RecursiveReadLock lock{ctx.mutex};
920 if (ctx.enabled)
921 ctx.handler();
922@@ -321,7 +333,7 @@
923 auto const timer_gsource = reinterpret_cast<TimerGSource*>(static_cast<GSource*>(gsource));
924
925 timer_gsource->ctx_constructed = false;
926- new (&timer_gsource->ctx) TimerContext{clock, handler, target_time};
927+ new (&timer_gsource->ctx) TimerContext{clock, handler, lock, unlock, target_time};
928 timer_gsource->ctx_constructed = true;
929
930 g_source_attach(gsource, main_context);
931
932=== modified file 'src/server/symbols.map'
933--- src/server/symbols.map 2015-02-03 15:07:44 +0000
934+++ src/server/symbols.map 2015-02-23 20:59:44 +0000
935@@ -1,4 +1,4 @@
936-MIR_SERVER_29 {
937+MIR_SERVER_30 {
938 global:
939 extern "C++" {
940 # Symbols not yet picked up by script
941
942=== modified file 'tests/acceptance-tests/test_symbols_required_by_mesa.cpp'
943--- tests/acceptance-tests/test_symbols_required_by_mesa.cpp 2015-01-27 03:02:22 +0000
944+++ tests/acceptance-tests/test_symbols_required_by_mesa.cpp 2015-02-23 20:59:44 +0000
945@@ -28,7 +28,7 @@
946
947 TEST(SymbolsRequiredByMesa, are_exported_by_client_platform_mesa)
948 {
949- auto const handle = dlopen(mtf::client_platform("mesa.so").c_str(), RTLD_LAZY);
950+ auto const handle = dlopen(mtf::client_platform("mesa").c_str(), RTLD_LAZY);
951 ASSERT_THAT(handle, NotNull());
952
953 auto const sym = dlsym(handle, "mir_client_mesa_egl_native_display_is_valid");
954
955=== modified file 'tests/include/mir_test_doubles/mock_frame_dropping_policy_factory.h'
956--- tests/include/mir_test_doubles/mock_frame_dropping_policy_factory.h 2014-05-22 20:48:20 +0000
957+++ tests/include/mir_test_doubles/mock_frame_dropping_policy_factory.h 2015-02-23 20:59:44 +0000
958@@ -1,5 +1,5 @@
959 /*
960- * Copyright © 2014 Canonical Ltd.
961+ * Copyright © 2014-2015 Canonical Ltd.
962 *
963 * This program is free software: you can redistribute it and/or modify it
964 * under the terms of the GNU General Public License version 3,
965@@ -14,6 +14,7 @@
966 * along with this program. If not, see <http://www.gnu.org/licenses/>.
967 *
968 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
969+ * Alberto Aguirre <alberto.aguirre@canonical.com>
970 */
971
972
973@@ -23,6 +24,8 @@
974 #include "mir/compositor/frame_dropping_policy_factory.h"
975 #include "mir/compositor/frame_dropping_policy.h"
976
977+#include "mir_test/gmock_fixes.h"
978+
979 #include <unordered_set>
980 #include <functional>
981
982@@ -42,7 +45,9 @@
983 class MockFrameDroppingPolicy : public mc::FrameDroppingPolicy
984 {
985 public:
986- MockFrameDroppingPolicy(std::function<void(void)> callback,
987+ MockFrameDroppingPolicy(std::function<void()> const& callback,
988+ std::function<void()> const& lock,
989+ std::function<void()> const& unlock,
990 MockFrameDroppingPolicyFactory const* parent);
991 ~MockFrameDroppingPolicy();
992
993@@ -55,14 +60,19 @@
994 friend class MockFrameDroppingPolicyFactory;
995 void parent_destroyed();
996
997- std::function<void(void)> callback;
998+ std::function<void()> callback;
999+ std::function<void()> lock;
1000+ std::function<void()> unlock;
1001 MockFrameDroppingPolicyFactory const* parent;
1002 };
1003
1004 class MockFrameDroppingPolicyFactory : public mc::FrameDroppingPolicyFactory
1005 {
1006 public:
1007- std::unique_ptr<mc::FrameDroppingPolicy> create_policy(std::function<void(void)> drop_frame) const override;
1008+ std::unique_ptr<mc::FrameDroppingPolicy> create_policy(
1009+ std::function<void()> const& drop_frame,
1010+ std::function<void()> const& lock,
1011+ std::function<void()> const& unlock) const override;
1012
1013 ~MockFrameDroppingPolicyFactory();
1014
1015@@ -75,6 +85,15 @@
1016 mutable std::unordered_set<MockFrameDroppingPolicy*> policies;
1017 };
1018
1019+class FrameDroppingPolicyFactoryMock : public mc::FrameDroppingPolicyFactory
1020+{
1021+public:
1022+ MOCK_CONST_METHOD3(create_policy, std::unique_ptr<mc::FrameDroppingPolicy>(
1023+ std::function<void()> const&,
1024+ std::function<void()> const&,
1025+ std::function<void()> const&));
1026+};
1027+
1028 }
1029 }
1030 }
1031
1032=== modified file 'tests/include/mir_test_doubles/mock_main_loop.h'
1033--- tests/include/mir_test_doubles/mock_main_loop.h 2014-06-24 14:12:25 +0000
1034+++ tests/include/mir_test_doubles/mock_main_loop.h 2015-02-23 20:59:44 +0000
1035@@ -1,5 +1,5 @@
1036 /*
1037- * Copyright © 2014 Canonical Ltd.
1038+ * Copyright © 2014-2015 Canonical Ltd.
1039 *
1040 * This program is free software: you can redistribute it and/or modify
1041 * it under the terms of the GNU General Public License version 3 as
1042@@ -52,11 +52,19 @@
1043 MOCK_METHOD1(pause_processing_for,void (void const*));
1044 MOCK_METHOD1(resume_processing_for,void (void const*));
1045
1046- MOCK_METHOD2(notify_in, std::unique_ptr<time::Alarm>(std::chrono::milliseconds delay,
1047- std::function<void(void)> callback));
1048- MOCK_METHOD2(notify_at, std::unique_ptr<time::Alarm>(time::Timestamp time_point,
1049- std::function<void(void)> callback));
1050- MOCK_METHOD1(create_alarm, std::unique_ptr<time::Alarm>(std::function<void ()> callback));
1051+ MOCK_METHOD2(notify_in,
1052+ std::unique_ptr<time::Alarm>(std::chrono::milliseconds delay,
1053+ std::function<void()> const& callback));
1054+ MOCK_METHOD2(notify_at,
1055+ std::unique_ptr<time::Alarm>(time::Timestamp time_point,
1056+ std::function<void()> const& callback));
1057+ MOCK_METHOD1(create_alarm, std::unique_ptr<time::Alarm>(std::function<void()> const& callback));
1058+ MOCK_METHOD3(create_alarm,
1059+ std::unique_ptr<time::Alarm>(
1060+ std::function<void()> const& callback,
1061+ std::function<void()> const& lock,
1062+ std::function<void()> const& unlock));
1063+
1064 };
1065
1066 }
1067
1068=== modified file 'tests/include/mir_test_doubles/mock_timer.h'
1069--- tests/include/mir_test_doubles/mock_timer.h 2014-05-22 20:48:20 +0000
1070+++ tests/include/mir_test_doubles/mock_timer.h 2015-02-23 20:59:44 +0000
1071@@ -1,5 +1,5 @@
1072 /*
1073- * Copyright © 2014 Canonical Ltd.
1074+ * Copyright © 2014-2015 Canonical Ltd.
1075 *
1076 * This program is free software: you can redistribute it and/or modify it
1077 * under the terms of the GNU General Public License version 3,
1078@@ -14,6 +14,7 @@
1079 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1080 *
1081 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
1082+ * Alberto Aguirre <alberto.aguirre@canonical.com>
1083 */
1084
1085 #ifndef MIR_TEST_DOUBLES_MOCK_TIMER_H_
1086@@ -36,11 +37,12 @@
1087 FakeTimer(std::shared_ptr<FakeClock> const& clock);
1088
1089 std::unique_ptr<time::Alarm> notify_in(std::chrono::milliseconds delay,
1090- std::function<void(void)> callback) override;
1091+ std::function<void()> const& callback) override;
1092 std::unique_ptr<time::Alarm> notify_at(time::Timestamp time_point,
1093- std::function<void(void)> callback) override;
1094- std::unique_ptr<time::Alarm> create_alarm(std::function<void ()> callback) override;
1095-
1096+ std::function<void()> const& callback) override;
1097+ std::unique_ptr<time::Alarm> create_alarm(std::function<void()> const& callback) override;
1098+ std::unique_ptr<time::Alarm> create_alarm(std::function<void()> const& callback,
1099+ std::function<void()> const& lock, std::function<void()> const& unlock) override;
1100 private:
1101 std::shared_ptr<FakeClock> const clock;
1102 };
1103
1104=== modified file 'tests/include/mir_test_doubles/stub_frame_dropping_policy_factory.h'
1105--- tests/include/mir_test_doubles/stub_frame_dropping_policy_factory.h 2014-05-22 20:48:20 +0000
1106+++ tests/include/mir_test_doubles/stub_frame_dropping_policy_factory.h 2015-02-23 20:59:44 +0000
1107@@ -1,5 +1,5 @@
1108 /*
1109- * Copyright © 2014 Canonical Ltd.
1110+ * Copyright © 2014-2015 Canonical Ltd.
1111 *
1112 * This program is free software: you can redistribute it and/or modify it
1113 * under the terms of the GNU General Public License version 3,
1114@@ -14,6 +14,7 @@
1115 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1116 *
1117 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
1118+ * Alberto Aguirre <alberto.aguirre@canonical.com>
1119 */
1120
1121
1122@@ -46,9 +47,12 @@
1123 class StubFrameDroppingPolicyFactory : public mc::FrameDroppingPolicyFactory
1124 {
1125 public:
1126- std::unique_ptr<mc::FrameDroppingPolicy> create_policy(std::function<void(void)>) const override
1127+ std::unique_ptr<mc::FrameDroppingPolicy> create_policy(
1128+ std::function<void()> const&,
1129+ std::function<void()> const&,
1130+ std::function<void()> const& ) const override
1131 {
1132- return std::unique_ptr<mc::FrameDroppingPolicy>{new StubFrameDroppingPolicy};
1133+ return std::unique_ptr<mc::FrameDroppingPolicy>{new StubFrameDroppingPolicy};
1134 }
1135 };
1136
1137
1138=== modified file 'tests/include/mir_test_doubles/stub_timer.h'
1139--- tests/include/mir_test_doubles/stub_timer.h 2015-01-21 07:34:50 +0000
1140+++ tests/include/mir_test_doubles/stub_timer.h 2015-02-23 20:59:44 +0000
1141@@ -1,5 +1,5 @@
1142 /*
1143- * Copyright © 2014 Canonical Ltd.
1144+ * Copyright © 2014-2015 Canonical Ltd.
1145 *
1146 * This program is free software: you can redistribute it and/or modify it
1147 * under the terms of the GNU General Public License version 3,
1148@@ -51,12 +51,12 @@
1149
1150 class StubTimer : public mir::time::Timer
1151 {
1152- std::unique_ptr<mir::time::Alarm> notify_in(std::chrono::milliseconds, std::function<void(void)>) override
1153+ std::unique_ptr<mir::time::Alarm> notify_in(std::chrono::milliseconds, std::function<void()> const&) override
1154 {
1155 return std::unique_ptr<mir::time::Alarm>{new StubAlarm};
1156 }
1157
1158- std::unique_ptr<mir::time::Alarm> notify_at(mir::time::Timestamp, std::function<void(void)>) override
1159+ std::unique_ptr<mir::time::Alarm> notify_at(mir::time::Timestamp, std::function<void()> const&) override
1160 {
1161 return std::unique_ptr<mir::time::Alarm>{new StubAlarm};
1162 }
1163
1164=== modified file 'tests/include/mir_test_doubles/triggered_main_loop.h'
1165--- tests/include/mir_test_doubles/triggered_main_loop.h 2015-01-27 11:47:52 +0000
1166+++ tests/include/mir_test_doubles/triggered_main_loop.h 2015-02-23 20:59:44 +0000
1167@@ -39,7 +39,7 @@
1168
1169 void register_fd_handler(std::initializer_list<int> fds, void const* owner, fd_callback const& handler) override;
1170 void unregister_fd_handler(void const* owner) override;
1171- std::unique_ptr<mir::time::Alarm> notify_in(std::chrono::milliseconds delay, callback call) override;
1172+ std::unique_ptr<mir::time::Alarm> notify_in(std::chrono::milliseconds delay, callback const& call) override;
1173 void enqueue(void const* owner, ServerAction const& action) override;
1174
1175 void trigger_pending_fds();
1176
1177=== modified file 'tests/include/mir_test_framework/client_platform_factory.h'
1178--- tests/include/mir_test_framework/client_platform_factory.h 2015-02-03 15:07:44 +0000
1179+++ tests/include/mir_test_framework/client_platform_factory.h 2015-02-23 20:59:44 +0000
1180@@ -37,7 +37,7 @@
1181 mtd::MockClientContext ctx;
1182 ON_CALL(ctx, populate_server_package(_))
1183 .WillByDefault(Invoke([](MirPlatformPackage& package) { ::memset(&package, 0, sizeof(package)); }));
1184- platform_library = std::make_shared<mir::SharedLibrary>(client_platform("android.so"));
1185+ platform_library = std::make_shared<mir::SharedLibrary>(client_platform("android"));
1186 auto platform_factory = platform_library->load_function<mir::client::CreateClientPlatform>("create_client_platform");
1187 return platform_factory(&ctx);
1188 }
1189@@ -46,7 +46,7 @@
1190 mir::client::ClientContext* client_context)
1191 {
1192 using namespace testing;
1193- platform_library = std::make_shared<mir::SharedLibrary>(client_platform("mesa.so"));
1194+ platform_library = std::make_shared<mir::SharedLibrary>(client_platform("mesa"));
1195 auto platform_factory = platform_library->load_function<mir::client::CreateClientPlatform>("create_client_platform");
1196 return platform_factory(client_context);
1197 }
1198
1199=== modified file 'tests/mir_test_doubles/mock_frame_dropping_policy_factory.cpp'
1200--- tests/mir_test_doubles/mock_frame_dropping_policy_factory.cpp 2014-05-22 20:48:20 +0000
1201+++ tests/mir_test_doubles/mock_frame_dropping_policy_factory.cpp 2015-02-23 20:59:44 +0000
1202@@ -1,5 +1,5 @@
1203 /*
1204- * Copyright © 2014 Canonical Ltd.
1205+ * Copyright © 2014-2015 Canonical Ltd.
1206 *
1207 * This program is free software: you can redistribute it and/or modify it
1208 * under the terms of the GNU General Public License version 3,
1209@@ -14,6 +14,7 @@
1210 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1211 *
1212 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
1213+ * Alberto Aguirre <alberto.aguirre@canonical.com>
1214 */
1215
1216 #include "mir_test_doubles/mock_frame_dropping_policy_factory.h"
1217@@ -21,9 +22,13 @@
1218 namespace mc = mir::compositor;
1219 namespace mtd = mir::test::doubles;
1220
1221-mtd::MockFrameDroppingPolicy::MockFrameDroppingPolicy(std::function<void(void)> callback,
1222+mtd::MockFrameDroppingPolicy::MockFrameDroppingPolicy(std::function<void()> const& callback,
1223+ std::function<void()> const& lock,
1224+ std::function<void()> const& unlock,
1225 MockFrameDroppingPolicyFactory const* parent)
1226 : callback{callback},
1227+ lock{lock},
1228+ unlock{unlock},
1229 parent{parent}
1230 {
1231 }
1232@@ -36,7 +41,9 @@
1233
1234 void mtd::MockFrameDroppingPolicy::trigger()
1235 {
1236+ lock();
1237 callback();
1238+ unlock();
1239 }
1240
1241 void mtd::MockFrameDroppingPolicy::parent_destroyed()
1242@@ -45,9 +52,10 @@
1243 }
1244
1245 std::unique_ptr<mc::FrameDroppingPolicy>
1246-mtd::MockFrameDroppingPolicyFactory::create_policy(std::function<void(void)> drop_frame) const
1247+mtd::MockFrameDroppingPolicyFactory::create_policy(std::function<void()> const& drop_frame,
1248+ std::function<void()> const& lock, std::function<void()> const& unlock) const
1249 {
1250- auto policy = new ::testing::NiceMock<MockFrameDroppingPolicy>{drop_frame, this};
1251+ auto policy = new ::testing::NiceMock<MockFrameDroppingPolicy>{drop_frame, lock, unlock, this};
1252 policies.insert(policy);
1253 return std::unique_ptr<mc::FrameDroppingPolicy>{policy};
1254 }
1255
1256=== modified file 'tests/mir_test_doubles/mock_timer.cpp'
1257--- tests/mir_test_doubles/mock_timer.cpp 2015-01-21 07:34:50 +0000
1258+++ tests/mir_test_doubles/mock_timer.cpp 2015-02-23 20:59:44 +0000
1259@@ -1,5 +1,5 @@
1260 /*
1261- * Copyright © 2014 Canonical Ltd.
1262+ * Copyright © 2014-2015 Canonical Ltd.
1263 *
1264 * This program is free software: you can redistribute it and/or modify it
1265 * under the terms of the GNU General Public License version 3,
1266@@ -14,6 +14,7 @@
1267 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1268 *
1269 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
1270+ * Alberto Aguirre <alberto.aguirre@canonical.com>
1271 */
1272
1273 #include "mir_test_doubles/mock_timer.h"
1274@@ -27,7 +28,10 @@
1275 class FakeAlarm : public mir::time::Alarm
1276 {
1277 public:
1278- FakeAlarm(std::function<void(void)> callback, std::shared_ptr<mt::FakeClock> const& clock);
1279+ FakeAlarm(std::function<void()> const& callback,
1280+ std::function<void()> const& lock,
1281+ std::function<void()> const& unlock,
1282+ std::shared_ptr<mt::FakeClock> const& clock);
1283 ~FakeAlarm() override;
1284
1285
1286@@ -39,9 +43,13 @@
1287 private:
1288 struct InternalState
1289 {
1290- explicit InternalState(std::function<void(void)> callback);
1291+ explicit InternalState(std::function<void()> const& callback,
1292+ std::function<void()> const& lock,
1293+ std::function<void()> const& unlock);
1294 State state;
1295- std::function<void(void)> const callback;
1296+ std::function<void()> const callback;
1297+ std::function<void()> const lock;
1298+ std::function<void()> const unlock;
1299 mt::FakeClock::time_point threshold;
1300 };
1301
1302@@ -51,13 +59,20 @@
1303 std::shared_ptr<mt::FakeClock> const clock;
1304 };
1305
1306-FakeAlarm::InternalState::InternalState(std::function<void(void)> callback)
1307- : state{mir::time::Alarm::pending}, callback{callback}
1308+FakeAlarm::InternalState::InternalState(
1309+ std::function<void()> const& callback,
1310+ std::function<void()> const& lock,
1311+ std::function<void()> const& unlock)
1312+ : state{mir::time::Alarm::pending}, callback{callback}, lock{lock}, unlock{unlock}
1313 {
1314 }
1315
1316-FakeAlarm::FakeAlarm(std::function<void(void)> callback, std::shared_ptr<mt::FakeClock> const& clock)
1317- : internal_state{std::make_shared<InternalState>(callback)}, clock{clock}
1318+FakeAlarm::FakeAlarm(
1319+ std::function<void()> const& callback,
1320+ std::function<void()> const& lock,
1321+ std::function<void()> const& unlock,
1322+ std::shared_ptr<mt::FakeClock> const& clock)
1323+ : internal_state{std::make_shared<InternalState>(callback, lock, unlock)}, clock{clock}
1324 {
1325 }
1326
1327@@ -88,7 +103,9 @@
1328 if (now > state.threshold)
1329 {
1330 state.state = triggered;
1331+ state.lock();
1332 state.callback();
1333+ state.unlock();
1334 return false;
1335 }
1336 return true;
1337@@ -128,22 +145,28 @@
1338 }
1339
1340 std::unique_ptr<mir::time::Alarm> mtd::FakeTimer::notify_in(std::chrono::milliseconds delay,
1341- std::function<void(void)> callback)
1342+ std::function<void()> const& callback)
1343 {
1344- auto alarm = std::unique_ptr<mir::time::Alarm>{new FakeAlarm{callback, clock}};
1345+ auto alarm = std::unique_ptr<mir::time::Alarm>{new FakeAlarm{callback, []{}, []{}, clock}};
1346 alarm->reschedule_in(delay);
1347 return std::move(alarm);
1348 }
1349
1350 std::unique_ptr<mir::time::Alarm> mtd::FakeTimer::notify_at(time::Timestamp time_point,
1351- std::function<void(void)> callback)
1352+ std::function<void()> const& callback)
1353 {
1354- auto alarm = std::unique_ptr<mir::time::Alarm>{new FakeAlarm{callback, clock}};
1355+ auto alarm = std::unique_ptr<mir::time::Alarm>{new FakeAlarm{callback, []{}, []{}, clock}};
1356 alarm->reschedule_for(time_point);
1357 return std::move(alarm);
1358 }
1359
1360-std::unique_ptr<mir::time::Alarm> mir::test::doubles::FakeTimer::create_alarm(std::function<void(void)> callback)
1361-{
1362- return std::unique_ptr<mir::time::Alarm>{new FakeAlarm{callback, clock}};
1363+std::unique_ptr<mir::time::Alarm> mir::test::doubles::FakeTimer::create_alarm(std::function<void()> const& callback)
1364+{
1365+ return std::unique_ptr<mir::time::Alarm>{new FakeAlarm{callback, []{}, []{}, clock}};
1366+}
1367+
1368+std::unique_ptr<mir::time::Alarm> mir::test::doubles::FakeTimer::create_alarm(std::function<void()> const& callback,
1369+ std::function<void()> const& lock, std::function<void()> const& unlock)
1370+{
1371+ return std::unique_ptr<mir::time::Alarm>{new FakeAlarm{callback, lock, unlock, clock}};
1372 }
1373
1374=== modified file 'tests/mir_test_doubles/triggered_main_loop.cpp'
1375--- tests/mir_test_doubles/triggered_main_loop.cpp 2015-01-27 11:47:52 +0000
1376+++ tests/mir_test_doubles/triggered_main_loop.cpp 2015-02-23 20:59:44 +0000
1377@@ -85,8 +85,9 @@
1378 action();
1379 }
1380
1381-std::unique_ptr<mir::time::Alarm> mtd::TriggeredMainLoop::notify_in(std::chrono::milliseconds delay,
1382- callback call)
1383+std::unique_ptr<mir::time::Alarm>
1384+mtd::TriggeredMainLoop::notify_in(std::chrono::milliseconds delay,
1385+ callback const& call)
1386 {
1387 base::notify_in(delay, call);
1388 timeout_callbacks.push_back(call);
1389
1390=== modified file 'tests/mir_test_framework/CMakeLists.txt'
1391--- tests/mir_test_framework/CMakeLists.txt 2015-01-27 03:02:22 +0000
1392+++ tests/mir_test_framework/CMakeLists.txt 2015-02-23 20:59:44 +0000
1393@@ -14,6 +14,8 @@
1394 add_definitions(
1395 -DMIR_CLIENT_PLATFORM_PATH="${MIR_CLIENT_PLATFORM_PATH}"
1396 -DMIR_SERVER_PLATFORM_PATH="${MIR_SERVER_PLATFORM_PATH}"
1397+ -DMIR_CLIENT_PLATFORM_ABI_STRING="${MIR_CLIENT_PLATFORM_ABI}"
1398+ -DMIR_SERVER_GRAPHICS_PLATFORM_ABI_STRING="${MIR_SERVER_GRAPHICS_PLATFORM_ABI}"
1399 )
1400
1401 set(
1402
1403=== modified file 'tests/mir_test_framework/executable_path.cpp'
1404--- tests/mir_test_framework/executable_path.cpp 2015-01-27 03:02:22 +0000
1405+++ tests/mir_test_framework/executable_path.cpp 2015-02-23 20:59:44 +0000
1406@@ -47,10 +47,15 @@
1407
1408 std::string mir_test_framework::server_platform(std::string const& name)
1409 {
1410+ std::string libname{name};
1411+
1412+ if (libname.find(".so") == std::string::npos)
1413+ libname += ".so." MIR_SERVER_GRAPHICS_PLATFORM_ABI_STRING;
1414+
1415 for (auto const& option :
1416 {library_path() + "/server-modules/", library_path() + "/server-platform/", std::string(MIR_SERVER_PLATFORM_PATH) + '/'})
1417 {
1418- auto path_to_test = option + name;
1419+ auto path_to_test = option + libname;
1420 if (boost::filesystem::exists(path_to_test))
1421 return path_to_test;
1422 }
1423@@ -60,10 +65,15 @@
1424
1425 std::string mir_test_framework::client_platform(std::string const& name)
1426 {
1427+ std::string libname{name};
1428+
1429+ if (libname.find(".so") == std::string::npos)
1430+ libname += ".so." MIR_CLIENT_PLATFORM_ABI_STRING;
1431+
1432 for (auto const& option :
1433 {library_path() + "/client-modules/", library_path() + "/client-platform/", std::string(MIR_CLIENT_PLATFORM_PATH) + '/'})
1434 {
1435- auto path_to_test = option + name;
1436+ auto path_to_test = option + libname;
1437 if (boost::filesystem::exists(path_to_test))
1438 return path_to_test;
1439 }
1440
1441=== modified file 'tests/unit-tests/client/test_client_platform.cpp'
1442--- tests/unit-tests/client/test_client_platform.cpp 2015-02-02 12:18:18 +0000
1443+++ tests/unit-tests/client/test_client_platform.cpp 2015-02-23 20:59:44 +0000
1444@@ -79,7 +79,7 @@
1445 };
1446
1447 #ifdef MIR_BUILD_PLATFORM_ANDROID
1448-ClientPlatformTraits const android_platform{"android.so",
1449+ClientPlatformTraits const android_platform{"android",
1450 [](MirPlatformPackage& pkg)
1451 {
1452 ::memset(&pkg, 0, sizeof(pkg));
1453@@ -94,7 +94,7 @@
1454 #endif
1455
1456 #ifdef MIR_BUILD_PLATFORM_MESA
1457-ClientPlatformTraits const mesa_platform{"mesa.so",
1458+ClientPlatformTraits const mesa_platform{"mesa",
1459 [](MirPlatformPackage& pkg)
1460 {
1461 ::memset(&pkg, 0, sizeof(pkg));
1462
1463=== modified file 'tests/unit-tests/client/test_probing_client_platform_factory.cpp'
1464--- tests/unit-tests/client/test_probing_client_platform_factory.cpp 2015-02-02 12:18:18 +0000
1465+++ tests/unit-tests/client/test_probing_client_platform_factory.cpp 2015-02-23 20:59:44 +0000
1466@@ -36,10 +36,10 @@
1467 {
1468 std::vector<std::shared_ptr<mir::SharedLibrary>> modules;
1469 #ifdef MIR_BUILD_PLATFORM_MESA
1470- modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::client_platform("mesa.so")));
1471+ modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::client_platform("mesa")));
1472 #endif
1473 #ifdef MIR_BUILD_PLATFORM_ANDROID
1474- modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::client_platform("android.so")));
1475+ modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::client_platform("android")));
1476 #endif
1477 return modules;
1478 }
1479
1480=== modified file 'tests/unit-tests/compositor/test_buffer_queue.cpp'
1481--- tests/unit-tests/compositor/test_buffer_queue.cpp 2015-01-22 09:12:04 +0000
1482+++ tests/unit-tests/compositor/test_buffer_queue.cpp 2015-02-23 20:59:44 +0000
1483@@ -1,5 +1,5 @@
1484 /*
1485- * Copyright © 2013-2014 Canonical Ltd.
1486+ * Copyright © 2013-2015 Canonical Ltd.
1487 *
1488 * This program is free software: you can redistribute it and/or modify
1489 * it under the terms of the GNU General Public License version 3 as
1490@@ -1687,3 +1687,12 @@
1491 auto comp2 = q.compositor_acquire(new_compositor_id);
1492 ASSERT_THAT(comp2->id(), Eq(handle2->id()));
1493 }
1494+
1495+TEST_F(BufferQueueTest, creates_policy_with_lock_unlock_functions)
1496+{
1497+ int const nbuffers = 3;
1498+
1499+ mtd::FrameDroppingPolicyFactoryMock mock_policy_factory;
1500+ EXPECT_CALL(mock_policy_factory, create_policy(_, _, _));
1501+ mc::BufferQueue q(nbuffers, allocator, basic_properties, mock_policy_factory);
1502+}
1503
1504=== modified file 'tests/unit-tests/compositor/test_timeout_frame_dropping_policy.cpp'
1505--- tests/unit-tests/compositor/test_timeout_frame_dropping_policy.cpp 2014-05-22 20:48:20 +0000
1506+++ tests/unit-tests/compositor/test_timeout_frame_dropping_policy.cpp 2015-02-23 20:59:44 +0000
1507@@ -1,5 +1,5 @@
1508 /*
1509- * Copyright © 2014 Canonical Ltd.
1510+ * Copyright © 2014-2015 Canonical Ltd.
1511 *
1512 * This program is free software: you can redistribute it and/or modify it
1513 * under the terms of the GNU General Public License version 3,
1514@@ -14,16 +14,18 @@
1515 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1516 *
1517 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
1518+ * Alberto Aguirre <alberto.aguirre@canonical.com>
1519 */
1520
1521 #include "src/server/compositor/timeout_frame_dropping_policy_factory.h"
1522 #include "mir/compositor/frame_dropping_policy.h"
1523
1524 #include "mir_test_doubles/mock_timer.h"
1525-
1526+#include "mir_test/auto_unblock_thread.h"
1527 #include "mir_test/gmock_fixes.h"
1528
1529 #include <stdexcept>
1530+#include <mutex>
1531
1532 #include <gtest/gtest.h>
1533 #include <gmock/gmock.h>
1534@@ -40,7 +42,7 @@
1535 bool frame_dropped{false};
1536
1537 mc::TimeoutFrameDroppingPolicyFactory factory{timer, timeout};
1538- auto policy = factory.create_policy([&frame_dropped]{ frame_dropped = true; });
1539+ auto policy = factory.create_policy([&frame_dropped]{ frame_dropped = true; }, []{}, []{});
1540
1541 clock->advance_time(timeout + std::chrono::milliseconds{1});
1542 EXPECT_FALSE(frame_dropped);
1543@@ -54,7 +56,7 @@
1544 bool frame_dropped{false};
1545
1546 mc::TimeoutFrameDroppingPolicyFactory factory{timer, timeout};
1547- auto policy = factory.create_policy([&frame_dropped]{ frame_dropped = true; });
1548+ auto policy = factory.create_policy([&frame_dropped]{ frame_dropped = true; }, []{}, []{});
1549 policy->swap_now_blocking();
1550
1551 clock->advance_time(timeout - std::chrono::milliseconds{1});
1552@@ -71,7 +73,7 @@
1553
1554 bool frame_dropped{false};
1555 mc::TimeoutFrameDroppingPolicyFactory factory{timer, timeout};
1556- auto policy = factory.create_policy([&frame_dropped]{ frame_dropped = true; });
1557+ auto policy = factory.create_policy([&frame_dropped]{ frame_dropped = true; }, []{}, []{});
1558
1559 policy->swap_now_blocking();
1560 policy->swap_unblocked();
1561@@ -89,7 +91,7 @@
1562
1563 bool frame_dropped{false};
1564 mc::TimeoutFrameDroppingPolicyFactory factory{timer, timeout};
1565- auto policy = factory.create_policy([&frame_dropped]{ frame_dropped = true; });
1566+ auto policy = factory.create_policy([&frame_dropped]{ frame_dropped = true; }, []{}, []{});
1567
1568 policy->swap_now_blocking();
1569 policy->swap_now_blocking();
1570@@ -119,7 +121,7 @@
1571
1572 bool frame_dropped{false};
1573 mc::TimeoutFrameDroppingPolicyFactory factory{timer, timeout};
1574- auto policy = factory.create_policy([&frame_dropped]{ frame_dropped = true; });
1575+ auto policy = factory.create_policy([&frame_dropped]{ frame_dropped = true; }, []{}, []{});
1576
1577 policy->swap_now_blocking();
1578 policy->swap_now_blocking();
1579@@ -142,7 +144,7 @@
1580
1581 bool frame_dropped{false};
1582 mc::TimeoutFrameDroppingPolicyFactory factory{timer, timeout};
1583- auto policy = factory.create_policy([&frame_dropped]{ frame_dropped = true; });
1584+ auto policy = factory.create_policy([&frame_dropped]{ frame_dropped = true; }, []{}, []{});
1585
1586 policy->swap_now_blocking();
1587 clock->advance_time(timeout - std::chrono::milliseconds{1});
1588@@ -160,7 +162,7 @@
1589
1590 bool frame_dropped{false};
1591 mc::TimeoutFrameDroppingPolicyFactory factory{timer, timeout};
1592- auto policy = factory.create_policy([&frame_dropped]{ frame_dropped = true; });
1593+ auto policy = factory.create_policy([&frame_dropped]{ frame_dropped = true; }, []{}, []{});
1594
1595 policy->swap_now_blocking();
1596 policy->swap_now_blocking();
1597@@ -184,3 +186,28 @@
1598 clock->advance_time(timeout + std::chrono::milliseconds{1});
1599 EXPECT_FALSE(frame_dropped);
1600 }
1601+
1602+TEST(TimeoutFrameDroppingPolicy, policy_calls_lock_unlock_functions)
1603+{
1604+ using namespace testing;
1605+
1606+ auto clock = std::make_shared<mt::FakeClock>();
1607+ auto timer = std::make_shared<mtd::FakeTimer>(clock);
1608+ std::chrono::milliseconds const timeout{1000};
1609+
1610+ mc::TimeoutFrameDroppingPolicyFactory factory{timer, timeout};
1611+
1612+ std::mutex m;
1613+ std::unique_lock<std::mutex> handler_guard{m, std::defer_lock};
1614+
1615+ auto policy = factory.create_policy([&]
1616+ {
1617+ EXPECT_THAT(handler_guard.owns_lock(), Eq(true));
1618+ },
1619+ [&] { handler_guard.lock(); },
1620+ [&] { handler_guard.unlock(); });
1621+
1622+
1623+ policy->swap_now_blocking();
1624+ clock->advance_time(timeout + std::chrono::milliseconds{1});
1625+}
1626
1627=== modified file 'tests/unit-tests/graphics/android/test_platform.cpp'
1628--- tests/unit-tests/graphics/android/test_platform.cpp 2015-01-27 03:02:22 +0000
1629+++ tests/unit-tests/graphics/android/test_platform.cpp 2015-02-23 20:59:44 +0000
1630@@ -239,7 +239,7 @@
1631
1632 ON_CALL(hwaccess, hw_get_module(_,_)).WillByDefault(Return(-1));
1633
1634- mir::SharedLibrary platform_lib{mtf::server_platform("graphics-android.so")};
1635+ mir::SharedLibrary platform_lib{mtf::server_platform("graphics-android")};
1636 auto probe = platform_lib.load_function<mg::PlatformProbe>(probe_platform);
1637 EXPECT_EQ(mg::PlatformPriority::unsupported, probe());
1638 }
1639@@ -248,7 +248,7 @@
1640 {
1641 testing::NiceMock<mtd::HardwareAccessMock> hwaccess;
1642
1643- mir::SharedLibrary platform_lib{mtf::server_platform("graphics-android.so")};
1644+ mir::SharedLibrary platform_lib{mtf::server_platform("graphics-android")};
1645 auto probe = platform_lib.load_function<mg::PlatformProbe>(probe_platform);
1646 EXPECT_EQ(mg::PlatformPriority::best, probe());
1647 }
1648
1649=== modified file 'tests/unit-tests/graphics/mesa/test_platform.cpp'
1650--- tests/unit-tests/graphics/mesa/test_platform.cpp 2015-02-02 12:18:18 +0000
1651+++ tests/unit-tests/graphics/mesa/test_platform.cpp 2015-02-23 20:59:44 +0000
1652@@ -304,7 +304,7 @@
1653 {
1654 mtf::UdevEnvironment udev_environment;
1655
1656- mir::SharedLibrary platform_lib{mtf::server_platform("graphics-mesa.so")};
1657+ mir::SharedLibrary platform_lib{mtf::server_platform("graphics-mesa")};
1658 auto probe = platform_lib.load_function<mg::PlatformProbe>(probe_platform);
1659 EXPECT_EQ(mg::PlatformPriority::unsupported, probe());
1660 }
1661@@ -315,7 +315,7 @@
1662
1663 udev_environment.add_standard_device("standard-drm-devices");
1664
1665- mir::SharedLibrary platform_lib{mtf::server_platform("graphics-mesa.so")};
1666+ mir::SharedLibrary platform_lib{mtf::server_platform("graphics-mesa")};
1667 auto probe = platform_lib.load_function<mg::PlatformProbe>(probe_platform);
1668 EXPECT_EQ(mg::PlatformPriority::best, probe());
1669 }
1670
1671=== modified file 'tests/unit-tests/graphics/test_platform_prober.cpp'
1672--- tests/unit-tests/graphics/test_platform_prober.cpp 2014-12-17 19:59:21 +0000
1673+++ tests/unit-tests/graphics/test_platform_prober.cpp 2015-02-23 20:59:44 +0000
1674@@ -47,10 +47,10 @@
1675 std::vector<std::shared_ptr<mir::SharedLibrary>> modules;
1676
1677 #ifdef MIR_BUILD_PLATFORM_MESA
1678- modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::server_platform("graphics-mesa.so")));
1679+ modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::server_platform("graphics-mesa")));
1680 #endif
1681 #ifdef MIR_BUILD_PLATFORM_ANDROID
1682- modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::server_platform("graphics-android.so")));
1683+ modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::server_platform("graphics-android")));
1684 #endif
1685 return modules;
1686 }
1687
1688=== modified file 'tests/unit-tests/shared_library_test.cpp'
1689--- tests/unit-tests/shared_library_test.cpp 2015-01-27 03:02:22 +0000
1690+++ tests/unit-tests/shared_library_test.cpp 2015-02-23 20:59:44 +0000
1691@@ -59,7 +59,7 @@
1692 public:
1693 SharedLibrary()
1694 : nonexistent_library{"imma_totally_not_a_library"},
1695- existing_library{mtf::client_platform("mesa.so")},
1696+ existing_library{mtf::client_platform("dummy.so")},
1697 nonexistent_function{"yo_dawg"},
1698 existing_function{"create_client_platform"},
1699 existent_version{"MIR_CLIENT_PLATFORM_2"},
1700
1701=== added file 'tests/unit-tests/test_data/libinvalid.so.3'
1702=== modified file 'tests/unit-tests/test_glib_main_loop.cpp'
1703--- tests/unit-tests/test_glib_main_loop.cpp 2015-02-03 15:07:44 +0000
1704+++ tests/unit-tests/test_glib_main_loop.cpp 2015-02-23 20:59:44 +0000
1705@@ -1,5 +1,5 @@
1706 /*
1707- * Copyright © 2014 Canonical Ltd.
1708+ * Copyright © 2014-2015 Canonical Ltd.
1709 *
1710 * This program is free software: you can redistribute it and/or modify
1711 * it under the terms of the GNU General Public License version 3 as
1712@@ -14,6 +14,7 @@
1713 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1714 *
1715 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
1716+ * Alberto Aguirre <alberto.aguirre@canonical.com>
1717 */
1718
1719 #include "mir/glib_main_loop.h"
1720@@ -960,43 +961,45 @@
1721 }
1722
1723 TEST_F(GLibMainLoopAlarmTest, alarm_callback_cannot_deadlock)
1724-{ // Regression test for deadlock bug LP: #1339700
1725- std::timed_mutex m;
1726- std::atomic_bool failed(false);
1727+{
1728+ using namespace testing;
1729+
1730+ std::mutex m;
1731+ std::unique_lock<std::mutex> handler_guard{m, std::defer_lock};
1732+ std::atomic_bool exit{false};
1733 int i = 0;
1734 int const loops = 5;
1735
1736- auto alarm = ml.notify_in(std::chrono::milliseconds{0}, [&]()
1737+ auto alarm = ml.create_alarm([&]()
1738 {
1739- // From this angle, ensure we can lock m (alarm should be unlocked)
1740- failed = !m.try_lock_for(std::chrono::seconds{5});
1741- ASSERT_FALSE(failed);
1742+ //In this handler context, the alarm dispatcher should have
1743+ //acquired the handler guard
1744+ EXPECT_THAT(handler_guard.owns_lock(), Eq(true));
1745 ++i;
1746- m.unlock();
1747+ },
1748+ [&] { handler_guard.lock(); },
1749+ [&] { handler_guard.unlock(); });
1750+
1751+ mt::AutoUnblockThread t([&]{ exit = true; }, [&]()
1752+ {
1753+ std::unique_lock<std::mutex> guard{m};
1754+ while (i < loops && !exit)
1755+ {
1756+ // It's safe to call cancel now because lock ordering is enforced
1757+ // by passing the lock/unlock lambdas to alarm above
1758+ alarm->cancel();
1759+ guard.unlock();
1760+ std::this_thread::yield();
1761+ guard.lock();
1762+ }
1763 });
1764
1765- std::thread t([&]()
1766- {
1767- m.lock();
1768- while (i < loops && !failed)
1769- {
1770- // From this angle, ensure we can lock alarm while holding m
1771- (void)alarm->state();
1772- m.unlock();
1773- std::this_thread::yield();
1774- m.lock();
1775- }
1776- m.unlock();
1777- });
1778-
1779 UnblockMainLoop unblocker(ml);
1780 for (int j = 0; j < loops; ++j)
1781 {
1782+ alarm->reschedule_in(std::chrono::milliseconds{10});
1783 clock->advance_by(std::chrono::milliseconds{11}, ml);
1784- alarm->reschedule_in(std::chrono::milliseconds{10});
1785 }
1786-
1787- t.join();
1788 }
1789
1790 TEST_F(GLibMainLoopAlarmTest, alarm_fires_at_correct_time_point)
1791
1792=== modified file 'tests/unit-tests/test_raii.cpp'
1793--- tests/unit-tests/test_raii.cpp 2013-10-21 14:21:00 +0000
1794+++ tests/unit-tests/test_raii.cpp 2015-02-23 20:59:44 +0000
1795@@ -179,3 +179,23 @@
1796
1797 EXPECT_EQ(this, raii.get());
1798 }
1799+
1800+TEST_F(RaiiTest, paired_call_takes_std_function_refs)
1801+{
1802+ int creator_call_count = 0;
1803+ int deleter_call_count = 0;
1804+ int const expected_calls = 2;
1805+
1806+ std::function<void()> creator = [&creator_call_count] { creator_call_count++; };
1807+ std::function<void()> deleter = [&deleter_call_count] { deleter_call_count++; };
1808+
1809+ for (int i = 0; i < expected_calls; i++)
1810+ {
1811+ auto const raii = mir::raii::paired_calls(
1812+ std::ref(creator),
1813+ std::ref(deleter));
1814+ }
1815+
1816+ EXPECT_THAT(creator_call_count, Eq(expected_calls));
1817+ EXPECT_THAT(deleter_call_count, Eq(expected_calls));
1818+}
1819
1820=== modified file 'tests/unit-tests/test_shared_library_prober.cpp'
1821--- tests/unit-tests/test_shared_library_prober.cpp 2015-01-21 07:34:50 +0000
1822+++ tests/unit-tests/test_shared_library_prober.cpp 2015-02-23 20:59:44 +0000
1823@@ -162,6 +162,7 @@
1824 EXPECT_CALL(report, loading_library(FilenameMatches("libarmhf.so")));
1825 EXPECT_CALL(report, loading_library(FilenameMatches("libi386.so")));
1826 EXPECT_CALL(report, loading_library(FilenameMatches("libarm64.so")));
1827+ EXPECT_CALL(report, loading_library(FilenameMatches("libinvalid.so.3")));
1828
1829 mir::libraries_for_path(library_path, report);
1830 }
1831@@ -175,6 +176,7 @@
1832 bool amd64_failed{false};
1833 bool i386_failed{false};
1834 bool arm64_failed{false};
1835+ bool invalid_failed{false};
1836
1837 ON_CALL(report, loading_failed(FilenameMatches("libamd64.so"), _))
1838 .WillByDefault(InvokeWithoutArgs([&amd64_failed]() { amd64_failed = true; }));
1839@@ -184,8 +186,11 @@
1840 .WillByDefault(InvokeWithoutArgs([&i386_failed]() { i386_failed = true; }));
1841 ON_CALL(report, loading_failed(FilenameMatches("libarm64.so"), _))
1842 .WillByDefault(InvokeWithoutArgs([&arm64_failed]() { arm64_failed = true; }));
1843+ ON_CALL(report, loading_failed(FilenameMatches("libinvalid.so.3"), _))
1844+ .WillByDefault(InvokeWithoutArgs([&invalid_failed]() { invalid_failed = true; }));
1845
1846 mir::libraries_for_path(library_path, report);
1847
1848+ EXPECT_TRUE(invalid_failed);
1849 EXPECT_TRUE(i386_failed || amd64_failed || armhf_failed || arm64_failed);
1850 }

Subscribers

People subscribed via source and target branches

to all changes: