Mir

Merge lp:~raof/mir/prebump-abi-for-lifecycle-cookie into lp:~mir-team/mir/trunk

Proposed by Chris Halse Rogers
Status: Work in progress
Proposed branch: lp:~raof/mir/prebump-abi-for-lifecycle-cookie
Merge into: lp:~mir-team/mir/trunk
Diff against target: 163 lines (+25/-12)
9 files modified
debian/control (+2/-2)
debian/libmirclient4.install (+1/-1)
include/shared/mir_toolkit/client_types.h (+2/-1)
include/shared/mir_toolkit/event.h (+4/-0)
src/client/CMakeLists.txt (+1/-1)
src/client/lifecycle_control.cpp (+3/-3)
src/client/lifecycle_control.h (+3/-2)
src/client/mir_connection.cpp (+5/-1)
tests/integration-tests/shell/test_session_lifecycle_event.cpp (+4/-1)
To merge this branch: bzr merge lp:~raof/mir/prebump-abi-for-lifecycle-cookie
Reviewer Review Type Date Requested Status
Daniel van Vugt Needs Fixing
Kevin DuBois (community) Needs Information
PS Jenkins bot (community) continuous-integration Needs Fixing
Robert Ancell Approve
Review via email: mp+184703@code.launchpad.net

Commit message

Pre-bump SONAME for future lifecycle cookie changes

Description of the change

We want to do this now, since the libmirclient3 ABI bump hasn't yet
been transitioned to, so we save work.

To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Looks good to me

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
1058. By Chris Halse Rogers

Switch from opaque pointers to uint64_t for event cookies.

It's highly likely that we'll want to reuse MirEventCookie for input event tagging
as well - for things like focus stealing prevention - and that will want to be portable
cross-process.

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

I have no idea what the context is here. But tere has to be a good reason to further increase coupling like this. Can you provide more details in the description/commit message?

review: Needs Information
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

not sure what we're planning to do with the new parameter

review: Needs Information
Revision history for this message
Chris Halse Rogers (raof) wrote :

The idea here is that sometimes clients will need to refer to a past event. They will do this with a MirEventCookie. This is generally useful - for example, we could use it in the modesetting code to verify that the configuration the client is trying to set is newer than the last hardware hotplug event, and if we tag each input event with a cookie it's useful for properly handing off focus to new surfaces/clients.

In this particular case, I'll later add a mir_connection_lifecycle_save_complete(MirConn, MirEventCookie), so that clients can tell Mir when they've finished handling the mir_lifecycle_state_may_suspend event.

I just wanted to land this while we hadn't yet transitioned to libmirclient3, to save some work.

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

Oh. If that's what a "cookie" is then I'd suggest "sequence" or "serial" are better more meaningful names. Just make "int serial" (or whatever) a required field in each Mir*Event type.

review: Needs Fixing
Revision history for this message
Chris Halse Rogers (raof) wrote :

I don't want to use serial or sequence for this; particularly, we *don't* want the case, as in X, that the sequence/serial/timestamps are trivially guessable.

‘Serial’ or ‘sequence’ imply some visible ordering that I think we should avoid.

I think that ‘cookie’ has a well-understood meaning along the lines of ‘here's an opaque token you'll want to use later’, which is the API I think we want.

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

Fair point, but "cookie" means you can't test if a>b. Only a != b. So you're saying you will never need to test if one cookie is specifically older or newer than another.

Also, the word "cookie" does not have any obvious meaning to most readers (IMHO). Hence my confusion. Even if you keep it opaque, I think a better name than "cookie" is desirable.

Revision history for this message
Chris Halse Rogers (raof) wrote :

*Client code* can't test if a > b, and I can't think of any particular reason why it would want to.

Suggestions for better naming welcome! :)

Revision history for this message
Robert Ancell (robert-ancell) wrote :

I agree we don't want ordering in the protocol, then would would have to manage wrapping around of sequence numbers etc. The server can quite easily keep a mapping of cookies to sequence if it needs it.

cookie seem acceptable to me, but other options are:
- id (though this might imply uniqueness forever)
- token

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Note we have reverted back from libmirclient3 to libmirclient2 in trunk [1] so the pressure to land this change is reduced - we should land it at the same time as we re-apply the DPMS branch.

[1] https://lists.ubuntu.com/archives/mir-devel/2013-September/000395.html

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

I like the "id" suggestion. Though arguably the word "sequence" could still represent an opaque value too. It's all about ensuring order, even if you can't compare a>b.

More importantly right now:
Text conflict in debian/control
Path conflict: debian/libmirclient2.install / debian/libmirclient4.install
Text conflict in debian/libmirclient4.install
Text conflict in src/client/CMakeLists.txt
4 conflicts encountered.

review: Needs Fixing

Unmerged revisions

1058. By Chris Halse Rogers

