Merge lp:~mir-team/mir/expose-debug-buffer-id-to-client into lp:~mir-team/mir/trunk
- expose-debug-buffer-id-to-client
- Merge into trunk
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 |
Related bugs: |
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
PS Jenkins bot (ps-jenkins) wrote : | # |
Kevin DuBois (kdub) wrote : | # |
could this be in a side header (that we don't give an API guarantee about), maybe mir_client_
Alexandros Frantzis (afrantzis) wrote : | # |
> could this be in a side header (that we don't give an API guarantee about),
> maybe mir_client_
> this debug function forever as part of the api.
+1
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_
(I'm sure that used to be called mir_debug_
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?
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.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:883
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Alan Griffiths (alan-griffiths) wrote : | # |
Looks OK, but the CI failure is weird - setting off a rebuild.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:883
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Alexandros Frantzis (afrantzis) wrote : | # |
Looks good.
Robert Ancell (robert-ancell) wrote : | # |
This breaks ABI - please leave mir_surface_get_id, mark it as deprecated and call mir_debug_
Also, I would have though mir_surface_
Alexandros Frantzis (afrantzis) wrote : | # |
> This breaks ABI - please leave mir_surface_get_id, mark it as deprecated and call mir_debug_
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?
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.
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?
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/
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.
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.
Daniel van Vugt (vanvugt) wrote : | # |
I think we need to improve the docs still. See my comment from 2013-07-31.
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.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:884
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Robert Ancell (robert-ancell) wrote : | # |
Happy now :)
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/
3. Should be const:
86 + uint32_t current_
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.
Robert Ancell (robert-ancell) wrote : | # |
> 2. Lines too long; need wrapping before col 80:
> include/
There is no requirement to wrap at column 80, and plenty of existing code does not do this.
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.
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://
--
Alan Griffiths +44 (0)798 9938 758
Octopull Ltd http://
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...
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:887
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Daniel van Vugt (vanvugt) : | # |
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
1 | === modified file 'include/client/mir_toolkit/mir_client_library.h' |
2 | --- include/client/mir_toolkit/mir_client_library.h 2013-08-08 02:34:31 +0000 |
3 | +++ include/client/mir_toolkit/mir_client_library.h 2013-08-13 10:28:51 +0000 |
4 | @@ -95,8 +95,9 @@ |
5 | void mir_connection_get_platform(MirConnection *connection, MirPlatformPackage *platform_package); |
6 | |
7 | /** |
8 | - * DEPRECATED. use mir_connection_create_display_config |
9 | + * \deprecated Use mir_connection_create_display_config |
10 | */ |
11 | +__attribute__((__deprecated__("Use mir_connection_create_display_config()"))) |
12 | void mir_connection_get_display_info(MirConnection *connection, MirDisplayInfo *display_info); |
13 | |
14 | /** |
15 | @@ -325,10 +326,9 @@ |
16 | void mir_wait_for_one(MirWaitHandle *wait_handle); |
17 | |
18 | /** |
19 | - * Return the ID of a surface (only useful for debug output). |
20 | - * \param [in] surface The surface |
21 | - * \return An internal ID that identifies the surface |
22 | + * \deprecated Use mir_debug_surface_id() |
23 | */ |
24 | +__attribute__((__deprecated__("Use mir_debug_surface_id()"))) |
25 | int mir_surface_get_id(MirSurface *surface); |
26 | |
27 | /** |
28 | |
29 | === added file 'include/client/mir_toolkit/mir_client_library_debug.h' |
30 | --- include/client/mir_toolkit/mir_client_library_debug.h 1970-01-01 00:00:00 +0000 |
31 | +++ include/client/mir_toolkit/mir_client_library_debug.h 2013-08-13 10:28:51 +0000 |
32 | @@ -0,0 +1,43 @@ |
33 | +/* |
34 | + * Copyright © 2013 Canonical Ltd. |
35 | + * |
36 | + * This program is free software: you can redistribute it and/or modify it |
37 | + * under the terms of the GNU Lesser General Public License version 3, |
38 | + * as published by the Free Software Foundation. |
39 | + * |
40 | + * This program is distributed in the hope that it will be useful, |
41 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
42 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
43 | + * GNU Lesser General Public License for more details. |
44 | + * |
45 | + * You should have received a copy of the GNU Lesser General Public License |
46 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
47 | + * |
48 | + */ |
49 | + |
50 | +#ifndef MIR_CLIENT_LIBRARY_DEBUG_H |
51 | +#define MIR_CLIENT_LIBRARY_DEBUG_H |
52 | + |
53 | +#include <mir_toolkit/mir_client_library.h> |
54 | + |
55 | +/* This header defines debug interfaces that aren't expected to be generally useful |
56 | + * and do not have the same API-stability guarantees that the main API has */ |
57 | + |
58 | +/** |
59 | + * Return the ID of a surface (only useful for debug output). |
60 | + * \param [in] surface The surface |
61 | + * \return An internal ID that identifies the surface |
62 | + */ |
63 | +int mir_debug_surface_id(MirSurface *surface); |
64 | + |
65 | +/** |
66 | + * Get the ID of the surface's current buffer (only useful for debug purposes) |
67 | + * \pre The surface is valid |
68 | + * \param [in] surface The surface |
69 | + * \return The internal buffer ID of the surface's current buffer. |
70 | + * This is the buffer that is currently being drawn to, |
71 | + * and would be returned by mir_surface_get_current_buffer. |
72 | + */ |
73 | +uint32_t mir_debug_surface_current_buffer_id(MirSurface *surface); |
74 | + |
75 | +#endif /* MIR_CLIENT_LIBRARY_DEBUG_H */ |
76 | |
77 | === modified file 'src/client/client_buffer_depository.cpp' |
78 | --- src/client/client_buffer_depository.cpp 2013-04-24 05:22:20 +0000 |
79 | +++ src/client/client_buffer_depository.cpp 2013-08-13 10:28:51 +0000 |
80 | @@ -65,3 +65,8 @@ |
81 | { |
82 | return buffers.front().second; |
83 | } |
84 | + |
85 | +uint32_t mcl::ClientBufferDepository::current_buffer_id() const |
86 | +{ |
87 | + return buffers.front().first; |
88 | +} |
89 | |
90 | === modified file 'src/client/client_buffer_depository.h' |
91 | --- src/client/client_buffer_depository.h 2013-05-02 00:11:18 +0000 |
92 | +++ src/client/client_buffer_depository.h 2013-08-13 10:28:51 +0000 |
93 | @@ -61,6 +61,7 @@ |
94 | void deposit_package(std::shared_ptr<MirBufferPackage> const&, int id, |
95 | geometry::Size, geometry::PixelFormat); |
96 | std::shared_ptr<ClientBuffer> current_buffer(); |
97 | + uint32_t current_buffer_id() const; |
98 | |
99 | private: |
100 | std::shared_ptr<ClientBufferFactory> const factory; |
101 | |
102 | === modified file 'src/client/mir_client_library.cpp' |
103 | --- src/client/mir_client_library.cpp 2013-08-08 02:34:31 +0000 |
104 | +++ src/client/mir_client_library.cpp 2013-08-13 10:28:51 +0000 |
105 | @@ -19,6 +19,7 @@ |
106 | #include "mir/default_configuration.h" |
107 | #include "mir_toolkit/mir_client_library.h" |
108 | #include "mir_toolkit/mir_client_library_drm.h" |
109 | +#include "mir_toolkit/mir_client_library_debug.h" |
110 | |
111 | #include "mir_connection.h" |
112 | #include "display_configuration.h" |
113 | @@ -203,7 +204,12 @@ |
114 | |
115 | int mir_surface_get_id(MirSurface * surface) |
116 | { |
117 | - return surface->id(); |
118 | + return mir_debug_surface_id(surface); |
119 | +} |
120 | + |
121 | +int mir_debug_surface_id(MirSurface * surface) |
122 | +{ |
123 | + return surface->id(); |
124 | } |
125 | |
126 | int mir_surface_is_valid(MirSurface* surface) |
127 | @@ -232,6 +238,11 @@ |
128 | *buffer_package_out = package.get(); |
129 | } |
130 | |
131 | +uint32_t mir_debug_surface_current_buffer_id(MirSurface * surface) |
132 | +{ |
133 | + return surface->get_current_buffer_id(); |
134 | +} |
135 | + |
136 | void mir_connection_get_platform(MirConnection *connection, MirPlatformPackage *platform_package) |
137 | { |
138 | connection->populate(*platform_package); |
139 | |
140 | === modified file 'src/client/mir_surface.cpp' |
141 | --- src/client/mir_surface.cpp 2013-06-28 09:25:09 +0000 |
142 | +++ src/client/mir_surface.cpp 2013-08-13 10:28:51 +0000 |
143 | @@ -239,6 +239,13 @@ |
144 | return buffer_depository->current_buffer(); |
145 | } |
146 | |
147 | +uint32_t MirSurface::get_current_buffer_id() const |
148 | +{ |
149 | + std::lock_guard<std::recursive_mutex> lock(mutex); |
150 | + |
151 | + return buffer_depository->current_buffer_id(); |
152 | +} |
153 | + |
154 | void MirSurface::populate(MirBufferPackage& buffer_package) |
155 | { |
156 | std::lock_guard<std::recursive_mutex> lock(mutex); |
157 | |
158 | === modified file 'src/client/mir_surface.h' |
159 | --- src/client/mir_surface.h 2013-06-28 11:10:25 +0000 |
160 | +++ src/client/mir_surface.h 2013-08-13 10:28:51 +0000 |
161 | @@ -82,6 +82,7 @@ |
162 | std::shared_ptr<MirNativeBuffer> get_current_buffer_package(); |
163 | MirPlatformType platform_type(); |
164 | std::shared_ptr<mir::client::ClientBuffer> get_current_buffer(); |
165 | + uint32_t get_current_buffer_id() const; |
166 | void get_cpu_region(MirGraphicsRegion& region); |
167 | void release_cpu_region(); |
168 | EGLNativeWindowType generate_native_window(); |
169 | |
170 | === modified file 'tests/acceptance-tests/test_client_library.cpp' |
171 | --- tests/acceptance-tests/test_client_library.cpp 2013-08-06 01:27:08 +0000 |
172 | +++ tests/acceptance-tests/test_client_library.cpp 2013-08-13 10:28:51 +0000 |
173 | @@ -19,6 +19,7 @@ |
174 | #include "mir_test_framework/display_server_test_fixture.h" |
175 | |
176 | #include "mir_toolkit/mir_client_library.h" |
177 | +#include "mir_toolkit/mir_client_library_debug.h" |
178 | #include "src/client/client_buffer.h" |
179 | |
180 | #include "mir/frontend/communicator.h" |
181 | @@ -389,7 +390,7 @@ |
182 | |
183 | mir_surface_set_event_handler(surface, &delegate); |
184 | |
185 | - int surface_id = mir_surface_get_id(surface); |
186 | + int surface_id = mir_debug_surface_id(surface); |
187 | |
188 | mir_wait_for(mir_surface_set_state(surface, |
189 | mir_surface_state_fullscreen)); |
190 | |
191 | === modified file 'tests/acceptance-tests/test_surfaceloop.cpp' |
192 | --- tests/acceptance-tests/test_surfaceloop.cpp 2013-07-11 16:54:41 +0000 |
193 | +++ tests/acceptance-tests/test_surfaceloop.cpp 2013-08-13 10:28:51 +0000 |
194 | @@ -20,6 +20,7 @@ |
195 | #include "mir/geometry/size.h" |
196 | |
197 | #include "mir_toolkit/mir_client_library.h" |
198 | +#include "mir_toolkit/mir_client_library_debug.h" |
199 | #include "src/client/mir_connection.h" |
200 | |
201 | #include "mir_protobuf.pb.h" |
202 | @@ -234,8 +235,8 @@ |
203 | wait_for_surface_create(ssync+1); |
204 | |
205 | EXPECT_NE( |
206 | - mir_surface_get_id(ssync[0].surface), |
207 | - mir_surface_get_id(ssync[1].surface)); |
208 | + mir_debug_surface_id(ssync[0].surface), |
209 | + mir_debug_surface_id(ssync[1].surface)); |
210 | |
211 | mir_surface_release(ssync[1].surface, release_surface_callback, ssync+1); |
212 | wait_for_surface_release(ssync+1); |
213 | @@ -280,12 +281,12 @@ |
214 | { |
215 | if (i == j) |
216 | EXPECT_EQ( |
217 | - mir_surface_get_id(ssync[i].surface), |
218 | - mir_surface_get_id(ssync[j].surface)); |
219 | + mir_debug_surface_id(ssync[i].surface), |
220 | + mir_debug_surface_id(ssync[j].surface)); |
221 | else |
222 | EXPECT_NE( |
223 | - mir_surface_get_id(ssync[i].surface), |
224 | - mir_surface_get_id(ssync[j].surface)); |
225 | + mir_debug_surface_id(ssync[i].surface), |
226 | + mir_debug_surface_id(ssync[j].surface)); |
227 | } |
228 | } |
229 |
PASSED: Continuous integration, rev:882 jenkins. qa.ubuntu. com/job/ mir-ci/ 1100/ jenkins. qa.ubuntu. com/job/ mir-android- saucy-i386- build/1441 jenkins. qa.ubuntu. com/job/ mir-clang- saucy-amd64- build/1326 jenkins. qa.ubuntu. com/job/ mir-saucy- amd64-ci/ 338 jenkins. qa.ubuntu. com/job/ mir-saucy- amd64-ci/ 338/artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ mir-ci/ 1100/rebuild
http://