Mir

Merge lp:~alan-griffiths/mir/bump-client-ABI into lp:mir

Proposed by Alan Griffiths
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 2610
Proposed branch: lp:~alan-griffiths/mir/bump-client-ABI
Merge into: lp:mir
Diff against target: 1190 lines (+87/-807)
17 files modified
debian/control (+2/-2)
debian/libmirclient9.install (+1/-1)
include/client/mir_toolkit/mir_client_library_drm.h (+0/-59)
include/client/mir_toolkit/mir_connection.h (+0/-6)
include/client/mir_toolkit/mir_screencast.h (+0/-7)
include/client/mir_toolkit/mir_surface.h (+0/-107)
src/client/CMakeLists.txt (+1/-1)
src/client/mir_connection.h (+0/-1)
src/client/mir_connection_api.cpp (+1/-175)
src/client/mir_screencast_api.cpp (+0/-5)
src/client/mir_surface_api.cpp (+1/-114)
src/client/symbols-debug.map (+1/-1)
src/client/symbols.map (+80/-129)
tests/acceptance-tests/test_client_library.cpp (+0/-45)
tests/client-language/c99.c (+0/-1)
tests/integration-tests/CMakeLists.txt (+0/-1)
tests/integration-tests/test_drm_auth_magic.cpp (+0/-152)
To merge this branch: bzr merge lp:~alan-griffiths/mir/bump-client-ABI
Reviewer Review Type Date Requested Status
Alexandros Frantzis (community) Approve
Daniel van Vugt Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+258769@code.launchpad.net

Commit message

Bump client ABI and delete ABI maintenance legacy

Description of the change

Bump client ABI and delete ABI maintenance legacy

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

That's the trouble with ABI breaks...

glmark2-es2-mir: symbol lookup error: glmark2-es2-mir: undefined symbol: mir_connection_create_surface_sync

Revision history for this message
Daniel van Vugt (vanvugt) wrote :
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Testing locally the archive glmark2-es2-mir correctly picks up the archive libmirclient.so.8 & libmircommon.so.3 and works with the built mir_performance_tests (which picks up the local ones).

So at least the code isn't broken.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Err http://ports.ubuntu.com/ubuntu-ports/ vivid/universe glmark2-data all 2014.03-0ubuntu3
  Temporary failure resolving 'ports.ubuntu.com'

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Managed to reproduce locally!!

Will investigate tomorrow

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Intermediate result of local investigations. It has something to do with the version of libmirclient.so.8 being picked up. If this comes from 0.13 everything is fine, if it comes from 0.12 then we see an error.

It is tempting to wait for 0.13 to hit achive and resubmit - but these problems tend to come back and bite.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

With a 0.12.1 version of libmirclient.so.8 the failure is:

