Mir

Merge lp:~kdub/mir/more-const-in-mirbuffer 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: 4089
Proposed branch: lp:~kdub/mir/more-const-in-mirbuffer
Merge into: lp:mir
Prerequisite: lp:~kdub/mir/gbm-ext-v2
Diff against target: 377 lines (+45/-45)
6 files modified
include/client/mir_toolkit/extensions/android_buffer.h (+5/-5)
include/client/mir_toolkit/extensions/gbm_buffer.h (+6/-6)
include/client/mir_toolkit/mir_buffer.h (+5/-5)
src/client/mir_buffer_api.cpp (+10/-10)
src/platforms/android/client/android_client_platform.cpp (+7/-7)
src/platforms/mesa/client/client_platform.cpp (+12/-12)
To merge this branch: bzr merge lp:~kdub/mir/more-const-in-mirbuffer
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
Cemil Azizoglu (community) Approve
Mir CI Bot continuous-integration Approve
Review via email: mp+319811@code.launchpad.net

Commit message

add more const fields to MirBuffer extensions and api.

Description of the change

add more const fields to MirBuffer extensions and api. Adding const to parameters doesn't break abi or api. (removing them would break api, but no removals here)

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

PASSED: Continuous integration, rev:4051
https://mir-jenkins.ubuntu.com/job/mir-ci/3152/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4231
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4318
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/4308
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/4308
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4308
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4258
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4258/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/4258
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4258/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4258
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4258/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/4258
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/4258/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/4258
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/4258/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/4258
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4258/artifact/output/*zip*/output.zip

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

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

LGTM

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

