Merge lp:~alan-griffiths/unity-system-compositor/debug-without-dm into lp:unity-system-compositor

Proposed by Alan Griffiths
Status: Merged
Approved by: Alan Griffiths
Approved revision: 198
Merged at revision: 215
Proposed branch: lp:~alan-griffiths/unity-system-compositor/debug-without-dm
Merge into: lp:unity-system-compositor
Diff against target: 88 lines (+50/-7)
1 file modified
src/server.cpp (+50/-7)
To merge this branch: bzr merge lp:~alan-griffiths/unity-system-compositor/debug-without-dm
Reviewer Review Type Date Requested Status
Alberto Aguirre (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Kevin DuBois (community) Approve
Review via email: mp+247815@code.launchpad.net

Commit message

debug option to startup without a display manager

Description of the change

debug option to startup without a display manager

 --debug-without-dm disables the display manager connection
 --debug-active-session-name names a session that can become active

For example:

$ sudo bin/unity-system-compositor --debug-without-dm --vt 2 --spinner bin/unity-system-compositor-spinner --arw-file

$ mir_demo_server --host-socket /tmp/mir_socket

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
Alberto Aguirre (albaguirre) wrote :

Looks useful

review: Approve
Revision history for this message
Kevin DuBois (kdub) wrote :

yes, sounds useful

review: Approve
197. By Alan Griffiths

merge lp:unity-system-compositor

198. By Alan Griffiths

Add --debug-active-session-name

Revision history for this message
Kevin DuBois (kdub) wrote :

new option seems useful to me, still lgtm

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alberto Aguirre (albaguirre) wrote :

LGTM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/server.cpp'
2--- src/server.cpp 2015-04-07 13:36:48 +0000
3+++ src/server.cpp 2015-06-03 15:59:34 +0000
4@@ -30,6 +30,7 @@
5 #include <mir/server_status_listener.h>
6 #include <mir/shell/focus_controller.h>
7 #include <mir/scene/session.h>
8+#include <mir/abnormal_exit.h>
9 #include <mir/main_loop.h>
10
11 #include <iostream>
12@@ -92,12 +93,20 @@
13
14 std::shared_ptr<msh::FocusController> const focus_controller;
15 };
16+const char* const dm_from_fd = "from-dm-fd";
17+const char* const dm_to_fd = "to-dm-fd";
18+const char* const dm_stub = "debug-without-dm";
19+const char* const dm_stub_active = "debug-active-session-name";
20 }
21
22 usc::Server::Server(int argc, char** argv)
23 {
24- add_configuration_option("from-dm-fd", "File descriptor of read end of pipe from display manager [int]", mir::OptionType::integer);
25- add_configuration_option("to-dm-fd", "File descriptor of write end of pipe to display manager [int]", mir::OptionType::integer);
26+ add_configuration_option(dm_from_fd, "File descriptor of read end of pipe from display manager [int]",
27+ mir::OptionType::integer);
28+ add_configuration_option(dm_to_fd, "File descriptor of write end of pipe to display manager [int]",
29+ mir::OptionType::integer);
30+ add_configuration_option(dm_stub, "Run without a display manager (only useful when debugging)", mir::OptionType::null);
31+ add_configuration_option(dm_stub_active, "Expected connection when run without a display manager (only useful when debugging)", "nested-mir@:/run/user/1000/mir_socket");
32 add_configuration_option("blacklist", "Video blacklist regex to use", mir::OptionType::string);
33 add_configuration_option("version", "Show version of Unity System Compositor", mir::OptionType::null);
34 add_configuration_option("spinner", "Path to spinner executable", mir::OptionType::string);
35@@ -171,15 +180,49 @@
36 return the_session_switcher();
37 }
38
39+namespace
40+{
41+struct NullDMMessageHandler : usc::DMConnection
42+{
43+ explicit NullDMMessageHandler(
44+ std::shared_ptr<usc::DMMessageHandler> const& dm_message_handler,
45+ std::string const& client_name) :
46+ dm_message_handler{dm_message_handler},
47+ client_name{client_name}
48+ {}
49+
50+ ~NullDMMessageHandler() = default;
51+
52+ void start() override
53+ {
54+ dm_message_handler->set_active_session(client_name);
55+ };
56+
57+ std::shared_ptr<usc::DMMessageHandler> const dm_message_handler;
58+ std::string const client_name;
59+};
60+}
61+
62 std::shared_ptr<usc::DMConnection> usc::Server::the_dm_connection()
63 {
64 return dm_connection(
65- [this]
66+ [this]() -> std::shared_ptr<usc::DMConnection>
67 {
68- return std::make_shared<AsioDMConnection>(
69- the_options()->get("from-dm-fd", -1),
70- the_options()->get("to-dm-fd", -1),
71- the_dm_message_handler());
72+ if (the_options()->is_set(dm_from_fd) && the_options()->is_set(dm_to_fd))
73+ {
74+ return std::make_shared<AsioDMConnection>(
75+ the_options()->get(dm_from_fd, -1),
76+ the_options()->get(dm_to_fd, -1),
77+ the_dm_message_handler());
78+ }
79+ else if (the_options()->is_set(dm_stub))
80+ {
81+ return std::make_shared<NullDMMessageHandler>(
82+ the_dm_message_handler(),
83+ the_options()->get<std::string>(dm_stub_active));
84+ }
85+
86+ BOOST_THROW_EXCEPTION(mir::AbnormalExit("to and from FDs are required for display manager"));
87 });
88 }
89

Subscribers

People subscribed via source and target branches