Mir

Merge lp:~kdub/mir/fix-1626503 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: 3719
Proposed branch: lp:~kdub/mir/fix-1626503
Merge into: lp:mir
Diff against target: 383 lines (+111/-9)
12 files modified
src/client/buffer_vault.cpp (+9/-0)
src/client/mir_connection.cpp (+1/-1)
src/client/surface_map.cpp (+7/-7)
src/server/compositor/multi_monitor_arbiter.cpp (+11/-0)
src/server/compositor/multi_monitor_arbiter.h (+1/-0)
src/server/compositor/stream.cpp (+6/-0)
src/server/compositor/stream.h (+1/-0)
tests/acceptance-tests/throwback/test_presentation_chain.cpp (+51/-0)
tests/integration-tests/test_buffer_scheduling.cpp (+4/-0)
tests/unit-tests/client/test_mir_connection.cpp (+1/-1)
tests/unit-tests/compositor/test_multi_monitor_arbiter.cpp (+13/-0)
tests/unit-tests/compositor/test_stream.cpp (+6/-0)
To merge this branch: bzr merge lp:~kdub/mir/fix-1626503
Reviewer Review Type Date Requested Status
Alexandros Frantzis (community) Approve
Brandon Schaefer (community) Approve
Mir CI Bot continuous-integration Approve
Review via email: mp+306480@code.launchpad.net

Commit message

mir_presentation_chain api:
fix situation where where the server would not notify a client of a buffers return, following the destruction of the MirPresentationChain that the buffer was associated with.

fixes: LP: #1626503

Description of the change

mir_presentation_chain api:
fix situation where where the server would not notify a client of a buffers return, following the destruction of the MirPresentationChain that the buffer was associated with.

fixes: LP: #1626503

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

FAILED: Continuous integration, rev:3718
https://mir-jenkins.ubuntu.com/job/mir-ci/1784/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/2234/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/2297
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2288
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2288
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2288
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2262/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2262
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2262/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2262
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2262/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/2262
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2262/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2262/console

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3720
https://mir-jenkins.ubuntu.com/job/mir-ci/1789/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/2239
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/2302
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2293
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2293
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2293
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2267
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2267/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/2267
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2267/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2267
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2267/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/2267
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2267/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/2267
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2267/artifact/output/*zip*/output.zip

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

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

It's worth noting MultiMonitorArbiter will get deprecated and possibly removed soon enough (hopefully). As swap interval 1 throttling moves out of libmirserver and into libmirclient (using high-precision frame sync timing), it won't be needed any more.

Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Im not super familiar with the context but the code looks good to me.

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

> It's worth noting MultiMonitorArbiter will get deprecated and possibly removed
> soon enough (hopefully). As swap interval 1 throttling moves out of
> libmirserver and into libmirclient (using high-precision frame sync timing),
> it won't be needed any more.

Hmm, news to me. I suppose some logic in there won't be needed, but some system of handing the buffers out will still be present, we might to need to sync on the plans.

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

Looks good.

Nit:
+ for(auto it = onscreen_buffers.begin(); it != onscreen_buffers.end(); it++)
+ {
+ if (it->use_count == 0)
+ map->send_buffer(it->buffer->id());
+ }

