Mir

Merge lp:~kdub/mir/fix-1584784 into lp:mir

Proposed by Kevin DuBois
Status: Merged
Approved by: Kevin DuBois
Approved revision: no longer in the source branch.
Merged at revision: 3530
Proposed branch: lp:~kdub/mir/fix-1584784
Merge into: lp:mir
Diff against target: 511 lines (+191/-48)
8 files modified
src/client/buffer_stream.cpp (+20/-12)
src/client/buffer_vault.cpp (+42/-7)
src/client/buffer_vault.h (+11/-3)
src/client/mir_connection.h (+1/-1)
tests/acceptance-tests/test_client_surface_swap_buffers.cpp (+73/-1)
tests/integration-tests/test_buffer_scheduling.cpp (+1/-1)
tests/unit-tests/client/test_buffer_vault.cpp (+23/-23)
tests/unit-tests/client/test_client_buffer_stream.cpp (+20/-0)
To merge this branch: bzr merge lp:~kdub/mir/fix-1584784
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve
Cemil Azizoglu (community) Approve
Chris Halse Rogers Approve
Review via email: mp+296106@code.launchpad.net

Commit message

client: make sure that users of mir_buffer_stream_swap_buffers() never get blocked awaiting incoming buffers. The code this MP is fixing could wait on buffers if the producer produced quickly. (eg, sw Xmir with a small window, common in pocket desktop on frieza)

The signalling had to shift from the glue-code in bufferstream to the BufferVault, as that is the object that knows if there are buffers available. As mentioned in prior MPs, one of the things to be done once the old stuff is removed is to condense the glue-code in mir_client_buffer_stream.cpp and BufferVault (its currently useful for switching between NBUFFERS=0 / 3)

fixes: LP: #1584784

Description of the change

client: make sure that users of mir_buffer_stream_swap_buffers() never get blocked awaiting incoming buffers. The code this MP is fixing could wait on buffers if the producer produced quickly. (eg, sw Xmir with a small window, common in pocket desktop on frieza).

The signalling had to shift from the glue-code in bufferstream to the BufferVault, as that is the object that knows if there are buffers available. As mentioned in prior MPs, one of the things to be done once the old stuff is removed is to condense the glue-code in mir_client_buffer_stream.cpp and BufferVault (its currently useful for switching between NBUFFERS=0 / 3)

fixes: LP: #1584784

Note: The approved version of this fix will be ported to 0.23. I've ported the initial revision over to the 0.23 branch already to get the ball rolling on the silo rebuild.

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

FAILED: Continuous integration, rev:3529
https://mir-jenkins.ubuntu.com/job/mir-ci/1058/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/1164/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1212
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1203
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1203
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1174/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1174
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1174/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/1174
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1174/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/1174
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1174/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1174/console

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :
Revision history for this message
Kevin DuBois (kdub) wrote :

other failures need addressing though.

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3529
https://mir-jenkins.ubuntu.com/job/mir-ci/1059/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/1165/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1213
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1204
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1204
    ABORTED: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1175/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1175/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1175
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1175/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/1175
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1175/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1175/console

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

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

FAILED: Continuous integration, rev:3530
https://mir-jenkins.ubuntu.com/job/mir-ci/1060/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/1166/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1214
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1205
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1205
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1176/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1176/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1176
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1176/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/1176
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1176/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1176/console

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Chris Halse Rogers (raof) wrote :

Looks sensible.

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

Ideally std::map<int, Owner> should be a typedef, only defined once.

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3530
https://mir-jenkins.ubuntu.com/job/mir-ci/1063/
Executed test runs:

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

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

FAILED: Continuous integration, rev:3534
https://mir-jenkins.ubuntu.com/job/mir-ci/1064/
Executed test runs:

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

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

FAILED: Continuous integration, rev:3534
https://mir-jenkins.ubuntu.com/job/mir-ci/1066/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/1175/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1225
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1216
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1216
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1185/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1185/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1185
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1185/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/1185
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1185/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1185/console

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

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

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

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

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

Changed the locking a bit from the "approve" from Chris (idea is still the same), but should probably get another review before landing.

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

Oh will this also fix the "no new buffers" crash? (bug 1506358)

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