Core was generated by `glmark2-es2-mir --fullscreen'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007fe8b318de26 in std::string::assign(char const*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
(gdb) bt
#0 0x00007fe8b318de26 in std::string::assign(char const*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1 0x00007fe8b3822871 in MirConnection::MirConnection(mir::client::ConnectionConfiguration&) () from /usr/lib/x86_64-linux-gnu/libmirclient.so.8
#2 0x00007fe8b3827679 in mir_connect () from /usr/lib/x86_64-linux-gnu/libmirclient.so.8
#3 0x00007fe8b38279fb in mir_connect_sync () from /usr/lib/x86_64-linux-gnu/libmirclient.so.8
#4 0x000000000050c402 in ?? ()
#5 0x000000000050aab3 in ?? ()
#6 0x0000000000406bf0 in ?? ()
#7 0x00007fe8b25e4a40 in __libc_start_main (main=0x406520, argc=2, argv=0x7fff42b48018, init=<optimised out>, fini=<optimised out>,
    rtld_fini=<optimised out>, stack_end=0x7fff42b48008) at libc-start.c:289
#8 0x000000000040842f in ?? ()
(gdb) f 2
#2 0x00007fe8b3827679 in mir_connect () from /usr/lib/x86_64-linux-gnu/libmirclient.so.8

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> That's bug 1341490

Well, maybe.

In this case it isn't directly bumping the client API that causes the failure.

What seems to be happening is that glmark2-es2-mir depends on libmirclient8 and the version of that in archive (0.12.1) depends on libmircommon3. As does libmirplatform6 and the corresponding drivers.

The version of libmirclient8 in 0.13.1 depends on libmircommon4 as does libmirplatform7 and the corresponding drivers.

When the libmirclient8 from 0.12.1 tries to load drivers that use libmircommon4 we get a segfault (I haven't quite traced the full mechanism yet - but loading libmircommon3 and libmircommon4 into the same process clearly "needs care" at best).

There are several ways to produce this crash:

  o Having 0.12.1 mir-platform-graphics-mesa2 installed alongside libmircommon3 is one.
    (That's what I believe happens in CI)

  o Building this branch and running mir_performance_tests via the wrapper link.
    (Ensure you don't have a recent libmirclient.so.8 in the libs directory)

Hacking test_glmark2-es2-mir.cpp to unsetenv("MIR_CLIENT_PLATFORM_PATH") actually "fixes" the second case, but is probably a bad idea (and doesn't fix CI which doesn't set that variable in the wrapper).

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Text conflict in src/client/symbols.map
1 conflicts encountered.

Revision history for this message
Daniel van Vugt (vanvugt) :
review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Might be related to bug 1415321 then. Unfortunately you need 0.13 in archive (and all downstreams like glmark2 rebuilt against it) to resolve that too :P

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Wow such diff, for a single ABI bump.

Not totally confident but it seems about right.

review: Approve
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

Great!

review: Approve

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 2015-05-19 21:34:34 +0000
3+++ debian/control 2015-06-01 09:48:29 +0000
4@@ -138,7 +138,7 @@
5 .
6 Contains header files required to build Mir servers.
7
8-Package: libmirclient8
9+Package: libmirclient9
10 Section: libs
11 Architecture: i386 amd64 armhf arm64
12 Multi-Arch: same
13@@ -156,7 +156,7 @@
14 Architecture: i386 amd64 armhf arm64
15 Multi-Arch: same
16 Pre-Depends: ${misc:Pre-Depends}
17-Depends: libmirclient8 (= ${binary:Version}),
18+Depends: libmirclient9 (= ${binary:Version}),
19 libmircommon-dev (= ${binary:Version}),
20 libprotobuf-dev (>= 2.4.1),
21 ${misc:Depends},
22
23=== renamed file 'debian/libmirclient8.install' => 'debian/libmirclient9.install'
24--- debian/libmirclient8.install 2015-03-31 02:35:42 +0000
25+++ debian/libmirclient9.install 2015-06-01 09:48:29 +0000
26@@ -1,1 +1,1 @@
27-usr/lib/*/libmirclient.so.8
28+usr/lib/*/libmirclient.so.9
29
30=== removed file 'include/client/mir_toolkit/mir_client_library_drm.h'
31--- include/client/mir_toolkit/mir_client_library_drm.h 2015-05-19 21:34:34 +0000
32+++ include/client/mir_toolkit/mir_client_library_drm.h 1970-01-01 00:00:00 +0000
33@@ -1,59 +0,0 @@
34-/*
35- * Copyright © 2012 Canonical Ltd.
36- *
37- * This program is free software: you can redistribute it and/or modify it
38- * under the terms of the GNU Lesser General Public License version 3,
39- * as published by the Free Software Foundation.
40- *
41- * This program is distributed in the hope that it will be useful,
42- * but WITHOUT ANY WARRANTY; without even the implied warranty of
43- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44- * GNU Lesser General Public License for more details.
45- *
46- * You should have received a copy of the GNU Lesser General Public License
47- * along with this program. If not, see <http://www.gnu.org/licenses/>.
48- */
49-
50-#ifndef MIR_CLIENT_LIBRARY_DRM_H_
51-#define MIR_CLIENT_LIBRARY_DRM_H_
52-
53-#include "mir_toolkit/mir_client_library.h"
54-
55-#ifdef __cplusplus
56-/**
57- * \addtogroup mir_toolkit
58- * @{
59- */
60-extern "C" {
61-#endif
62-
63-struct gbm_device;
64-
65-typedef void (*mir_drm_auth_magic_callback)(int status, void *context);
66-
67-/* Authenticates a DRM magic cookie */
68-MirWaitHandle *mir_connection_drm_auth_magic(MirConnection *connection,
69- unsigned int magic,
70- mir_drm_auth_magic_callback callback,
71- void *context)
72- __attribute__((__deprecated__("Use mir_connection_platform_operation() with operations from mir_toolkit/mesa/platform_operation.h")));
73-
74-/**
75- * Set the gbm_device to be used by the EGL implementation.
76- * This is required if the application needs to create EGLImages from
77- * gbm buffers objects created on that gbm device.
78- * \param [in] connection The connection
79- * \param [in] dev The gbm_device to set
80- * \return A non-zero value if the operation was successful,
81- * 0 otherwise
82- */
83-int mir_connection_drm_set_gbm_device(MirConnection* connection,
84- struct gbm_device* dev)
85- __attribute__((__deprecated__("Use mir_connection_platform_operation() with operations from mir_toolkit/mesa/platform_operation.h")));
86-
87-#ifdef __cplusplus
88-}
89-/**@}*/
90-#endif
91-
92-#endif /* MIR_CLIENT_LIBRARY_DRM_H_ */
93
94=== modified file 'include/client/mir_toolkit/mir_connection.h'
95--- include/client/mir_toolkit/mir_connection.h 2015-03-31 02:35:42 +0000
96+++ include/client/mir_toolkit/mir_connection.h 2015-06-01 09:48:29 +0000
97@@ -104,12 +104,6 @@
98 mir_lifecycle_event_callback callback, void* context);
99
100 /**
101- * \deprecated Use mir_connection_create_display_config
102- */
103-__attribute__((__deprecated__("Use mir_connection_create_display_config()")))
104-void mir_connection_get_display_info(MirConnection *connection, MirDisplayInfo *display_info);
105-
106-/**
107 * Query the display
108 * \warning return value must be destroyed via mir_display_config_destroy()
109 * \warning may return null if connection is invalid
110
111=== modified file 'include/client/mir_toolkit/mir_screencast.h'
112--- include/client/mir_toolkit/mir_screencast.h 2015-03-31 02:35:42 +0000
113+++ include/client/mir_toolkit/mir_screencast.h 2015-06-01 09:48:29 +0000
114@@ -56,13 +56,6 @@
115 */
116 MirBufferStream* mir_screencast_get_buffer_stream(MirScreencast *screencast);
117
118-/**
119- * Get a window type that can be used by EGL.
120- * \param [in] screencast The screencast
121- * \return An EGLNativeWindowType that the client can use
122- */
123-MirEGLNativeWindowType mir_screencast_egl_native_window(MirScreencast *screencast) __attribute__((__deprecated__("Use mir_screencast_get_buffer_stream and the corresponding mir_buffer_stream* function")));
124-
125 #ifdef __cplusplus
126 }
127 /**@}*/
128
129=== modified file 'include/client/mir_toolkit/mir_surface.h'
130--- include/client/mir_toolkit/mir_surface.h 2015-05-19 21:34:34 +0000
131+++ include/client/mir_toolkit/mir_surface.h 2015-06-01 09:48:29 +0000
132@@ -383,42 +383,6 @@
133 void mir_surface_spec_release(MirSurfaceSpec* spec);
134
135 /**
136- * Request a new Mir surface on the supplied connection with the supplied
137- * parameters. The returned handle remains valid until the surface has been
138- * released.
139- * \warning callback could be called from another thread. You must do any
140- * locking appropriate to protect your data accessed in the
141- * callback.
142- * \note This will soon be deprecated. Use the *_spec_for_* / mir_surface_create()
143- * two-stage process instead.
144- * \param [in] connection The connection
145- * \param [in] surface_parameters Request surface parameters
146- * \param [in] callback Callback function to be invoked when
147- * request completes
148- * \param [in,out] context User data passed to the callback function
149- * \return A handle that can be passed to
150- * mir_wait_for
151- */
152-MirWaitHandle *mir_connection_create_surface(
153- MirConnection *connection,
154- MirSurfaceParameters const *surface_parameters,
155- mir_surface_callback callback,
156- void *context) __attribute__((__deprecated__("Use mir_surface_create()")));
157-
158-/**
159- * Create a surface like in mir_connection_create_surface(), but also wait for
160- * creation to complete and return the resulting surface.
161- * \note This will soon be deprecated. Use the create_spec_for/mir_surface_create()
162- * two-stage process instead.
163- * \param [in] connection The connection
164- * \param [in] params Parameters describing the desired surface
165- * \return The resulting surface
166- */
167-MirSurface *mir_connection_create_surface_sync(
168- MirConnection *connection,
169- MirSurfaceParameters const *params) __attribute__((__deprecated__("Use mir_surface_create_sync()")));
170-
171-/**
172 * Set the event handler to be called when events arrive for a surface.
173 * \warning event_handler could be called from another thread. You must do
174 * any locking appropriate to protect your data accessed in the
175@@ -442,13 +406,6 @@
176 MirBufferStream* mir_surface_get_buffer_stream(MirSurface *surface);
177
178 /**
179- * Get a window type that can be used for OpenGL ES 2.0 acceleration.
180- * \param [in] surface The surface
181- * \return An EGLNativeWindowType that the client can use
182- */
183-MirEGLNativeWindowType mir_surface_get_egl_native_window(MirSurface *surface) __attribute__((__deprecated__("Use mir_surface_get_buffer_stream and the corresponding mir_buffer_stream* function")));
184-
185-/**
186 * Test for a valid surface
187 * \param [in] surface The surface
188 * \return True if the supplied surface is valid, or
189@@ -476,58 +433,6 @@
190 void mir_surface_get_parameters(MirSurface *surface, MirSurfaceParameters *parameters);
191
192 /**
193- * Get the underlying platform type so the buffer obtained in "raw" representation
194- * in mir_surface_get_current_buffer() can be understood
195- * \pre The surface is valid
196- * \param [in] surface The surface
197- * \return One of mir_platform_type_android or mir_platform_type_gbm
198- */
199-MirPlatformType mir_surface_get_platform_type(MirSurface *surface) __attribute__((__deprecated__("Use mir_surface_get_buffer_stream and the corresponding mir_buffer_stream* function")));
200-
201-/**
202- * Get a surface's buffer in "raw" representation.
203- * \pre The surface is valid
204- * \param [in] surface The surface
205- * \param [out] buffer_package Structure to be populated
206- */
207-void mir_surface_get_current_buffer(MirSurface *surface, MirNativeBuffer **buffer_package) __attribute__((__deprecated__("Use mir_surface_get_buffer_stream and the corresponding mir_buffer_stream* function")));
208-
209-/**
210- * Get a surface's graphics_region, i.e., map the graphics buffer to main
211- * memory.
212- * \pre The surface is valid
213- * \param [in] surface The surface
214- * \param [out] graphics_region Structure to be populated
215- */
216-void mir_surface_get_graphics_region(
217- MirSurface *surface,
218- MirGraphicsRegion *graphics_region) __attribute__((__deprecated__("Use mir_surface_get_buffer_stream and the corresponding mir_buffer_stream* function")));
219- /**
220- * Advance a surface's buffer. The returned handle remains valid until the next
221- * call to mir_surface_swap_buffers, until the surface has been released or the
222- * connection to the server has been released.
223- * \warning callback could be called from another thread. You must do any
224- * locking appropriate to protect your data accessed in the
225- * callback.
226- * \param [in] surface The surface
227- * \param [in] callback Callback function to be invoked when the request
228- * completes
229- * \param [in,out] context User data passed to the callback function
230- * \return A handle that can be passed to mir_wait_for
231- */
232-MirWaitHandle *mir_surface_swap_buffers(
233- MirSurface *surface,
234- mir_surface_callback callback,
235- void *context) __attribute__((__deprecated__("Use mir_surface_get_buffer_stream and the corresponding mir_buffer_stream* function")));
236-
237-/**
238- * Advance a surface's buffer as in mir_surface_swap_buffers(), but also wait
239- * for the operation to complete.
240- * \param [in] surface The surface whose buffer to advance
241- */
242-void mir_surface_swap_buffers_sync(MirSurface *surface) __attribute__((__deprecated__("Use mir_surface_get_buffer_stream and the corresponding mir_buffer_stream* function")));
243-
244-/**
245 * Release the supplied surface and any associated buffer. The returned wait
246 * handle remains valid until the connection to the server is released.
247 * \warning callback could be called from another thread. You must do any
248@@ -552,18 +457,6 @@
249 void mir_surface_release_sync(MirSurface *surface);
250
251 /**
252- * \deprecated Use mir_debug_surface_id()
253- */
254-__attribute__((__deprecated__("Use mir_debug_surface_id()")))
255-int mir_surface_get_id(MirSurface *surface);
256-
257-/**
258- * \deprecated Use the mir_connection_create_spec_for_xxx family of APIs
259- */
260-__attribute__((__deprecated__("Use mir_connection_create_spec_for_xxx()")))
261-MirWaitHandle* mir_surface_set_type(MirSurface *surface, MirSurfaceType type);
262-
263-/**
264 * Get the type (purpose) of a surface.
265 * \param [in] surface The surface to query
266 * \return The type of the surface
267
268=== modified file 'src/client/CMakeLists.txt'
269--- src/client/CMakeLists.txt 2015-05-19 21:34:34 +0000
270+++ src/client/CMakeLists.txt 2015-06-01 09:48:29 +0000
271@@ -23,7 +23,7 @@
272 ${DRM_INCLUDE_DIRS}
273 )
274
275-set(MIRCLIENT_ABI 8)
276+set(MIRCLIENT_ABI 9)
277 set(symbol_map ${CMAKE_SOURCE_DIR}/src/client/symbols.map)
278
279 add_definitions(-DMIR_CLIENT_PLATFORM_PATH="${MIR_CLIENT_PLATFORM_PATH}/")
280
281=== modified file 'src/client/mir_connection.h'
282--- src/client/mir_connection.h 2015-05-15 07:32:33 +0000
283+++ src/client/mir_connection.h 2015-06-01 09:48:29 +0000
284@@ -29,7 +29,6 @@
285 #include "mir_protobuf.pb.h"
286
287 #include "mir_toolkit/mir_client_library.h"
288-#include "mir_toolkit/mir_client_library_drm.h"
289
290 #include "mir/client_platform.h"
291 #include "mir/client_context.h"
292
293=== modified file 'src/client/mir_connection_api.cpp'
294--- src/client/mir_connection_api.cpp 2015-03-31 02:35:42 +0000
295+++ src/client/mir_connection_api.cpp 2015-06-01 09:48:29 +0000
296@@ -20,7 +20,6 @@
297
298 #include "mir_connection_api.h"
299 #include "mir_toolkit/mir_connection.h"
300-#include "mir_toolkit/mir_client_library_drm.h"
301 #include "mir/default_configuration.h"
302 #include "mir/raii.h"
303
304@@ -203,55 +202,6 @@
305 connection->register_lifecycle_event_callback(callback, context);
306 }
307
308-//TODO: DEPRECATED: remove this function
309-void mir_connection_get_display_info(
310- MirConnection* connection,
311- MirDisplayInfo* display_info)
312-{
313- auto const config = mir::raii::deleter_for(
314- mir_connection_create_display_config(connection),
315- &mir_display_config_destroy);
316-
317- if (config->num_outputs < 1)
318- return;
319-
320- MirDisplayOutput* state = nullptr;
321- // We can't handle more than one display, so just populate based on the first
322- // active display we find.
323- for (unsigned int i = 0; i < config->num_outputs; ++i)
324- {
325- if (config->outputs[i].used && config->outputs[i].connected &&
326- config->outputs[i].current_mode < config->outputs[i].num_modes)
327- {
328- state = &config->outputs[i];
329- break;
330- }
331- }
332- // Oh, oh! No connected outputs?!
333- if (state == nullptr)
334- {
335- memset(display_info, 0, sizeof(*display_info));
336- return;
337- }
338-
339- MirDisplayMode mode = state->modes[state->current_mode];
340-
341- display_info->width = mode.horizontal_resolution;
342- display_info->height = mode.vertical_resolution;
343-
344- unsigned int format_items;
345- if (state->num_output_formats > mir_supported_pixel_format_max)
346- format_items = mir_supported_pixel_format_max;
347- else
348- format_items = state->num_output_formats;
349-
350- display_info->supported_pixel_format_items = format_items;
351- for(auto i=0u; i < format_items; i++)
352- {
353- display_info->supported_pixel_format[i] = state->output_formats[i];
354- }
355-}
356-
357 MirDisplayConfiguration* mir_connection_create_display_config(
358 MirConnection* connection)
359 {
360@@ -305,20 +255,7 @@
361 connection->available_surface_formats(formats, format_size, *num_valid_formats);
362 }
363
364-extern "C"
365-{
366-MirWaitHandle* new_mir_connection_platform_operation(
367- MirConnection* connection,
368- MirPlatformMessage const* request,
369- mir_platform_operation_callback callback, void* context);
370-MirWaitHandle* old_mir_connection_platform_operation(
371- MirConnection* connection, int /* opcode */,
372- MirPlatformMessage const* request,
373- mir_platform_operation_callback callback, void* context);
374-}
375-
376-__asm__(".symver new_mir_connection_platform_operation,mir_connection_platform_operation@@MIR_CLIENT_8.3");
377-MirWaitHandle* new_mir_connection_platform_operation(
378+MirWaitHandle* mir_connection_platform_operation(
379 MirConnection* connection,
380 MirPlatformMessage const* request,
381 mir_platform_operation_callback callback, void* context)
382@@ -332,115 +269,4 @@
383 MIR_LOG_UNCAUGHT_EXCEPTION(ex);
384 return nullptr;
385 }
386-
387-}
388-
389-// TODO: Remove when we bump so name
390-__asm__(".symver old_mir_connection_platform_operation,mir_connection_platform_operation@MIR_CLIENT_8");
391-MirWaitHandle* old_mir_connection_platform_operation(
392- MirConnection* connection, int /* opcode */,
393- MirPlatformMessage const* request,
394- mir_platform_operation_callback callback, void* context)
395-{
396- return new_mir_connection_platform_operation(connection, request, callback, context);
397-}
398-
399-/**************************
400- * DRM specific functions *
401- **************************/
402-
403-namespace
404-{
405-
406-struct AuthMagicPlatformOperationContext
407-{
408- mir_drm_auth_magic_callback callback;
409- void* context;
410-};
411-
412-void platform_operation_to_auth_magic_callback(
413- MirConnection*, MirPlatformMessage* response, void* context)
414-{
415- auto const response_msg = mir::raii::deleter_for(
416- response,
417- &mir_platform_message_release);
418- auto const auth_magic_context =
419- std::unique_ptr<AuthMagicPlatformOperationContext>{
420- static_cast<AuthMagicPlatformOperationContext*>(context)};
421-
422- auto response_data = mir_platform_message_get_data(response_msg.get());
423- MirMesaAuthMagicResponse auth_response{-1};
424-
425- if (response_data.size == sizeof(auth_response))
426- std::memcpy(&auth_response, response_data.data, response_data.size);
427-
428- auth_magic_context->callback(auth_response.status, auth_magic_context->context);
429-}
430-
431-void assign_set_gbm_device_status(
432- MirConnection*, MirPlatformMessage* response, void* context)
433-{
434- auto const response_msg = mir::raii::deleter_for(
435- response,
436- &mir_platform_message_release);
437-
438- auto const response_data = mir_platform_message_get_data(response_msg.get());
439- MirMesaSetGBMDeviceResponse set_gbm_device_response{-1};
440-
441- if (response_data.size == sizeof(set_gbm_device_response))
442- std::memcpy(&set_gbm_device_response, response_data.data, response_data.size);
443-
444- auto status_ptr = static_cast<int*>(context);
445- *status_ptr = set_gbm_device_response.status;
446-}
447-
448-}
449-
450-MirWaitHandle* mir_connection_drm_auth_magic(MirConnection* connection,
451- unsigned int magic,
452- mir_drm_auth_magic_callback callback,
453- void* context)
454-{
455- auto const msg = mir::raii::deleter_for(
456- mir_platform_message_create(MirMesaPlatformOperation::auth_magic),
457- &mir_platform_message_release);
458-
459- auto const auth_magic_op_context =
460- new AuthMagicPlatformOperationContext{callback, context};
461-
462- MirMesaAuthMagicRequest request;
463- request.magic = magic;
464-
465- mir_platform_message_set_data(msg.get(), &request, sizeof(request));
466-
467- return new_mir_connection_platform_operation(
468- connection,
469- msg.get(),
470- platform_operation_to_auth_magic_callback,
471- auth_magic_op_context);
472-}
473-
474-int mir_connection_drm_set_gbm_device(MirConnection* connection,
475- struct gbm_device* gbm_dev)
476-{
477- MirMesaSetGBMDeviceRequest const request{gbm_dev};
478-
479- auto const msg = mir::raii::deleter_for(
480- mir_platform_message_create(MirMesaPlatformOperation::set_gbm_device),
481- &mir_platform_message_release);
482-
483- mir_platform_message_set_data(msg.get(), &request, sizeof(request));
484-
485- static int const success{0};
486- int status{-1};
487-
488- auto wh = new_mir_connection_platform_operation(
489- connection,
490- msg.get(),
491- assign_set_gbm_device_status,
492- &status);
493-
494- mir_wait_for(wh);
495-
496- return status == success;
497 }
498
499=== modified file 'src/client/mir_screencast_api.cpp'
500--- src/client/mir_screencast_api.cpp 2015-03-31 02:35:42 +0000
501+++ src/client/mir_screencast_api.cpp 2015-06-01 09:48:29 +0000
502@@ -86,11 +86,6 @@
503 delete screencast;
504 }
505
506-MirEGLNativeWindowType mir_screencast_egl_native_window(MirScreencast* screencast)
507-{
508- return reinterpret_cast<MirEGLNativeWindowType>(mir_buffer_stream_get_egl_native_window(mir_screencast_get_buffer_stream(screencast)));
509-}
510-
511 MirBufferStream *mir_screencast_get_buffer_stream(MirScreencast *screencast)
512 try
513 {
514
515=== modified file 'src/client/mir_surface_api.cpp'
516--- src/client/mir_surface_api.cpp 2015-05-19 21:34:34 +0000
517+++ src/client/mir_surface_api.cpp 2015-06-01 09:48:29 +0000
518@@ -229,57 +229,14 @@
519 delete spec;
520 }
521
522-MirWaitHandle* mir_connection_create_surface(
523- MirConnection* connection,
524- MirSurfaceParameters const* params,
525- mir_surface_callback callback,
526- void* context)
527-{
528- MirSurfaceSpec spec{connection, *params};
529- return mir_surface_create(&spec, callback, context);
530-}
531-
532-MirSurface* mir_connection_create_surface_sync(
533- MirConnection* connection,
534- MirSurfaceParameters const* params)
535-{
536- MirSurfaceSpec spec{connection, *params};
537- return mir_surface_create_sync(&spec);
538-}
539-
540-__asm__(".symver new_mir_surface_set_event_handler,mir_surface_set_event_handler@@MIR_CLIENT_8.4");
541 extern "C"
542-void new_mir_surface_set_event_handler(MirSurface* surface,
543+void mir_surface_set_event_handler(MirSurface* surface,
544 mir_surface_event_callback callback,
545 void* context)
546 {
547 surface->set_event_handler(callback, context);
548 }
549
550-// Deprecated but ABI backward compatible --->
551-typedef struct MirEventDelegate
552-{
553- mir_surface_event_callback callback;
554- void *context;
555-} MirEventDelegate;
556-
557-__asm__(".symver old_mir_surface_set_event_handler,mir_surface_set_event_handler@MIR_CLIENT_8");
558-extern "C"
559-void old_mir_surface_set_event_handler(MirSurface* surface,
560- MirEventDelegate const* delegate)
561-{
562- if (delegate)
563- surface->set_event_handler(delegate->callback, delegate->context);
564- else
565- surface->set_event_handler(nullptr, nullptr);
566-}
567-// <--- Deprecated
568-
569-MirEGLNativeWindowType mir_surface_get_egl_native_window(MirSurface* surface)
570-{
571- return mir_buffer_stream_get_egl_native_window(
572- mir_surface_get_buffer_stream(surface));
573-}
574
575 bool mir_surface_is_valid(MirSurface* surface)
576 {
577@@ -296,57 +253,6 @@
578 *parameters = surface->get_parameters();
579 }
580
581-MirPlatformType mir_surface_get_platform_type(MirSurface* surface)
582-{
583- return mir_buffer_stream_get_platform_type(mir_surface_get_buffer_stream(surface));
584-}
585-
586-void mir_surface_get_current_buffer(MirSurface* surface, MirNativeBuffer** buffer_package_out)
587-{
588- mir_buffer_stream_get_current_buffer(mir_surface_get_buffer_stream(surface), buffer_package_out);
589-}
590-
591-void mir_surface_get_graphics_region(MirSurface* surface, MirGraphicsRegion* graphics_region)
592-{
593- mir_buffer_stream_get_graphics_region(mir_surface_get_buffer_stream(surface), graphics_region);
594-}
595-
596-namespace
597-{
598-void buffer_to_surface_thunk(MirBufferStream* /* stream */, void* context)
599-{
600- auto cb = static_cast<std::function<void()>*>(context);
601- (*cb)();
602-}
603-}
604-
605-MirWaitHandle* mir_surface_swap_buffers(
606- MirSurface* surface,
607- mir_surface_callback callback,
608- void* context)
609-try
610-{
611- auto shim_callback = new std::function<void()>;
612- *shim_callback = [surface, callback, context, shim_callback] ()
613- {
614- if (callback)
615- callback(surface, context);
616- delete shim_callback;
617- };
618- return mir_buffer_stream_swap_buffers(mir_surface_get_buffer_stream(surface), buffer_to_surface_thunk, shim_callback);
619-}
620-catch (std::exception const& ex)
621-{
622- MIR_LOG_UNCAUGHT_EXCEPTION(ex);
623- return nullptr;
624-}
625-
626-void mir_surface_swap_buffers_sync(MirSurface* surface)
627-{
628- mir_buffer_stream_swap_buffers_sync(
629- mir_surface_get_buffer_stream(surface));
630-}
631-
632 MirWaitHandle* mir_surface_release(
633 MirSurface* surface,
634 mir_surface_callback callback, void* context)
635@@ -369,25 +275,6 @@
636 nullptr));
637 }
638
639-int mir_surface_get_id(MirSurface* /*surface*/)
640-{
641- return 0;
642-}
643-
644-MirWaitHandle* mir_surface_set_type(MirSurface* surf,
645- MirSurfaceType type)
646-{
647- try
648- {
649- return surf ? surf->configure(mir_surface_attrib_type, type) : nullptr;
650- }
651- catch (std::exception const& ex)
652- {
653- MIR_LOG_UNCAUGHT_EXCEPTION(ex);
654- return nullptr;
655- }
656-}
657-
658 MirSurfaceType mir_surface_get_type(MirSurface* surf)
659 {
660 MirSurfaceType type = mir_surface_type_normal;
661
662=== modified file 'src/client/symbols-debug.map'
663--- src/client/symbols-debug.map 2015-03-31 02:35:42 +0000
664+++ src/client/symbols-debug.map 2015-06-01 09:48:29 +0000
665@@ -1,4 +1,4 @@
666-MIR_CLIENT_DEBUG_8 {
667+MIR_CLIENT_DEBUG_9 {
668 global:
669 mir_debug_*;
670 local: *;
671
672=== modified file 'src/client/symbols.map'
673--- src/client/symbols.map 2015-05-21 19:25:51 +0000
674+++ src/client/symbols.map 2015-06-01 09:48:29 +0000
675@@ -1,23 +1,34 @@
676-MIR_CLIENT_8 {
677+MIR_CLIENT_9 {
678 global:
679 mir_arrow_cursor_name;
680+ mir_buffer_stream_get_current_buffer;
681+ mir_buffer_stream_get_egl_native_window;
682+ mir_buffer_stream_get_graphics_region;
683+ mir_buffer_stream_get_platform_type;
684+ mir_buffer_stream_is_valid;
685+ mir_buffer_stream_release;
686+ mir_buffer_stream_release_sync;
687+ mir_buffer_stream_swap_buffers;
688+ mir_buffer_stream_swap_buffers_sync;
689 mir_busy_cursor_name;
690 mir_caret_cursor_name;
691 mir_closed_hand_cursor_name;
692 mir_connect;
693 mir_connection_api_impl;
694 mir_connection_apply_display_config;
695+ mir_connection_create_buffer_stream;
696+ mir_connection_create_buffer_stream_sync;
697 mir_connection_create_display_config;
698 mir_connection_create_prompt_session_sync;
699 mir_connection_create_screencast_sync;
700+ mir_connection_create_spec_for_changes;
701+ mir_connection_create_spec_for_dialog;
702 mir_connection_create_spec_for_input_method;
703+ mir_connection_create_spec_for_menu;
704 mir_connection_create_spec_for_modal_dialog;
705- mir_connection_create_surface;
706- mir_connection_create_surface_sync;
707- mir_connection_drm_auth_magic;
708- mir_connection_drm_set_gbm_device;
709+ mir_connection_create_spec_for_normal_surface;
710+ mir_connection_create_spec_for_tooltip;
711 mir_connection_get_available_surface_formats;
712- mir_connection_get_display_info;
713 mir_connection_get_egl_native_display;
714 mir_connection_get_error_message;
715 mir_connection_get_platform;
716@@ -28,123 +39,29 @@
717 mir_connection_set_lifecycle_event_callback;
718 mir_connect_sync;
719 mir_cursor_configuration_destroy;
720+ mir_cursor_configuration_from_buffer_stream;
721 mir_cursor_configuration_from_name;
722 mir_default_cursor_name;
723 mir_diagonal_resize_bottom_to_top_cursor_name;
724 mir_diagonal_resize_top_to_bottom_cursor_name;
725 mir_disabled_cursor_name;
726 mir_display_config_destroy;
727- mir_horizontal_resize_cursor_name;
728- mir_hsplit_resize_cursor_name;
729- mir_omnidirectional_resize_cursor_name;
730- mir_open_hand_cursor_name;
731- mir_platform_message_create;
732- mir_platform_message_get_data;
733- mir_platform_message_get_fds;
734- mir_platform_message_get_opcode;
735- mir_platform_message_release;
736- mir_platform_message_set_data;
737- mir_platform_message_set_fds;
738- mir_pointing_hand_cursor_name;
739- mir_prompt_session_error_message;
740- mir_prompt_session_is_valid;
741- mir_prompt_session_new_fds_for_prompt_providers;
742- mir_prompt_session_release_sync;
743- mir_screencast_egl_native_window;
744- mir_screencast_release_sync;
745- mir_surface_configure_cursor;
746- mir_surface_get_current_buffer;
747- mir_surface_get_dpi;
748- mir_surface_get_egl_native_window;
749- mir_surface_get_error_message;
750- mir_surface_get_focus;
751- mir_surface_get_graphics_region;
752- mir_surface_get_id;
753- mir_surface_get_orientation;
754- mir_surface_get_parameters;
755- mir_surface_get_platform_type;
756- mir_surface_get_state;
757- mir_surface_get_swapinterval;
758- mir_surface_get_type;
759- mir_surface_get_visibility;
760- mir_surface_is_valid;
761- mir_surface_release;
762- mir_surface_release_sync;
763- mir_surface_set_event_handler;
764- mir_surface_set_state;
765- mir_surface_set_swapinterval;
766- mir_surface_set_type;
767- mir_surface_spec_release;
768- mir_surface_swap_buffers;
769- mir_surface_swap_buffers_sync;
770- mir_vertical_resize_cursor_name;
771- mir_vsplit_resize_cursor_name;
772- mir_wait_for;
773- mir_wait_for_one;
774- local: *;
775-};
776-MIR_CLIENT_8.1 {
777- global:
778- mir_connection_create_spec_for_normal_surface;
779- mir_surface_create;
780- mir_surface_create_sync;
781- mir_surface_spec_set_buffer_usage;
782- mir_surface_spec_set_fullscreen_on_output;
783- mir_surface_spec_set_height;
784- mir_surface_spec_set_name;
785- mir_surface_spec_set_pixel_format;
786- mir_surface_spec_set_width;
787-} MIR_CLIENT_8;
788-
789-MIR_CLIENT_8.2 {
790- global:
791- mir_surface_get_preferred_orientation;
792- mir_surface_set_preferred_orientation;
793- mir_surface_spec_set_preferred_orientation;
794-} MIR_CLIENT_8.1;
795-
796-MIR_CLIENT_8.3 { # New in Mir 0.11
797- global:
798- mir_connection_create_spec_for_dialog;
799- mir_connection_create_spec_for_menu;
800- mir_connection_create_spec_for_tooltip;
801- mir_connection_platform_operation;
802-} MIR_CLIENT_8.2;
803-
804-MIR_CLIENT_8.4 { # New in Mir 0.13
805- global:
806- mir_connection_create_spec_for_changes;
807- mir_surface_apply_spec;
808- mir_surface_set_event_handler;
809- mir_default_cursor_name;
810- mir_disabled_cursor_name;
811- mir_arrow_cursor_name;
812- mir_busy_cursor_name;
813- mir_caret_cursor_name;
814- mir_pointing_hand_cursor_name;
815- mir_open_hand_cursor_name;
816- mir_closed_hand_cursor_name;
817- mir_horizontal_resize_cursor_name;
818- mir_vertical_resize_cursor_name;
819- mir_diagonal_resize_bottom_to_top_cursor_name;
820- mir_diagonal_resize_top_to_bottom_cursor_name;
821- mir_omnidirectional_resize_cursor_name;
822- mir_vsplit_resize_cursor_name;
823- mir_hsplit_resize_cursor_name;
824 mir_event_get_close_surface_event;
825+ mir_event_get_input_configuration_event;
826 mir_event_get_input_event;
827 mir_event_get_keymap_event;
828 mir_event_get_orientation_event;
829 mir_event_get_prompt_session_event;
830 mir_event_get_resize_event;
831 mir_event_get_surface_event;
832- mir_event_get_input_configuration_event;
833 mir_event_get_type;
834+ mir_event_ref;
835+ mir_event_unref;
836+ mir_horizontal_resize_cursor_name;
837+ mir_hsplit_resize_cursor_name;
838 mir_input_configuration_event_get_action;
839+ mir_input_configuration_event_get_device_id;
840 mir_input_configuration_event_get_time;
841- mir_input_configuration_event_get_device_id;
842- mir_event_ref;
843- mir_event_unref;
844 mir_input_event_get_device_id;
845 mir_input_event_get_event_time;
846 mir_input_event_get_keyboard_event;
847@@ -156,50 +73,84 @@
848 mir_keyboard_event_modifiers;
849 mir_keyboard_event_scan_code;
850 mir_keymap_event_get_rules;
851+ mir_omnidirectional_resize_cursor_name;
852+ mir_open_hand_cursor_name;
853 mir_orientation_event_get_direction;
854+ mir_platform_message_create;
855+ mir_platform_message_get_data;
856+ mir_platform_message_get_fds;
857+ mir_platform_message_get_opcode;
858+ mir_platform_message_release;
859+ mir_platform_message_set_data;
860+ mir_platform_message_set_fds;
861 mir_pointer_event_action;
862 mir_pointer_event_axis_value;
863+ mir_pointer_event_buttons;
864 mir_pointer_event_button_state;
865 mir_pointer_event_modifiers;
866+ mir_pointing_hand_cursor_name;
867+ mir_prompt_session_error_message;
868 mir_prompt_session_event_get_state;
869+ mir_prompt_session_is_valid;
870+ mir_prompt_session_new_fds_for_prompt_providers;
871+ mir_prompt_session_release_sync;
872 mir_resize_event_get_height;
873 mir_resize_event_get_width;
874+ mir_screencast_get_buffer_stream;
875+ mir_screencast_release_sync;
876+ mir_surface_apply_spec;
877+ mir_surface_configure_cursor;
878+ mir_surface_create;
879+ mir_surface_create_sync;
880 mir_surface_event_get_attribute;
881 mir_surface_event_get_attribute_value;
882+ mir_surface_get_buffer_stream;
883+ mir_surface_get_dpi;
884+ mir_surface_get_error_message;
885+ mir_surface_get_focus;
886+ mir_surface_get_orientation;
887+ mir_surface_get_parameters;
888+ mir_surface_get_preferred_orientation;
889+ mir_surface_get_state;
890+ mir_surface_get_swapinterval;
891+ mir_surface_get_type;
892+ mir_surface_get_visibility;
893+ mir_surface_is_valid;
894+ mir_surface_release;
895+ mir_surface_release_sync;
896+ mir_surface_set_event_handler;
897+ mir_surface_set_preferred_orientation;
898+ mir_surface_set_state;
899 mir_surface_set_swapinterval;
900+ mir_surface_spec_release;
901+ mir_surface_spec_set_buffer_usage;
902+ mir_surface_spec_set_fullscreen_on_output;
903+ mir_surface_spec_set_height;
904 mir_surface_spec_set_height_increment;
905 mir_surface_spec_set_max_aspect_ratio;
906+ mir_surface_spec_set_max_height;
907 mir_surface_spec_set_max_width;
908- mir_surface_spec_set_max_height;
909 mir_surface_spec_set_min_aspect_ratio;
910+ mir_surface_spec_set_min_height;
911 mir_surface_spec_set_min_width;
912- mir_surface_spec_set_min_height;
913+ mir_surface_spec_set_name;
914+ mir_surface_spec_set_pixel_format;
915+ mir_surface_spec_set_preferred_orientation;
916+ mir_surface_spec_set_width;
917 mir_surface_spec_set_width_increment;
918- mir_surface_swap_buffers;
919- mir_surface_swap_buffers_sync;
920- mir_touch_event_modifiers;
921 mir_touch_event_action;
922 mir_touch_event_axis_value;
923+ mir_touch_event_id;
924+ mir_touch_event_modifiers;
925 mir_touch_event_point_count;
926- mir_touch_event_id;
927 mir_touch_event_tooltype;
928- mir_surface_get_buffer_stream;
929- mir_buffer_stream_get_current_buffer;
930- mir_buffer_stream_get_platform_type;
931- mir_buffer_stream_swap_buffers;
932- mir_buffer_stream_swap_buffers_sync;
933- mir_screencast_get_buffer_stream;
934- mir_buffer_stream_get_egl_native_window;
935- mir_buffer_stream_get_graphics_region;
936- mir_connection_create_buffer_stream_sync;
937- mir_cursor_configuration_from_buffer_stream;
938- mir_buffer_stream_release;
939- mir_buffer_stream_release_sync;
940- mir_buffer_stream_is_valid;
941- mir_pointer_event_buttons; # Move to 8.5
942-} MIR_CLIENT_8.3;
943+ mir_vertical_resize_cursor_name;
944+ mir_vsplit_resize_cursor_name;
945+ mir_wait_for;
946+ mir_wait_for_one;
947+};
948
949-MIR_CLIENT_DETAIL_8 {
950+MIR_CLIENT_DETAIL_9 {
951 global:
952 extern "C++" {
953 mir::events::make_event*;
954
955=== modified file 'tests/acceptance-tests/test_client_library.cpp'
956--- tests/acceptance-tests/test_client_library.cpp 2015-05-19 21:34:34 +0000
957+++ tests/acceptance-tests/test_client_library.cpp 2015-06-01 09:48:29 +0000
958@@ -192,51 +192,6 @@
959 mir_connection_release(connection);
960 }
961
962-#pragma GCC diagnostic push
963-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
964-
965-TEST_F(ClientLibrary, can_set_surface_types)
966-{
967- mir_wait_for(mir_connect(new_connection().c_str(), __PRETTY_FUNCTION__, connection_callback, this));
968-
969- auto const spec =
970- mir_connection_create_spec_for_normal_surface(
971- connection, 640, 480, mir_pixel_format_abgr_8888);
972-
973- mir_wait_for(mir_surface_create(spec, create_surface_callback, this));
974- mir_surface_spec_release(spec);
975-
976- EXPECT_THAT(mir_surface_get_type(surface), Eq(mir_surface_type_normal));
977-
978- mir_wait_for(mir_surface_set_type(surface, mir_surface_type_freestyle));
979- EXPECT_THAT(mir_surface_get_type(surface), Eq(mir_surface_type_freestyle));
980-
981- mir_wait_for(mir_surface_set_type(surface, static_cast<MirSurfaceType>(999)));
982- EXPECT_THAT(mir_surface_get_type(surface), Eq(mir_surface_type_freestyle));
983-
984- mir_wait_for(mir_surface_set_type(surface, mir_surface_type_dialog));
985- EXPECT_THAT(mir_surface_get_type(surface), Eq(mir_surface_type_dialog));
986-
987- mir_wait_for(mir_surface_set_type(surface, static_cast<MirSurfaceType>(888)));
988- EXPECT_THAT(mir_surface_get_type(surface), Eq(mir_surface_type_dialog));
989-
990- // Stress-test synchronization logic with some flooding
991- for (int i = 0; i < 100; i++)
992- {
993- mir_surface_set_type(surface, mir_surface_type_normal);
994- mir_surface_set_type(surface, mir_surface_type_utility);
995- mir_surface_set_type(surface, mir_surface_type_dialog);
996- mir_surface_set_type(surface, mir_surface_type_gloss);
997- mir_surface_set_type(surface, mir_surface_type_freestyle);
998- mir_wait_for(mir_surface_set_type(surface, mir_surface_type_menu));
999- ASSERT_THAT(mir_surface_get_type(surface), Eq(mir_surface_type_menu));
1000- }
1001-
1002- mir_wait_for(mir_surface_release(surface, release_surface_callback, this));
1003- mir_connection_release(connection);
1004-}
1005-#pragma GCC diagnostic pop
1006-
1007 TEST_F(ClientLibrary, can_set_surface_state)
1008 {
1009 connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__);
1010
1011=== modified file 'tests/client-language/c99.c'
1012--- tests/client-language/c99.c 2015-01-21 07:34:50 +0000
1013+++ tests/client-language/c99.c 2015-06-01 09:48:29 +0000
1014@@ -21,7 +21,6 @@
1015 */
1016
1017 #include "mir_toolkit/mir_client_library.h"
1018-#include "mir_toolkit/mir_client_library_drm.h"
1019 #include "mir_toolkit/debug/surface.h"
1020 #include "mir_toolkit/event.h"
1021
1022
1023=== modified file 'tests/integration-tests/CMakeLists.txt'
1024--- tests/integration-tests/CMakeLists.txt 2015-05-19 21:34:34 +0000
1025+++ tests/integration-tests/CMakeLists.txt 2015-06-01 09:48:29 +0000
1026@@ -61,7 +61,6 @@
1027 ${CMAKE_SOURCE_DIR}
1028 )
1029 add_subdirectory(graphics/mesa)
1030- list(APPEND INTEGRATION_TESTS_SRCS test_drm_auth_magic.cpp)
1031 endif()
1032
1033 link_directories(${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
1034
1035=== removed file 'tests/integration-tests/test_drm_auth_magic.cpp'
1036--- tests/integration-tests/test_drm_auth_magic.cpp 2015-05-19 21:34:34 +0000
1037+++ tests/integration-tests/test_drm_auth_magic.cpp 1970-01-01 00:00:00 +0000
1038@@ -1,152 +0,0 @@
1039-/*
1040- * Copyright © 2012 Canonical Ltd.
1041- *
1042- * This program is free software: you can redistribute it and/or modify
1043- * it under the terms of the GNU General Public License version 3 as
1044- * published by the Free Software Foundation.
1045- *
1046- * This program is distributed in the hope that it will be useful,
1047- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1048- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1049- * GNU General Public License for more details.
1050- *
1051- * You should have received a copy of the GNU General Public License
1052- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1053- *
1054- * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
1055- */
1056-
1057-#include "mir/graphics/display.h"
1058-#include "mir/graphics/platform_ipc_package.h"
1059-#include "mir/graphics/buffer_ipc_message.h"
1060-#include "mir/graphics/buffer_basic.h"
1061-
1062-#include <boost/exception/errinfo_errno.hpp>
1063-#include <boost/throw_exception.hpp>
1064-
1065-#include "mir_test_doubles/stub_buffer_allocator.h"
1066-#include "mir_test_doubles/null_platform.h"
1067-#include "mir_test_framework/display_server_test_fixture.h"
1068-
1069-#include "mir_toolkit/mir_client_library.h"
1070-#include "mir_toolkit/mir_client_library_drm.h"
1071-#include "mir_toolkit/mesa/platform_operation.h"
1072-
1073-#include <gmock/gmock.h>
1074-#include <gtest/gtest.h>
1075-
1076-#include <cstring>
1077-
1078-namespace mg = mir::graphics;
1079-namespace mc = mir::compositor;
1080-namespace geom = mir::geometry;
1081-namespace mtf = mir_test_framework;
1082-namespace mtd = mir::test::doubles;
1083-namespace
1084-{
1085-
1086-char const* const mir_test_socket = mtf::test_socket_file().c_str();
1087-
1088-struct MockAuthenticatingIpcOps : public mg::PlatformIpcOperations
1089-{
1090- MOCK_CONST_METHOD3(pack_buffer, void(mg::BufferIpcMessage&, mg::Buffer const&, mg::BufferIpcMsgType));
1091- MOCK_CONST_METHOD2(unpack_buffer, void(mg::BufferIpcMessage&, mg::Buffer const&));
1092- MOCK_METHOD0(connection_ipc_package, std::shared_ptr<mg::PlatformIPCPackage>());
1093- MOCK_METHOD2(platform_operation, mg::PlatformOperationMessage(
1094- unsigned int const, mg::PlatformOperationMessage const&));
1095-};
1096-
1097-class StubAuthenticatingPlatform : public mtd::NullPlatform
1098-{
1099-public:
1100- StubAuthenticatingPlatform(std::shared_ptr<mg::PlatformIpcOperations> const& ops) :
1101- ops{ops}
1102- {
1103- }
1104-
1105- std::shared_ptr<mg::GraphicBufferAllocator> create_buffer_allocator() override
1106- {
1107- return std::make_shared<mtd::StubBufferAllocator>();
1108- }
1109- std::shared_ptr<mg::PlatformIpcOperations> make_ipc_operations() const override
1110- {
1111- return ops;
1112- }
1113-
1114-private:
1115- std::shared_ptr<mg::PlatformIpcOperations> const ops;
1116-};
1117-
1118-void connection_callback(MirConnection* connection, void* context)
1119-{
1120- auto connection_ptr = static_cast<MirConnection**>(context);
1121- *connection_ptr = connection;
1122-}
1123-
1124-void drm_auth_magic_callback(int status, void* client_context)
1125-{
1126- auto status_ptr = static_cast<int*>(client_context);
1127- *status_ptr = status;
1128-}
1129-
1130-}
1131-
1132-#pragma GCC diagnostic warning "-Wdeprecated-declarations"
1133-
1134-TEST_F(BespokeDisplayServerTestFixture, client_drm_auth_magic_calls_platform)
1135-{
1136- static unsigned int const magic{0x10111213};
1137- static MirMesaAuthMagicResponse const auth_magic_response{123};
1138-
1139- struct ServerConfig : TestingServerConfiguration
1140- {
1141- std::shared_ptr<mg::Platform> the_graphics_platform()
1142- {
1143- using namespace testing;
1144- if (!platform)
1145- {
1146- mg::PlatformOperationMessage pkg;
1147- pkg.data.resize(sizeof(auth_magic_response));
1148- std::memcpy(pkg.data.data(), &auth_magic_response,
1149- sizeof(auth_magic_response));
1150-
1151- auto ipc_ops = std::make_shared<NiceMock<MockAuthenticatingIpcOps>>();
1152- EXPECT_CALL(*ipc_ops, platform_operation(_,_))
1153- .Times(1)
1154- .WillRepeatedly(Return(pkg));
1155- ON_CALL(*ipc_ops, connection_ipc_package())
1156- .WillByDefault(Return(std::make_shared<mg::PlatformIPCPackage>()));
1157- platform = std::make_shared<StubAuthenticatingPlatform>(ipc_ops);
1158- }
1159-
1160- return platform;
1161- }
1162-
1163- std::shared_ptr<StubAuthenticatingPlatform> platform;
1164- } server_config;
1165-
1166- launch_server_process(server_config);
1167-
1168- struct Client : TestingClientConfiguration
1169- {
1170- void exec()
1171- {
1172- MirConnection* connection{nullptr};
1173- mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__,
1174- connection_callback, &connection));
1175-
1176- int status{67};
1177-
1178- ASSERT_TRUE(mir_connection_is_valid(connection));
1179-
1180- mir_wait_for(mir_connection_drm_auth_magic(connection, magic,
1181- drm_auth_magic_callback,
1182- &status));
1183- EXPECT_EQ(auth_magic_response.status, status);
1184-
1185- mir_connection_release(connection);
1186- }
1187- } client_config;
1188-
1189- launch_client_process(client_config);
1190-}

Subscribers

People subscribed via source and target branches