Mir

Merge lp:~kdub/mir/server-sends-extensions into lp:mir

Proposed by Kevin DuBois
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 4141
Proposed branch: lp:~kdub/mir/server-sends-extensions
Merge into: lp:mir
Diff against target: 1039 lines (+360/-42)
38 files modified
include/common/mir/extension_description.h (+33/-0)
include/platform/mir/graphics/platform.h (+6/-0)
include/test/mir/test/doubles/null_platform.h (+5/-0)
include/test/mir_test_framework/stub_server_platform_factory.h (+3/-0)
src/client/mir_connection.cpp (+19/-11)
src/client/mir_connection.h (+3/-0)
src/include/server/mir/default_server_configuration.h (+2/-0)
src/platforms/android/server/platform.cpp (+45/-4)
src/platforms/android/server/platform.h (+4/-2)
src/platforms/eglstream-kms/server/platform.cpp (+13/-0)
src/platforms/eglstream-kms/server/platform.h (+2/-0)
src/platforms/mesa/include/mesa_extensions.h (+45/-0)
src/platforms/mesa/server/kms/guest_platform.cpp (+6/-0)
src/platforms/mesa/server/kms/guest_platform.h (+1/-0)
src/platforms/mesa/server/kms/platform.cpp (+6/-0)
src/platforms/mesa/server/kms/platform.h (+1/-0)
src/platforms/mesa/server/x11/graphics/guest_platform.cpp (+6/-0)
src/platforms/mesa/server/x11/graphics/guest_platform.h (+1/-0)
src/platforms/mesa/server/x11/graphics/platform.cpp (+6/-0)
src/platforms/mesa/server/x11/graphics/platform.h (+1/-0)
src/protobuf/mir_protobuf.proto (+7/-0)
src/protobuf/symbols.map (+25/-0)
src/server/default_server_configuration.cpp (+11/-0)
src/server/frontend/default_configuration.cpp (+2/-1)
src/server/frontend/default_ipc_factory.cpp (+6/-3)
src/server/frontend/default_ipc_factory.h (+4/-1)
src/server/frontend/session_mediator.cpp (+13/-3)
src/server/frontend/session_mediator.h (+4/-1)
src/server/graphics/nested/platform.cpp (+5/-0)
src/server/graphics/nested/platform.h (+1/-0)
tests/acceptance-tests/test_client_extensions.cpp (+16/-0)
tests/integration-tests/test_submit_buffer.cpp (+1/-0)
tests/mir_test_framework/platform_graphics_throw.cpp (+5/-0)
tests/mir_test_framework/stub_server_platform_factory.cpp (+7/-0)
tests/mir_test_framework/stubbed_graphics_platform.cpp (+22/-0)
tests/unit-tests/frontend/test_session_mediator.cpp (+6/-5)
tests/unit-tests/platforms/nested/test_host_buffer.cpp (+15/-1)
tests/unit-tests/platforms/nested/test_ipc_operations.cpp (+2/-10)
To merge this branch: bzr merge lp:~kdub/mir/server-sends-extensions
Reviewer Review Type Date Requested Status
Cemil Azizoglu (community) Approve
Chris Halse Rogers Approve
Mir CI Bot continuous-integration Approve
Review via email: mp+321856@code.launchpad.net

Commit message

send the extensions that the server supports to the client on connection. Previously the supported extensions were hardcoded on a per-platform basis.

Description of the change

send the extensions that the server supports to the client on connection. Previously the supported extensions were hardcoded on a per-platform basis.

The goal here is to fallback to software GL in mesa, if the server doesn't report certain extensions (gbm_buffer).

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

PASSED: Continuous integration, rev:4152
https://mir-jenkins.ubuntu.com/job/mir-ci/3297/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4459
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4574
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/4564
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4564
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/4564
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4564
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4491
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4491/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4491
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4491/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4491
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4491/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/4491
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/4491/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/4491
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/4491/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4491
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4491/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Chris Halse Rogers (raof) wrote :

Minor nit: I'd use version*s* for
+ std::vector<int> version;

Otherwise, this looks sensible to me.

review: Approve
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