Woo, free consts for everybody.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/client/mir_toolkit/extensions/android_buffer.h'
2--- include/client/mir_toolkit/extensions/android_buffer.h 2017-03-14 04:41:33 +0000
3+++ include/client/mir_toolkit/extensions/android_buffer.h 2017-03-14 12:31:32 +0000
4@@ -89,7 +89,7 @@
5 * \param [in] buffer The buffer
6 * \return True if suitable, false if unsuitable
7 */
8-typedef bool (*MirBufferIsAndroidCompatible)(MirBuffer* buffer);
9+typedef bool (*MirBufferIsAndroidCompatible)(MirBuffer const* buffer);
10
11 /** Access the data from the native_handle_t of the MirBuffer
12 * \warning Take care not to close any of the fds.
13@@ -101,7 +101,7 @@
14 * \param [out] data The data
15 */
16 typedef void (*MirBufferAndroidNativeHandle)(
17- MirBuffer* buffer,
18+ MirBuffer const* buffer,
19 int* num_fds, int const** fds,
20 int* num_data, int const** data);
21
22@@ -111,7 +111,7 @@
23 * \return The hal_pixel_format of the buffer
24 */
25 typedef unsigned int (*MirBufferAndroidHalPixelFormat)(
26- MirBuffer* buffer);
27+ MirBuffer const* buffer);
28
29 /** Access the GRALLOC_USAGE_FLAGS of the buffer
30 * \pre The buffer is suitable for android use
31@@ -119,7 +119,7 @@
32 * \return The gralloc_usage of the buffer
33 */
34 typedef unsigned int (*MirBufferAndroidGrallocUsage)(
35- MirBuffer* buffer);
36+ MirBuffer const* buffer);
37
38 /** Access the stride in bytes of the buffer
39 * \pre The buffer is suitable for android use
40@@ -127,7 +127,7 @@
41 * \return The stride of the buffer
42 */
43 typedef unsigned int (*MirBufferAndroidStride)(
44- MirBuffer* buffer);
45+ MirBuffer const* buffer);
46
47 /** Increase refcount of the ANativeWindowBuffer
48 * \pre The buffer is suitable for android use
49
50=== modified file 'include/client/mir_toolkit/extensions/gbm_buffer.h'
51--- include/client/mir_toolkit/extensions/gbm_buffer.h 2017-03-14 12:31:32 +0000
52+++ include/client/mir_toolkit/extensions/gbm_buffer.h 2017-03-14 12:31:32 +0000
53@@ -98,7 +98,7 @@
54 * \param [in] buffer The buffer
55 * \return True if suitable, false if unsuitable
56 */
57-typedef bool (*MirBufferIsGbmImportable)(MirBuffer* buffer);
58+typedef bool (*MirBufferIsGbmImportable)(MirBuffer const* buffer);
59
60 /** Access the fd a MirBuffer suitable for gbm import
61 * \pre The buffer is suitable for GBM_BO_IMPORT_FD
62@@ -106,35 +106,35 @@
63 * \param [in] buffer The buffer
64 * \return The fd
65 */
66-typedef int (*MirBufferGbmFd)(MirBuffer* buffer);
67+typedef int (*MirBufferGbmFd)(MirBuffer const* buffer);
68
69 /** Get the stride of a MirBuffer
70 * \pre The buffer is suitable for GBM_BO_IMPORT_FD
71 * \param [in] buffer The buffer
72 * \return The stride of the buffer
73 */
74-typedef uint32_t (*MirBufferGbmStride)(MirBuffer* buffer);
75+typedef uint32_t (*MirBufferGbmStride)(MirBuffer const* buffer);
76
77 /** Get the GBM_FORMAT of a MirBuffer
78 * \pre The buffer is suitable for GBM_BO_IMPORT_FD
79 * \param [in] buffer The buffer
80 * \return The GBM_FORMAT of the buffer
81 */
82-typedef uint32_t (*MirBufferGbmFormat)(MirBuffer* buffer);
83+typedef uint32_t (*MirBufferGbmFormat)(MirBuffer const* buffer);
84
85 /** Get the gbm_bo_flags of a MirBuffer
86 * \pre The buffer is suitable for GBM_BO_IMPORT_FD
87 * \param [in] buffer The buffer
88 * \return The gbm_bo_flags of the buffer
89 */
90-typedef uint32_t (*MirBufferGbmFlags)(MirBuffer* buffer);
91+typedef uint32_t (*MirBufferGbmFlags)(MirBuffer const* buffer);
92
93 /** Get the age of a MirBuffer
94 * \pre The buffer is suitable for GBM_BO_IMPORT_FD
95 * \param [in] buffer The buffer
96 * \return The age of the buffer
97 */
98-typedef unsigned int (*MirBufferGbmAge)(MirBuffer* buffer);
99+typedef unsigned int (*MirBufferGbmAge)(MirBuffer const* buffer);
100
101 typedef struct MirExtensionGbmBufferV2
102 {
103
104=== modified file 'include/client/mir_toolkit/mir_buffer.h'
105--- include/client/mir_toolkit/mir_buffer.h 2017-03-10 19:47:57 +0000
106+++ include/client/mir_toolkit/mir_buffer.h 2017-03-14 12:31:32 +0000
107@@ -68,7 +68,7 @@
108 * \param [in] buffer The buffer
109 * \return True if the buffer is valid, or false otherwise.
110 **/
111-bool mir_buffer_is_valid(MirBuffer* buffer);
112+bool mir_buffer_is_valid(MirBuffer const* buffer);
113
114 /** Retrieve a text description an error associated with a MirBuffer.
115 * The returned string is owned by the library and remains valid until the
116@@ -78,7 +78,7 @@
117 * invalid buffer, or the empty string "" if the
118 * connection is valid.
119 **/
120-char const *mir_buffer_get_error_message(MirBuffer* buffer);
121+char const *mir_buffer_get_error_message(MirBuffer const* buffer);
122
123 /**
124 * Access the MirBufferPackage
125@@ -111,21 +111,21 @@
126 * \param [in] buffer The buffer
127 * \return The width of the buffer in pixels
128 **/
129-unsigned int mir_buffer_get_width(MirBuffer* buffer);
130+unsigned int mir_buffer_get_width(MirBuffer const* buffer);
131
132 /** Retrieve the height of the buffer in pixels.
133 *
134 * \param [in] buffer The buffer
135 * \return The height of the buffer in pixels
136 **/
137-unsigned int mir_buffer_get_height(MirBuffer* buffer);
138+unsigned int mir_buffer_get_height(MirBuffer const* buffer);
139
140 /** Retrieve the pixel format of the buffer.
141 *
142 * \param [in] buffer The buffer
143 * \return The pixel format of the buffer
144 **/
145-MirPixelFormat mir_buffer_get_pixel_format(MirBuffer* buffer);
146+MirPixelFormat mir_buffer_get_pixel_format(MirBuffer const* buffer);
147
148 /** @} */
149
150
151=== modified file 'src/client/mir_buffer_api.cpp'
152--- src/client/mir_buffer_api.cpp 2017-03-10 19:47:57 +0000
153+++ src/client/mir_buffer_api.cpp 2017-03-14 12:31:32 +0000
154@@ -129,11 +129,11 @@
155 MIR_LOG_UNCAUGHT_EXCEPTION(ex);
156 }
157
158-unsigned int mir_buffer_get_width(MirBuffer* b)
159+unsigned int mir_buffer_get_width(MirBuffer const* b)
160 try
161 {
162 mir::require(b);
163- auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);
164+ auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
165 return buffer->size().width.as_uint32_t();
166 }
167 catch (std::exception const& ex)
168@@ -142,11 +142,11 @@
169 return 0;
170 }
171
172-unsigned int mir_buffer_get_height(MirBuffer* b)
173+unsigned int mir_buffer_get_height(MirBuffer const* b)
174 try
175 {
176 mir::require(b);
177- auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);
178+ auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
179 return buffer->size().height.as_uint32_t();
180 }
181 catch (std::exception const& ex)
182@@ -155,11 +155,11 @@
183 return 0;
184 }
185
186-MirPixelFormat mir_buffer_get_pixel_format(MirBuffer* b)
187+MirPixelFormat mir_buffer_get_pixel_format(MirBuffer const* b)
188 try
189 {
190 mir::require(b);
191- auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);
192+ auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
193 return buffer->pixel_format();
194 }
195 catch (std::exception const& ex)
196@@ -168,10 +168,10 @@
197 return mir_pixel_format_invalid;
198 }
199
200-bool mir_buffer_is_valid(MirBuffer* b)
201+bool mir_buffer_is_valid(MirBuffer const* b)
202 try
203 {
204- auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);
205+ auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
206 return buffer->valid();
207 }
208 catch (std::exception const& ex)
209@@ -180,10 +180,10 @@
210 return false;
211 }
212
213-char const *mir_buffer_get_error_message(MirBuffer* b)
214+char const *mir_buffer_get_error_message(MirBuffer const* b)
215 try
216 {
217- auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);
218+ auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
219 return buffer->error_message();
220 }
221 catch (std::exception const& ex)
222
223=== modified file 'src/platforms/android/client/android_client_platform.cpp'
224--- src/platforms/android/client/android_client_platform.cpp 2017-03-14 04:41:33 +0000
225+++ src/platforms/android/client/android_client_platform.cpp 2017-03-14 12:31:32 +0000
226@@ -232,18 +232,18 @@
227 return nullptr;
228 }
229
230-ANativeWindowBuffer* to_anwb(MirBuffer* b)
231+ANativeWindowBuffer* to_anwb(MirBuffer const* b)
232 {
233 if (!b)
234 std::abort();
235- auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);
236+ auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
237 auto native = dynamic_cast<mga::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get());
238 if (!native)
239 return nullptr;
240 return native->anwb();
241 }
242
243-bool is_android_compatible(MirBuffer* b)
244+bool is_android_compatible(MirBuffer const* b)
245 try
246 {
247 return to_anwb(b);
248@@ -255,7 +255,7 @@
249 }
250
251 void android_native_handle(
252- MirBuffer* b,
253+ MirBuffer const* b,
254 int* num_fds, int const** fds,
255 int* num_data, int const** data)
256 try
257@@ -277,7 +277,7 @@
258 MIR_LOG_UNCAUGHT_EXCEPTION(ex);
259 }
260
261-unsigned int hal_pixel_format(MirBuffer* b)
262+unsigned int hal_pixel_format(MirBuffer const* b)
263 try
264 {
265 if (auto anwb = to_anwb(b))
266@@ -290,7 +290,7 @@
267 return std::numeric_limits<unsigned int>::max();
268 }
269
270-unsigned int gralloc_usage(MirBuffer* b)
271+unsigned int gralloc_usage(MirBuffer const* b)
272 try
273 {
274 if (auto anwb = to_anwb(b))
275@@ -303,7 +303,7 @@
276 return std::numeric_limits<unsigned int>::max();
277 }
278
279-unsigned int android_stride(MirBuffer* b)
280+unsigned int android_stride(MirBuffer const* b)
281 try
282 {
283 if (auto anwb = to_anwb(b))
284
285=== modified file 'src/platforms/mesa/client/client_platform.cpp'
286--- src/platforms/mesa/client/client_platform.cpp 2017-03-14 12:31:32 +0000
287+++ src/platforms/mesa/client/client_platform.cpp 2017-03-14 12:31:32 +0000
288@@ -189,12 +189,12 @@
289 return nullptr;
290 }
291
292-bool is_gbm_importable(MirBuffer* b)
293+bool is_gbm_importable(MirBuffer const* b)
294 try
295 {
296 if (!b)
297 return false;
298- auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);
299+ auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
300 auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get());
301 if (!native)
302 return false;
303@@ -205,12 +205,12 @@
304 return false;
305 }
306
307-int import_fd(MirBuffer* b)
308+int import_fd(MirBuffer const* b)
309 try
310 {
311 if (!is_gbm_importable(b))
312 return -1;
313- auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);
314+ auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
315 auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get());
316 return native->fd[0];
317 }
318@@ -219,12 +219,12 @@
319 return -1;
320 }
321
322-uint32_t buffer_stride(MirBuffer* b)
323+uint32_t buffer_stride(MirBuffer const* b)
324 try
325 {
326 if (!is_gbm_importable(b))
327 return 0;
328- auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);
329+ auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
330 auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get());
331 return native->stride;
332 }
333@@ -233,12 +233,12 @@
334 return 0;
335 }
336
337-uint32_t buffer_format(MirBuffer* b)
338+uint32_t buffer_format(MirBuffer const* b)
339 try
340 {
341 if (!is_gbm_importable(b))
342 return 0;
343- auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);
344+ auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
345 auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get());
346 return native->native_format;
347 }
348@@ -247,12 +247,12 @@
349 return 0;
350 }
351
352-uint32_t buffer_flags(MirBuffer* b)
353+uint32_t buffer_flags(MirBuffer const* b)
354 try
355 {
356 if (!is_gbm_importable(b))
357 return 0;
358- auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);
359+ auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
360 auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get());
361 return native->native_flags;
362 }
363@@ -261,12 +261,12 @@
364 return 0;
365 }
366
367-unsigned int buffer_age(MirBuffer* b)
368+unsigned int buffer_age(MirBuffer const* b)
369 try
370 {
371 if (!is_gbm_importable(b))
372 return 0;
373- auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);
374+ auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
375 auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get());
376 return native->age;
377 }

Subscribers

People subscribed via source and target branches