re: 1506358, probably not, most of the code change is in the new path, and seems that crash came through the old path. I'll comment in the bug too.

re: rev 3537, corrects a problem seen in porting this to the 0.23 series (and which is averted in the 0.24 series by other commits that are larger and don't need a full port to 0.23)

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

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

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

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

This works for me.

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

Cancelled the autolanding, still working on testing the recent revs with full stack.

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Autolanding.
Approved revid is not set in launchpad. This is most likely a launchpad issue and re-approve should fix it. There is also a chance (although a very small one) this is a permission problem of the ps-jenkins bot.
https://mir-jenkins.ubuntu.com/job/mir-autolanding/297/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/1193
    None: https://mir-jenkins.ubuntu.com/job/generic-land-mp/320/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1243
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1234
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1234
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1203
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1203/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1203
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1203/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/1203
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1203/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/1203
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1203/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1203
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1203/artifact/output/*zip*/output.zip

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

FAILED: Autolanding.
More details in the following jenkins job:
https://mir-jenkins.ubuntu.com/job/mir-autolanding/297/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/1193
    FAILURE: https://mir-jenkins.ubuntu.com/job/generic-land-mp/320/console
    None: https://mir-jenkins.ubuntu.com/job/generic-land-mp/321/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1243
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1234
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1234
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1203
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1203/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1203
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1203/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/1203
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1203/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/1203
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1203/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1203
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1203/artifact/output/*zip*/output.zip

review: Needs Fixing (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

> Cancelled the autolanding, still working on testing the recent revs with full
> stack.

Exposed lp: #1588929, which after a good deal of investigation seems to be a pre-existing bug (and doesnt look related to this fix), during full stack testing, so MP is good to autoland.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/client/buffer_stream.cpp'
--- src/client/buffer_stream.cpp 2016-06-02 05:33:50 +0000
+++ src/client/buffer_stream.cpp 2016-06-02 13:02:31 +0000
@@ -181,6 +181,14 @@
181 }181 }
182 if (next_buffer_wait_handle.is_pending())182 if (next_buffer_wait_handle.is_pending())
183 next_buffer_wait_handle.result_received();183 next_buffer_wait_handle.result_received();
184
185 while (!incoming_buffers.empty())
186 {
187 auto b = incoming_buffers.front();
188 for (auto i = 0; i < b.fd_size(); i++)
189 close(b.fd(i));
190 incoming_buffers.pop();
191 }
184 }192 }
185193
186 void set_size(geom::Size) override194 void set_size(geom::Size) override
@@ -299,6 +307,8 @@
299 geom::Size size, MirPixelFormat format, int usage,307 geom::Size size, MirPixelFormat format, int usage,
300 unsigned int initial_nbuffers) :308 unsigned int initial_nbuffers) :
301 vault(factory, mirbuffer_factory, requests, surface_map, size, format, usage, initial_nbuffers),309 vault(factory, mirbuffer_factory, requests, surface_map, size, format, usage, initial_nbuffers),
310 current(nullptr),
311 future(vault.withdraw()),
302 size_(size)312 size_(size)
303 {313 {
304 }314 }
@@ -310,9 +320,9 @@
310 void advance_current_buffer(std::unique_lock<std::mutex>& lk)320 void advance_current_buffer(std::unique_lock<std::mutex>& lk)
311 {321 {
312 lk.unlock();322 lk.unlock();
313 auto buffer = vault.withdraw().get();323 auto c = future.get();
314 lk.lock();324 lk.lock();
315 current = buffer;325 current = c;
316 }326 }
317327
318 std::shared_ptr<mir::client::ClientBuffer> current_buffer() override328 std::shared_ptr<mir::client::ClientBuffer> current_buffer() override
@@ -336,18 +346,16 @@
336 std::unique_lock<std::mutex> lk(mutex);346 std::unique_lock<std::mutex> lk(mutex);
337 if (!current)347 if (!current)
338 advance_current_buffer(lk);348 advance_current_buffer(lk);
349 auto c = current;
350 current = nullptr;
339 lk.unlock();351 lk.unlock();
340352
341 vault.deposit(current);353 vault.deposit(c);
342354 auto wh = vault.wire_transfer_outbound(c, done);
343 next_buffer_wait_handle.expect_result();355 auto f = vault.withdraw();
344 vault.wire_transfer_outbound(current);
345 next_buffer_wait_handle.result_received();
346
347 lk.lock();356 lk.lock();
348 advance_current_buffer(lk);357 future = std::move(f);
349 done();358 return wh;
350 return &next_buffer_wait_handle;
351 }359 }
352360
353 void set_size(geom::Size size) override361 void set_size(geom::Size size) override
@@ -398,7 +406,7 @@
398 mcl::BufferVault vault;406 mcl::BufferVault vault;
399 std::mutex mutable mutex;407 std::mutex mutable mutex;
400 std::shared_ptr<mcl::Buffer> current{nullptr};408 std::shared_ptr<mcl::Buffer> current{nullptr};
401 MirWaitHandle next_buffer_wait_handle;409 mir::client::NoTLSFuture<std::shared_ptr<mcl::Buffer>> future;
402 MirWaitHandle scale_wait_handle;410 MirWaitHandle scale_wait_handle;
403 int current_swap_interval = 1;411 int current_swap_interval = 1;
404 geom::Size size_;412 geom::Size size_;
405413
=== modified file 'src/client/buffer_vault.cpp'
--- src/client/buffer_vault.cpp 2016-06-02 05:33:50 +0000
+++ src/client/buffer_vault.cpp 2016-06-02 13:02:31 +0000
@@ -120,12 +120,9 @@
120 BOOST_THROW_EXCEPTION(std::logic_error("no buffer in map"));120 BOOST_THROW_EXCEPTION(std::logic_error("no buffer in map"));
121}121}
122122
123mcl::NoTLSFuture<std::shared_ptr<mcl::Buffer>> mcl::BufferVault::withdraw()123
124mcl::BufferVault::BufferMap::iterator mcl::BufferVault::available_buffer()
124{125{
125 std::unique_lock<std::mutex> lk(mutex);
126 if (disconnected_)
127 BOOST_THROW_EXCEPTION(std::logic_error("server_disconnected"));
128 mcl::NoTLSPromise<std::shared_ptr<mcl::Buffer>> promise;
129 auto it = std::find_if(buffers.begin(), buffers.end(),126 auto it = std::find_if(buffers.begin(), buffers.end(),
130 [this](std::pair<int, Owner> const& entry) {127 [this](std::pair<int, Owner> const& entry) {
131 return ((entry.second == Owner::Self) &&128 return ((entry.second == Owner::Self) &&
@@ -136,7 +133,16 @@
136 [this](std::pair<int, Owner> const& entry) {133 [this](std::pair<int, Owner> const& entry) {
137 return ((entry.second == Owner::Self) &&134 return ((entry.second == Owner::Self) &&
138 (checked_buffer_from_map(entry.first)->size() == size)); });135 (checked_buffer_from_map(entry.first)->size() == size)); });
136 return it;
137}
139138
139mcl::NoTLSFuture<std::shared_ptr<mcl::Buffer>> mcl::BufferVault::withdraw()
140{
141 std::unique_lock<std::mutex> lk(mutex);
142 if (disconnected_)
143 BOOST_THROW_EXCEPTION(std::logic_error("server_disconnected"));
144 mcl::NoTLSPromise<std::shared_ptr<mcl::Buffer>> promise;
145 auto it = available_buffer();
140 auto future = promise.get_future();146 auto future = promise.get_future();
141 if (it != buffers.end())147 if (it != buffers.end())
142 {148 {
@@ -170,7 +176,8 @@
170 checked_buffer_from_map(it->first)->increment_age();176 checked_buffer_from_map(it->first)->increment_age();
171}177}
172178
173void mcl::BufferVault::wire_transfer_outbound(std::shared_ptr<mcl::Buffer> const& buffer)179MirWaitHandle* mcl::BufferVault::wire_transfer_outbound(
180 std::shared_ptr<mcl::Buffer> const& buffer, std::function<void()> const& done)
174{181{
175 std::unique_lock<std::mutex> lk(mutex);182 std::unique_lock<std::mutex> lk(mutex);
176 auto it = buffers.find(buffer->rpc_id());183 auto it = buffers.find(buffer->rpc_id());
@@ -181,6 +188,20 @@
181188
182 buffer->submitted();189 buffer->submitted();
183 server_requests->submit_buffer(*buffer);190 server_requests->submit_buffer(*buffer);
191
192 lk.lock();
193 if (disconnected_)
194 BOOST_THROW_EXCEPTION(std::logic_error("server_disconnected"));
195 if (buffers.end() != available_buffer())
196 {
197 done();
198 }
199 else
200 {
201 next_buffer_wait_handle.expect_result();
202 deferred_cb = done;
203 }
204 return &next_buffer_wait_handle;
184}205}
185206
186void mcl::BufferVault::wire_transfer_inbound(int buffer_id)207void mcl::BufferVault::wire_transfer_inbound(int buffer_id)
@@ -228,13 +249,27 @@
228 promises.front().set_value(buffer);249 promises.front().set_value(buffer);
229 promises.pop_front();250 promises.pop_front();
230 }251 }
252
253 trigger_callback(std::move(lk));
231}254}
232255
233void mcl::BufferVault::disconnected()256void mcl::BufferVault::disconnected()
234{257{
235 std::lock_guard<std::mutex> lk(mutex);258 std::unique_lock<std::mutex> lk(mutex);
236 disconnected_ = true;259 disconnected_ = true;
237 promises.clear();260 promises.clear();
261 trigger_callback(std::move(lk));
262}
263
264void mcl::BufferVault::trigger_callback(std::unique_lock<std::mutex> lk)
265{
266 if (auto cb = deferred_cb)
267 {
268 deferred_cb = {};
269 lk.unlock();
270 cb();
271 next_buffer_wait_handle.result_received();
272 }
238}273}
239274
240void mcl::BufferVault::set_scale(float scale)275void mcl::BufferVault::set_scale(float scale)
241276
=== modified file 'src/client/buffer_vault.h'
--- src/client/buffer_vault.h 2016-06-02 05:33:50 +0000
+++ src/client/buffer_vault.h 2016-06-02 13:02:31 +0000
@@ -22,6 +22,7 @@
22#include "mir/geometry/size.h"22#include "mir/geometry/size.h"
23#include "mir_toolkit/common.h"23#include "mir_toolkit/common.h"
24#include "mir_toolkit/mir_native_buffer.h"24#include "mir_toolkit/mir_native_buffer.h"
25#include "mir_wait_handle.h"
25#include <memory>26#include <memory>
26#include "no_tls_future-inl.h"27#include "no_tls_future-inl.h"
27#include <deque>28#include <deque>
@@ -67,7 +68,8 @@
67 NoTLSFuture<std::shared_ptr<Buffer>> withdraw();68 NoTLSFuture<std::shared_ptr<Buffer>> withdraw();
68 void deposit(std::shared_ptr<Buffer> const& buffer);69 void deposit(std::shared_ptr<Buffer> const& buffer);
69 void wire_transfer_inbound(int buffer_id);70 void wire_transfer_inbound(int buffer_id);
70 void wire_transfer_outbound(std::shared_ptr<Buffer> const& buffer);71 MirWaitHandle* wire_transfer_outbound(
72 std::shared_ptr<Buffer> const& buffer, std::function<void()> const&);
71 void set_size(geometry::Size);73 void set_size(geometry::Size);
72 void disconnected();74 void disconnected();
73 void set_scale(float scale);75 void set_scale(float scale);
@@ -75,6 +77,11 @@
75 void decrease_buffer_count();77 void decrease_buffer_count();
7678
77private:79private:
80 enum class Owner;
81 typedef std::map<int, Owner> BufferMap;
82 BufferMap::iterator available_buffer();
83 void trigger_callback(std::unique_lock<std::mutex> lk);
84
78 void alloc_buffer(geometry::Size size, MirPixelFormat format, int usage);85 void alloc_buffer(geometry::Size size, MirPixelFormat format, int usage);
79 void free_buffer(int free_id);86 void free_buffer(int free_id);
80 void realloc_buffer(int free_id, geometry::Size size, MirPixelFormat format, int usage);87 void realloc_buffer(int free_id, geometry::Size size, MirPixelFormat format, int usage);
@@ -89,9 +96,8 @@
89 MirPixelFormat const format;96 MirPixelFormat const format;
90 int const usage;97 int const usage;
9198
92 enum class Owner;
93 std::mutex mutex;99 std::mutex mutex;
94 std::map<int, Owner> buffers;100 BufferMap buffers;
95 std::deque<NoTLSPromise<std::shared_ptr<Buffer>>> promises;101 std::deque<NoTLSPromise<std::shared_ptr<Buffer>>> promises;
96 geometry::Size size;102 geometry::Size size;
97 bool disconnected_;103 bool disconnected_;
@@ -99,6 +105,8 @@
99 size_t needed_buffer_count;105 size_t needed_buffer_count;
100 size_t const initial_buffer_count;106 size_t const initial_buffer_count;
101 int last_received_id = 0;107 int last_received_id = 0;
108 MirWaitHandle next_buffer_wait_handle;
109 std::function<void()> deferred_cb;
102};110};
103}111}
104}112}
105113
=== modified file 'src/client/mir_connection.h'
--- src/client/mir_connection.h 2016-06-02 05:33:50 +0000
+++ src/client/mir_connection.h 2016-06-02 13:02:31 +0000
@@ -260,6 +260,7 @@
260260
261 mutable std::mutex mutex; // Protects all members of *this (except release_wait_handles)261 mutable std::mutex mutex; // Protects all members of *this (except release_wait_handles)
262262
263 std::shared_ptr<mir::client::ClientPlatform> platform;
263 std::shared_ptr<mir::client::ConnectionSurfaceMap> surface_map;264 std::shared_ptr<mir::client::ConnectionSurfaceMap> surface_map;
264 std::shared_ptr<mir::client::AsyncBufferFactory> buffer_factory;265 std::shared_ptr<mir::client::AsyncBufferFactory> buffer_factory;
265 std::shared_ptr<mir::client::rpc::MirBasicRpcChannel> const channel;266 std::shared_ptr<mir::client::rpc::MirBasicRpcChannel> const channel;
@@ -280,7 +281,6 @@
280 int surface_error_id{-1};281 int surface_error_id{-1};
281282
282 std::shared_ptr<mir::client::ClientPlatformFactory> const client_platform_factory;283 std::shared_ptr<mir::client::ClientPlatformFactory> const client_platform_factory;
283 std::shared_ptr<mir::client::ClientPlatform> platform;
284 std::shared_ptr<mir::client::ClientBufferFactory> client_buffer_factory;284 std::shared_ptr<mir::client::ClientBufferFactory> client_buffer_factory;
285 std::shared_ptr<EGLNativeDisplayType> native_display;285 std::shared_ptr<EGLNativeDisplayType> native_display;
286286
287287
=== modified file 'tests/acceptance-tests/test_client_surface_swap_buffers.cpp'
--- tests/acceptance-tests/test_client_surface_swap_buffers.cpp 2016-01-29 08:18:22 +0000
+++ tests/acceptance-tests/test_client_surface_swap_buffers.cpp 2016-06-02 13:02:31 +0000
@@ -21,13 +21,17 @@
21#include "mir_test_framework/connected_client_with_a_surface.h"21#include "mir_test_framework/connected_client_with_a_surface.h"
22#include "mir/test/doubles/null_display_buffer_compositor_factory.h"22#include "mir/test/doubles/null_display_buffer_compositor_factory.h"
23#include "mir/test/signal.h"23#include "mir/test/signal.h"
24#include "mir/compositor/scene_element.h"
25#include "mir/graphics/renderable.h"
26#include "mir/graphics/cursor.h"
2427
25#include <gtest/gtest.h>28#include <gtest/gtest.h>
2629
27namespace mtf = mir_test_framework;30namespace mtf = mir_test_framework;
28namespace mt = mir::test;31namespace mt = mir::test;
29namespace mtd = mir::test::doubles;32namespace mtd = mir::test::doubles;
3033namespace mc = mir::compositor;
34namespace mg = mir::graphics;
31using namespace testing;35using namespace testing;
3236
33namespace37namespace
@@ -50,6 +54,7 @@
50 ConnectedClientWithASurface::SetUp();54 ConnectedClientWithASurface::SetUp();
51 }55 }
52};56};
57
53}58}
5459
55TEST_F(SurfaceSwapBuffers, does_not_block_when_surface_is_not_composited)60TEST_F(SurfaceSwapBuffers, does_not_block_when_surface_is_not_composited)
@@ -67,3 +72,70 @@
67 ASSERT_TRUE(buffers_swapped.wait_for(std::chrono::seconds{20}));72 ASSERT_TRUE(buffers_swapped.wait_for(std::chrono::seconds{20}));
68 }73 }
69}74}
75
76namespace
77{
78struct BufferCollectingCompositorFactory : mc::DisplayBufferCompositorFactory
79{
80public:
81 auto create_compositor_for(mg::DisplayBuffer&)
82 -> std::unique_ptr<mc::DisplayBufferCompositor> override
83 {
84 struct CollectingDisplayBufferCompositor : mc::DisplayBufferCompositor
85 {
86 void composite(mc::SceneElementSequence&& seq)
87 {
88 for (auto& s : seq)
89 buffers.insert(s->renderable()->buffer());
90 }
91 std::set<std::shared_ptr<mg::Buffer>> buffers;
92 };
93
94 return std::make_unique<CollectingDisplayBufferCompositor>();
95 }
96};
97
98struct SwapBuffersDoesntBlockOnSubmission : mtf::ConnectedClientWithASurface
99{
100 unsigned int figure_out_nbuffers()
101 {
102 auto default_nbuffers = 3u;
103 if (auto server_nbuffers_switch = getenv("MIR_SERVER_NBUFFERS"))
104 {
105 if (server_nbuffers_switch && atoi(server_nbuffers_switch) > 0)
106 return atoi(server_nbuffers_switch);
107 else
108 {
109 auto client_nbuffers_switch = getenv("MIR_CLIENT_NBUFFERS");
110 if (client_nbuffers_switch)
111 return atoi(client_nbuffers_switch);
112 }
113 }
114 return default_nbuffers;
115 }
116 void SetUp() override
117 {
118 server.override_the_display_buffer_compositor_factory([]
119 {
120 return std::make_shared<BufferCollectingCompositorFactory>();
121 });
122
123 ConnectedClientWithASurface::SetUp();
124 server.the_cursor()->hide();
125 }
126
127 void TearDown() override
128 {
129 ConnectedClientWithASurface::TearDown();
130 }
131
132 unsigned int nbuffers = figure_out_nbuffers();
133};
134}
135
136//LP: #1584784
137TEST_F(SwapBuffersDoesntBlockOnSubmission, can_swap_nbuffers_times_without_blocking)
138{
139 for (auto i = 0u; i != nbuffers; ++i)
140 mir_buffer_stream_swap_buffers(mir_surface_get_buffer_stream(surface), nullptr, nullptr);
141}
70142
=== modified file 'tests/integration-tests/test_buffer_scheduling.cpp'
--- tests/integration-tests/test_buffer_scheduling.cpp 2016-06-02 05:33:50 +0000
+++ tests/integration-tests/test_buffer_scheduling.cpp 2016-06-02 13:02:31 +0000
@@ -465,7 +465,7 @@
465 {465 {
466 auto buffer = vault.withdraw().get();466 auto buffer = vault.withdraw().get();
467 vault.deposit(buffer);467 vault.deposit(buffer);
468 vault.wire_transfer_outbound(buffer);468 vault.wire_transfer_outbound(buffer, []{});
469 last_size_ = buffer->size();469 last_size_ = buffer->size();
470 entries.emplace_back(BufferEntry{mg::BufferID{(unsigned int)ipc->last_transferred_to_server()}, age, Access::unblocked});470 entries.emplace_back(BufferEntry{mg::BufferID{(unsigned int)ipc->last_transferred_to_server()}, age, Access::unblocked});
471 available--;471 available--;
472472
=== modified file 'tests/unit-tests/client/test_buffer_vault.cpp'
--- tests/unit-tests/client/test_buffer_vault.cpp 2016-06-02 05:33:50 +0000
+++ tests/unit-tests/client/test_buffer_vault.cpp 2016-06-02 13:02:31 +0000
@@ -208,14 +208,14 @@
208 auto buffer = vault.withdraw().get();208 auto buffer = vault.withdraw().get();
209 EXPECT_CALL(mock_requests, submit_buffer(Ref(*buffer)));209 EXPECT_CALL(mock_requests, submit_buffer(Ref(*buffer)));
210 vault.deposit(buffer);210 vault.deposit(buffer);
211 vault.wire_transfer_outbound(buffer);211 vault.wire_transfer_outbound(buffer, []{});
212}212}
213213
214TEST_F(StartedBufferVault, cant_transfer_if_not_in_acct)214TEST_F(StartedBufferVault, cant_transfer_if_not_in_acct)
215{215{
216 auto buffer = vault.withdraw().get();216 auto buffer = vault.withdraw().get();
217 EXPECT_THROW({ 217 EXPECT_THROW({
218 vault.wire_transfer_outbound(buffer);218 vault.wire_transfer_outbound(buffer, []{});
219 }, std::logic_error);219 }, std::logic_error);
220}220}
221221
@@ -235,7 +235,7 @@
235{235{
236 auto buffer = vault.withdraw().get();236 auto buffer = vault.withdraw().get();
237 vault.deposit(buffer);237 vault.deposit(buffer);
238 vault.wire_transfer_outbound(buffer);238 vault.wire_transfer_outbound(buffer, []{});
239 EXPECT_THROW({239 EXPECT_THROW({
240 vault.deposit(buffer);240 vault.deposit(buffer);
241 }, std::logic_error);241 }, std::logic_error);
@@ -247,7 +247,7 @@
247 vault->wire_transfer_inbound(package.buffer_id());247 vault->wire_transfer_inbound(package.buffer_id());
248 auto buffer = vault->withdraw().get();248 auto buffer = vault->withdraw().get();
249 vault->deposit(buffer);249 vault->deposit(buffer);
250 vault->wire_transfer_outbound(buffer);250 vault->wire_transfer_outbound(buffer, []{});
251251
252 vault->wire_transfer_inbound(package.buffer_id());252 vault->wire_transfer_inbound(package.buffer_id());
253 auto buffer2 = vault->withdraw().get();253 auto buffer2 = vault->withdraw().get();
@@ -321,7 +321,7 @@
321321
322 auto buffer = vault->withdraw().get();322 auto buffer = vault->withdraw().get();
323 vault->deposit(buffer);323 vault->deposit(buffer);
324 vault->wire_transfer_outbound(buffer);324 vault->wire_transfer_outbound(buffer, []{});
325}325}
326326
327TEST_F(StartedBufferVault, reallocates_incoming_buffers_of_incorrect_size_with_immediate_response)327TEST_F(StartedBufferVault, reallocates_incoming_buffers_of_incorrect_size_with_immediate_response)
@@ -530,19 +530,19 @@
530 vault.wire_transfer_inbound(requested_buffer.buffer_id());530 vault.wire_transfer_inbound(requested_buffer.buffer_id());
531 auto b = vault.withdraw().get();531 auto b = vault.withdraw().get();
532 vault.deposit(b);532 vault.deposit(b);
533 vault.wire_transfer_outbound(b);533 vault.wire_transfer_outbound(b, []{});
534534
535 b = vault.withdraw().get();535 b = vault.withdraw().get();
536 vault.deposit(b);536 vault.deposit(b);
537 vault.wire_transfer_outbound(b);537 vault.wire_transfer_outbound(b, []{});
538538
539 b = vault.withdraw().get();539 b = vault.withdraw().get();
540 vault.deposit(b);540 vault.deposit(b);
541 vault.wire_transfer_outbound(b);541 vault.wire_transfer_outbound(b, []{});
542542
543 b = vault.withdraw().get();543 b = vault.withdraw().get();
544 vault.deposit(b);544 vault.deposit(b);
545 vault.wire_transfer_outbound(b);545 vault.wire_transfer_outbound(b, []{});
546546
547 vault.decrease_buffer_count();547 vault.decrease_buffer_count();
548 vault.wire_transfer_inbound(package.buffer_id());548 vault.wire_transfer_inbound(package.buffer_id());
@@ -555,12 +555,12 @@
555{555{
556 auto buffer = vault.withdraw().get();556 auto buffer = vault.withdraw().get();
557 vault.deposit(buffer);557 vault.deposit(buffer);
558 vault.wire_transfer_outbound(buffer);558 vault.wire_transfer_outbound(buffer, []{});
559 auto first_id = buffer->rpc_id();559 auto first_id = buffer->rpc_id();
560560
561 buffer = vault.withdraw().get();561 buffer = vault.withdraw().get();
562 vault.deposit(buffer);562 vault.deposit(buffer);
563 vault.wire_transfer_outbound(buffer);563 vault.wire_transfer_outbound(buffer, []{});
564 auto second_id = buffer->rpc_id();564 auto second_id = buffer->rpc_id();
565565
566 vault.wire_transfer_inbound(second_id);566 vault.wire_transfer_inbound(second_id);
@@ -593,7 +593,7 @@
593 Mock::VerifyAndClearExpectations(&mock_requests);593 Mock::VerifyAndClearExpectations(&mock_requests);
594594
595 vault.deposit(buffer);595 vault.deposit(buffer);
596 vault.wire_transfer_outbound(buffer);596 vault.wire_transfer_outbound(buffer, []{});
597597
598 EXPECT_CALL(mock_requests, free_buffer(_))598 EXPECT_CALL(mock_requests, free_buffer(_))
599 .Times(1);599 .Times(1);
@@ -610,7 +610,7 @@
610 vault.set_size(new_size);610 vault.set_size(new_size);
611 Mock::VerifyAndClearExpectations(&mock_requests);611 Mock::VerifyAndClearExpectations(&mock_requests);
612612
613 vault.wire_transfer_outbound(buffer);613 vault.wire_transfer_outbound(buffer, []{});
614 EXPECT_CALL(mock_requests, free_buffer(_))614 EXPECT_CALL(mock_requests, free_buffer(_))
615 .Times(1);615 .Times(1);
616 vault.wire_transfer_inbound(buffer->rpc_id());616 vault.wire_transfer_inbound(buffer->rpc_id());
@@ -642,7 +642,7 @@
642 auto buffer = vault.withdraw().get();642 auto buffer = vault.withdraw().get();
643 vault.deposit(buffer);643 vault.deposit(buffer);
644 buffer->received();644 buffer->received();
645 vault.wire_transfer_outbound(buffer);645 vault.wire_transfer_outbound(buffer, []{});
646 vault.wire_transfer_inbound(buffer->rpc_id());646 vault.wire_transfer_inbound(buffer->rpc_id());
647 }647 }
648}648}
649649
=== modified file 'tests/unit-tests/client/test_client_buffer_stream.cpp'
--- tests/unit-tests/client/test_client_buffer_stream.cpp 2016-06-02 05:33:50 +0000
+++ tests/unit-tests/client/test_client_buffer_stream.cpp 2016-06-02 13:02:31 +0000
@@ -789,4 +789,24 @@
789 EXPECT_THAT(stream.get_current_buffer_id(), Eq(10));789 EXPECT_THAT(stream.get_current_buffer_id(), Eq(10));
790}790}
791791
792//LP: #1584784
793TEST_P(ClientBufferStream, can_cycle_through_available_buffers_without_waiting)
794{
795 ON_CALL(mock_protobuf_server, submit_buffer(_,_,_))
796 .WillByDefault(mtd::RunProtobufClosure());
797 mcl::BufferStream bs{
798 nullptr, wait_handle, mock_protobuf_server,
799 std::make_shared<StubClientPlatform>(mt::fake_shared(stub_factory)),
800 map, factory,
801 response, perf_report, "", size, nbuffers};
802 service_requests_for(bs, mock_protobuf_server.alloc_count);
803
804 auto count = 0;
805 for(auto i = 0u; i < mock_protobuf_server.alloc_count; i++)
806 {
807 bs.get_current_buffer();
808 bs.next_buffer([&count]{ count++;});
809 }
810}
811
792INSTANTIATE_TEST_CASE_P(BufferSemanticsMode, ClientBufferStream, Bool());812INSTANTIATE_TEST_CASE_P(BufferSemanticsMode, ClientBufferStream, Bool());

Subscribers

People subscribed via source and target branches