Mir

Merge lp:~kdub/mir/usage-deprecation-nested into lp:mir

Proposed by Kevin DuBois on 2017-01-11
Status: Merged
Approved by: Daniel van Vugt on 2017-01-13
Approved revision: 3921
Merged at revision: 3933
Proposed branch: lp:~kdub/mir/usage-deprecation-nested
Merge into: lp:mir
Diff against target: 415 lines (+162/-33)
8 files modified
src/server/graphics/nested/buffer.cpp (+20/-0)
src/server/graphics/nested/buffer.h (+6/-0)
src/server/graphics/nested/host_connection.h (+2/-0)
src/server/graphics/nested/mir_client_host_connection.cpp (+80/-2)
src/server/graphics/nested/mir_client_host_connection.h (+2/-0)
src/server/graphics/nested/platform.cpp (+8/-9)
tests/include/mir/test/doubles/stub_host_connection.h (+8/-0)
tests/unit-tests/platforms/nested/test_buffer.cpp (+36/-22)
To merge this branch: bzr merge lp:~kdub/mir/usage-deprecation-nested
Reviewer Review Type Date Requested Status
Cemil Azizoglu (community) Approve on 2017-01-12
Alan Griffiths 2017-01-11 Approve on 2017-01-12
Mir CI Bot continuous-integration Approve on 2017-01-11
Review via email: mp+314518@code.launchpad.net

Commit Message

platform: add deprecation path for mg::BufferUsage for the nested platform. This adds a path to create a software buffer, and uses the extensions to create the hardware buffers.

Description of the Change

platform: add deprecation path for mg::BufferUsage for the nested platform. This adds a path to create a software buffer, and uses the extensions to create the hardware buffers.

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

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

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

review: Approve (continuous-integration)
Alan Griffiths (alan-griffiths) wrote :

Looks reasonable, but when I try to launch mir_demo_client inside a nested mir server it segfaults.

Host server:
    $ bin/mir_demo_server --x11-displays 800x600 --launch qterminal\&qterminal

Nested server (in first qtermial window):
    $ bin/mir_demo_server --host $XDG_RUNTIME_DIR/mir_socket --file mir_socket

Client (in second qterminal window):
    $ bin/mir_demo_client_egltriangle -m mir_socket

I checked this works with 0.25

review: Needs Fixing
Kevin DuBois (kdub) wrote :

thanks for noticing, working on fixing. Was a bit overzealous in removing the old code before the whole new system is in place.

3919. By Kevin DuBois on 2017-01-12

add back path that allows for server-selected hardware allocation request

3920. By Kevin DuBois on 2017-01-12

merge in mir

3921. By Kevin DuBois on 2017-01-12

diff reduction

Alan Griffiths (alan-griffiths) wrote :

> thanks for noticing, working on fixing. Was a bit overzealous in removing the
> old code before the whole new system is in place.

Fixed. Thanks - I'll just have another look over the code

review: Abstain
Alan Griffiths (alan-griffiths) wrote :

