Mir

Merge lp:~albaguirre/mir/fix-1321861 into lp:mir

Proposed by Alberto Aguirre
Status: Rejected
Rejected by: Alberto Aguirre
Proposed branch: lp:~albaguirre/mir/fix-1321861
Merge into: lp:mir
Diff against target: 40 lines (+18/-1)
2 files modified
src/server/compositor/buffer_queue.cpp (+1/-1)
tests/unit-tests/compositor/test_buffer_queue.cpp (+17/-0)
To merge this branch: bzr merge lp:~albaguirre/mir/fix-1321861
Reviewer Review Type Date Requested Status
Daniel van Vugt Needs Fixing
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+220518@code.launchpad.net

Commit message

BufferQueue: return correct number in buffers_ready_for_compositor (LP:#1321861)

Description of the change

BufferQueue: fix buffers_ready_for_compositor (LP:#1321861)

Since once buffer is always ready, buffers_ready_for_compositor should return ready buffers + 1.
This fixes regression that was masked before by the buffer consuming compositor (now gone) since it held buffers long enough which delayed the consumption of the ready buffer queue.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Raising the minimum to one buffer always-ready in theory should make the compositor spin and continuously re-composite even when nothing is changing. That would be a regression of bug 1108725, although that's not happening due to this:

    for(auto const& renderable : renderable_list)
        uncomposited_buffers |= (renderable->buffers_ready_for_compositor() > 1);

which I think should be "> 0" anyway, and moved to the bottom of DefaultDisplayBufferCompositor::composite().

So, to make the logic easier to follow and ensure DefaultDisplayBufferCompositor doesn't need to know that BufferQueue is always lying, I think we should keep BufferQueue unmodified and fix DefaultDisplayBufferCompositor instead.

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

Actually I ran into another related issue recently where BufferQueue's restriction of always allocating one buffer minimum to compositing was reducing pipelining and triggering failures of a performance test. I wonder if that's something we need to revisit and perhaps allow zero compositors again, like SwitchingBundle used to.

Revision history for this message
Alberto Aguirre (albaguirre) wrote :

I'm fine with either one. So team let me know what you'd prefer.

It looks like buffers_ready_for_compositor will soon be removed in any case.

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

> Raising the minimum to one buffer always-ready in theory should make the
> compositor spin and continuously re-composite even when nothing is changing.
> That would be a regression of bug 1108725, although that's not happening due
> to this:
>
> for(auto const& renderable : renderable_list)
> uncomposited_buffers |= (renderable->buffers_ready_for_compositor() >
> 1);
>
> which I think should be "> 0" anyway, and moved to the bottom of
> DefaultDisplayBufferCompositor::composite().
>
> So, to make the logic easier to follow and ensure
> DefaultDisplayBufferCompositor doesn't need to know that BufferQueue is always
> lying, I think we should keep BufferQueue unmodified and fix
> DefaultDisplayBufferCompositor instead.

I was actually looking into this for the purposes of making DefaultDisplayBufferCompositor simpler, and I agree the logic on the compositor-system is misplaced. I think that we should shift it to MultiThreadedCompositor, which is the class that best can arrange the compositor's scheduling.

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

I think returning the wrong answer from buffers_ready_for_compositor() just because the caller only works with a *wrong* answer is the wrong answer :)

Fix the caller instead, so we don't risk regressing on bug 1108725.

Unmerged revisions

1650. By Alberto Aguirre

check buffers_ready_for_compositor goes down after compositor_acquire

1649. By Alberto Aguirre

buffers_ready_for_compositor should returns at least 1.

A buffer is always available for compositing so return ready buffers + 1.

1648. By Alberto Aguirre

test: add check for buffers_ready_for_compositor

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/server/compositor/buffer_queue.cpp'
2--- src/server/compositor/buffer_queue.cpp 2014-05-20 23:21:10 +0000
3+++ src/server/compositor/buffer_queue.cpp 2014-05-21 18:41:20 +0000
4@@ -364,7 +364,7 @@
5 * as the number of buffers that are truly ready
6 * vary depending on concurrent compositors.
7 */
8- return ready_to_composite_queue.size();
9+ return ready_to_composite_queue.size() + 1;
10 }
11
12 void mc::BufferQueue::give_buffer_to_client(
13
14=== modified file 'tests/unit-tests/compositor/test_buffer_queue.cpp'
15--- tests/unit-tests/compositor/test_buffer_queue.cpp 2014-05-20 23:21:10 +0000
16+++ tests/unit-tests/compositor/test_buffer_queue.cpp 2014-05-21 18:41:20 +0000
17@@ -1404,6 +1404,23 @@
18 }
19 }
20
21+TEST_F(BufferQueueTest, buffers_ready_for_compositor_returns_at_least_one)
22+{
23+ mc::BufferQueue q(3, allocator, basic_properties, policy_factory);
24+
25+ /* There's always one buffer ready for a compositor */
26+ EXPECT_THAT(q.buffers_ready_for_compositor(), Eq(1));
27+
28+ auto handle = client_acquire_async(q);
29+ ASSERT_THAT(handle->has_acquired_buffer(), Eq(true));
30+ handle->release_buffer();
31+
32+ EXPECT_THAT(q.buffers_ready_for_compositor(), Eq(2));
33+
34+ auto buffer = q.compositor_acquire(this);
35+ EXPECT_THAT(q.buffers_ready_for_compositor(), Eq(1));
36+}
37+
38 /* FIXME (enabling this optimization breaks timing tests) */
39 TEST_F(BufferQueueTest, DISABLED_synchronous_clients_only_get_two_real_buffers)
40 {

Subscribers

People subscribed via source and target branches