Mir

Merge lp:~mir-team/mir/expose-debug-buffer-id-to-client into lp:~mir-team/mir/trunk

Proposed by Chris Halse Rogers
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 974
Proposed branch: lp:~mir-team/mir/expose-debug-buffer-id-to-client
Merge into: lp:~mir-team/mir/trunk
Diff against target: 228 lines (+82/-12)
9 files modified
include/client/mir_toolkit/mir_client_library.h (+4/-4)
include/client/mir_toolkit/mir_client_library_debug.h (+43/-0)
src/client/client_buffer_depository.cpp (+5/-0)
src/client/client_buffer_depository.h (+1/-0)
src/client/mir_client_library.cpp (+12/-1)
src/client/mir_surface.cpp (+7/-0)
src/client/mir_surface.h (+1/-0)
tests/acceptance-tests/test_client_library.cpp (+2/-1)
tests/acceptance-tests/test_surfaceloop.cpp (+7/-6)
To merge this branch: bzr merge lp:~mir-team/mir/expose-debug-buffer-id-to-client
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
PS Jenkins bot (community) continuous-integration Approve
Robert Ancell Approve
Kevin DuBois (community) Approve
Alexandros Frantzis (community) Approve
Alan Griffiths Approve
Review via email: mp+176843@code.launchpad.net

Commit message

Add a little extra debugging API

Description of the change

Add a little extra debugging API to get the buffer ID

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