Looks good. (Would like CI to compile it before landing, just in case there's a weird compiler out there.)

review: Approve
Cemil Azizoglu (cemil-azizoglu) wrote :

yeap lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/server/graphics/nested/buffer.cpp'
2--- src/server/graphics/nested/buffer.cpp 2016-12-14 06:27:05 +0000
3+++ src/server/graphics/nested/buffer.cpp 2017-01-12 13:57:10 +0000
4@@ -19,6 +19,7 @@
5 #include "mir/renderer/sw/pixel_source.h"
6 #include "mir/renderer/gl/texture_source.h"
7 #include "mir/graphics/egl_extensions.h"
8+#include "mir/graphics/buffer_ipc_message.h"
9 #include "mir_toolkit/mir_buffer.h"
10 #include "host_connection.h"
11 #include "buffer.h"
12@@ -179,6 +180,25 @@
13 {
14 }
15
16+mgn::Buffer::Buffer(
17+ std::shared_ptr<HostConnection> const& connection,
18+ geom::Size size, uint32_t native_format, uint32_t native_flags) :
19+ connection(connection),
20+ buffer(connection->create_buffer(size, native_format, native_flags)),
21+ native_base(std::make_shared<TextureAccess>(*this, buffer, connection))
22+{
23+}
24+
25+mgn::Buffer::Buffer(
26+ std::shared_ptr<HostConnection> const& connection,
27+ geom::Size size,
28+ MirPixelFormat format) :
29+ connection(connection),
30+ buffer(connection->create_buffer(size, format)),
31+ native_base(std::make_shared<PixelAndTextureAccess>(*this, buffer, connection))
32+{
33+}
34+
35 std::shared_ptr<mg::NativeBuffer> mgn::Buffer::native_buffer_handle() const
36 {
37 return buffer;
38
39=== modified file 'src/server/graphics/nested/buffer.h'
40--- src/server/graphics/nested/buffer.h 2016-10-31 02:37:31 +0000
41+++ src/server/graphics/nested/buffer.h 2017-01-12 13:57:10 +0000
42@@ -40,6 +40,12 @@
43 Buffer(
44 std::shared_ptr<HostConnection> const& connection,
45 BufferProperties const& properties);
46+ Buffer(
47+ std::shared_ptr<HostConnection> const& connection,
48+ geometry::Size size, MirPixelFormat pf);
49+ Buffer(
50+ std::shared_ptr<HostConnection> const& connection,
51+ geometry::Size size, unsigned int native_format, unsigned int native_flags);
52
53 std::shared_ptr<graphics::NativeBuffer> native_buffer_handle() const override;
54 geometry::Size size() const override;
55
56=== modified file 'src/server/graphics/nested/host_connection.h'
57--- src/server/graphics/nested/host_connection.h 2016-12-09 02:54:31 +0000
58+++ src/server/graphics/nested/host_connection.h 2017-01-12 13:57:10 +0000
59@@ -77,6 +77,8 @@
60 virtual void set_input_event_callback(std::function<void(MirEvent const&, mir::geometry::Rectangle const&)> const& cb) = 0;
61 virtual void emit_input_event(MirEvent const& event, mir::geometry::Rectangle const& source_frame) = 0;
62 virtual std::shared_ptr<NativeBuffer> create_buffer(graphics::BufferProperties const&) = 0;
63+ virtual std::shared_ptr<NativeBuffer> create_buffer(mir::geometry::Size, MirPixelFormat format) = 0;
64+ virtual std::shared_ptr<NativeBuffer> create_buffer(geometry::Size, uint32_t format, uint32_t flags) = 0;
65 virtual bool supports_passthrough() = 0;
66
67 protected:
68
69=== modified file 'src/server/graphics/nested/mir_client_host_connection.cpp'
70--- src/server/graphics/nested/mir_client_host_connection.cpp 2017-01-11 20:17:22 +0000
71+++ src/server/graphics/nested/mir_client_host_connection.cpp 2017-01-12 13:57:10 +0000
72@@ -31,10 +31,13 @@
73 #include "mir_toolkit/mir_buffer_private.h"
74 #include "mir_toolkit/mir_presentation_chain.h"
75 #include "mir_toolkit/extensions/fenced_buffers.h"
76+#include "mir_toolkit/extensions/android_buffer.h"
77+#include "mir_toolkit/extensions/gbm_buffer.h"
78 #include "mir/raii.h"
79 #include "mir/graphics/platform_operation_message.h"
80 #include "mir/graphics/cursor_image.h"
81 #include "mir/graphics/buffer.h"
82+#include "mir/graphics/buffer_ipc_message.h"
83 #include "mir/input/device.h"
84 #include "mir/input/device_capability.h"
85 #include "mir/input/mir_pointer_configuration.h"
86@@ -568,6 +571,60 @@
87 BOOST_THROW_EXCEPTION(std::runtime_error("could not allocate MirBuffer"));
88 }
89 }
90+
91+ HostBuffer(MirConnection* mir_connection, geom::Size size, MirPixelFormat format) :
92+ fence_extensions(mir_extension_fenced_buffers_v1(mir_connection))
93+ {
94+ mir_connection_allocate_buffer(
95+ mir_connection,
96+ size.width.as_int(),
97+ size.height.as_int(),
98+ format,
99+ mir_buffer_usage_software,
100+ buffer_available, this);
101+ std::unique_lock<std::mutex> lk(mut);
102+ cv.wait(lk, [&]{ return handle; });
103+ if (!mir_buffer_is_valid(handle))
104+ {
105+ mir_buffer_release(handle);
106+ BOOST_THROW_EXCEPTION(std::runtime_error("could not allocate MirBuffer"));
107+ }
108+ }
109+
110+ HostBuffer(MirConnection* mir_connection,
111+ MirExtensionGbmBufferV1 const* ext,
112+ geom::Size size, unsigned int native_pf, unsigned int native_flags) :
113+ fence_extensions(mir_extension_fenced_buffers_v1(mir_connection))
114+ {
115+ ext->allocate_buffer_gbm(
116+ mir_connection, size.width.as_int(), size.height.as_int(), native_pf, native_flags,
117+ buffer_available, this);
118+ std::unique_lock<std::mutex> lk(mut);
119+ cv.wait(lk, [&]{ return handle; });
120+ if (!mir_buffer_is_valid(handle))
121+ {
122+ mir_buffer_release(handle);
123+ BOOST_THROW_EXCEPTION(std::runtime_error("could not allocate MirBuffer"));
124+ }
125+ }
126+
127+ HostBuffer(MirConnection* mir_connection,
128+ MirExtensionAndroidBufferV1 const* ext,
129+ geom::Size size, unsigned int native_pf, unsigned int native_flags) :
130+ fence_extensions(mir_extension_fenced_buffers_v1(mir_connection))
131+ {
132+ ext->allocate_buffer_android(
133+ mir_connection, size.width.as_int(), size.height.as_int(), native_pf, native_flags,
134+ buffer_available, this);
135+ std::unique_lock<std::mutex> lk(mut);
136+ cv.wait(lk, [&]{ return handle; });
137+ if (!mir_buffer_is_valid(handle))
138+ {
139+ mir_buffer_release(handle);
140+ BOOST_THROW_EXCEPTION(std::runtime_error("could not allocate MirBuffer"));
141+ }
142+ }
143+
144 ~HostBuffer()
145 {
146 mir_buffer_release(handle);
147@@ -707,6 +764,28 @@
148 return std::make_shared<HostBuffer>(mir_connection, properties);
149 }
150
151+std::shared_ptr<mgn::NativeBuffer> mgn::MirClientHostConnection::create_buffer(
152+ geom::Size size, MirPixelFormat format)
153+{
154+ return std::make_shared<HostBuffer>(mir_connection, size, format);
155+}
156+
157+std::shared_ptr<mgn::NativeBuffer> mgn::MirClientHostConnection::create_buffer(
158+ geom::Size size, uint32_t native_format, uint32_t native_flags)
159+{
160+ if (auto ext = mir_extension_gbm_buffer_v1(mir_connection))
161+ {
162+ return std::make_shared<HostBuffer>(mir_connection, ext, size, native_format, native_flags);
163+ }
164+
165+ if (auto ext = mir_extension_android_buffer_v1(mir_connection))
166+ {
167+ return std::make_shared<HostBuffer>(mir_connection, ext, size, native_format, native_flags);
168+ }
169+
170+ BOOST_THROW_EXCEPTION(std::runtime_error("could not create hardware buffer"));
171+}
172+
173 std::unique_ptr<mgn::HostSurfaceSpec> mgn::MirClientHostConnection::create_surface_spec()
174 {
175 return std::make_unique<SurfaceSpec>(mir_connection);
176@@ -714,8 +793,7 @@
177
178 bool mgn::MirClientHostConnection::supports_passthrough()
179 {
180- auto buffer = create_buffer(mg::BufferProperties(geom::Size{1, 1} , mir_pixel_format_abgr_8888, mg::BufferUsage::software));
181-
182+ auto buffer = create_buffer(geom::Size{1, 1} , mir_pixel_format_abgr_8888);
183 auto hints = buffer->egl_image_creation_hints();
184 if (std::get<1>(hints) == nullptr && std::get<2>(hints) == nullptr)
185 return false;
186
187=== modified file 'src/server/graphics/nested/mir_client_host_connection.h'
188--- src/server/graphics/nested/mir_client_host_connection.h 2016-12-09 02:54:31 +0000
189+++ src/server/graphics/nested/mir_client_host_connection.h 2017-01-12 13:57:10 +0000
190@@ -86,6 +86,8 @@
191 void set_input_event_callback(std::function<void(MirEvent const&, mir::geometry::Rectangle const&)> const& cb) override;
192 void emit_input_event(MirEvent const& cb, mir::geometry::Rectangle const& source_frame) override;
193 std::shared_ptr<NativeBuffer> create_buffer(graphics::BufferProperties const&) override;
194+ std::shared_ptr<NativeBuffer> create_buffer(geometry::Size, MirPixelFormat) override;
195+ std::shared_ptr<NativeBuffer> create_buffer(geometry::Size, uint32_t format, uint32_t flags) override;
196 bool supports_passthrough() override;
197
198 optional_value<std::shared_ptr<MesaAuthExtension>> auth_extension() override;
199
200=== modified file 'src/server/graphics/nested/platform.cpp'
201--- src/server/graphics/nested/platform.cpp 2016-10-11 17:04:43 +0000
202+++ src/server/graphics/nested/platform.cpp 2017-01-12 13:57:10 +0000
203@@ -73,17 +73,12 @@
204 {
205 }
206
207- std::shared_ptr<mg::Buffer> alloc_buffer(mg::BufferProperties const& buffer_properties) override
208+ std::shared_ptr<mg::Buffer> alloc_buffer(mg::BufferProperties const& properties) override
209 {
210- if ((buffer_properties.size.width >= mir::geometry::Width{480}) &&
211- (buffer_properties.size.height >= mir::geometry::Height{480}))
212- {
213- return std::make_shared<mgn::Buffer>(connection, buffer_properties);
214- }
215+ if (passthrough_candidate(properties.size))
216+ return std::make_shared<mgn::Buffer>(connection, properties);
217 else
218- {
219- return guest_allocator->alloc_buffer(buffer_properties);
220- }
221+ return guest_allocator->alloc_buffer(properties);
222 }
223
224 std::vector<MirPixelFormat> supported_pixel_formats() override
225@@ -92,6 +87,10 @@
226 }
227
228 private:
229+ bool passthrough_candidate(mir::geometry::Size size)
230+ {
231+ return (size.width >= mir::geometry::Width{480}) && (size.height >= mir::geometry::Height{480});
232+ }
233 std::shared_ptr<mgn::HostConnection> const connection;
234 std::shared_ptr<mg::GraphicBufferAllocator> const guest_allocator;
235 };
236
237=== modified file 'tests/include/mir/test/doubles/stub_host_connection.h'
238--- tests/include/mir/test/doubles/stub_host_connection.h 2017-01-09 06:48:47 +0000
239+++ tests/include/mir/test/doubles/stub_host_connection.h 2017-01-12 13:57:10 +0000
240@@ -140,6 +140,14 @@
241 {
242 return nullptr;
243 }
244+ std::shared_ptr<graphics::nested::NativeBuffer> create_buffer(geometry::Size, MirPixelFormat)
245+ {
246+ return nullptr;
247+ }
248+ std::shared_ptr<graphics::nested::NativeBuffer> create_buffer(geometry::Size, uint32_t, uint32_t)
249+ {
250+ return nullptr;
251+ }
252
253 MirNativeBuffer* get_native_handle(MirBuffer*)
254 {
255
256=== modified file 'tests/unit-tests/platforms/nested/test_buffer.cpp'
257--- tests/unit-tests/platforms/nested/test_buffer.cpp 2016-12-14 06:27:05 +0000
258+++ tests/unit-tests/platforms/nested/test_buffer.cpp 2017-01-12 13:57:10 +0000
259@@ -62,14 +62,17 @@
260
261 struct MockHostConnection : mtd::StubHostConnection
262 {
263- MOCK_METHOD1(create_buffer, std::shared_ptr<mgn::NativeBuffer>(mg::BufferProperties const&));
264+ MOCK_METHOD2(create_buffer, std::shared_ptr<mgn::NativeBuffer>(geom::Size, MirPixelFormat));
265+ MOCK_METHOD3(create_buffer, std::shared_ptr<mgn::NativeBuffer>(geom::Size, uint32_t, uint32_t));
266 };
267
268 struct NestedBuffer : Test
269 {
270 NestedBuffer()
271 {
272- ON_CALL(mock_connection, create_buffer(_))
273+ ON_CALL(mock_connection, create_buffer(_,_))
274+ .WillByDefault(Return(client_buffer));
275+ ON_CALL(mock_connection, create_buffer(_,_,_))
276 .WillByDefault(Return(client_buffer));
277 ON_CALL(*client_buffer, size())
278 .WillByDefault(Return(sw_properties.size));
279@@ -95,11 +98,15 @@
280 }
281
282 NiceMock<MockHostConnection> mock_connection;
283- mg::BufferProperties sw_properties{{1, 1}, mir_pixel_format_abgr_8888, mg::BufferUsage::software};
284- mg::BufferProperties hw_properties{{1, 1}, mir_pixel_format_abgr_8888, mg::BufferUsage::hardware};
285+ geom::Size size {1, 1};
286+ MirPixelFormat pf = mir_pixel_format_abgr_8888;
287+ mg::BufferProperties sw_properties{size, pf, mg::BufferUsage::software};
288+ mg::BufferProperties hw_properties{size, pf, mg::BufferUsage::hardware};
289
290 std::shared_ptr<MockNativeBuffer> client_buffer = std::make_shared<NiceMock<MockNativeBuffer>>();
291
292+ uint32_t native_pf = 0x44;
293+ uint32_t native_flags = 0x48;
294 unsigned int data = 0x11111111;
295 int stride_with_padding = sw_properties.size.width.as_int() * MIR_BYTES_PER_PIXEL(sw_properties.format) + 4;
296
297@@ -108,37 +115,44 @@
298 };
299 }
300
301-TEST_F(NestedBuffer, creates_buffer_when_constructed)
302-{
303- EXPECT_CALL(mock_connection, create_buffer(sw_properties))
304- .WillOnce(Return(client_buffer));
305- mgn::Buffer buffer(mt::fake_shared(mock_connection), sw_properties);
306+TEST_F(NestedBuffer, creates_sw_buffer_when_constructed)
307+{
308+ EXPECT_CALL(mock_connection, create_buffer(size, pf))
309+ .WillOnce(Return(client_buffer));
310+ mgn::Buffer buffer(mt::fake_shared(mock_connection), size, pf);
311+}
312+
313+TEST_F(NestedBuffer, creates_hw_buffer_when_constructed)
314+{
315+ EXPECT_CALL(mock_connection, create_buffer(size, native_pf, native_flags))
316+ .WillOnce(Return(client_buffer));
317+ mgn::Buffer buffer(mt::fake_shared(mock_connection), size, native_pf, native_flags);
318 }
319
320 TEST_F(NestedBuffer, generates_valid_id)
321 {
322- mgn::Buffer buffer(mt::fake_shared(mock_connection), sw_properties);
323+ mgn::Buffer buffer(mt::fake_shared(mock_connection), size, pf);
324 EXPECT_THAT(buffer.id().as_value(), Gt(0u));
325 }
326
327 TEST_F(NestedBuffer, has_correct_properties)
328 {
329- mgn::Buffer buffer(mt::fake_shared(mock_connection), sw_properties);
330- EXPECT_THAT(buffer.size(), Eq(sw_properties.size));
331- EXPECT_THAT(buffer.pixel_format(), Eq(sw_properties.format));
332+ mgn::Buffer buffer(mt::fake_shared(mock_connection), size, pf);
333+ EXPECT_THAT(buffer.size(), Eq(size));
334+ EXPECT_THAT(buffer.pixel_format(), Eq(pf));
335 }
336
337 TEST_F(NestedBuffer, sw_support_if_requested)
338 {
339
340 {
341- mgn::Buffer buffer(mt::fake_shared(mock_connection), sw_properties);
342+ mgn::Buffer buffer(mt::fake_shared(mock_connection), size, pf);
343 EXPECT_THAT(dynamic_cast<mrs::PixelSource*>(buffer.native_buffer_base()), Ne(nullptr));
344 EXPECT_THAT(dynamic_cast<mrg::TextureSource*>(buffer.native_buffer_base()), Ne(nullptr));
345 }
346
347 {
348- mgn::Buffer buffer(mt::fake_shared(mock_connection), hw_properties);
349+ mgn::Buffer buffer(mt::fake_shared(mock_connection), size, native_pf, native_flags);
350 EXPECT_THAT(dynamic_cast<mrs::PixelSource*>(buffer.native_buffer_base()), Eq(nullptr));
351 EXPECT_THAT(dynamic_cast<mrg::TextureSource*>(buffer.native_buffer_base()), Ne(nullptr));
352 }
353@@ -148,7 +162,7 @@
354 {
355 unsigned int data = 0x11223344;
356 unsigned int new_data = 0x11111111;
357- mgn::Buffer buffer(mt::fake_shared(mock_connection), sw_properties);
358+ mgn::Buffer buffer(mt::fake_shared(mock_connection), size, pf);
359
360 EXPECT_CALL(*client_buffer, get_graphics_region())
361 .WillOnce(Invoke([&, this] { return generate_region(reinterpret_cast<char*>(&data)); }));
362@@ -160,7 +174,7 @@
363
364 TEST_F(NestedBuffer, checks_for_null_vaddr)
365 {
366- mgn::Buffer buffer(mt::fake_shared(mock_connection), sw_properties);
367+ mgn::Buffer buffer(mt::fake_shared(mock_connection), size, pf);
368
369 EXPECT_CALL(*client_buffer, get_graphics_region())
370 .WillOnce(Invoke([&, this] { return generate_region(nullptr); }));
371@@ -177,7 +191,7 @@
372 TEST_F(NestedBuffer, throws_if_incorrect_sizing)
373 {
374 auto too_large_size = 4 * sizeof(data);
375- mgn::Buffer buffer(mt::fake_shared(mock_connection), sw_properties);
376+ mgn::Buffer buffer(mt::fake_shared(mock_connection), size, pf);
377 auto pixel_source = dynamic_cast<mir::renderer::software::PixelSource*>(buffer.native_buffer_base());
378 ASSERT_THAT(pixel_source, Ne(nullptr));
379 EXPECT_THROW({
380@@ -188,7 +202,7 @@
381 TEST_F(NestedBuffer, reads_from_region)
382 {
383 unsigned int read_data = 0x11111111;
384- mgn::Buffer buffer(mt::fake_shared(mock_connection), sw_properties);
385+ mgn::Buffer buffer(mt::fake_shared(mock_connection), size, pf);
386
387 EXPECT_CALL(*client_buffer, get_graphics_region())
388 .WillOnce(Invoke([&, this] { return generate_region(reinterpret_cast<char*>(&read_data)); }));
389@@ -205,7 +219,7 @@
390 ON_CALL(*client_buffer, egl_image_creation_hints())
391 .WillByDefault(Return(std::tuple<EGLenum, EGLClientBuffer, EGLint*>{}));
392
393- mgn::Buffer buffer(mt::fake_shared(mock_connection), hw_properties);
394+ mgn::Buffer buffer(mt::fake_shared(mock_connection), size, native_pf, native_flags);
395 auto native_base = buffer.native_buffer_base();
396 ASSERT_THAT(native_base, Ne(nullptr));
397 auto texture_source = dynamic_cast<mir::renderer::gl::TextureSource*>(native_base);
398@@ -227,7 +241,7 @@
399 int fake_context1 = 113;
400 int fake_context2 = 114;
401
402- mgn::Buffer buffer(mt::fake_shared(mock_connection), hw_properties);
403+ mgn::Buffer buffer(mt::fake_shared(mock_connection), size, native_pf, native_flags);
404 auto texture_source = dynamic_cast<mir::renderer::gl::TextureSource*>(buffer.native_buffer_base());
405 ASSERT_THAT(texture_source, Ne(nullptr));
406
407@@ -250,7 +264,7 @@
408
409 TEST_F(NestedBuffer, has_correct_stride)
410 {
411- mgn::Buffer buffer(mt::fake_shared(mock_connection), sw_properties);
412+ mgn::Buffer buffer(mt::fake_shared(mock_connection), size, pf);
413 auto pixel_source = dynamic_cast<mir::renderer::software::PixelSource*>(buffer.native_buffer_base());
414 ASSERT_THAT(pixel_source, Ne(nullptr));
415 EXPECT_THAT(pixel_source->stride().as_int(), Eq(stride_with_padding));

Subscribers

People subscribed via source and target branches