ok

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'include/common/mir/extension_description.h'
2--- include/common/mir/extension_description.h 1970-01-01 00:00:00 +0000
3+++ include/common/mir/extension_description.h 2017-04-04 13:12:12 +0000
4@@ -0,0 +1,33 @@
5+/*
6+ * Copyright © 2017 Canonical Ltd.
7+ *
8+ * This program is free software: you can redistribute it and/or modify it
9+ * under the terms of the GNU Lesser General Public License version 3,
10+ * as published by the Free Software Foundation.
11+ *
12+ * This program is distributed in the hope that it will be useful,
13+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+ * GNU Lesser General Public License for more details.
16+ *
17+ * You should have received a copy of the GNU Lesser General Public License
18+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19+ *
20+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
21+ */
22+#ifndef MIR_EXTENSION_DESCRIPTION_H_
23+#define MIR_EXTENSION_DESCRIPTION_H_
24+#include <vector>
25+#include <string>
26+
27+namespace mir
28+{
29+
30+struct ExtensionDescription
31+{
32+ std::string name;
33+ std::vector<int> version;
34+};
35+
36+}
37+#endif /* MIR_EXTENSION_DESCRIPTION_H_ */
38
39=== modified file 'include/platform/mir/graphics/platform.h'
40--- include/platform/mir/graphics/platform.h 2017-03-23 17:53:37 +0000
41+++ include/platform/mir/graphics/platform.h 2017-04-04 13:12:12 +0000
42@@ -22,6 +22,7 @@
43
44 #include <boost/program_options/options_description.hpp>
45
46+#include "mir/extension_description.h"
47 #include "mir/module_properties.h"
48 #include "mir/module_deleter.h"
49
50@@ -127,6 +128,11 @@
51 * Access the platform-specific resource[s] from the display.
52 */
53 virtual NativeDisplayPlatform* native_display_platform() = 0;
54+
55+ /**
56+ * Get the extensions for the platform.
57+ */
58+ virtual std::vector<ExtensionDescription> extensions() const = 0;
59 };
60
61 class Platform : public DisplayPlatform,
62
63=== modified file 'include/test/mir/test/doubles/null_platform.h'
64--- include/test/mir/test/doubles/null_platform.h 2017-03-23 16:32:38 +0000
65+++ include/test/mir/test/doubles/null_platform.h 2017-04-04 13:12:12 +0000
66@@ -60,6 +60,11 @@
67 {
68 return nullptr;
69 }
70+
71+ std::vector<ExtensionDescription> extensions() const override
72+ {
73+ return {};
74+ }
75 };
76 }
77 }
78
79=== modified file 'include/test/mir_test_framework/stub_server_platform_factory.h'
80--- include/test/mir_test_framework/stub_server_platform_factory.h 2017-04-03 15:45:59 +0000
81+++ include/test/mir_test_framework/stub_server_platform_factory.h 2017-04-04 13:12:12 +0000
82@@ -46,5 +46,8 @@
83 void set_next_preset_display(std::shared_ptr<mir::graphics::Display> const& display);
84
85 mir::UniqueModulePtr<FakeInputDevice> add_fake_input_device(mir::input::InputDeviceInfo const& info);
86+
87+void disable_flavors();
88+
89 }
90 #endif /* MIR_TEST_FRAMEWORK_STUB_SERVER_PLATFORM_FACTORY_ */
91
92=== modified file 'src/client/mir_connection.cpp'
93--- src/client/mir_connection.cpp 2017-03-21 05:51:47 +0000
94+++ src/client/mir_connection.cpp 2017-04-04 13:12:12 +0000
95@@ -587,16 +587,16 @@
96
97 connect_done = true;
98
99- if (connect_result->has_coordinate_translation_present() &&
100- connect_result->coordinate_translation_present())
101- {
102- translation_ext = MirExtensionWindowCoordinateTranslationV1{ translate_coordinates };
103- }
104+ translation_ext = MirExtensionWindowCoordinateTranslationV1{ translate_coordinates };
105+ graphics_module_extension = MirExtensionGraphicsModuleV1 { get_graphics_module };
106
107- if (connect_result->has_platform() &&
108- connect_result->platform().has_graphics_module())
109+ for ( auto i = 0; i < connect_result->extension().size(); i++)
110 {
111- graphics_module_extension = MirExtensionGraphicsModuleV1 { get_graphics_module };
112+ auto& ex = connect_result->extension(i);
113+ std::vector<int> versions;
114+ for ( auto j = 0; j < connect_result->extension(i).version().size(); j++ )
115+ versions.push_back(connect_result->extension(i).version(j));
116+ extensions.push_back({ex.name(), versions});
117 }
118
119 /*
120@@ -1446,14 +1446,22 @@
121 if (!platform)
122 BOOST_THROW_EXCEPTION(std::invalid_argument("cannot query extensions before connecting to server"));
123
124+ auto supported = std::find_if(extensions.begin(), extensions.end(),
125+ [&](auto& e) {
126+ return e.name == std::string{name} &&
127+ std::find(e.version.begin(), e.version.end(), version) != e.version.end();
128+ });
129+ if (supported == extensions.end())
130+ return nullptr;
131+
132 if (!strcmp(name, "mir_extension_window_coordinate_translation") && (version == 1) && translation_ext.is_set())
133 return &translation_ext.value();
134- if (!strcmp(name, "mir_extension_graphics_module") && (version == 1) && graphics_module_extension.is_set())
135- return &graphics_module_extension.value();
136-
137 if (!strcmp(name, "mir_drag_and_drop") && (version == 1))
138 return const_cast<MirDragAndDropV1*>(mir::drag_and_drop::v1);
139
140+ //this extension should move to the platform plugin.
141+ if (!strcmp(name, "mir_extension_graphics_module") && (version == 1))
142+ return &graphics_module_extension.value();
143 return platform->request_interface(name, version);
144 }
145
146
147=== modified file 'src/client/mir_connection.h'
148--- src/client/mir_connection.h 2017-03-14 04:41:33 +0000
149+++ src/client/mir_connection.h 2017-04-04 13:12:12 +0000
150@@ -24,6 +24,7 @@
151 #include "rpc/mir_display_server.h"
152 #include "rpc/mir_display_server_debug.h"
153
154+#include "mir/extension_description.h"
155 #include "mir_toolkit/extensions/window_coordinate_translation.h"
156 #include "mir_toolkit/extensions/graphics_module.h"
157 #include "mir/geometry/size.h"
158@@ -377,6 +378,8 @@
159 int const nbuffers;
160 mir::optional_value<MirExtensionWindowCoordinateTranslationV1> translation_ext;
161 mir::optional_value<MirExtensionGraphicsModuleV1> graphics_module_extension;
162+
163+ std::vector<mir::ExtensionDescription> extensions;
164 };
165
166 #endif /* MIR_CLIENT_MIR_CONNECTION_H_ */
167
168=== modified file 'src/include/server/mir/default_server_configuration.h'
169--- src/include/server/mir/default_server_configuration.h 2017-03-14 16:17:51 +0000
170+++ src/include/server/mir/default_server_configuration.h 2017-04-04 13:12:12 +0000
171@@ -19,6 +19,7 @@
172 #define MIR_DEFAULT_SERVER_CONFIGURATION_H_
173
174 #include "mir/cached_ptr.h"
175+#include "mir/extension_description.h"
176 #include "mir/server_configuration.h"
177 #include "mir/shell/window_manager_builder.h"
178
179@@ -468,6 +469,7 @@
180 auto initialise_reports() -> std::shared_ptr<report::Reports>;
181
182 CachedPtr<shell::detail::FrontendShell> frontend_shell;
183+ std::vector<mir::ExtensionDescription> the_extensions();
184 };
185 }
186
187
188=== modified file 'src/platforms/android/server/platform.cpp'
189--- src/platforms/android/server/platform.cpp 2017-03-23 17:53:37 +0000
190+++ src/platforms/android/server/platform.cpp 2017-04-04 13:12:12 +0000
191@@ -95,7 +95,7 @@
192 }
193
194 mga::Platform::Platform(
195- std::shared_ptr<HwcPlatform> const& display,
196+ std::shared_ptr<DisplayPlatform> const& display,
197 std::shared_ptr<GrallocPlatform> const& rendering) :
198 display(display),
199 rendering(rendering)
200@@ -129,6 +129,11 @@
201 return display->native_display_platform();
202 }
203
204+std::vector<mir::ExtensionDescription> mga::Platform::extensions() const
205+{
206+ return display->extensions();
207+}
208+
209 mga::GrallocPlatform::GrallocPlatform(
210 std::shared_ptr<mg::GraphicBufferAllocator> const& buffer_allocator) :
211 buffer_allocator(buffer_allocator)
212@@ -245,6 +250,21 @@
213 std::make_shared<mga::GrallocPlatform>(allocator));
214 }
215
216+namespace
217+{
218+std::vector<mir::ExtensionDescription> extensions()
219+{
220+ return
221+ {
222+ { "mir_extension_android_buffer", { 1, 2 } },
223+ { "mir_extension_android_egl", { 1 } },
224+ { "mir_extension_fenced_buffers", { 1 } },
225+ { "mir_extension_graphics_module", { 1 } },
226+ { "mir_extension_hardware_buffer_stream", { 1 } }
227+ };
228+}
229+}
230+
231 mir::UniqueModulePtr<mg::Platform> create_guest_platform(
232 std::shared_ptr<mg::DisplayReport> const&,
233 std::shared_ptr<mg::PlatformAuthentication> const&)
234@@ -260,10 +280,26 @@
235 sync_factory = std::make_shared<mga::NullCommandStreamSyncFactory>();
236
237 auto const buffer_allocator = std::make_shared<mga::GraphicBufferAllocator>(sync_factory, quirks);
238- //TODO: remove nullptr parameter once platform classes are sorted.
239- // a guest platform cannot create a display anyways, so it doesnt need a display builder
240+
241+ struct GuestDisplayPlatform : mg::DisplayPlatform
242+ {
243+ mir::UniqueModulePtr<mg::Display> create_display(
244+ std::shared_ptr<mg::DisplayConfigurationPolicy> const&,
245+ std::shared_ptr<mg::GLConfig> const&) override
246+ {
247+ BOOST_THROW_EXCEPTION(std::runtime_error("cannot create mga::Display from nested server"));
248+ }
249+ mg::NativeDisplayPlatform* native_display_platform() override
250+ {
251+ return nullptr;
252+ }
253+ std::vector<mir::ExtensionDescription> extensions() const override
254+ {
255+ return ::extensions();
256+ }
257+ };
258 return mir::make_module_ptr<mga::Platform>(
259- nullptr, std::make_shared<mga::GrallocPlatform>(buffer_allocator));
260+ std::make_shared<GuestDisplayPlatform>(), std::make_shared<mga::GrallocPlatform>(buffer_allocator));
261 }
262
263 mir::UniqueModulePtr<mir::graphics::DisplayPlatform> create_display_platform(
264@@ -351,3 +387,8 @@
265 mir::assert_entry_point_signature<mg::DescribeModule>(&describe_graphics_module);
266 return &description;
267 }
268+
269+std::vector<mir::ExtensionDescription> mga::HwcPlatform::extensions() const
270+{
271+ return ::extensions();
272+}
273
274=== modified file 'src/platforms/android/server/platform.h'
275--- src/platforms/android/server/platform.h 2017-03-23 17:53:37 +0000
276+++ src/platforms/android/server/platform.h 2017-04-04 13:12:12 +0000
277@@ -71,6 +71,7 @@
278 std::shared_ptr<graphics::DisplayConfigurationPolicy> const&,
279 std::shared_ptr<graphics::GLConfig> const& /*gl_config*/) override;
280 NativeDisplayPlatform* native_display_platform() override;
281+ std::vector<mir::ExtensionDescription> extensions() const override;
282
283 private:
284 std::shared_ptr<graphics::GraphicBufferAllocator> const buffer_allocator;
285@@ -85,7 +86,7 @@
286 {
287 public:
288 Platform(
289- std::shared_ptr<HwcPlatform> const& display,
290+ std::shared_ptr<DisplayPlatform> const& display,
291 std::shared_ptr<GrallocPlatform> const& rendering);
292
293 UniqueModulePtr<graphics::GraphicBufferAllocator> create_buffer_allocator() override;
294@@ -95,9 +96,10 @@
295 UniqueModulePtr<PlatformIpcOperations> make_ipc_operations() const override;
296 NativeRenderingPlatform* native_rendering_platform() override;
297 NativeDisplayPlatform* native_display_platform() override;
298+ std::vector<mir::ExtensionDescription> extensions() const override;
299
300 private:
301- std::shared_ptr<HwcPlatform> const display;
302+ std::shared_ptr<DisplayPlatform> const display;
303 std::shared_ptr<GrallocPlatform> const rendering;
304 };
305
306
307=== modified file 'src/platforms/eglstream-kms/server/platform.cpp'
308--- src/platforms/eglstream-kms/server/platform.cpp 2017-03-27 19:21:10 +0000
309+++ src/platforms/eglstream-kms/server/platform.cpp 2017-04-04 13:12:12 +0000
310@@ -110,6 +110,14 @@
311 return nullptr;
312 }
313
314+std::vector<mir::ExtensionDescription> mge::DisplayPlatform::extensions() const
315+{
316+ return
317+ {
318+ { "mir_extension_graphics_module", { 1 } }
319+ };
320+}
321+
322 mir::UniqueModulePtr<mg::GraphicBufferAllocator> mge::RenderingPlatform::create_buffer_allocator()
323 {
324 return mir::make_module_ptr<mge::BufferAllocator>();
325@@ -201,3 +209,8 @@
326 {
327 return display->native_display_platform();
328 }
329+
330+std::vector<mir::ExtensionDescription> mge::Platform::extensions() const
331+{
332+ return display->extensions();
333+}
334
335=== modified file 'src/platforms/eglstream-kms/server/platform.h'
336--- src/platforms/eglstream-kms/server/platform.h 2017-03-27 19:21:10 +0000
337+++ src/platforms/eglstream-kms/server/platform.h 2017-04-04 13:12:12 +0000
338@@ -54,6 +54,7 @@
339 std::shared_ptr<DisplayConfigurationPolicy> const& /*initial_conf_policy*/,
340 std::shared_ptr<GLConfig> const& /*gl_config*/) override;
341 NativeDisplayPlatform* native_display_platform() override;
342+ std::vector<ExtensionDescription> extensions() const override;
343
344 private:
345 EGLDisplay display;
346@@ -74,6 +75,7 @@
347 std::shared_ptr<DisplayConfigurationPolicy> const& /*initial_conf_policy*/,
348 std::shared_ptr<GLConfig> const& /*gl_config*/) override;
349 NativeDisplayPlatform* native_display_platform() override;
350+ std::vector<ExtensionDescription> extensions() const override;
351
352 UniqueModulePtr<PlatformIpcOperations> make_ipc_operations() const override;
353
354
355=== added file 'src/platforms/mesa/include/mesa_extensions.h'
356--- src/platforms/mesa/include/mesa_extensions.h 1970-01-01 00:00:00 +0000
357+++ src/platforms/mesa/include/mesa_extensions.h 2017-04-04 13:12:12 +0000
358@@ -0,0 +1,45 @@
359+/*
360+ * Copyright © 2017 Canonical Ltd.
361+ *
362+ * This program is free software: you can redistribute it and/or modify it
363+ * under the terms of the GNU Lesser General Public License version 3,
364+ * as published by the Free Software Foundation.
365+ *
366+ * This program is distributed in the hope that it will be useful,
367+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
368+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
369+ * GNU Lesser General Public License for more details.
370+ *
371+ * You should have received a copy of the GNU Lesser General Public License
372+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
373+ *
374+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
375+ *
376+ */
377+
378+#ifndef MIR_GRAPHICS_MESA_EXTENSIONS_H_
379+#define MIR_GRAPHICS_MESA_EXTENSIONS_H_
380+#include "mir/extension_description.h"
381+#include <vector>
382+
383+namespace mir
384+{
385+namespace graphics
386+{
387+namespace mesa
388+{
389+inline std::vector<ExtensionDescription> mesa_extensions()
390+{
391+ return
392+ {
393+ { "mir_extension_gbm_buffer", { 1, 2 } },
394+ { "mir_extension_graphics_module", { 1 } },
395+ { "mir_extension_mesa_drm_auth", { 1 } },
396+ { "mir_extension_set_gbm_device", { 1 } },
397+ { "mir_extension_hardware_buffer_stream", { 1 } }
398+ };
399+}
400+}
401+}
402+}
403+#endif /* MIR_GRAPHICS_MESA_EXTENSIONS_H_ */
404
405=== modified file 'src/platforms/mesa/server/kms/guest_platform.cpp'
406--- src/platforms/mesa/server/kms/guest_platform.cpp 2017-03-23 17:18:29 +0000
407+++ src/platforms/mesa/server/kms/guest_platform.cpp 2017-04-04 13:12:12 +0000
408@@ -22,6 +22,7 @@
409 #include "nested_authentication.h"
410 #include "ipc_operations.h"
411 #include "buffer_allocator.h"
412+#include "mesa_extensions.h"
413
414 #include "mir/graphics/platform_authentication.h"
415 #include "mir/graphics/platform_operation_message.h"
416@@ -128,3 +129,8 @@
417 {
418 return gbm.device;
419 }
420+
421+std::vector<mir::ExtensionDescription> mgm::GuestPlatform::extensions() const
422+{
423+ return mgm::mesa_extensions();
424+}
425
426=== modified file 'src/platforms/mesa/server/kms/guest_platform.h'
427--- src/platforms/mesa/server/kms/guest_platform.h 2017-03-23 16:32:38 +0000
428+++ src/platforms/mesa/server/kms/guest_platform.h 2017-04-04 13:12:12 +0000
429@@ -48,6 +48,7 @@
430 std::shared_ptr<graphics::DisplayConfigurationPolicy> const&,
431 std::shared_ptr<graphics::GLConfig> const& /*gl_config*/) override;
432 NativeDisplayPlatform* native_display_platform() override;
433+ std::vector<ExtensionDescription> extensions() const override;
434
435 NativeRenderingPlatform* native_rendering_platform() override;
436 EGLNativeDisplayType egl_native_display() const override;
437
438=== modified file 'src/platforms/mesa/server/kms/platform.cpp'
439--- src/platforms/mesa/server/kms/platform.cpp 2017-03-29 03:23:17 +0000
440+++ src/platforms/mesa/server/kms/platform.cpp 2017-04-04 13:12:12 +0000
441@@ -28,6 +28,7 @@
442 #include "mir/graphics/native_buffer.h"
443 #include "mir/emergency_cleanup_registry.h"
444 #include "mir/udev/wrapper.h"
445+#include "mesa_extensions.h"
446
447 #include <boost/throw_exception.hpp>
448 #include <stdexcept>
449@@ -127,3 +128,8 @@
450 {
451 return bypass_option_;
452 }
453+
454+std::vector<mir::ExtensionDescription> mgm::Platform::extensions() const
455+{
456+ return mgm::mesa_extensions();
457+}
458
459=== modified file 'src/platforms/mesa/server/kms/platform.h'
460--- src/platforms/mesa/server/kms/platform.h 2017-03-29 03:23:17 +0000
461+++ src/platforms/mesa/server/kms/platform.h 2017-04-04 13:12:12 +0000
462@@ -51,6 +51,7 @@
463 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
464 std::shared_ptr<GLConfig> const& gl_config) override;
465 NativeDisplayPlatform* native_display_platform() override;
466+ std::vector<ExtensionDescription> extensions() const override;
467
468 UniqueModulePtr<PlatformIpcOperations> make_ipc_operations() const override;
469
470
471=== modified file 'src/platforms/mesa/server/x11/graphics/guest_platform.cpp'
472--- src/platforms/mesa/server/x11/graphics/guest_platform.cpp 2017-03-23 17:18:29 +0000
473+++ src/platforms/mesa/server/x11/graphics/guest_platform.cpp 2017-04-04 13:12:12 +0000
474@@ -20,6 +20,7 @@
475 #include "guest_platform.h"
476 #include "ipc_operations.h"
477 #include "buffer_allocator.h"
478+#include "mesa_extensions.h"
479
480 #include <boost/exception/errinfo_errno.hpp>
481 #include <boost/throw_exception.hpp>
482@@ -71,3 +72,8 @@
483 {
484 return gbm.device;
485 }
486+
487+std::vector<mir::ExtensionDescription> mgx::GuestPlatform::extensions() const
488+{
489+ return mgm::mesa_extensions();
490+}
491
492=== modified file 'src/platforms/mesa/server/x11/graphics/guest_platform.h'
493--- src/platforms/mesa/server/x11/graphics/guest_platform.h 2017-03-23 17:18:29 +0000
494+++ src/platforms/mesa/server/x11/graphics/guest_platform.h 2017-04-04 13:12:12 +0000
495@@ -47,6 +47,7 @@
496 std::shared_ptr<graphics::DisplayConfigurationPolicy> const&,
497 std::shared_ptr<graphics::GLConfig> const&) override;
498 NativeDisplayPlatform* native_display_platform() override;
499+ std::vector<ExtensionDescription> extensions() const override;
500
501 NativeRenderingPlatform* native_rendering_platform() override;
502 EGLNativeDisplayType egl_native_display() const override;
503
504=== modified file 'src/platforms/mesa/server/x11/graphics/platform.cpp'
505--- src/platforms/mesa/server/x11/graphics/platform.cpp 2017-03-23 17:18:29 +0000
506+++ src/platforms/mesa/server/x11/graphics/platform.cpp 2017-04-04 13:12:12 +0000
507@@ -20,6 +20,7 @@
508 #include "display.h"
509 #include "buffer_allocator.h"
510 #include "ipc_operations.h"
511+#include "mesa_extensions.h"
512
513 namespace mg = mir::graphics;
514 namespace mgm = mg::mesa;
515@@ -75,3 +76,8 @@
516 {
517 return eglGetDisplay(x11_connection.get());
518 }
519+
520+std::vector<mir::ExtensionDescription> mgx::Platform::extensions() const
521+{
522+ return mgm::mesa_extensions();
523+}
524
525=== modified file 'src/platforms/mesa/server/x11/graphics/platform.h'
526--- src/platforms/mesa/server/x11/graphics/platform.h 2017-03-23 17:18:29 +0000
527+++ src/platforms/mesa/server/x11/graphics/platform.h 2017-04-04 13:12:12 +0000
528@@ -52,6 +52,7 @@
529 UniqueModulePtr<graphics::Display> create_display(
530 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
531 std::shared_ptr<GLConfig> const& gl_config) override;
532+ std::vector<ExtensionDescription> extensions() const override;
533 NativeDisplayPlatform* native_display_platform() override;
534
535 UniqueModulePtr<PlatformIpcOperations> make_ipc_operations() const override;
536
537=== modified file 'src/protobuf/mir_protobuf.proto'
538--- src/protobuf/mir_protobuf.proto 2017-04-04 07:04:57 +0000
539+++ src/protobuf/mir_protobuf.proto 2017-04-04 13:12:12 +0000
540@@ -248,6 +248,12 @@
541 optional uint32 logical_height = 27;
542 }
543
544+message Extension
545+{
546+ optional string name = 1;
547+ repeated sint32 version = 2;
548+}
549+
550 message Connection {
551 optional Platform platform = 1;
552 // optional DisplayInfo display_info = 2;
553@@ -257,6 +263,7 @@
554 optional InputDevices input_devices = 6;
555 optional string input_configuration = 7;
556 optional bool coordinate_translation_present = 8;
557+ repeated Extension extension = 9;
558
559 optional string error = 127;
560 optional StructuredError structured_error = 128;
561
562=== modified file 'src/protobuf/symbols.map'
563--- src/protobuf/symbols.map 2017-04-04 07:04:57 +0000
564+++ src/protobuf/symbols.map 2017-04-04 13:12:12 +0000
565@@ -1139,3 +1139,28 @@
566 vtable?for?mir::protobuf::RequestWithAuthority;
567 };
568 } MIR_PROTOBUF_0.26;
569+
570+MIR_PROTOBUF_0.28 {
571+ global:
572+ extern "C++" {
573+ typeinfo?for?mir::protobuf::Extension;
574+ vtable?for?mir::protobuf::Extension;
575+ mir::protobuf::Extension::MergePartialFromCodedStream*;
576+ mir::protobuf::Extension::Extension*;
577+ mir::protobuf::Extension::ByteSize*;
578+ mir::protobuf::Extension::GetTypeName*;
579+ mir::protobuf::Extension::?Extension*;
580+ mir::protobuf::Extension::New*;
581+ mir::protobuf::Extension::default_instance*;
582+ mir::protobuf::Extension::SerializeWithCachedSizes*;
583+ mir::protobuf::Extension::Clear*;
584+ mir::protobuf::Extension::IsInitialized*;
585+ mir::protobuf::Extension::CopyFrom*;
586+ mir::protobuf::Extension::MergeFrom*;
587+ mir::protobuf::Extension::kVersionFieldNumber*;
588+ mir::protobuf::Extension::CheckTypeAndMergeFrom*;
589+ mir::protobuf::Extension::Swap*;
590+ mir::protobuf::Extension::kNameFieldNumber*;
591+ mir::protobuf::Extension::DiscardUnknownFields*;
592+ };
593+} MIR_PROTOBUF_0.27;
594
595=== modified file 'src/server/default_server_configuration.cpp'
596--- src/server/default_server_configuration.cpp 2017-02-15 07:38:33 +0000
597+++ src/server/default_server_configuration.cpp 2017-04-04 13:12:12 +0000
598@@ -41,6 +41,8 @@
599 #include "mir/default_configuration.h"
600 #include "mir/scene/null_prompt_session_listener.h"
601 #include "default_emergency_cleanup.h"
602+#include "mir/graphics/platform.h"
603+#include "mir/scene/coordinate_translator.h"
604
605 #include <type_traits>
606
607@@ -228,3 +230,12 @@
608 return std::make_shared<ml::DumbConsoleLogger>();
609 });
610 }
611+
612+std::vector<mir::ExtensionDescription> mir::DefaultServerConfiguration::the_extensions()
613+{
614+ auto extensions = the_graphics_platform()->extensions();
615+ extensions.push_back(mir::ExtensionDescription{"mir_drag_and_drop", { 1 } });
616+ if (the_coordinate_translator()->translation_supported())
617+ extensions.push_back(mir::ExtensionDescription{"mir_extension_window_coordinate_translation", {1}});
618+ return extensions;
619+}
620
621=== modified file 'src/server/frontend/default_configuration.cpp'
622--- src/server/frontend/default_configuration.cpp 2017-02-15 07:38:33 +0000
623+++ src/server/frontend/default_configuration.cpp 2017-04-04 13:12:12 +0000
624@@ -167,7 +167,8 @@
625 the_coordinate_translator(),
626 the_application_not_responding_detector(),
627 the_cookie_authority(),
628- the_input_configuration_changer());
629+ the_input_configuration_changer(),
630+ the_extensions());
631 }
632
633 std::shared_ptr<mf::SessionMediatorObserver>
634
635=== modified file 'src/server/frontend/default_ipc_factory.cpp'
636--- src/server/frontend/default_ipc_factory.cpp 2017-02-15 07:38:33 +0000
637+++ src/server/frontend/default_ipc_factory.cpp 2017-04-04 13:12:12 +0000
638@@ -46,7 +46,8 @@
639 std::shared_ptr<scene::CoordinateTranslator> const& translator,
640 std::shared_ptr<scene::ApplicationNotRespondingDetector> const& anr_detector,
641 std::shared_ptr<mir::cookie::Authority> const& cookie_authority,
642- std::shared_ptr<InputConfigurationChanger> const& input_changer) :
643+ std::shared_ptr<InputConfigurationChanger> const& input_changer,
644+ std::vector<mir::ExtensionDescription> const& extensions) :
645 shell(shell),
646 no_prompt_shell(std::make_shared<NoPromptShell>(shell)),
647 sm_observer(sm_observer),
648@@ -60,7 +61,8 @@
649 translator{translator},
650 anr_detector{anr_detector},
651 cookie_authority(cookie_authority),
652- input_changer(input_changer)
653+ input_changer(input_changer),
654+ extensions(extensions)
655 {
656 }
657
658@@ -147,5 +149,6 @@
659 translator,
660 anr_detector,
661 cookie_authority,
662- input_changer);
663+ input_changer,
664+ extensions);
665 }
666
667=== modified file 'src/server/frontend/default_ipc_factory.h'
668--- src/server/frontend/default_ipc_factory.h 2017-02-15 07:38:33 +0000
669+++ src/server/frontend/default_ipc_factory.h 2017-04-04 13:12:12 +0000
670@@ -19,6 +19,7 @@
671 #ifndef MIR_FRONTEND_DEFAULT_IPC_FACTORY_H_
672 #define MIR_FRONTEND_DEFAULT_IPC_FACTORY_H_
673
674+#include "mir/extension_description.h"
675 #include "protobuf_ipc_factory.h"
676
677 namespace mir
678@@ -68,7 +69,8 @@
679 std::shared_ptr<scene::CoordinateTranslator> const& translator,
680 std::shared_ptr<scene::ApplicationNotRespondingDetector> const& anr_detector,
681 std::shared_ptr<cookie::Authority> const& cookie_authority,
682- std::shared_ptr<InputConfigurationChanger> const& input_Changer);
683+ std::shared_ptr<InputConfigurationChanger> const& input_Changer,
684+ std::vector<mir::ExtensionDescription> const& extensions);
685
686 std::shared_ptr<detail::DisplayServer> make_ipc_server(
687 SessionCredentials const &creds,
688@@ -106,6 +108,7 @@
689 std::shared_ptr<scene::ApplicationNotRespondingDetector> const anr_detector;
690 std::shared_ptr<cookie::Authority> const cookie_authority;
691 std::shared_ptr<InputConfigurationChanger> const input_changer;
692+ std::vector<mir::ExtensionDescription> const extensions;
693 };
694 }
695 }
696
697=== modified file 'src/server/frontend/session_mediator.cpp'
698--- src/server/frontend/session_mediator.cpp 2017-04-04 07:04:57 +0000
699+++ src/server/frontend/session_mediator.cpp 2017-04-04 13:12:12 +0000
700@@ -116,7 +116,8 @@
701 std::shared_ptr<scene::CoordinateTranslator> const& translator,
702 std::shared_ptr<scene::ApplicationNotRespondingDetector> const& anr_detector,
703 std::shared_ptr<mir::cookie::Authority> const& cookie_authority,
704- std::shared_ptr<mf::InputConfigurationChanger> const& input_changer) :
705+ std::shared_ptr<mf::InputConfigurationChanger> const& input_changer,
706+ std::vector<mir::ExtensionDescription> const& extensions) :
707 client_pid_(0),
708 shell(shell),
709 ipc_operations(ipc_operations),
710@@ -133,7 +134,8 @@
711 translator{translator},
712 anr_detector{anr_detector},
713 cookie_authority(cookie_authority),
714- input_changer(input_changer)
715+ input_changer(input_changer),
716+ extensions(extensions)
717 {
718 }
719
720@@ -194,7 +196,15 @@
721
722 resource_cache->save_resource(response, ipc_package);
723
724- response->set_coordinate_translation_present(translator->translation_supported());
725+ for ( auto const& ext : extensions )
726+ {
727+ if (ext.version.empty()) //malformed plugin, ignore
728+ continue;
729+ auto e = response->add_extension();
730+ e->set_name(ext.name);
731+ for(auto const& v : ext.version)
732+ e->add_version(v);
733+ }
734
735 done->Run();
736 }
737
738=== modified file 'src/server/frontend/session_mediator.h'
739--- src/server/frontend/session_mediator.h 2017-04-04 07:04:57 +0000
740+++ src/server/frontend/session_mediator.h 2017-04-04 13:12:12 +0000
741@@ -23,6 +23,7 @@
742 #include "screencast_buffer_tracker.h"
743 #include "protobuf_ipc_factory.h"
744
745+#include "mir/extension_description.h"
746 #include "mir/frontend/connection_context.h"
747 #include "mir/frontend/surface_id.h"
748 #include "mir/frontend/buffer_stream_id.h"
749@@ -122,7 +123,8 @@
750 std::shared_ptr<scene::CoordinateTranslator> const& translator,
751 std::shared_ptr<scene::ApplicationNotRespondingDetector> const& anr_detector,
752 std::shared_ptr<cookie::Authority> const& cookie_authority,
753- std::shared_ptr<InputConfigurationChanger> const& input_changer
754+ std::shared_ptr<InputConfigurationChanger> const& input_changer,
755+ std::vector<mir::ExtensionDescription> const& extensions
756 );
757
758 ~SessionMediator() noexcept;
759@@ -296,6 +298,7 @@
760 std::shared_ptr<scene::ApplicationNotRespondingDetector> const anr_detector;
761 std::shared_ptr<cookie::Authority> const cookie_authority;
762 std::shared_ptr<InputConfigurationChanger> const input_changer;
763+ std::vector<mir::ExtensionDescription> const extensions;
764
765 ScreencastBufferTracker screencast_buffer_tracker;
766
767
768=== modified file 'src/server/graphics/nested/platform.cpp'
769--- src/server/graphics/nested/platform.cpp 2017-03-23 17:18:29 +0000
770+++ src/server/graphics/nested/platform.cpp 2017-04-04 13:12:12 +0000
771@@ -159,3 +159,8 @@
772 {
773 return this;
774 }
775+
776+std::vector<mir::ExtensionDescription> mgn::Platform::extensions() const
777+{
778+ return guest_platform->extensions();
779+}
780
781=== modified file 'src/server/graphics/nested/platform.h'
782--- src/server/graphics/nested/platform.h 2017-03-23 17:18:29 +0000
783+++ src/server/graphics/nested/platform.h 2017-04-04 13:12:12 +0000
784@@ -55,6 +55,7 @@
785 UniqueModulePtr<PlatformIpcOperations> make_ipc_operations() const override;
786 NativeRenderingPlatform* native_rendering_platform() override;
787 EGLNativeDisplayType egl_native_display() const override;
788+ std::vector<mir::ExtensionDescription> extensions() const override;
789 private:
790 std::shared_ptr<mir::SharedLibrary> const library;
791 std::shared_ptr<HostConnection> const connection;
792
793=== modified file 'tests/acceptance-tests/test_client_extensions.cpp'
794--- tests/acceptance-tests/test_client_extensions.cpp 2017-01-18 02:29:37 +0000
795+++ tests/acceptance-tests/test_client_extensions.cpp 2017-04-04 13:12:12 +0000
796@@ -18,6 +18,7 @@
797
798 #include "mir_test_framework/connected_client_headless_server.h"
799 #include "mir_test_framework/stub_platform_extension.h"
800+#include "mir_test_framework/stub_server_platform_factory.h"
801 #include "mir_toolkit/mir_extension_core.h"
802 #include <gtest/gtest.h>
803 #include <gmock/gmock.h>
804@@ -29,6 +30,15 @@
805 {
806 };
807
808+struct ClientExtensionsDisabled : mtf::ConnectedClientHeadlessServer
809+{
810+ void SetUp() override
811+ {
812+ mtf::disable_flavors();
813+ mtf::ConnectedClientHeadlessServer::SetUp();
814+ }
815+};
816+
817 TEST_F(ClientExtensions, can_load_an_extension)
818 {
819 auto ext = mir_extension_favorite_flavor_v1(connection);
820@@ -61,3 +71,9 @@
821 EXPECT_THAT(mir_connection_request_extension(
822 connection, "pancake", 8), Eq(nullptr));
823 }
824+
825+TEST_F(ClientExtensionsDisabled, queries_for_extensions)
826+{
827+ auto ext = mir_extension_favorite_flavor_v1(connection);
828+ EXPECT_THAT(ext, Eq(nullptr));
829+}
830
831=== modified file 'tests/integration-tests/test_submit_buffer.cpp'
832--- tests/integration-tests/test_submit_buffer.cpp 2017-03-23 14:46:35 +0000
833+++ tests/integration-tests/test_submit_buffer.cpp 2017-04-04 13:12:12 +0000
834@@ -235,6 +235,7 @@
835
836 mg::NativeRenderingPlatform* native_rendering_platform() override { return nullptr; }
837 mg::NativeDisplayPlatform* native_display_platform() override { return nullptr; }
838+ std::vector<mir::ExtensionDescription> extensions() const override { return {}; }
839
840 std::shared_ptr<mir::Fd> const last_fd;
841 std::shared_ptr<mg::Platform> const underlying_platform;
842
843=== modified file 'tests/mir_test_framework/platform_graphics_throw.cpp'
844--- tests/mir_test_framework/platform_graphics_throw.cpp 2017-03-23 14:46:35 +0000
845+++ tests/mir_test_framework/platform_graphics_throw.cpp 2017-04-04 13:12:12 +0000
846@@ -100,6 +100,11 @@
847 return stub_platform->native_display_platform();
848 }
849
850+ std::vector<mir::ExtensionDescription> extensions() const
851+ {
852+ return {};
853+ }
854+
855 private:
856 enum ExceptionLocation : uint32_t
857 {
858
859=== modified file 'tests/mir_test_framework/stub_server_platform_factory.cpp'
860--- tests/mir_test_framework/stub_server_platform_factory.cpp 2016-01-29 08:18:22 +0000
861+++ tests/mir_test_framework/stub_server_platform_factory.cpp 2017-04-04 13:12:12 +0000
862@@ -77,6 +77,13 @@
863 display_setter(display);
864 }
865
866+void mtf::disable_flavors()
867+{
868+ ensure_platform_library();
869+ auto disable = platform_graphics_lib->load_function<void(*)()>("disable_flavors");
870+ disable();
871+}
872+
873 mir::UniqueModulePtr<mtf::FakeInputDevice> mtf::add_fake_input_device(mir::input::InputDeviceInfo const& info)
874 {
875 ensure_platform_library();
876
877=== modified file 'tests/mir_test_framework/stubbed_graphics_platform.cpp'
878--- tests/mir_test_framework/stubbed_graphics_platform.cpp 2017-03-23 14:46:35 +0000
879+++ tests/mir_test_framework/stubbed_graphics_platform.cpp 2017-04-04 13:12:12 +0000
880@@ -50,6 +50,7 @@
881 namespace
882 {
883
884+bool flavor_enabled = true;
885 struct WrappingDisplay : mg::Display
886 {
887 WrappingDisplay(std::shared_ptr<mg::Display> const& display) : display{display} {}
888@@ -314,6 +315,22 @@
889 return adaptee->native_display_platform();
890 }
891
892+ std::vector<mir::ExtensionDescription> extensions() const override
893+ {
894+ std::vector<mir::ExtensionDescription> ext
895+ {
896+ { "mir_extension_gbm_buffer", { 1, 2 } },
897+ { "mir_extension_fenced_buffers", { 1 } },
898+ { "mir_extension_hardware_buffer_stream", { 1 } },
899+ { "mir_extension_graphics_module", { 1 } },
900+ { "mir_extension_animal_names", {1} }
901+ };
902+ if (flavor_enabled)
903+ ext.push_back({ std::string{"mir_extension_favorite_flavor"}, {1, 9} });
904+
905+ return ext;
906+ }
907+
908 std::shared_ptr<mg::PlatformAuthentication> const context;
909 std::shared_ptr<mg::Platform> const adaptee;
910 };
911@@ -388,3 +405,8 @@
912 {
913 display_preset = display;
914 }
915+
916+extern "C" void disable_flavors()
917+{
918+ flavor_enabled = false;
919+}
920
921=== modified file 'tests/unit-tests/frontend/test_session_mediator.cpp'
922--- tests/unit-tests/frontend/test_session_mediator.cpp 2017-04-04 07:04:57 +0000
923+++ tests/unit-tests/frontend/test_session_mediator.cpp 2017-04-04 13:12:12 +0000
924@@ -279,7 +279,8 @@
925 std::make_shared<NullCoordinateTranslator>(),
926 std::make_shared<mtd::NullANRDetector>(),
927 mir::cookie::Authority::create(),
928- mt::fake_shared(mock_input_config_changer)}
929+ mt::fake_shared(mock_input_config_changer),
930+ {}}
931 {
932 using namespace ::testing;
933
934@@ -309,7 +310,7 @@
935 std::make_shared<NullCoordinateTranslator>(),
936 std::make_shared<mtd::NullANRDetector>(),
937 mir::cookie::Authority::create(),
938- mt::fake_shared(mock_input_config_changer));
939+ mt::fake_shared(mock_input_config_changer), std::vector<mir::ExtensionDescription>{});
940 }
941
942 std::shared_ptr<mf::SessionMediator> create_session_mediator_with_screencast(
943@@ -324,7 +325,7 @@
944 std::make_shared<NullCoordinateTranslator>(),
945 std::make_shared<mtd::NullANRDetector>(),
946 mir::cookie::Authority::create(),
947- mt::fake_shared(mock_input_config_changer));
948+ mt::fake_shared(mock_input_config_changer), std::vector<mir::ExtensionDescription>{});
949 }
950
951 MockConnector connector;
952@@ -382,7 +383,7 @@
953 std::make_shared<NullCoordinateTranslator>(),
954 std::make_shared<mtd::NullANRDetector>(),
955 mir::cookie::Authority::create(),
956- mt::fake_shared(mock_input_config_changer)};
957+ mt::fake_shared(mock_input_config_changer), {}};
958
959 EXPECT_THAT(connects_handled_count, Eq(0));
960
961@@ -860,7 +861,7 @@
962 std::make_shared<NullCoordinateTranslator>(),
963 std::make_shared<mtd::NullANRDetector>(),
964 mir::cookie::Authority::create(),
965- mt::fake_shared(mock_input_config_changer)};
966+ mt::fake_shared(mock_input_config_changer), {}};
967
968 ON_CALL(*shell, create_surface( _, _, _))
969 .WillByDefault(
970
971=== modified file 'tests/unit-tests/platforms/nested/test_host_buffer.cpp'
972--- tests/unit-tests/platforms/nested/test_host_buffer.cpp 2017-02-14 15:14:15 +0000
973+++ tests/unit-tests/platforms/nested/test_host_buffer.cpp 2017-04-04 13:12:12 +0000
974@@ -93,6 +93,20 @@
975 }
976 };
977
978+struct ServerTool : mt::StubServerTool
979+{
980+ virtual void connect(
981+ mir::protobuf::ConnectParameters const* request,
982+ mir::protobuf::Connection* connect_msg,
983+ google::protobuf::Closure* done) override
984+ {
985+ auto ext = connect_msg->add_extension();
986+ ext->add_version(1);
987+ ext->set_name("mir_extension_fenced_buffers");
988+ mt::StubServerTool::connect(request, connect_msg, done);
989+ }
990+};
991+
992 struct HostBuffer : Test
993 {
994 HostBuffer()
995@@ -105,7 +119,7 @@
996 }
997
998 std::string const socket { "./test_sock" };
999- std::shared_ptr<mt::StubServerTool> const server_tool = std::make_shared<mt::StubServerTool>();
1000+ std::shared_ptr<mt::StubServerTool> const server_tool = std::make_shared<ServerTool>();
1001 std::shared_ptr<mt::TestProtobufServer> test_server;
1002 std::shared_ptr<TestConnectionConfiguration> config;
1003 };
1004
1005=== modified file 'tests/unit-tests/platforms/nested/test_ipc_operations.cpp'
1006--- tests/unit-tests/platforms/nested/test_ipc_operations.cpp 2017-01-19 19:47:56 +0000
1007+++ tests/unit-tests/platforms/nested/test_ipc_operations.cpp 2017-04-04 13:12:12 +0000
1008@@ -20,6 +20,7 @@
1009 #include "src/server/graphics/nested/native_buffer.h"
1010 #include "mir/test/doubles/stub_buffer.h"
1011 #include "mir/test/doubles/mock_buffer_ipc_message.h"
1012+#include "mir/test/doubles/mock_platform_ipc_operations.h"
1013 #include "mir/test/fake_shared.h"
1014 #include "mir/graphics/platform_ipc_operations.h"
1015 #include "mir/graphics/platform_operation_message.h"
1016@@ -68,15 +69,6 @@
1017 MOCK_METHOD1(set_fence, void(mir::Fd));
1018 };
1019
1020-struct MockIpcOperations : mg::PlatformIpcOperations
1021-{
1022- MOCK_CONST_METHOD3(pack_buffer, void(mg::BufferIpcMessage&, mg::Buffer const&, mg::BufferIpcMsgType));
1023- MOCK_CONST_METHOD2(unpack_buffer, void(mg::BufferIpcMessage&, mg::Buffer const&));
1024- MOCK_METHOD0(connection_ipc_package, std::shared_ptr<mg::PlatformIPCPackage>());
1025- MOCK_METHOD2(platform_operation,
1026- mg::PlatformOperationMessage(unsigned int const, mg::PlatformOperationMessage const&));
1027-};
1028-
1029 struct NestedIPCOperations : testing::Test
1030 {
1031 NestedIPCOperations()
1032@@ -88,7 +80,7 @@
1033 }
1034 mtd::StubBuffer foreign_buffer{std::make_shared<ForeignBuffer>()};
1035 mtd::StubBuffer nested_buffer{std::make_shared<MockNestedBuffer>()};
1036- MockIpcOperations mock_ops;
1037+ mtd::MockPlatformIpcOperations mock_ops;
1038 };
1039 }
1040

Subscribers

People subscribed via source and target branches