Merge lp:~mir-team/mir/add-dispatchable-interface into lp:mir
| Status: | Merged |
|---|---|
| Approved by: | Chris Halse Rogers on 2015-01-28 |
| Approved revision: | 2279 |
| Merged at revision: | 2269 |
| Proposed branch: | lp:~mir-team/mir/add-dispatchable-interface |
| Merge into: | lp:mir |
| Diff against target: |
2044 lines (+1169/-266) 33 files modified
common-ABI-sha1sums (+2/-0) include/common/mir/dispatch/dispatchable.h (+78/-0) include/common/mir/dispatch/simple_dispatch_thread.h (+48/-0) platform-ABI-sha1sums (+2/-0) server-ABI-sha1sums (+2/-0) src/client/mir_connection.cpp (+5/-1) src/client/mir_connection.h (+7/-0) src/client/rpc/mir_protobuf_rpc_channel.cpp (+16/-0) src/client/rpc/mir_protobuf_rpc_channel.h (+9/-1) src/client/rpc/stream_socket_transport.cpp (+30/-111) src/client/rpc/stream_socket_transport.h (+3/-4) src/client/rpc/stream_transport.h (+4/-5) src/common/CMakeLists.txt (+2/-0) src/common/dispatch/CMakeLists.txt (+22/-0) src/common/dispatch/simple_dispatch_thread.cpp (+158/-0) src/common/symbols.map (+6/-2) tests/CMakeLists.txt (+1/-0) tests/include/mir_test/fd_utils.h (+69/-0) tests/include/mir_test/pipe.h (+8/-4) tests/include/mir_test/test_dispatchable.h (+60/-0) tests/include/mir_test/test_protobuf_client.h (+5/-0) tests/integration-tests/client/test_screencast.cpp (+7/-0) tests/mir_test/CMakeLists.txt (+2/-0) tests/mir_test/fd_utils.cpp (+40/-0) tests/mir_test/pipe.cpp (+21/-18) tests/mir_test/test_dispatchable.cpp (+98/-0) tests/mir_test_doubles/test_protobuf_client.cpp (+6/-1) tests/unit-tests/CMakeLists.txt (+1/-0) tests/unit-tests/client/test_mir_connection.cpp (+13/-1) tests/unit-tests/client/test_protobuf_rpc_channel.cpp (+4/-0) tests/unit-tests/client/test_stream_transport.cpp (+250/-118) tests/unit-tests/dispatch/CMakeLists.txt (+5/-0) tests/unit-tests/dispatch/test_simple_dispatch_thread.cpp (+185/-0) |
| To merge this branch: | bzr merge lp:~mir-team/mir/add-dispatchable-interface |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| PS Jenkins bot | continuous-integration | Approve on 2015-01-28 | |
| Daniel van Vugt | Abstain on 2015-01-23 | ||
| Robert Carr (community) | Approve on 2015-01-21 | ||
| Andreas Pokorny (community) | Needs Information on 2015-01-21 | ||
| Alexandros Frantzis (community) | 2015-01-14 | Approve on 2015-01-21 | |
| Cemil Azizoglu (community) | Approve on 2015-01-15 | ||
|
Review via email:
|
|||
Commit Message
Add a Dispatchable interface, and transition StreamSocketTra
(LP: #1397375)
The Dispatchable interface is useful for anything that can provide a monitorable file descriptor.
Description of the Change
A rough guide for the reviewer:
This whole enchilada is necessary because we want to expose a fd based wait/dispatch event model to clients: https:/
In turn, this means that all event generators in the client library need to provide some mechanism we can aggregate into the client dispatch fd; epoll is a very nice interface for this, so in the end the event generators will provide an fd that the client library can add to an epoll fd and pass that epoll fd out to the client to wait on.
The meat of this MP is the mir::dispatch:
SimpleDispatchT
The next step in this series is to turn the AndroidInputDis
- 2218. By Daniel van Vugt on 2015-01-14
-
mesa::DisplayBu
ffer: Schedule page flips in a double buffered pattern
instead of triple when it's safe to do so (not clone mode). This
noticeably reduces visible lag. (LP: #1350725)Clone mode still needs triple buffering because you can't tell two or
more separate monitors to vblank at the same time. You just have to
accept that waiting for multiple vblanks will often take an extra
frame's time.The more common cases of single or separate outputs however only need
to deal with one vsync signal per frame so can be optimized into
double buffering. And this feels significantly less laggy when dragging
windows around.This is an improvement on the present behaviour introduced in r1380. Fixes: https:/
/bugs.launchpad .net/bugs/ 1274408, https:/ /bugs.launchpad .net/bugs/ 1350725. Approved by PS Jenkins bot, Robert Carr, Alexandros Frantzis, Alan Griffiths.
- 2219. By Alberto Aguirre on 2015-01-14
-
Add API to specify client menu surfaces (LP: #1324101). Fixes: https:/
/bugs.launchpad .net/bugs/ 1324101. Approved by Chris Halse Rogers, PS Jenkins bot, Alan Griffiths, Robert Carr, Cemil Azizoglu.
| PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2241
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
| PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2242
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 2220. By Daniel van Vugt on 2015-01-14
-
Add close/quit message support to some examples, and invoke it from the
demo shell via Alt+F4.
.Approved by PS Jenkins bot, Alan Griffiths, Robert Carr.
| PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2243
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 2221. By Daniel van Vugt on 2015-01-14
-
Hello Mir 0.11.
Series 0.10 was released almost a week ago already.Approved by Alan Griffiths, PS Jenkins bot.
| Alexandros Frantzis (afrantzis) wrote : | # |
A first pass...
This MP introduces another event loop implementation. We are already using the GLib event loop API in the server, perhaps we should also do so in the client. I guess the counter-argument is that we don't want to impose extra dependencies on the client. I am OK with having this custom implementation as long as it doesn't get too complex (in which case we can switch to GLib or other library).
34 +enum fd_event : uint32_t {
41 +using fd_events = uint32_t;
Types should use PascalCase.
76 + virtual fd_events relevant_events() const = 0;
Just noting that this is not used at the moment. Not really an issue since its utility is evident, but still it would be good to use it in wait_for_
- 2222. By Kevin DuBois on 2015-01-14
-
android: move where the display configuration is stored from the mga::DisplayBuffer to the mga::Display, so the mga::Display can see and control the arrangement of all the monitors.
Approved by PS Jenkins bot, Alexandros Frantzis, Robert Carr, Alan Griffiths, Chris Halse Rogers.
- 2223. By Alan Griffiths on 2015-01-14
-
examples: extend the mir_demo_server's TilingWindowManager into something more functional.
Approved by Andreas Pokorny, PS Jenkins bot, Cemil Azizoglu, Alberto Aguirre, Alexandros Frantzis, Robert Carr, Kevin DuBois.
| Chris Halse Rogers (raof) wrote : | # |
Yeah, it does introduce another event loop. I think that it's sufficiently simple now that it's not really worth replacing with g_main_loop, and although subsequent MPs will extend it, I think they're extending it in ways not supported by g_main_loop anyway.
| Chris Halse Rogers (raof) wrote : | # |
(In particular, in later MPs SimpleDispatchT
- 2224. By Alan Griffiths on 2015-01-15
-
common, examples: adding mir_surface_
state_horizmaxi mized to MirSurfaceState allows simplification of TilingWindowMan ager. Approved by Alberto Aguirre, Cemil Azizoglu, PS Jenkins bot.
| PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2246
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 2225. By Alexandros Frantzis on 2015-01-15
-
server: Add a software cursor
In addition to the software cursor addition, this MP also changes the cursor controller class so that it doesn't call cursor methods under lock, since this can lead to deadlocks.
Approved by PS Jenkins bot, Cemil Azizoglu, Kevin DuBois, Robert Carr.
- 2226. By Daniel van Vugt on 2015-01-15
-
First attempts at adding custom shaders in shells. As an example, this
introduces negative (Super+N) and high contrast (Super+C) modes to the
demo shell (mir_proving_server) . (LP: #1400580) I also took the opportunity to clean up and eliminate the ugly vector
of programs approach.
. Fixes: https://bugs.launchpad .net/bugs/ 1400580. Approved by Cemil Azizoglu, PS Jenkins bot.
- 2227. By Daniel van Vugt on 2015-01-15
-
DumbConsoleLogger: Report less cryptic severity information. And if it's
just information, no need to mention that it is information (which saves
space for most messages).
.Approved by Cemil Azizoglu, PS Jenkins bot.
- 2228. By Robert Carr on 2015-01-15
-
Introduce MirPointerEvent.
Approved by Andreas Pokorny, Alan Griffiths, Cemil Azizoglu, Chris Halse Rogers, PS Jenkins bot, Kevin DuBois.
- 2229. By Robert Carr on 2015-01-15
-
Remove one set of test event matchers (all API 'clients' may use both) and port the other set to new MirEvent accessors.
Approved by PS Jenkins bot, Alan Griffiths, Alexandros Frantzis, Kevin DuBois.
| Robert Carr (robertcarr) wrote : | # |
I think some of the tests could be made easier to read without much effort.
test_simple_
Since there are no expectations you can use a StubDispatchable and clean up the test body a little. Likewise you can move at least the dispatcher and the signal and uint64_t dummy to the fixture.
test_stream_
+ // A valid fd is >= 0, and we know that stdin, stdout, and stderr aren't correct.
fnctl(fd, O_GETFD) is used elsewhere.
+ uint64_t dummy{0xdeadbeef};
Can be moved to fixture or
1084:
+ EXPECT_
Perhaps move to fixture.
1138: + std::this_
:(
1095: + auto observer = std::make_
Stub
| Robert Carr (robertcarr) wrote : | # |
I guess the needs fixing are please fix the stub v. mocks and fixtures in order to clear up test bodies. Will finish review tomorrow :)
- 2230. By Alan Griffiths on 2015-01-15
-
examples: further simplify TilingWindowMan
ager::toggle( ). Approved by Cemil Azizoglu, PS Jenkins bot.
| Cemil Azizoglu (cemil-azizoglu) wrote : | # |
Thanks for the guide, it was useful.
Some nits, otherwise all good.
63 + * Dispatch should no longer be called.
Indentation
65 + * specify in \ref event (eg: readable | remote_closed) then dispatch
you mean "specified", I think.
534 +# Copyright © 2014 Canonical Ltd.
s/2014/2015
548 +# Authored by: Robert Carr <email address hidden>
Correct attribution?
562 + * Copyright © 2014 Canonical Ltd.
s/2014/2015
| Alexandros Frantzis (afrantzis) wrote : | # |
693 + shutdown_fd = mir::Fd{
<snip>
713 + ::close(
This can lead to nasty double close bug: after the call to explicitly close the shutdown_fd, some other thread in the process may open a file and get the fd number that was just closed. When the shutdown_fd destructor is finally called the newly created file will be closed.
1709 + EXPECT_
1741 + EXPECT_
It's difficult (and often not possible) to test that an event will not occur, without waiting for some amount of time. I am a bit torn about this. On the one hand, unit tests should be super-fast. On the other hand one could argue that with the ability to run tests in parallel, small delays don't matter.
> 1095: + auto observer = std::make_
>
> Stub
+1
- 2231. By Alexandros Frantzis on 2015-01-17
-
client: Extract client platform API headers into src/include.
Approved by Kevin DuBois, PS Jenkins bot, Cemil Azizoglu, Robert Carr.
- 2232. By Daniel van Vugt on 2015-01-19
-
Add client API access to set surfaces "hidden".
Approved by PS Jenkins bot, Alberto Aguirre, Cemil Azizoglu, Alan Griffiths.
- 2233. By Kevin DuBois on 2015-01-19
-
android: make the helper class HwcLayerList more helpful by adding a common hwc list function to update the framebuffer.
Approved by PS Jenkins bot, Alexandros Frantzis, Robert Carr.
- 2234. By Alan Griffiths on 2015-01-19
-
tests: fix logging option for some acceptance and integration tests
(LP: #1408231). Fixes: https://bugs.launchpad .net/bugs/ 1408231. Approved by PS Jenkins bot, Daniel van Vugt, Kevin DuBois, Robert Carr, Cemil Azizoglu.
- 2235. By Daniel van Vugt on 2015-01-19
-
Modifier flags: Avoid casting to impossible (unnamed) enum values. That would only confuse debuggers and future maintainers.
Approved by Cemil Azizoglu, PS Jenkins bot.
- 2236. By Daniel van Vugt on 2015-01-20
-
demo-shell: Allow mouse resizing (Alt+middlebutton) to control any edge
or corner.Approved by Alexandros Frantzis, PS Jenkins bot.
- 2237. By Alan Griffiths on 2015-01-20
-
Bump server ABI.
Approved by Daniel van Vugt, PS Jenkins bot.
- 2238. By Alan Griffiths on 2015-01-20
-
shell: remove FocusSetter from public interface.
Approved by PS Jenkins bot, Alexandros Frantzis.
- 2239. By Daniel van Vugt on 2015-01-20
-
Document server ABI bump to 29.
Approved by Alan Griffiths, PS Jenkins bot.
- 2240. By Chris Halse Rogers on 2015-01-21
-
Add the start of a pollable fd interface to StreamTransport
- 2241. By Chris Halse Rogers on 2015-01-21
-
Test that watch_fd() is pollable
- 2242. By Chris Halse Rogers on 2015-01-21
-
Wire up watch_fd() to the actual epoller
- 2243. By Chris Halse Rogers on 2015-01-21
-
Add dispatch() method to StreamTransport
- 2244. By Chris Halse Rogers on 2015-01-21
-
Use mir::Fd in StreamTransport
- 2245. By Chris Halse Rogers on 2015-01-21
-
Remove superfluous ~StreamTranspor
tTest - 2246. By Chris Halse Rogers on 2015-01-21
-
Switch StreamSocketTra
nsport over to a dispatch() driven interface. Only the specific tests have been updated; at this point all client code will fail.
- 2247. By Chris Halse Rogers on 2015-01-21
-
Drop the ‘more events pending’ return value from StreamTransport
::dispatch( ). Anyone polling watch_fd() will do this with equal efficiency.
- 2248. By Chris Halse Rogers on 2015-01-21
-
Move dispatch tests to the top of the file.
These are more primitive than the observer & data read/write ones
- 2249. By Chris Halse Rogers on 2015-01-21
-
Simplify StreamSocketTra
nsport: :dispatch. We don't actually need to do all that exception-catching, particularly since
we don't do anything but eat the exceptions anyway. - 2250. By Chris Halse Rogers on 2015-01-21
-
Test that we dispatch a signle event for a single ::dispatch()
- 2251. By Chris Halse Rogers on 2015-01-21
-
Fix more docs; Observers are now called from the dispatch() thread
- 2252. By Chris Halse Rogers on 2015-01-21
-
Factor out fd_is_readable and fd_becomes_
readable. These are broadly useful; now live in mir_test
- 2253. By Chris Halse Rogers on 2015-01-21
-
Add a simple eventloop thread implementation
- 2254. By Chris Halse Rogers on 2015-01-21
-
Promote Dispatchable to a top-level namespace
- 2255. By Chris Halse Rogers on 2015-01-21
-
Move dispatch-y things to mir::dispatch namespace
- 2256. By Chris Halse Rogers on 2015-01-21
-
Also rename the SimpleRPCThread tests
- 2257. By Chris Halse Rogers on 2015-01-21
-
(Prepare to) Pass the set of events through to Dispatchable:
:dispatch. It can be useful for a Dispatchable to know why it's been dispatched.
Specifically, with this we'll be to implement StreamSocketTransport
without an additional epoll fd. - 2258. By Chris Halse Rogers on 2015-01-21
-
Make SimpleDispatchT
hread pass the relevant fd_event to its dispatchee - 2259. By Chris Halse Rogers on 2015-01-21
-
Simplify StreamSocketTra
nsport with the new dispatch(fd_events) interface. We no longer need an epoll fd simply to monitor when our socket is closed.
- 2260. By Chris Halse Rogers on 2015-01-21
-
Return false from Dispatchable:
:dispatch( ) to indicate no further events. Once the remote end has closed the connection a fd will remain in state
fd_event::remote_ closed indefinitely. Likewise, a file descriptor at EOF
will indefinitely be readable.At the same time it's unsafe to ::close the relevant fd. For a start,
there's no guarantee that someone hasn't dup()ed it, or kept a reference
to the mir::Fd that will now close some random file descriptor when it
loses scope. Even if neither of those are true, close()ing a file descriptor
when some other thread is in select(), poll(), or epoll_wait() invokes
undefined behaviour.Let the Dispatchable return false from dispatch to signal that it should
no longer be called, and punt that problem to whatever is dispatching it. - 2261. By Chris Halse Rogers on 2015-01-21
-
Reword watch_fd() comment
- 2262. By Chris Halse Rogers on 2015-01-21
-
socket_fd can be const again
- 2263. By Chris Halse Rogers on 2015-01-21
-
Consume the result of read() in SimpleDispatchT
hread tests - 2264. By Chris Halse Rogers on 2015-01-21
-
Use (and test) Dispatchable:
:relevant_ events( ) - 2265. By Chris Halse Rogers on 2015-01-21
-
Slightly better docs for Dispatchable
- 2266. By Chris Halse Rogers on 2015-01-21
-
CamelCase fd_event and fd_events
- 2267. By Chris Halse Rogers on 2015-01-21
-
Fixup test_naming_policy
- 2268. By Chris Halse Rogers on 2015-01-21
-
Move mt::fd_utils implementation out of header file
- 2269. By Chris Halse Rogers on 2015-01-21
-
Port mir::test::Pipe to mir::Fd
- 2270. By Chris Halse Rogers on 2015-01-21
-
Augment mt::Pipe to accept pipe2() flags
- 2271. By Chris Halse Rogers on 2015-01-21
-
Add a TestDispatchable to mir::test
- 2272. By Chris Halse Rogers on 2015-01-21
-
Simplify SimpleDispatchT
hread tests with mt::TestDispatc hable - 2273. By Chris Halse Rogers on 2015-01-21
-
Fix all the copyrights
| Chris Halse Rogers (raof) wrote : | # |
> 1709 +
> EXPECT_
> 1741 + EXPECT_
>
> It's difficult (and often not possible) to test that an event will not occur,
> without waiting for some amount of time. I am a bit torn about this. On the
> one hand, unit tests should be super-fast. On the other hand one could argue
> that with the ability to run tests in parallel, small delays don't matter.
Right. We do ideally want to avoid long tests, but the testsuite still takes ~5 seconds for a full run, which is close enough to instant for me.
- 2274. By Chris Halse Rogers on 2015-01-21
-
SimpleDispatchT
hread: Correctly close shutdown mir::Fd - 2275. By Chris Halse Rogers on 2015-01-21
-
Dispatchable: Doc fixup
| Chris Halse Rogers (raof) wrote : | # |
In case you're wondering about the long stream of commits Launchpad sees, that's an unfortunate artefact of git-remote-bzr; as far as I can tell I can't merge from trunk, I need to rebase on it. It shouldn't be visible in the final bzr log, and I won't use git-remote-bzr for any further branches.
| PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2275
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
| Andreas Pokorny (andreas-pokorny) wrote : | # |
side note:
+ 41 FdEvents could be made type safer with:
hmm it only lacks toggling and disabling bits..
Why is that in include/, instead of src/include?
| Robert Carr (robertcarr) wrote : | # |
I still think it maybe worth trying to clean up the tests a little anyway don't want to block this on that though....:)
| Daniel van Vugt (vanvugt) wrote : | # |
Adding to the public API:
1 === added directory 'include/
2 === added file 'include/
3 --- include/
4 +++ include/
also means we need to update the sha1sums.
| Chris Halse Rogers (raof) wrote : | # |
@Andreas: I've looked at using mir::Flags<
- 2276. By Chris Halse Rogers on 2015-01-22
-
Add new public headers to SHA1sums
| PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2276
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 2277. By Chris Halse Rogers on 2015-01-27
-
Drop accidental flag.h detritus from ABI SHAsums
| PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2277
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 2278. By kevin gunn on 2015-01-27
-
resolve conflicts
- 2279. By kevin gunn on 2015-01-27
-
merge trunk and resolve conflicts
| PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2278
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
| PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2279
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://

FAILED: Continuous integration, rev:2232 /code.launchpad .net/~mir- team/mir/ add-dispatchabl e-interface/ +merge/ 246372/ +edit-commit- message
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http:// jenkins. qa.ubuntu. com/job/ mir-ci/ 2636/ jenkins. qa.ubuntu. com/job/ mir-android- vivid-i386- build/837/ console jenkins. qa.ubuntu. com/job/ mir-clang- vivid-amd64- build/837 jenkins. qa.ubuntu. com/job/ mir-mediumtests -vivid- touch/799/ console jenkins. qa.ubuntu. com/job/ mir-vivid- amd64-ci/ 633/console jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- vivid-armhf/ 799/console
Executed test runs:
FAILURE: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/mir- ci/2636/ rebuild
http://