Mir

Merge lp:~alan-griffiths/mir/fix-1716436 into lp:mir

Proposed by Alan Griffiths on 2017-09-15
Status: Merged
Approved by: Alan Griffiths on 2017-09-18
Approved revision: 4253
Merged at revision: 4253
Proposed branch: lp:~alan-griffiths/mir/fix-1716436
Merge into: lp:mir
Prerequisite: lp:~alan-griffiths/mir/fix-1716353
Diff against target: 233 lines (+61/-16)
8 files modified
examples/miral-shell/miral-app.sh (+10/-6)
examples/miral-shell/miral-desktop.sh (+16/-9)
src/include/platform/mir/options/configuration.h (+1/-0)
src/platform/options/default_configuration.cpp (+3/-0)
src/platform/symbols.map (+7/-0)
src/server/frontend/wayland/wayland_connector.cpp (+16/-1)
src/server/frontend/wayland/wayland_connector.h (+2/-0)
src/server/frontend/wayland/wayland_default_configuration.cpp (+6/-0)
To merge this branch: bzr merge lp:~alan-griffiths/mir/fix-1716436
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve on 2017-09-18
Chris Halse Rogers 2017-09-15 Approve on 2017-09-18
Review via email: mp+330843@code.launchpad.net

Commit message

Allow (and use) setting of the wayland display socket name. (LP: #1716436)

To post a comment you must log in.
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4252
https://mir-jenkins.ubuntu.com/job/mir-ci/3664/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/5015/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5247
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5235
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5235
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5235
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5058/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5058
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5058/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5058
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5058/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5058
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5058/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5058
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5058/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5058
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5058/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5058
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5058/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5058/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3664/rebuild

review: Needs Fixing (continuous-integration)
lp:~alan-griffiths/mir/fix-1716436 updated on 2017-09-18
4253. By Alan Griffiths on 2017-09-18

merge :parent

Chris Halse Rogers (raof) wrote :

Seems sensible

review: Approve
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4253
https://mir-jenkins.ubuntu.com/job/mir-ci/3665/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/5016
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5248
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5236
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5236
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5236
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5059
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5059/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5059
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5059/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5059
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5059/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5059
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5059/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5059
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5059/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5059
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5059/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5059
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5059/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5059
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5059/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3665/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/miral-shell/miral-app.sh'
2--- examples/miral-shell/miral-app.sh 2017-09-06 16:44:12 +0000
3+++ examples/miral-shell/miral-app.sh 2017-09-18 08:42:01 +0000
4@@ -15,6 +15,7 @@
5 fi
6
7 socket=${XDG_RUNTIME_DIR}/miral_socket
8+wayland_display=miral_wayland
9
10 while [ $# -gt 0 ]
11 do
12@@ -23,14 +24,16 @@
13 echo "$(basename $0) - Handy launch script for a hosted miral \"desktop session\""
14 echo "Usage: $(basename $0) [options] [shell options]"
15 echo "Options are:"
16- echo " -kiosk use miral-kiosk instead of ${miral_server}"
17- echo " -launcher <launcher> use <launcher> instead of '${launcher}'"
18- echo " -socket <socket> set the mir socket [${socket}]"
19- echo " -bindir <bindir> path to the miral executable [${bindir}]"
20+ echo " -kiosk use miral-kiosk instead of ${miral_server}"
21+ echo " -launcher <launcher> use <launcher> instead of '${launcher}'"
22+ echo " -socket <socket> set the legacy mir socket [${socket}]"
23+ echo " -wayland-socket-name <socket> set the wayland socket [${wayland_display}]"
24+ echo " -bindir <bindir> path to the miral executable [${bindir}]"
25 exit 0
26 elif [ "$1" == "-kiosk" ]; then miral_server=miral-kiosk
27 elif [ "$1" == "-launcher" ]; then shift; launcher=$1
28 elif [ "$1" == "-socket" ]; then shift; socket=$1
29+ elif [ "$1" == "-wayland-socket-name" ];then shift; wayland_display=$1
30 elif [ "$1" == "-bindir" ]; then shift; bindir=$1
31 elif [ "${1:0:2}" == "--" ]; then break
32 fi
33@@ -40,15 +43,16 @@
34 if [ "${bindir}" != "" ]; then bindir="${bindir}/"; fi
35
36 if [ -e "${socket}" ]; then echo "Error: session endpoint '${socket}' already exists"; exit 1 ;fi
37+if [ -e "${wayland_display}" ]; then echo "Error: wayland endpoint '${wayland_display}' already exists"; exit 1 ;fi
38
39 qtubuntu_desktop_installed=$(apt list qtubuntu-desktop 2>/dev/null | grep installed | wc -l)
40 if [ "${qtubuntu_desktop_installed}" == "0" ]; then echo "Need qtubuntu-desktop - run \"sudo apt install qtubuntu-desktop\""; exit 1 ;fi
41
42-sh -c "${bindir}${miral_server} $* ${hostsocket} --file ${socket} --desktop_file_hint=miral-shell.desktop"&
43+sh -c "${bindir}${miral_server} $* ${hostsocket} --file ${socket} --wayland-socket-name ${wayland_display} --desktop_file_hint=miral-shell.desktop"&
44
45 while [ ! -e "${socket}" ]; do echo "waiting for ${socket}"; sleep 1 ;done
46
47 unset QT_QPA_PLATFORMTHEME
48-MIR_SOCKET=${socket} XDG_SESSION_TYPE=mir GDK_BACKEND=mir QT_QPA_PLATFORM=ubuntumirclient SDL_VIDEODRIVER=mir dbus-run-session -- ${launcher}
49+MIR_SOCKET=${socket} XDG_SESSION_TYPE=mir GDK_BACKEND=mir QT_QPA_PLATFORM=ubuntumirclient SDL_VIDEODRIVER=mir WAYLAND_DISPLAY=${wayland_display} dbus-run-session -- ${launcher}
50 killall ${bindir}${miral_server}
51
52
53=== modified file 'examples/miral-shell/miral-desktop.sh'
54--- examples/miral-shell/miral-desktop.sh 2017-09-11 13:23:39 +0000
55+++ examples/miral-shell/miral-desktop.sh 2017-09-18 08:42:01 +0000
56@@ -1,6 +1,7 @@
57 #! /bin/bash
58
59 socket=${XDG_RUNTIME_DIR}/miral_socket
60+wayland_display=miral_wayland
61 miral_server=miral-shell
62 launcher=qterminal
63 bindir=$(dirname $0)
64@@ -13,17 +14,19 @@
65 echo "$(basename $0) - Handy launch script for a miral \"desktop session\""
66 echo "Usage: $(basename $0) [options] [shell options]"
67 echo "Options are:"
68- echo " -kiosk use miral-kiosk instead of ${miral_server}"
69- echo " -launcher <launcher> use <launcher> instead of '${launcher}'"
70- echo " -vt <termid> set the virtual terminal [${vt}]"
71- echo " -socket <socket> set the mir socket [${socket}]"
72- echo " -bindir <bindir> path to the miral executable [${bindir}]"
73+ echo " -kiosk use miral-kiosk instead of ${miral_server}"
74+ echo " -launcher <launcher> use <launcher> instead of '${launcher}'"
75+ echo " -vt <termid> set the virtual terminal [${vt}]"
76+ echo " -socket <socket> set the legacy mir socket [${socket}]"
77+ echo " -wayland-socket-name <socket> set the wayland socket [${wayland_display}]"
78+ echo " -bindir <bindir> path to the miral executable [${bindir}]"
79 exit 0
80 elif [ "$1" == "-kiosk" ]; then miral_server=miral-kiosk
81 elif [ "$1" == "-launcher" ]; then shift; launcher=$1
82 elif [ "$1" == "-vt" ]; then shift; vt=$1
83 elif [ "$1" == "-socket" ]; then shift; socket=$1
84- elif [ "$1" == "-bindir" ]; then shift; bindir=$1/
85+ elif [ "$1" == "-wayland-socket-name" ];then shift; wayland_display=$1
86+ elif [ "$1" == "-bindir" ]; then shift; bindir=$1
87 elif [ "${1:0:2}" == "--" ]; then break
88 fi
89 shift
90@@ -31,15 +34,19 @@
91
92 if [ "${bindir}" != "" ]; then bindir="${bindir}/"; fi
93
94-if [ -e "${socket}" ]; then echo "Error: '${socket}' already exists"; exit 1 ;fi
95+if [ -e "${socket}" ]; then echo "Error: session endpoint '${socket}' already exists"; exit 1 ;fi
96+if [ -e "${wayland_display}" ]; then echo "Error: wayland endpoint '${wayland_display}' already exists"; exit 1 ;fi
97+
98+qtubuntu_desktop_installed=$(apt list qtubuntu-desktop 2>/dev/null | grep installed | wc -l)
99+if [ "${qtubuntu_desktop_installed}" == "0" ]; then echo "Need qtubuntu-desktop - run \"sudo apt install qtubuntu-desktop\""; exit 1 ;fi
100
101 sudo ls >> /dev/null
102 oldvt=$(sudo fgconsole)
103-sudo sh -c "LD_LIBRARY_PATH=${LD_LIBRARY_PATH} XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR} ${bindir}${miral_server} --vt ${vt} --arw-file --file ${socket} $*; chvt ${oldvt}"&
104+sudo sh -c "LD_LIBRARY_PATH=${LD_LIBRARY_PATH} XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR} --wayland-socket-name ${wayland_display} ${bindir}${miral_server} --vt ${vt} --arw-file --file ${socket} $*; chvt ${oldvt}"&
105
106 while [ ! -e "${socket}" ]; do echo "waiting for ${socket}"; sleep 1 ;done
107
108 unset QT_QPA_PLATFORMTHEME
109-MIR_SOCKET=${socket} XDG_SESSION_TYPE=mir GDK_BACKEND=mir QT_QPA_PLATFORM=ubuntumirclient SDL_VIDEODRIVER=mir dbus-run-session -- ${launcher}
110+MIR_SOCKET=${socket} XDG_SESSION_TYPE=mir GDK_BACKEND=mir QT_QPA_PLATFORM=ubuntumirclient SDL_VIDEODRIVER=mir WAYLAND_DISPLAY=${wayland_display} dbus-run-session -- ${launcher}
111 sudo killall ${bindir}${miral_server}
112
113
114=== modified file 'src/include/platform/mir/options/configuration.h'
115--- src/include/platform/mir/options/configuration.h 2017-07-28 17:00:43 +0000
116+++ src/include/platform/mir/options/configuration.h 2017-09-18 08:42:01 +0000
117@@ -27,6 +27,7 @@
118 {
119 namespace options
120 {
121+extern char const* const wayland_socket_name_opt;
122 extern char const* const server_socket_opt;
123 extern char const* const prompt_socket_opt;
124 extern char const* const no_server_socket_opt;
125
126=== modified file 'src/platform/options/default_configuration.cpp'
127--- src/platform/options/default_configuration.cpp 2017-07-28 17:00:43 +0000
128+++ src/platform/options/default_configuration.cpp 2017-09-18 08:42:01 +0000
129@@ -27,6 +27,7 @@
130
131 namespace mo = mir::options;
132
133+char const* const mo::wayland_socket_name_opt = "wayland-socket-name";
134 char const* const mo::server_socket_opt = "file,f";
135 char const* const mo::prompt_socket_opt = "prompt-file,p";
136 char const* const mo::no_server_socket_opt = "no-file";
137@@ -139,6 +140,8 @@
138 namespace po = boost::program_options;
139
140 add_options()
141+ (wayland_socket_name_opt, po::value<std::string>(),
142+ "Overrides the default socket name used for communicating with clients")
143 (host_socket_opt, po::value<std::string>(),
144 "Host socket filename")
145 (server_socket_opt, po::value<std::string>()->default_value(::mir::default_server_socket),
146
147=== modified file 'src/platform/symbols.map'
148--- src/platform/symbols.map 2017-05-25 08:58:03 +0000
149+++ src/platform/symbols.map 2017-09-18 08:42:01 +0000
150@@ -153,3 +153,10 @@
151 };
152 local: *;
153 };
154+
155+MIRPLATFORM_1.0 {
156+ global:
157+ extern "C++" {
158+ mir::options::wayland_socket_name_opt*;
159+ };
160+} MIRPLATFORM_0.27;
161
162=== modified file 'src/server/frontend/wayland/wayland_connector.cpp'
163--- src/server/frontend/wayland/wayland_connector.cpp 2017-09-11 13:23:39 +0000
164+++ src/server/frontend/wayland/wayland_connector.cpp 2017-09-18 08:42:01 +0000
165@@ -1680,6 +1680,7 @@
166 }
167
168 mf::WaylandConnector::WaylandConnector(
169+ optional_value<std::string> const& display_name,
170 std::shared_ptr<mf::Shell> const& shell,
171 DisplayChanger& display_config,
172 std::shared_ptr<mg::GraphicBufferAllocator> const& allocator,
173@@ -1733,7 +1734,21 @@
174 mir::log_warning("No WaylandAllocator EGL support!");
175 }
176
177- if (auto const wayland_display = wl_display_add_socket_auto(display.get()))
178+ char const* wayland_display = nullptr;
179+
180+ if (!display_name.is_set())
181+ {
182+ wayland_display = wl_display_add_socket_auto(display.get());
183+ }
184+ else
185+ {
186+ if (!wl_display_add_socket(display.get(), display_name.value().c_str()))
187+ {
188+ wayland_display = display_name.value().c_str();
189+ }
190+ }
191+
192+ if (wayland_display)
193 {
194 if (arw_socket)
195 {
196
197=== modified file 'src/server/frontend/wayland/wayland_connector.h'
198--- src/server/frontend/wayland/wayland_connector.h 2017-09-14 11:08:07 +0000
199+++ src/server/frontend/wayland/wayland_connector.h 2017-09-18 08:42:01 +0000
200@@ -21,6 +21,7 @@
201
202 #include "mir/frontend/connector.h"
203 #include "mir/fd.h"
204+#include "mir/optional_value.h"
205
206 #include <wayland-server-core.h>
207 #include <thread>
208@@ -50,6 +51,7 @@
209 {
210 public:
211 WaylandConnector(
212+ optional_value<std::string> const& display_name,
213 std::shared_ptr<Shell> const& shell,
214 DisplayChanger& display_config,
215 std::shared_ptr<graphics::GraphicBufferAllocator> const& allocator,
216
217=== modified file 'src/server/frontend/wayland/wayland_default_configuration.cpp'
218--- src/server/frontend/wayland/wayland_default_configuration.cpp 2017-09-11 13:23:39 +0000
219+++ src/server/frontend/wayland/wayland_default_configuration.cpp 2017-09-18 08:42:01 +0000
220@@ -33,7 +33,13 @@
221 {
222 bool const arw_socket = the_options()->is_set(options::arw_server_socket_opt);
223
224+ optional_value<std::string> display_name;
225+
226+ if (the_options()->is_set(options::wayland_socket_name_opt))
227+ display_name = the_options()->get<std::string>(options::wayland_socket_name_opt);
228+
229 return std::make_shared<mf::WaylandConnector>(
230+ display_name,
231 the_frontend_shell(),
232 *the_frontend_display_changer(),
233 the_buffer_allocator(),

Subscribers

People subscribed via source and target branches