could this be in a side header (that we don't give an API guarantee about), maybe mir_client_library_debug.h? Just so we aren't locked into supporting this debug function forever as part of the api.

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

> could this be in a side header (that we don't give an API guarantee about),
> maybe mir_client_library_debug.h? Just so we aren't locked into supporting
> this debug function forever as part of the api.

+1

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

I agree about separating the debug APIs, but this is an existing issue. Vis:

/**
 * Return the ID of a surface (only useful for debug output).
 * \param [in] surface The surface
 * \return An internal ID that identifies the surface
 */
int mir_surface_get_id(MirSurface *surface);

(I'm sure that used to be called mir_debug_surface_id())

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

> I agree about separating the debug APIs, but this is an existing issue

Perhaps this is a good opportunity to fix it then?

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

"current_buffer_id" is confusing. It could mean either the back buffer or the currently visible front buffer.

Please clarify the docs, if not the function name.

review: Needs Fixing
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 :

Looks OK, but the CI failure is weird - setting off a rebuild.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

Looks good.

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

looks good

review: Approve
Revision history for this message
Robert Ancell (robert-ancell) wrote :

This breaks ABI - please leave mir_surface_get_id, mark it as deprecated and call mir_debug_surface_get_id.

Also, I would have though mir_surface_get_debug_id would be a more appropriate name (since we're not getting the id from a "DebugSurface".

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

> This breaks ABI - please leave mir_surface_get_id, mark it as deprecated and call mir_debug_surface_get_id.

What's the plan for deprecating APIs at this stage (I don't think we are, or should, really be providing API stability yet)? Should we keep the old functions for a while and then remove them?

Revision history for this message
Robert Ancell (robert-ancell) wrote :

For libmirclient we are providing stability, so a Mir update doesn't break mesa/XMir etc. Just mark functions as deprecated and we'll remove them in one big change (libmirclient1 -> libmirclient2). If you really want to get rid of a function now, then you have to bump ABI but this will probably be more work overall than just leaving the old function there.

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

> For libmirclient we are providing stability, so a Mir update doesn't break
> mesa/XMir etc. Just mark functions as deprecated and we'll remove them in one
> big change (libmirclient1 -> libmirclient2). If you really want to get rid of
> a function now, then you have to bump ABI but this will probably be more work
> overall than just leaving the old function there.

Does it really call this functionally useless function?

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

> For libmirclient we are providing stability, so a Mir update doesn't break
> mesa/XMir etc. Just mark functions as deprecated and we'll remove them in one
> big change (libmirclient1 -> libmirclient2). If you really want to get rid of
> a function now, then you have to bump ABI but this will probably be more work
> overall than just leaving the old function there.

I hope the same goes for protobuf too? (that we'll just clean up all dead code at once to minimize disruption). I'd feel better if this cleanup/old-api-breakage was scheduled at regular intervals or something (every three months perhaps), just so we keep bloat at a 3-month maximum.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

> > For libmirclient we are providing stability, so a Mir update doesn't break
> > mesa/XMir etc. Just mark functions as deprecated and we'll remove them in
> one
> > big change (libmirclient1 -> libmirclient2). If you really want to get rid
> of
> > a function now, then you have to bump ABI but this will probably be more
> work
> > overall than just leaving the old function there.
>
> I hope the same goes for protobuf too? (that we'll just clean up all dead code
> at once to minimize disruption). I'd feel better if this cleanup/old-api-
> breakage was scheduled at regular intervals or something (every three months
> perhaps), just so we keep bloat at a 3-month maximum.

protobuf is harder - because we can't stop any old client connecting we have to be able to handle that case. In practise, one we have bumped the ABI on libmirclient we can drop old protobuf changes (since we know all the clients currently). But we can only do this in this phase of the project - once we are widely distributed we can't do this any longer. Also make sure to make a note in the .proto of old field numbers that have been used to avoid weird binary mismatches.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

> > For libmirclient we are providing stability, so a Mir update doesn't break
> > mesa/XMir etc. Just mark functions as deprecated and we'll remove them in
> one
> > big change (libmirclient1 -> libmirclient2). If you really want to get rid
> of
> > a function now, then you have to bump ABI but this will probably be more
> work
> > overall than just leaving the old function there.
>
> Does it really call this functionally useless function?

It seems unlikely that any client uses this function, however if we're going to be API/ABI stable then we need to be consistent.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I think we need to improve the docs still. See my comment from 2013-07-31.

review: Needs Fixing
Revision history for this message
Chris Halse Rogers (raof) wrote :

I've kept the name mir_debug_* as I think the "debugness" is the most important thing about these functions.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Happy now :)

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Wow, seems I'm the blocker here. Just a few issues:

1. DEPRECATED should use proper Doxygen: \deprecated

2. Lines too long; need wrapping before col 80:
include/client/mir_toolkit/mir_client_library_debug.h

3. Should be const:
86 + uint32_t current_buffer_id();

Overall I think the line between "debug" and regular client API is still too blurry. But I can't think of a way to make it clearer right now. So just worry about the above nitpicks.

review: Needs Fixing
Revision history for this message
Robert Ancell (robert-ancell) wrote :

> 2. Lines too long; need wrapping before col 80:
> include/client/mir_toolkit/mir_client_library_debug.h

There is no requirement to wrap at column 80, and plenty of existing code does not do this.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Our client headers are /mostly/ wrapped before col 80 right now, so it would be nice to not go backwards.

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

On 12/08/13 04:22, Daniel van Vugt wrote:
> Our client headers are /mostly/ wrapped before col 80 right now, so it would be nice to not go backwards.
>

I don't care much about line length, but we do have a project guideline:

http://unity.ubuntu.com/mir/cppguide/index.html?showone=Line_Length#Line_Length

--
Alan Griffiths +44 (0)798 9938 758
Octopull Ltd http://www.octopull.co.uk/

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

There are very solid reasons for limiting yourself to 80 characters, founded in the limitations of the human brain and readability. See also; print media. But I will drop the issue now...

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

I had already decided to not block on my previous comments, but thanks for getting to them before I got around to hitting Approve.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'include/client/mir_toolkit/mir_client_library.h'
--- include/client/mir_toolkit/mir_client_library.h 2013-08-08 02:34:31 +0000
+++ include/client/mir_toolkit/mir_client_library.h 2013-08-13 10:28:51 +0000
@@ -95,8 +95,9 @@
95void mir_connection_get_platform(MirConnection *connection, MirPlatformPackage *platform_package);95void mir_connection_get_platform(MirConnection *connection, MirPlatformPackage *platform_package);
9696
97/** 97/**
98 * DEPRECATED. use mir_connection_create_display_config98 * \deprecated Use mir_connection_create_display_config
99 */99 */
100__attribute__((__deprecated__("Use mir_connection_create_display_config()")))
100void mir_connection_get_display_info(MirConnection *connection, MirDisplayInfo *display_info);101void mir_connection_get_display_info(MirConnection *connection, MirDisplayInfo *display_info);
101102
102/**103/**
@@ -325,10 +326,9 @@
325void mir_wait_for_one(MirWaitHandle *wait_handle);326void mir_wait_for_one(MirWaitHandle *wait_handle);
326327
327/**328/**
328 * Return the ID of a surface (only useful for debug output).329 * \deprecated Use mir_debug_surface_id()
329 * \param [in] surface The surface
330 * \return An internal ID that identifies the surface
331 */330 */
331__attribute__((__deprecated__("Use mir_debug_surface_id()")))
332int mir_surface_get_id(MirSurface *surface);332int mir_surface_get_id(MirSurface *surface);
333333
334/**334/**
335335
=== added file 'include/client/mir_toolkit/mir_client_library_debug.h'
--- include/client/mir_toolkit/mir_client_library_debug.h 1970-01-01 00:00:00 +0000
+++ include/client/mir_toolkit/mir_client_library_debug.h 2013-08-13 10:28:51 +0000
@@ -0,0 +1,43 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18#ifndef MIR_CLIENT_LIBRARY_DEBUG_H
19#define MIR_CLIENT_LIBRARY_DEBUG_H
20
21#include <mir_toolkit/mir_client_library.h>
22
23/* This header defines debug interfaces that aren't expected to be generally useful
24 * and do not have the same API-stability guarantees that the main API has */
25
26/**
27 * Return the ID of a surface (only useful for debug output).
28 * \param [in] surface The surface
29 * \return An internal ID that identifies the surface
30 */
31int mir_debug_surface_id(MirSurface *surface);
32
33/**
34 * Get the ID of the surface's current buffer (only useful for debug purposes)
35 * \pre The surface is valid
36 * \param [in] surface The surface
37 * \return The internal buffer ID of the surface's current buffer.
38 * This is the buffer that is currently being drawn to,
39 * and would be returned by mir_surface_get_current_buffer.
40 */
41uint32_t mir_debug_surface_current_buffer_id(MirSurface *surface);
42
43#endif /* MIR_CLIENT_LIBRARY_DEBUG_H */
044
=== modified file 'src/client/client_buffer_depository.cpp'
--- src/client/client_buffer_depository.cpp 2013-04-24 05:22:20 +0000
+++ src/client/client_buffer_depository.cpp 2013-08-13 10:28:51 +0000
@@ -65,3 +65,8 @@
65{65{
66 return buffers.front().second;66 return buffers.front().second;
67}67}
68
69uint32_t mcl::ClientBufferDepository::current_buffer_id() const
70{
71 return buffers.front().first;
72}
6873
=== modified file 'src/client/client_buffer_depository.h'
--- src/client/client_buffer_depository.h 2013-05-02 00:11:18 +0000
+++ src/client/client_buffer_depository.h 2013-08-13 10:28:51 +0000
@@ -61,6 +61,7 @@
61 void deposit_package(std::shared_ptr<MirBufferPackage> const&, int id,61 void deposit_package(std::shared_ptr<MirBufferPackage> const&, int id,
62 geometry::Size, geometry::PixelFormat);62 geometry::Size, geometry::PixelFormat);
63 std::shared_ptr<ClientBuffer> current_buffer();63 std::shared_ptr<ClientBuffer> current_buffer();
64 uint32_t current_buffer_id() const;
6465
65private:66private:
66 std::shared_ptr<ClientBufferFactory> const factory;67 std::shared_ptr<ClientBufferFactory> const factory;
6768
=== modified file 'src/client/mir_client_library.cpp'
--- src/client/mir_client_library.cpp 2013-08-08 02:34:31 +0000
+++ src/client/mir_client_library.cpp 2013-08-13 10:28:51 +0000
@@ -19,6 +19,7 @@
19#include "mir/default_configuration.h"19#include "mir/default_configuration.h"
20#include "mir_toolkit/mir_client_library.h"20#include "mir_toolkit/mir_client_library.h"
21#include "mir_toolkit/mir_client_library_drm.h"21#include "mir_toolkit/mir_client_library_drm.h"
22#include "mir_toolkit/mir_client_library_debug.h"
2223
23#include "mir_connection.h"24#include "mir_connection.h"
24#include "display_configuration.h"25#include "display_configuration.h"
@@ -203,7 +204,12 @@
203204
204int mir_surface_get_id(MirSurface * surface)205int mir_surface_get_id(MirSurface * surface)
205{206{
206 return surface->id();207 return mir_debug_surface_id(surface);
208}
209
210int mir_debug_surface_id(MirSurface * surface)
211{
212 return surface->id();
207}213}
208214
209int mir_surface_is_valid(MirSurface* surface)215int mir_surface_is_valid(MirSurface* surface)
@@ -232,6 +238,11 @@
232 *buffer_package_out = package.get();238 *buffer_package_out = package.get();
233}239}
234240
241uint32_t mir_debug_surface_current_buffer_id(MirSurface * surface)
242{
243 return surface->get_current_buffer_id();
244}
245
235void mir_connection_get_platform(MirConnection *connection, MirPlatformPackage *platform_package)246void mir_connection_get_platform(MirConnection *connection, MirPlatformPackage *platform_package)
236{247{
237 connection->populate(*platform_package);248 connection->populate(*platform_package);
238249
=== modified file 'src/client/mir_surface.cpp'
--- src/client/mir_surface.cpp 2013-06-28 09:25:09 +0000
+++ src/client/mir_surface.cpp 2013-08-13 10:28:51 +0000
@@ -239,6 +239,13 @@
239 return buffer_depository->current_buffer();239 return buffer_depository->current_buffer();
240}240}
241241
242uint32_t MirSurface::get_current_buffer_id() const
243{
244 std::lock_guard<std::recursive_mutex> lock(mutex);
245
246 return buffer_depository->current_buffer_id();
247}
248
242void MirSurface::populate(MirBufferPackage& buffer_package)249void MirSurface::populate(MirBufferPackage& buffer_package)
243{250{
244 std::lock_guard<std::recursive_mutex> lock(mutex);251 std::lock_guard<std::recursive_mutex> lock(mutex);
245252
=== modified file 'src/client/mir_surface.h'
--- src/client/mir_surface.h 2013-06-28 11:10:25 +0000
+++ src/client/mir_surface.h 2013-08-13 10:28:51 +0000
@@ -82,6 +82,7 @@
82 std::shared_ptr<MirNativeBuffer> get_current_buffer_package();82 std::shared_ptr<MirNativeBuffer> get_current_buffer_package();
83 MirPlatformType platform_type();83 MirPlatformType platform_type();
84 std::shared_ptr<mir::client::ClientBuffer> get_current_buffer();84 std::shared_ptr<mir::client::ClientBuffer> get_current_buffer();
85 uint32_t get_current_buffer_id() const;
85 void get_cpu_region(MirGraphicsRegion& region);86 void get_cpu_region(MirGraphicsRegion& region);
86 void release_cpu_region();87 void release_cpu_region();
87 EGLNativeWindowType generate_native_window();88 EGLNativeWindowType generate_native_window();
8889
=== modified file 'tests/acceptance-tests/test_client_library.cpp'
--- tests/acceptance-tests/test_client_library.cpp 2013-08-06 01:27:08 +0000
+++ tests/acceptance-tests/test_client_library.cpp 2013-08-13 10:28:51 +0000
@@ -19,6 +19,7 @@
19#include "mir_test_framework/display_server_test_fixture.h"19#include "mir_test_framework/display_server_test_fixture.h"
2020
21#include "mir_toolkit/mir_client_library.h"21#include "mir_toolkit/mir_client_library.h"
22#include "mir_toolkit/mir_client_library_debug.h"
22#include "src/client/client_buffer.h"23#include "src/client/client_buffer.h"
2324
24#include "mir/frontend/communicator.h"25#include "mir/frontend/communicator.h"
@@ -389,7 +390,7 @@
389390
390 mir_surface_set_event_handler(surface, &delegate);391 mir_surface_set_event_handler(surface, &delegate);
391392
392 int surface_id = mir_surface_get_id(surface);393 int surface_id = mir_debug_surface_id(surface);
393394
394 mir_wait_for(mir_surface_set_state(surface,395 mir_wait_for(mir_surface_set_state(surface,
395 mir_surface_state_fullscreen));396 mir_surface_state_fullscreen));
396397
=== modified file 'tests/acceptance-tests/test_surfaceloop.cpp'
--- tests/acceptance-tests/test_surfaceloop.cpp 2013-07-11 16:54:41 +0000
+++ tests/acceptance-tests/test_surfaceloop.cpp 2013-08-13 10:28:51 +0000
@@ -20,6 +20,7 @@
20#include "mir/geometry/size.h"20#include "mir/geometry/size.h"
2121
22#include "mir_toolkit/mir_client_library.h"22#include "mir_toolkit/mir_client_library.h"
23#include "mir_toolkit/mir_client_library_debug.h"
23#include "src/client/mir_connection.h"24#include "src/client/mir_connection.h"
2425
25#include "mir_protobuf.pb.h"26#include "mir_protobuf.pb.h"
@@ -234,8 +235,8 @@
234 wait_for_surface_create(ssync+1);235 wait_for_surface_create(ssync+1);
235236
236 EXPECT_NE(237 EXPECT_NE(
237 mir_surface_get_id(ssync[0].surface),238 mir_debug_surface_id(ssync[0].surface),
238 mir_surface_get_id(ssync[1].surface));239 mir_debug_surface_id(ssync[1].surface));
239240
240 mir_surface_release(ssync[1].surface, release_surface_callback, ssync+1);241 mir_surface_release(ssync[1].surface, release_surface_callback, ssync+1);
241 wait_for_surface_release(ssync+1);242 wait_for_surface_release(ssync+1);
@@ -280,12 +281,12 @@
280 {281 {
281 if (i == j)282 if (i == j)
282 EXPECT_EQ(283 EXPECT_EQ(
283 mir_surface_get_id(ssync[i].surface),284 mir_debug_surface_id(ssync[i].surface),
284 mir_surface_get_id(ssync[j].surface));285 mir_debug_surface_id(ssync[j].surface));
285 else286 else
286 EXPECT_NE(287 EXPECT_NE(
287 mir_surface_get_id(ssync[i].surface),288 mir_debug_surface_id(ssync[i].surface),
288 mir_surface_get_id(ssync[j].surface));289 mir_debug_surface_id(ssync[j].surface));
289 }290 }
290 }291 }
291292

Subscribers

People subscribed via source and target branches