Why not use a range-based for loop?

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/client/buffer_vault.cpp'
--- src/client/buffer_vault.cpp 2016-07-05 12:40:56 +0000
+++ src/client/buffer_vault.cpp 2016-09-22 19:03:27 +0000
@@ -45,6 +45,9 @@
4545
46namespace46namespace
47{47{
48void ignore_buffer(MirBuffer*, void*)
49{
50}
48void incoming_buffer(MirBuffer* buffer, void* context)51void incoming_buffer(MirBuffer* buffer, void* context)
49{52{
50 auto vault = static_cast<mcl::BufferVault*>(context);53 auto vault = static_cast<mcl::BufferVault*>(context);
@@ -80,9 +83,15 @@
80 return;83 return;
8184
82 buffer_factory->cancel_requests_with_context(this);85 buffer_factory->cancel_requests_with_context(this);
86 std::unique_lock<std::mutex> lk(mutex);
83 for (auto& it : buffers)87 for (auto& it : buffers)
84 try88 try
85 {89 {
90 if (auto map = surface_map.lock())
91 {
92 auto buffer = map->buffer(it.first);
93 buffer->set_callback(ignore_buffer, nullptr);
94 }
86 free_buffer(it.first);95 free_buffer(it.first);
87 }96 }
88 catch (...)97 catch (...)
8998
=== modified file 'src/client/mir_connection.cpp'
--- src/client/mir_connection.cpp 2016-08-31 10:47:16 +0000
+++ src/client/mir_connection.cpp 2016-09-22 19:03:27 +0000
@@ -1223,7 +1223,7 @@
1223void MirConnection::release_presentation_chain(MirPresentationChain* chain)1223void MirConnection::release_presentation_chain(MirPresentationChain* chain)
1224{1224{
1225 auto id = chain->rpc_id();1225 auto id = chain->rpc_id();
1226 if (id > 0)1226 if (id >= 0)
1227 {1227 {
1228 StreamRelease stream_release{nullptr, nullptr, nullptr, nullptr, chain->rpc_id()};1228 StreamRelease stream_release{nullptr, nullptr, nullptr, nullptr, chain->rpc_id()};
1229 mp::BufferStreamId buffer_stream_id;1229 mp::BufferStreamId buffer_stream_id;
12301230
=== modified file 'src/client/surface_map.cpp'
--- src/client/surface_map.cpp 2016-06-06 11:51:31 +0000
+++ src/client/surface_map.cpp 2016-09-22 19:03:27 +0000
@@ -60,7 +60,7 @@
60void mcl::ConnectionSurfaceMap::with_stream_do(60void mcl::ConnectionSurfaceMap::with_stream_do(
61 mf::BufferStreamId stream_id, std::function<void(ClientBufferStream*)> const& exec) const61 mf::BufferStreamId stream_id, std::function<void(ClientBufferStream*)> const& exec) const
62{62{
63 std::shared_lock<decltype(guard)> lk(guard);63 std::shared_lock<decltype(stream_guard)> lk(stream_guard);
64 auto const it = streams.find(stream_id);64 auto const it = streams.find(stream_id);
65 if (it != streams.end())65 if (it != streams.end())
66 {66 {
@@ -78,7 +78,7 @@
7878
79void mcl::ConnectionSurfaceMap::with_all_streams_do(std::function<void(ClientBufferStream*)> const& fn) const79void mcl::ConnectionSurfaceMap::with_all_streams_do(std::function<void(ClientBufferStream*)> const& fn) const
80{80{
81 std::shared_lock<decltype(guard)> lk(guard);81 std::shared_lock<decltype(stream_guard)> lk(stream_guard);
82 for(auto const& stream : streams)82 for(auto const& stream : streams)
83 fn(stream.second.get());83 fn(stream.second.get());
84}84}
@@ -86,7 +86,7 @@
86void mcl::ConnectionSurfaceMap::insert(86void mcl::ConnectionSurfaceMap::insert(
87 mf::BufferStreamId stream_id, std::shared_ptr<ClientBufferStream> const& stream)87 mf::BufferStreamId stream_id, std::shared_ptr<ClientBufferStream> const& stream)
88{88{
89 std::lock_guard<decltype(guard)> lk(guard);89 std::lock_guard<decltype(stream_guard)> lk(stream_guard);
90 streams[stream_id] = stream;90 streams[stream_id] = stream;
91}91}
9292
@@ -99,7 +99,7 @@
9999
100void mcl::ConnectionSurfaceMap::erase(mf::BufferStreamId stream_id)100void mcl::ConnectionSurfaceMap::erase(mf::BufferStreamId stream_id)
101{101{
102 std::lock_guard<decltype(guard)> lk(guard);102 std::lock_guard<decltype(stream_guard)> lk(stream_guard);
103 auto stream_it = streams.find(stream_id);103 auto stream_it = streams.find(stream_id);
104 auto chain_it = chains.find(stream_id);104 auto chain_it = chains.find(stream_id);
105 if (stream_it != streams.end())105 if (stream_it != streams.end())
@@ -110,19 +110,19 @@
110110
111void mcl::ConnectionSurfaceMap::insert(int buffer_id, std::shared_ptr<mcl::MirBuffer> const& buffer)111void mcl::ConnectionSurfaceMap::insert(int buffer_id, std::shared_ptr<mcl::MirBuffer> const& buffer)
112{112{
113 std::lock_guard<decltype(guard)> lk(guard);113 std::lock_guard<decltype(buffer_guard)> lk(buffer_guard);
114 buffers[buffer_id] = buffer;114 buffers[buffer_id] = buffer;
115}115}
116116
117void mcl::ConnectionSurfaceMap::erase(int buffer_id)117void mcl::ConnectionSurfaceMap::erase(int buffer_id)
118{118{
119 std::lock_guard<decltype(guard)> lk(guard);119 std::lock_guard<decltype(buffer_guard)> lk(buffer_guard);
120 buffers.erase(buffer_id);120 buffers.erase(buffer_id);
121}121}
122122
123std::shared_ptr<mcl::MirBuffer> mcl::ConnectionSurfaceMap::buffer(int buffer_id) const123std::shared_ptr<mcl::MirBuffer> mcl::ConnectionSurfaceMap::buffer(int buffer_id) const
124{124{
125 std::shared_lock<decltype(guard)> lk(guard);125 std::shared_lock<decltype(buffer_guard)> lk(buffer_guard);
126 auto const it = buffers.find(buffer_id);126 auto const it = buffers.find(buffer_id);
127 if (it != buffers.end())127 if (it != buffers.end())
128 return it->second;128 return it->second;
129129
=== modified file 'src/server/compositor/multi_monitor_arbiter.cpp'
--- src/server/compositor/multi_monitor_arbiter.cpp 2016-05-03 06:55:25 +0000
+++ src/server/compositor/multi_monitor_arbiter.cpp 2016-09-22 19:03:27 +0000
@@ -39,6 +39,17 @@
39{39{
40}40}
4141
42mc::MultiMonitorArbiter::~MultiMonitorArbiter()
43{
44 std::lock_guard<decltype(mutex)> lk(mutex);
45 for(auto it = onscreen_buffers.begin(); it != onscreen_buffers.end(); it++)
46 {
47 if (it->use_count == 0)
48 map->send_buffer(it->buffer->id());
49 }
50
51}
52
42std::shared_ptr<mg::Buffer> mc::MultiMonitorArbiter::compositor_acquire(compositor::CompositorID id)53std::shared_ptr<mg::Buffer> mc::MultiMonitorArbiter::compositor_acquire(compositor::CompositorID id)
43{54{
44 std::lock_guard<decltype(mutex)> lk(mutex);55 std::lock_guard<decltype(mutex)> lk(mutex);
4556
=== modified file 'src/server/compositor/multi_monitor_arbiter.h'
--- src/server/compositor/multi_monitor_arbiter.h 2016-05-03 06:55:25 +0000
+++ src/server/compositor/multi_monitor_arbiter.h 2016-09-22 19:03:27 +0000
@@ -41,6 +41,7 @@
41 MultiMonitorMode mode,41 MultiMonitorMode mode,
42 std::shared_ptr<frontend::ClientBuffers> const& map,42 std::shared_ptr<frontend::ClientBuffers> const& map,
43 std::shared_ptr<Schedule> const& schedule);43 std::shared_ptr<Schedule> const& schedule);
44 ~MultiMonitorArbiter();
4445
45 std::shared_ptr<graphics::Buffer> compositor_acquire(compositor::CompositorID id) override;46 std::shared_ptr<graphics::Buffer> compositor_acquire(compositor::CompositorID id) override;
46 void compositor_release(std::shared_ptr<graphics::Buffer> const&) override;47 void compositor_release(std::shared_ptr<graphics::Buffer> const&) override;
4748
=== modified file 'src/server/compositor/stream.cpp'
--- src/server/compositor/stream.cpp 2016-06-02 05:33:50 +0000
+++ src/server/compositor/stream.cpp 2016-09-22 19:03:27 +0000
@@ -73,6 +73,12 @@
73{73{
74}74}
7575
76mc::Stream::~Stream()
77{
78 while(schedule->num_scheduled())
79 buffers->send_buffer(schedule->next_buffer()->id());
80}
81
76unsigned int mc::Stream::client_owned_buffer_count(std::lock_guard<decltype(mutex)> const&) const82unsigned int mc::Stream::client_owned_buffer_count(std::lock_guard<decltype(mutex)> const&) const
77{83{
78 auto server_count = schedule->num_scheduled();84 auto server_count = schedule->num_scheduled();
7985
=== modified file 'src/server/compositor/stream.h'
--- src/server/compositor/stream.h 2016-05-04 01:48:16 +0000
+++ src/server/compositor/stream.h 2016-09-22 19:03:27 +0000
@@ -44,6 +44,7 @@
44 Stream(44 Stream(
45 FrameDroppingPolicyFactory const& policy_factory,45 FrameDroppingPolicyFactory const& policy_factory,
46 std::shared_ptr<frontend::ClientBuffers>, geometry::Size sz, MirPixelFormat format);46 std::shared_ptr<frontend::ClientBuffers>, geometry::Size sz, MirPixelFormat format);
47 ~Stream();
4748
48 void swap_buffers(49 void swap_buffers(
49 graphics::Buffer* old_buffer, std::function<void(graphics::Buffer* new_buffer)> complete) override;50 graphics::Buffer* old_buffer, std::function<void(graphics::Buffer* new_buffer)> complete) override;
5051
=== modified file 'tests/acceptance-tests/throwback/test_presentation_chain.cpp'
--- tests/acceptance-tests/throwback/test_presentation_chain.cpp 2016-08-23 16:18:08 +0000
+++ tests/acceptance-tests/throwback/test_presentation_chain.cpp 2016-09-22 19:03:27 +0000
@@ -188,6 +188,10 @@
188 unsigned int callback_count = 0;188 unsigned int callback_count = 0;
189};189};
190190
191void ignore_callback(MirBuffer*, void*)
192{
193}
194
191void buffer_callback(MirBuffer* buffer, void* context)195void buffer_callback(MirBuffer* buffer, void* context)
192{196{
193 auto sync = reinterpret_cast<MirBufferSync*>(context);197 auto sync = reinterpret_cast<MirBufferSync*>(context);
@@ -292,6 +296,9 @@
292 if (i != 0)296 if (i != 0)
293 ASSERT_TRUE(contexts[(i-1) % num_buffers].wait_for_buffer(10s)) << "iteration " << i;297 ASSERT_TRUE(contexts[(i-1) % num_buffers].wait_for_buffer(10s)) << "iteration " << i;
294 }298 }
299
300 for (auto& context : contexts)
301 mir_buffer_set_callback(context.buffer(), ignore_callback, nullptr);
295}302}
296303
297TEST_F(PresentationChain, submission_will_eventually_call_callback_reassociated)304TEST_F(PresentationChain, submission_will_eventually_call_callback_reassociated)
@@ -318,6 +325,8 @@
318 if (i != 0)325 if (i != 0)
319 ASSERT_TRUE(contexts[(i-1) % num_buffers].wait_for_buffer(10s)) << "iteration " << i;326 ASSERT_TRUE(contexts[(i-1) % num_buffers].wait_for_buffer(10s)) << "iteration " << i;
320 }327 }
328 for (auto& context : contexts)
329 mir_buffer_set_callback(context.buffer(), ignore_callback, nullptr);
321}330}
322331
323TEST_F(PresentationChain, buffers_can_be_destroyed_before_theyre_returned)332TEST_F(PresentationChain, buffers_can_be_destroyed_before_theyre_returned)
@@ -336,6 +345,45 @@
336 mir_buffer_release(context.buffer());345 mir_buffer_release(context.buffer());
337}346}
338347
348TEST_F(PresentationChain, destroying_a_chain_will_return_buffers_associated_with_chain)
349{
350 auto chain = mir_connection_create_presentation_chain_sync(connection);
351 auto stream = mir_connection_create_buffer_stream_sync(connection, 25, 12, mir_pixel_format_abgr_8888, mir_buffer_usage_hardware);
352 ASSERT_TRUE(mir_presentation_chain_is_valid(chain));
353
354 auto spec = mir_connection_create_spec_for_normal_surface(
355 connection, size.width.as_int(), size.height.as_int(), pf);
356 auto surface = mir_surface_create_sync(spec);
357 mir_surface_spec_release(spec);
358
359 spec = mir_connection_create_spec_for_changes(connection);
360 mir_surface_spec_add_presentation_chain(
361 spec, size.width.as_int(), size.height.as_int(), 0, 0, chain);
362 mir_surface_apply_spec(surface, spec);
363 mir_surface_spec_release(spec);
364
365 MirBufferSync context;
366 mir_connection_allocate_buffer(
367 connection,
368 size.width.as_int(), size.height.as_int(), pf, usage,
369 buffer_callback, &context);
370 ASSERT_TRUE(context.wait_for_buffer(10s));
371 context.unavailable();
372 mir_presentation_chain_submit_buffer(chain, context.buffer());
373
374 spec = mir_connection_create_spec_for_changes(connection);
375 mir_surface_spec_add_buffer_stream(spec, 0, 0, stream);
376 mir_surface_apply_spec(surface, spec);
377 mir_surface_spec_release(spec);
378 mir_presentation_chain_release(chain);
379 mir_buffer_stream_swap_buffers_sync(stream);
380
381 ASSERT_TRUE(context.wait_for_buffer(10s));
382
383 mir_buffer_stream_release_sync(stream);
384 mir_surface_release_sync(surface);
385}
386
339TEST_F(PresentationChain, can_access_basic_buffer_properties)387TEST_F(PresentationChain, can_access_basic_buffer_properties)
340{388{
341 MirBufferSync context;389 MirBufferSync context;
@@ -417,4 +465,7 @@
417465
418 ASSERT_TRUE(another_context.wait_for_buffer(10s));466 ASSERT_TRUE(another_context.wait_for_buffer(10s));
419 ASSERT_THAT(another_context.buffer(), Ne(nullptr));467 ASSERT_THAT(another_context.buffer(), Ne(nullptr));
468
469 mir_buffer_set_callback(context.buffer(), ignore_callback, nullptr);
470 mir_buffer_set_callback(second_buffer_context.buffer(), ignore_callback, nullptr);
420}471}
421472
=== modified file 'tests/integration-tests/test_buffer_scheduling.cpp'
--- tests/integration-tests/test_buffer_scheduling.cpp 2016-08-16 19:34:28 +0000
+++ tests/integration-tests/test_buffer_scheduling.cpp 2016-09-22 19:03:27 +0000
@@ -453,6 +453,10 @@
453 vault.set_size(sz);453 vault.set_size(sz);
454 });454 });
455 }455 }
456 ~ScheduledProducer()
457 {
458 ipc->on_client_bound_transfer([this](mp::BufferRequest&){});
459 }
456460
457 bool can_produce()461 bool can_produce()
458 {462 {
459463
=== modified file 'tests/unit-tests/client/test_mir_connection.cpp'
--- tests/unit-tests/client/test_mir_connection.cpp 2016-06-28 12:18:18 +0000
+++ tests/unit-tests/client/test_mir_connection.cpp 2016-09-22 19:03:27 +0000
@@ -820,7 +820,7 @@
820 static_cast<MirPresentationChain*>(callback.resulting_chain)->rpc_id());820 static_cast<MirPresentationChain*>(callback.resulting_chain)->rpc_id());
821821
822 EXPECT_CALL(*mock_channel, buffer_stream_release(ReleaseRequestHasId(expected_request)))822 EXPECT_CALL(*mock_channel, buffer_stream_release(ReleaseRequestHasId(expected_request)))
823 .Times(0);823 .Times(1);
824824
825 connection->release_presentation_chain(callback.resulting_chain);825 connection->release_presentation_chain(callback.resulting_chain);
826}826}
827827
=== modified file 'tests/unit-tests/compositor/test_multi_monitor_arbiter.cpp'
--- tests/unit-tests/compositor/test_multi_monitor_arbiter.cpp 2016-06-02 05:33:50 +0000
+++ tests/unit-tests/compositor/test_multi_monitor_arbiter.cpp 2016-09-22 19:03:27 +0000
@@ -142,6 +142,7 @@
142 EXPECT_THAT(cbuffer1, Ne(cbuffer2));142 EXPECT_THAT(cbuffer1, Ne(cbuffer2));
143 arbiter.compositor_release(cbuffer2);143 arbiter.compositor_release(cbuffer2);
144 arbiter.compositor_release(cbuffer1);144 arbiter.compositor_release(cbuffer1);
145 Mock::VerifyAndClearExpectations(&mock_map);
145}146}
146147
147TEST_F(MultiMonitorArbiterWithAnyFrameGuarantee, compositor_buffer_syncs_to_fastest_compositor)148TEST_F(MultiMonitorArbiterWithAnyFrameGuarantee, compositor_buffer_syncs_to_fastest_compositor)
@@ -394,6 +395,8 @@
394 arbiter.compositor_release(b4);395 arbiter.compositor_release(b4);
395 auto b6 = arbiter.compositor_acquire(&comp_id1);396 auto b6 = arbiter.compositor_acquire(&comp_id1);
396 arbiter.compositor_release(b6);397 arbiter.compositor_release(b6);
398
399 Mock::VerifyAndClearExpectations(&mock_map);
397}400}
398401
399TEST_F(MultiMonitorArbiter, can_check_if_buffers_are_ready)402TEST_F(MultiMonitorArbiter, can_check_if_buffers_are_ready)
@@ -458,6 +461,7 @@
458 EXPECT_THAT(b2, Eq(buffers[1]));461 EXPECT_THAT(b2, Eq(buffers[1]));
459 arbiter.compositor_release(b1);462 arbiter.compositor_release(b1);
460 arbiter.compositor_release(b2);463 arbiter.compositor_release(b2);
464 Mock::VerifyAndClearExpectations(&mock_map);
461} 465}
462466
463TEST_F(MultiMonitorArbiter, will_release_buffer_in_nbuffers_2_starvation_scenario)467TEST_F(MultiMonitorArbiter, will_release_buffer_in_nbuffers_2_starvation_scenario)
@@ -513,6 +517,7 @@
513 EXPECT_THAT(b3, Eq(buffers[1]));517 EXPECT_THAT(b3, Eq(buffers[1]));
514 EXPECT_THAT(b4, Eq(buffers[1]));518 EXPECT_THAT(b4, Eq(buffers[1]));
515 EXPECT_THAT(b5, Eq(buffers[2]));519 EXPECT_THAT(b5, Eq(buffers[2]));
520 Mock::VerifyAndClearExpectations(&mock_map);
516} 521}
517522
518TEST_F(MultiMonitorArbiter, can_advance_buffer_manually)523TEST_F(MultiMonitorArbiter, can_advance_buffer_manually)
@@ -532,3 +537,11 @@
532 auto b3 = arbiter.compositor_acquire(&comp_id1);537 auto b3 = arbiter.compositor_acquire(&comp_id1);
533 EXPECT_THAT(b3->id(), Eq(buffers[2]->id()));538 EXPECT_THAT(b3->id(), Eq(buffers[2]->id()));
534}539}
540
541TEST_F(MultiMonitorArbiter, releases_buffer_on_destruction)
542{
543 mc::MultiMonitorArbiter arbiter{guarantee, mt::fake_shared(mock_map), mt::fake_shared(schedule)};
544 EXPECT_CALL(mock_map, send_buffer(buffers[0]->id()));
545 schedule.set_schedule({buffers[0]});
546 arbiter.advance_schedule();
547}
535548
=== modified file 'tests/unit-tests/compositor/test_stream.cpp'
--- tests/unit-tests/compositor/test_stream.cpp 2016-05-04 01:48:16 +0000
+++ tests/unit-tests/compositor/test_stream.cpp 2016-09-22 19:03:27 +0000
@@ -123,6 +123,7 @@
123 cbuffers.push_back(stream.lock_compositor_buffer(this));123 cbuffers.push_back(stream.lock_compositor_buffer(this));
124 ASSERT_THAT(cbuffers, SizeIs(1));124 ASSERT_THAT(cbuffers, SizeIs(1));
125 EXPECT_THAT(cbuffers[0]->id(), Eq(buffers.back()->id()));125 EXPECT_THAT(cbuffers[0]->id(), Eq(buffers.back()->id()));
126 Mock::VerifyAndClearExpectations(&mock_sink);
126}127}
127128
128TEST_F(Stream, transitions_from_framedropping_to_queuing)129TEST_F(Stream, transitions_from_framedropping_to_queuing)
@@ -325,6 +326,7 @@
325 Mock::VerifyAndClearExpectations(&mock_sink);326 Mock::VerifyAndClearExpectations(&mock_sink);
326 EXPECT_CALL(mock_sink, send_buffer(_,_,_));327 EXPECT_CALL(mock_sink, send_buffer(_,_,_));
327 framedrop_factory.trigger_policies();328 framedrop_factory.trigger_policies();
329 Mock::VerifyAndClearExpectations(&mock_sink);
328}330}
329331
330TEST_F(Stream, doesnt_drop_the_only_frame_when_arbiter_has_none)332TEST_F(Stream, doesnt_drop_the_only_frame_when_arbiter_has_none)
@@ -334,6 +336,7 @@
334 EXPECT_CALL(mock_sink, send_buffer(_,_,_))336 EXPECT_CALL(mock_sink, send_buffer(_,_,_))
335 .Times(0);337 .Times(0);
336 framedrop_factory.trigger_policies();338 framedrop_factory.trigger_policies();
339 Mock::VerifyAndClearExpectations(&mock_sink);
337}340}
338341
339TEST_F(Stream, doesnt_drop_the_latest_frame_with_a_longer_queue)342TEST_F(Stream, doesnt_drop_the_latest_frame_with_a_longer_queue)
@@ -347,6 +350,7 @@
347 EXPECT_CALL(mock_sink, send_buffer(_,Ref(*buffers[1]),_))350 EXPECT_CALL(mock_sink, send_buffer(_,Ref(*buffers[1]),_))
348 .Times(1);351 .Times(1);
349 framedrop_factory.trigger_policies();352 framedrop_factory.trigger_policies();
353 Mock::VerifyAndClearExpectations(&mock_sink);
350}354}
351355
352TEST_F(Stream, doesnt_drop_the_latest_frame_with_a_2_buffer_queue)356TEST_F(Stream, doesnt_drop_the_latest_frame_with_a_2_buffer_queue)
@@ -359,6 +363,7 @@
359 EXPECT_CALL(mock_sink, send_buffer(_,Ref(*buffers[1]),_))363 EXPECT_CALL(mock_sink, send_buffer(_,Ref(*buffers[1]),_))
360 .Times(0);364 .Times(0);
361 framedrop_factory.trigger_policies();365 framedrop_factory.trigger_policies();
366 Mock::VerifyAndClearExpectations(&mock_sink);
362}367}
363368
364TEST_F(Stream, returns_buffers_to_client_when_told_to_bring_queue_up_to_date)369TEST_F(Stream, returns_buffers_to_client_when_told_to_bring_queue_up_to_date)
@@ -371,4 +376,5 @@
371 EXPECT_CALL(mock_sink, send_buffer(_,Ref(*buffers[0]),_));376 EXPECT_CALL(mock_sink, send_buffer(_,Ref(*buffers[0]),_));
372 EXPECT_CALL(mock_sink, send_buffer(_,Ref(*buffers[1]),_));377 EXPECT_CALL(mock_sink, send_buffer(_,Ref(*buffers[1]),_));
373 stream.drop_old_buffers();378 stream.drop_old_buffers();
379 Mock::VerifyAndClearExpectations(&mock_sink);
374}380}

Subscribers

People subscribed via source and target branches