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
=== modified file 'include/client/mir_toolkit/extensions/android_buffer.h'
--- include/client/mir_toolkit/extensions/android_buffer.h 2017-03-14 04:41:33 +0000
+++ include/client/mir_toolkit/extensions/android_buffer.h 2017-03-14 12:31:32 +0000
@@ -89,7 +89,7 @@
89 * \param [in] buffer The buffer89 * \param [in] buffer The buffer
90 * \return True if suitable, false if unsuitable90 * \return True if suitable, false if unsuitable
91 */91 */
92typedef bool (*MirBufferIsAndroidCompatible)(MirBuffer* buffer);92typedef bool (*MirBufferIsAndroidCompatible)(MirBuffer const* buffer);
9393
94/** Access the data from the native_handle_t of the MirBuffer94/** Access the data from the native_handle_t of the MirBuffer
95 * \warning Take care not to close any of the fds.95 * \warning Take care not to close any of the fds.
@@ -101,7 +101,7 @@
101 * \param [out] data The data101 * \param [out] data The data
102 */102 */
103typedef void (*MirBufferAndroidNativeHandle)(103typedef void (*MirBufferAndroidNativeHandle)(
104 MirBuffer* buffer,104 MirBuffer const* buffer,
105 int* num_fds, int const** fds,105 int* num_fds, int const** fds,
106 int* num_data, int const** data);106 int* num_data, int const** data);
107107
@@ -111,7 +111,7 @@
111 * \return The hal_pixel_format of the buffer111 * \return The hal_pixel_format of the buffer
112 */112 */
113typedef unsigned int (*MirBufferAndroidHalPixelFormat)(113typedef unsigned int (*MirBufferAndroidHalPixelFormat)(
114 MirBuffer* buffer);114 MirBuffer const* buffer);
115115
116/** Access the GRALLOC_USAGE_FLAGS of the buffer116/** Access the GRALLOC_USAGE_FLAGS of the buffer
117 * \pre The buffer is suitable for android use117 * \pre The buffer is suitable for android use
@@ -119,7 +119,7 @@
119 * \return The gralloc_usage of the buffer119 * \return The gralloc_usage of the buffer
120 */120 */
121typedef unsigned int (*MirBufferAndroidGrallocUsage)(121typedef unsigned int (*MirBufferAndroidGrallocUsage)(
122 MirBuffer* buffer);122 MirBuffer const* buffer);
123123
124/** Access the stride in bytes of the buffer124/** Access the stride in bytes of the buffer
125 * \pre The buffer is suitable for android use125 * \pre The buffer is suitable for android use
@@ -127,7 +127,7 @@
127 * \return The stride of the buffer127 * \return The stride of the buffer
128 */128 */
129typedef unsigned int (*MirBufferAndroidStride)(129typedef unsigned int (*MirBufferAndroidStride)(
130 MirBuffer* buffer);130 MirBuffer const* buffer);
131131
132/** Increase refcount of the ANativeWindowBuffer132/** Increase refcount of the ANativeWindowBuffer
133 * \pre The buffer is suitable for android use133 * \pre The buffer is suitable for android use
134134
=== modified file 'include/client/mir_toolkit/extensions/gbm_buffer.h'
--- include/client/mir_toolkit/extensions/gbm_buffer.h 2017-03-14 12:31:32 +0000
+++ include/client/mir_toolkit/extensions/gbm_buffer.h 2017-03-14 12:31:32 +0000
@@ -98,7 +98,7 @@
98 * \param [in] buffer The buffer98 * \param [in] buffer The buffer
99 * \return True if suitable, false if unsuitable99 * \return True if suitable, false if unsuitable
100 */100 */
101typedef bool (*MirBufferIsGbmImportable)(MirBuffer* buffer);101typedef bool (*MirBufferIsGbmImportable)(MirBuffer const* buffer);
102102
103/** Access the fd a MirBuffer suitable for gbm import103/** Access the fd a MirBuffer suitable for gbm import
104 * \pre The buffer is suitable for GBM_BO_IMPORT_FD104 * \pre The buffer is suitable for GBM_BO_IMPORT_FD
@@ -106,35 +106,35 @@
106 * \param [in] buffer The buffer106 * \param [in] buffer The buffer
107 * \return The fd107 * \return The fd
108 */108 */
109typedef int (*MirBufferGbmFd)(MirBuffer* buffer);109typedef int (*MirBufferGbmFd)(MirBuffer const* buffer);
110110
111/** Get the stride of a MirBuffer111/** Get the stride of a MirBuffer
112 * \pre The buffer is suitable for GBM_BO_IMPORT_FD112 * \pre The buffer is suitable for GBM_BO_IMPORT_FD
113 * \param [in] buffer The buffer113 * \param [in] buffer The buffer
114 * \return The stride of the buffer114 * \return The stride of the buffer
115 */115 */
116typedef uint32_t (*MirBufferGbmStride)(MirBuffer* buffer);116typedef uint32_t (*MirBufferGbmStride)(MirBuffer const* buffer);
117117
118/** Get the GBM_FORMAT of a MirBuffer118/** Get the GBM_FORMAT of a MirBuffer
119 * \pre The buffer is suitable for GBM_BO_IMPORT_FD119 * \pre The buffer is suitable for GBM_BO_IMPORT_FD
120 * \param [in] buffer The buffer120 * \param [in] buffer The buffer
121 * \return The GBM_FORMAT of the buffer121 * \return The GBM_FORMAT of the buffer
122 */122 */
123typedef uint32_t (*MirBufferGbmFormat)(MirBuffer* buffer);123typedef uint32_t (*MirBufferGbmFormat)(MirBuffer const* buffer);
124124
125/** Get the gbm_bo_flags of a MirBuffer125/** Get the gbm_bo_flags of a MirBuffer
126 * \pre The buffer is suitable for GBM_BO_IMPORT_FD126 * \pre The buffer is suitable for GBM_BO_IMPORT_FD
127 * \param [in] buffer The buffer127 * \param [in] buffer The buffer
128 * \return The gbm_bo_flags of the buffer128 * \return The gbm_bo_flags of the buffer
129 */129 */
130typedef uint32_t (*MirBufferGbmFlags)(MirBuffer* buffer);130typedef uint32_t (*MirBufferGbmFlags)(MirBuffer const* buffer);
131131
132/** Get the age of a MirBuffer132/** Get the age of a MirBuffer
133 * \pre The buffer is suitable for GBM_BO_IMPORT_FD133 * \pre The buffer is suitable for GBM_BO_IMPORT_FD
134 * \param [in] buffer The buffer134 * \param [in] buffer The buffer
135 * \return The age of the buffer135 * \return The age of the buffer
136 */136 */
137typedef unsigned int (*MirBufferGbmAge)(MirBuffer* buffer);137typedef unsigned int (*MirBufferGbmAge)(MirBuffer const* buffer);
138138
139typedef struct MirExtensionGbmBufferV2139typedef struct MirExtensionGbmBufferV2
140{140{
141141
=== modified file 'include/client/mir_toolkit/mir_buffer.h'
--- include/client/mir_toolkit/mir_buffer.h 2017-03-10 19:47:57 +0000
+++ include/client/mir_toolkit/mir_buffer.h 2017-03-14 12:31:32 +0000
@@ -68,7 +68,7 @@
68 * \param [in] buffer The buffer68 * \param [in] buffer The buffer
69 * \return True if the buffer is valid, or false otherwise.69 * \return True if the buffer is valid, or false otherwise.
70 **/70 **/
71bool mir_buffer_is_valid(MirBuffer* buffer);71bool mir_buffer_is_valid(MirBuffer const* buffer);
7272
73/** Retrieve a text description an error associated with a MirBuffer.73/** Retrieve a text description an error associated with a MirBuffer.
74 * The returned string is owned by the library and remains valid until the74 * The returned string is owned by the library and remains valid until the
@@ -78,7 +78,7 @@
78 * invalid buffer, or the empty string "" if the78 * invalid buffer, or the empty string "" if the
79 * connection is valid.79 * connection is valid.
80 **/80 **/
81char const *mir_buffer_get_error_message(MirBuffer* buffer);81char const *mir_buffer_get_error_message(MirBuffer const* buffer);
8282
83/**83/**
84 * Access the MirBufferPackage84 * Access the MirBufferPackage
@@ -111,21 +111,21 @@
111 * \param [in] buffer The buffer111 * \param [in] buffer The buffer
112 * \return The width of the buffer in pixels112 * \return The width of the buffer in pixels
113 **/113 **/
114unsigned int mir_buffer_get_width(MirBuffer* buffer);114unsigned int mir_buffer_get_width(MirBuffer const* buffer);
115115
116/** Retrieve the height of the buffer in pixels.116/** Retrieve the height of the buffer in pixels.
117 *117 *
118 * \param [in] buffer The buffer118 * \param [in] buffer The buffer
119 * \return The height of the buffer in pixels119 * \return The height of the buffer in pixels
120 **/120 **/
121unsigned int mir_buffer_get_height(MirBuffer* buffer);121unsigned int mir_buffer_get_height(MirBuffer const* buffer);
122122
123/** Retrieve the pixel format of the buffer.123/** Retrieve the pixel format of the buffer.
124 *124 *
125 * \param [in] buffer The buffer125 * \param [in] buffer The buffer
126 * \return The pixel format of the buffer126 * \return The pixel format of the buffer
127 **/127 **/
128MirPixelFormat mir_buffer_get_pixel_format(MirBuffer* buffer);128MirPixelFormat mir_buffer_get_pixel_format(MirBuffer const* buffer);
129129
130/** @} */130/** @} */
131131
132132
=== modified file 'src/client/mir_buffer_api.cpp'
--- src/client/mir_buffer_api.cpp 2017-03-10 19:47:57 +0000
+++ src/client/mir_buffer_api.cpp 2017-03-14 12:31:32 +0000
@@ -129,11 +129,11 @@
129 MIR_LOG_UNCAUGHT_EXCEPTION(ex);129 MIR_LOG_UNCAUGHT_EXCEPTION(ex);
130}130}
131131
132unsigned int mir_buffer_get_width(MirBuffer* b)132unsigned int mir_buffer_get_width(MirBuffer const* b)
133try133try
134{134{
135 mir::require(b);135 mir::require(b);
136 auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);136 auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
137 return buffer->size().width.as_uint32_t();137 return buffer->size().width.as_uint32_t();
138}138}
139catch (std::exception const& ex)139catch (std::exception const& ex)
@@ -142,11 +142,11 @@
142 return 0;142 return 0;
143}143}
144144
145unsigned int mir_buffer_get_height(MirBuffer* b)145unsigned int mir_buffer_get_height(MirBuffer const* b)
146try146try
147{147{
148 mir::require(b);148 mir::require(b);
149 auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);149 auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
150 return buffer->size().height.as_uint32_t();150 return buffer->size().height.as_uint32_t();
151}151}
152catch (std::exception const& ex)152catch (std::exception const& ex)
@@ -155,11 +155,11 @@
155 return 0;155 return 0;
156}156}
157157
158MirPixelFormat mir_buffer_get_pixel_format(MirBuffer* b)158MirPixelFormat mir_buffer_get_pixel_format(MirBuffer const* b)
159try159try
160{160{
161 mir::require(b);161 mir::require(b);
162 auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);162 auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
163 return buffer->pixel_format();163 return buffer->pixel_format();
164}164}
165catch (std::exception const& ex)165catch (std::exception const& ex)
@@ -168,10 +168,10 @@
168 return mir_pixel_format_invalid;168 return mir_pixel_format_invalid;
169}169}
170170
171bool mir_buffer_is_valid(MirBuffer* b)171bool mir_buffer_is_valid(MirBuffer const* b)
172try172try
173{173{
174 auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);174 auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
175 return buffer->valid();175 return buffer->valid();
176}176}
177catch (std::exception const& ex)177catch (std::exception const& ex)
@@ -180,10 +180,10 @@
180 return false;180 return false;
181}181}
182182
183char const *mir_buffer_get_error_message(MirBuffer* b)183char const *mir_buffer_get_error_message(MirBuffer const* b)
184try184try
185{185{
186 auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);186 auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
187 return buffer->error_message();187 return buffer->error_message();
188}188}
189catch (std::exception const& ex)189catch (std::exception const& ex)
190190
=== modified file 'src/platforms/android/client/android_client_platform.cpp'
--- src/platforms/android/client/android_client_platform.cpp 2017-03-14 04:41:33 +0000
+++ src/platforms/android/client/android_client_platform.cpp 2017-03-14 12:31:32 +0000
@@ -232,18 +232,18 @@
232 return nullptr;232 return nullptr;
233}233}
234234
235ANativeWindowBuffer* to_anwb(MirBuffer* b)235ANativeWindowBuffer* to_anwb(MirBuffer const* b)
236{236{
237 if (!b)237 if (!b)
238 std::abort();238 std::abort();
239 auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);239 auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
240 auto native = dynamic_cast<mga::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get());240 auto native = dynamic_cast<mga::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get());
241 if (!native)241 if (!native)
242 return nullptr;242 return nullptr;
243 return native->anwb();243 return native->anwb();
244}244}
245245
246bool is_android_compatible(MirBuffer* b)246bool is_android_compatible(MirBuffer const* b)
247try247try
248{248{
249 return to_anwb(b);249 return to_anwb(b);
@@ -255,7 +255,7 @@
255}255}
256256
257void android_native_handle(257void android_native_handle(
258 MirBuffer* b,258 MirBuffer const* b,
259 int* num_fds, int const** fds,259 int* num_fds, int const** fds,
260 int* num_data, int const** data)260 int* num_data, int const** data)
261try261try
@@ -277,7 +277,7 @@
277 MIR_LOG_UNCAUGHT_EXCEPTION(ex);277 MIR_LOG_UNCAUGHT_EXCEPTION(ex);
278}278}
279279
280unsigned int hal_pixel_format(MirBuffer* b)280unsigned int hal_pixel_format(MirBuffer const* b)
281try281try
282{282{
283 if (auto anwb = to_anwb(b))283 if (auto anwb = to_anwb(b))
@@ -290,7 +290,7 @@
290 return std::numeric_limits<unsigned int>::max();290 return std::numeric_limits<unsigned int>::max();
291}291}
292292
293unsigned int gralloc_usage(MirBuffer* b)293unsigned int gralloc_usage(MirBuffer const* b)
294try294try
295{295{
296 if (auto anwb = to_anwb(b))296 if (auto anwb = to_anwb(b))
@@ -303,7 +303,7 @@
303 return std::numeric_limits<unsigned int>::max();303 return std::numeric_limits<unsigned int>::max();
304}304}
305305
306unsigned int android_stride(MirBuffer* b)306unsigned int android_stride(MirBuffer const* b)
307try307try
308{308{
309 if (auto anwb = to_anwb(b))309 if (auto anwb = to_anwb(b))
310310
=== modified file 'src/platforms/mesa/client/client_platform.cpp'
--- src/platforms/mesa/client/client_platform.cpp 2017-03-14 12:31:32 +0000
+++ src/platforms/mesa/client/client_platform.cpp 2017-03-14 12:31:32 +0000
@@ -189,12 +189,12 @@
189 return nullptr;189 return nullptr;
190}190}
191191
192bool is_gbm_importable(MirBuffer* b)192bool is_gbm_importable(MirBuffer const* b)
193try193try
194{194{
195 if (!b)195 if (!b)
196 return false;196 return false;
197 auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);197 auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
198 auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get());198 auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get());
199 if (!native)199 if (!native)
200 return false;200 return false;
@@ -205,12 +205,12 @@
205 return false;205 return false;
206}206}
207207
208int import_fd(MirBuffer* b)208int import_fd(MirBuffer const* b)
209try209try
210{210{
211 if (!is_gbm_importable(b))211 if (!is_gbm_importable(b))
212 return -1;212 return -1;
213 auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);213 auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
214 auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get());214 auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get());
215 return native->fd[0];215 return native->fd[0];
216}216}
@@ -219,12 +219,12 @@
219 return -1;219 return -1;
220}220}
221221
222uint32_t buffer_stride(MirBuffer* b)222uint32_t buffer_stride(MirBuffer const* b)
223try223try
224{224{
225 if (!is_gbm_importable(b))225 if (!is_gbm_importable(b))
226 return 0;226 return 0;
227 auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);227 auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
228 auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get());228 auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get());
229 return native->stride;229 return native->stride;
230}230}
@@ -233,12 +233,12 @@
233 return 0;233 return 0;
234}234}
235235
236uint32_t buffer_format(MirBuffer* b)236uint32_t buffer_format(MirBuffer const* b)
237try237try
238{238{
239 if (!is_gbm_importable(b))239 if (!is_gbm_importable(b))
240 return 0;240 return 0;
241 auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);241 auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
242 auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get());242 auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get());
243 return native->native_format;243 return native->native_format;
244}244}
@@ -247,12 +247,12 @@
247 return 0;247 return 0;
248}248}
249249
250uint32_t buffer_flags(MirBuffer* b)250uint32_t buffer_flags(MirBuffer const* b)
251try251try
252{252{
253 if (!is_gbm_importable(b))253 if (!is_gbm_importable(b))
254 return 0;254 return 0;
255 auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);255 auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
256 auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get());256 auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get());
257 return native->native_flags;257 return native->native_flags;
258}258}
@@ -261,12 +261,12 @@
261 return 0;261 return 0;
262}262}
263263
264unsigned int buffer_age(MirBuffer* b)264unsigned int buffer_age(MirBuffer const* b)
265try265try
266{266{
267 if (!is_gbm_importable(b))267 if (!is_gbm_importable(b))
268 return 0;268 return 0;
269 auto buffer = reinterpret_cast<mcl::MirBuffer*>(b);269 auto const buffer = reinterpret_cast<mcl::MirBuffer const*>(b);
270 auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get());270 auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get());
271 return native->age;271 return native->age;
272}272}

Subscribers

People subscribed via source and target branches