Switch from opaque pointers to uint64_t for event cookies.

It's highly likely that we'll want to reuse MirEventCookie for input event tagging
as well - for things like focus stealing prevention - and that will want to be portable
cross-process.

1057. By Chris Halse Rogers

Bump SONAME for ABI break

1056. By Chris Halse Rogers

Add a (as yet unset) opaque MirEventCookie to lifecycle callback.

Doing this now so that I can break the ABI while libmirclient3 still hasn't been
transitioned to

1055. By Alan Griffiths

input: Separate the code for dispatching input from that reading it.

Approved by PS Jenkins bot, Alexandros Frantzis.

1054. By Robert Carr

Add DPMS configuration API. Fixes: https://bugs.launchpad.net/bugs/1193222.

Approved by PS Jenkins bot, Alan Griffiths, Robert Ancell.

1053. By Eleni Maria Stea

graphics: Pull in Eleni's changes to get the DRM fd to init GBM from the host Mir instance.

Approved by PS Jenkins bot, Alexandros Frantzis, Kevin DuBois, Robert Ancell.

1052. By PS Jenkins bot

Releasing 0.0.10+13.10.20130904-0ubuntu1 (revision 1051 from lp:mir).

Approved by PS Jenkins bot.

1051. By Kevin DuBois

fix lp:1220441 (a test for android display ID was not updated). Fixes: https://bugs.launchpad.net/bugs/1220441.

Approved by Daniel van Vugt, PS Jenkins bot, Robert Ancell.

1050. By PS Jenkins bot

Releasing 0.0.10+13.10.20130903-0ubuntu1 (revision 1049 from lp:mir).

Approved by PS Jenkins bot.

1049. By Daniel van Vugt

SwitchingBundle: Simplify and clarify guarantees that compositor_acquire
always has a buffer to return without blocking or throwing an exception.

The trade-off is that to enforce the guarantee we need to permanently
reserve one buffer for compositing. This reduces the flexibility of
SwitchingBundle a little, such that minimum nbuffers is now 2.

This was originally requested by Alexandros, as the potential throw concerned
him. Although, it was logically guaranteed to never happen for other reasons.

The second reason for doing this is to eliminate recycling logic, which
while safe and correct, was quite confusing. So this change further proves
that that logic (now removed) is not to blame for frame ordering bugs.
.

Approved by Robert Ancell, Alan Griffiths, PS Jenkins bot.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2013-09-04 18:19:53 +0000
3+++ debian/control 2013-09-10 05:58:22 +0000
4@@ -127,7 +127,7 @@
5 .
6 Contains header files required to build Mir servers.
7
8-Package: libmirclient3
9+Package: libmirclient4
10 Section: libs
11 Architecture: i386 amd64 armhf arm64
12 Multi-Arch: same
13@@ -145,7 +145,7 @@
14 Architecture: i386 amd64 armhf arm64
15 Multi-Arch: same
16 Pre-Depends: ${misc:Pre-Depends}
17-Depends: libmirclient3 (= ${binary:Version}),
18+Depends: libmirclient4 (= ${binary:Version}),
19 libmirprotobuf-dev (= ${binary:Version}),
20 mircommon-dev (= ${binary:Version}),
21 ${misc:Depends},
22
23=== renamed file 'debian/libmirclient3.install' => 'debian/libmirclient4.install'
24--- debian/libmirclient3.install 2013-08-23 17:52:27 +0000
25+++ debian/libmirclient4.install 2013-09-10 05:58:22 +0000
26@@ -1,1 +1,1 @@
27-usr/lib/*/libmirclient.so.3
28+usr/lib/*/libmirclient.so.4
29
30=== modified file 'include/shared/mir_toolkit/client_types.h'
31--- include/shared/mir_toolkit/client_types.h 2013-09-06 03:46:37 +0000
32+++ include/shared/mir_toolkit/client_types.h 2013-09-10 05:58:22 +0000
33@@ -81,11 +81,12 @@
34 * from the running server.
35 * \param [in] connection The connection associated with the lifecycle event
36 * \param [in] cb The callback requested
37+ * \param [in] cookie The cookie associated with this event
38 * \param [in,out] context The context provided by the client
39 */
40
41 typedef void (*mir_lifecycle_event_callback)(
42- MirConnection* connection, MirLifecycleState state, void* context);
43+ MirConnection* connection, MirLifecycleState state, MirEventCookie cookie, void* context);
44
45 /**
46 * Callback called when a display config change has occurred
47
48=== modified file 'include/shared/mir_toolkit/event.h'
49--- include/shared/mir_toolkit/event.h 2013-08-28 03:41:48 +0000
50+++ include/shared/mir_toolkit/event.h 2013-09-10 05:58:22 +0000
51@@ -182,6 +182,10 @@
52 MirSurfaceEvent surface;
53 } MirEvent;
54
55+/** Opaque cookie used by clients to refer to past events */
56+typedef uint64_t MirEventCookie;
57+
58+
59 #ifdef __cplusplus
60 }
61 /**@}*/
62
63=== modified file 'src/client/CMakeLists.txt'
64--- src/client/CMakeLists.txt 2013-09-04 18:19:53 +0000
65+++ src/client/CMakeLists.txt 2013-09-10 05:58:22 +0000
66@@ -68,7 +68,7 @@
67 ${CLIENT_SOURCES}
68 )
69
70-set(MIRCLIENT_ABI 3)
71+set(MIRCLIENT_ABI 4)
72
73 set_target_properties(
74 mirclient
75
76=== modified file 'src/client/lifecycle_control.cpp'
77--- src/client/lifecycle_control.cpp 2013-08-23 12:23:47 +0000
78+++ src/client/lifecycle_control.cpp 2013-09-10 05:58:22 +0000
79@@ -23,7 +23,7 @@
80 namespace mcl = mir::client;
81
82 mcl::LifecycleControl::LifecycleControl()
83- : handle_lifecycle_event([](MirLifecycleState){})
84+ : handle_lifecycle_event([](MirLifecycleState, MirEventCookie){})
85 {
86 }
87
88@@ -31,7 +31,7 @@
89 {
90 }
91
92-void mcl::LifecycleControl::set_lifecycle_event_handler(std::function<void(MirLifecycleState)> const& fn)
93+void mcl::LifecycleControl::set_lifecycle_event_handler(std::function<void(MirLifecycleState, MirEventCookie)> const& fn)
94 {
95 std::unique_lock<std::mutex> lk(guard);
96
97@@ -42,5 +42,5 @@
98 {
99 std::unique_lock<std::mutex> lk(guard);
100
101- handle_lifecycle_event(static_cast<MirLifecycleState>(state));
102+ handle_lifecycle_event(static_cast<MirLifecycleState>(state), 0);
103 }
104
105=== modified file 'src/client/lifecycle_control.h'
106--- src/client/lifecycle_control.h 2013-08-23 12:23:47 +0000
107+++ src/client/lifecycle_control.h 2013-09-10 05:58:22 +0000
108@@ -20,6 +20,7 @@
109 #define MIR_LIFECYCLE_CONTROL_H_
110
111 #include "mir_toolkit/common.h"
112+#include "mir_toolkit/event.h"
113
114 #include <functional>
115 #include <mutex>
116@@ -34,12 +35,12 @@
117 LifecycleControl();
118 ~LifecycleControl();
119
120- void set_lifecycle_event_handler(std::function<void(MirLifecycleState)> const&);
121+ void set_lifecycle_event_handler(std::function<void(MirLifecycleState, MirEventCookie)> const&);
122 void call_lifecycle_event_handler(uint32_t state);
123
124 private:
125 std::mutex mutable guard;
126- std::function<void(MirLifecycleState)> handle_lifecycle_event;
127+ std::function<void(MirLifecycleState, MirEventCookie)> handle_lifecycle_event;
128 };
129 }
130 }
131
132=== modified file 'src/client/mir_connection.cpp'
133--- src/client/mir_connection.cpp 2013-09-06 03:46:37 +0000
134+++ src/client/mir_connection.cpp 2013-09-10 05:58:22 +0000
135@@ -371,7 +371,11 @@
136
137 void MirConnection::register_lifecycle_event_callback(mir_lifecycle_event_callback callback, void* context)
138 {
139- lifecycle_control->set_lifecycle_event_handler(std::bind(callback, this, std::placeholders::_1, context));
140+ lifecycle_control->set_lifecycle_event_handler(std::bind(callback,
141+ this,
142+ std::placeholders::_1,
143+ std::placeholders::_2,
144+ context));
145 }
146
147 void MirConnection::register_display_change_callback(mir_display_config_callback callback, void* context)
148
149=== modified file 'tests/integration-tests/shell/test_session_lifecycle_event.cpp'
150--- tests/integration-tests/shell/test_session_lifecycle_event.cpp 2013-08-23 12:59:23 +0000
151+++ tests/integration-tests/shell/test_session_lifecycle_event.cpp 2013-09-10 05:58:22 +0000
152@@ -71,7 +71,10 @@
153
154 struct ClientConfig : TestingClientConfiguration
155 {
156- static void lifecycle_callback(MirConnection* /*connection*/, MirLifecycleState state, void* context)
157+ static void lifecycle_callback(MirConnection* /*connection*/,
158+ MirLifecycleState state,
159+ MirEventCookie /*cookie*/,
160+ void* context)
161 {
162 auto config = static_cast<ClientConfig*>(context);
163 config->handler->state_changed(state);

Subscribers

People subscribed via source and target branches