Mir

Merge lp:~kdub/mir/fix-1369763 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: 3759
Proposed branch: lp:~kdub/mir/fix-1369763
Merge into: lp:mir
Diff against target: 266 lines (+71/-2)
17 files modified
include/platform/mir/graphics/renderable.h (+1/-0)
src/include/server/mir/compositor/buffer_stream.h (+1/-0)
src/platform/symbols.map (+1/-0)
src/platforms/android/server/hwc_device.cpp (+2/-1)
src/platforms/android/utils/render_overlays.cpp (+5/-0)
src/platforms/android/utils/test_android_hardware_sanity.cpp (+4/-0)
src/server/compositor/stream.cpp (+5/-0)
src/server/compositor/stream.h (+1/-0)
src/server/graphics/software_cursor.cpp (+5/-0)
src/server/input/touchspot_controller.cpp (+6/-0)
src/server/scene/basic_surface.cpp (+5/-0)
tests/include/mir/test/doubles/fake_renderable.h (+5/-0)
tests/include/mir/test/doubles/mock_buffer_stream.h (+1/-0)
tests/include/mir/test/doubles/mock_renderable.h (+1/-0)
tests/include/mir/test/doubles/stub_buffer_stream.h (+4/-1)
tests/include/mir/test/doubles/stub_renderable.h (+13/-0)
tests/unit-tests/platforms/android/server/test_hwc_device.cpp (+11/-0)
To merge this branch: bzr merge lp:~kdub/mir/fix-1369763
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
Brandon Schaefer (community) Approve
Mir CI Bot continuous-integration Approve
Cemil Azizoglu (community) Approve
Alexandros Frantzis (community) Needs Fixing
Review via email: mp+307945@code.launchpad.net

Commit message

android: disable overlays when a swapinterval 0 client is part of the RenderableList. This won't affect the overlay percentage for usc/u8, as u8 runs swapinterval 1.

mg::Renderable providing swapinterval information is useful to android to fix this bug, as well as for nested-passthrough, where nested-passthrough has to coordinate the passthrough surface with the host server, so the host server doesn't end up grabbing all the buffers from the passthrough surface.

platform abi number was already increased for the 0.25 series.

Fixes: LP: #1369763

Description of the change

android: disable overlays when a swapinterval 0 client is part of the RenderableList. This won't affect the overlay percentage for usc/u8, as u8 runs swapinterval 1.

mg::Renderable providing swapinterval information is useful to android to fix this bug, as well as for nested-passthrough, where nested-passthrough has to coordinate the passthrough surface with the host server, so the host server doesn't end up grabbing all the buffers from the passthrough surface.

platform abi number was already increased for the 0.25 series.

Fixes: LP: #1369763

To post a comment you must log in.
Revision history for this message
Kevin DuBois (kdub) wrote :

This can go in the 'why didn't I think of this before" pile.

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

Looks good, except for:

1. a left over debugging comment:

+ printf("SET SWAPINTERVAL %i\n", interval);

2. a clang build error (and perhaps there are others):

src/platforms/android/utils/render_overlays.cpp:145:18: error: 'swap_interval' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]

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

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

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

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

Ok

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

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

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

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

Thanks for looking at this. Just wondering; if you're disabling overlays for anything that's interval 0 on the server side and we hope to make everything on the server side interval 0 (when interval 1 becomes a function of the libmirclient), then won't we need to revert this? Would it not just be a better idea to leave the bug unresolved until a final solution is feasible?

By landing this now, we create a regression that's worse than the bug itself. That is a future mirserver will never overlay unless we remember to also revert this change.

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

> Thanks for looking at this. Just wondering; if you're disabling overlays for
> anything that's interval 0 on the server side and we hope to make everything
> on the server side interval 0 (when interval 1 becomes a function of the
> libmirclient), then won't we need to revert this? Would it not just be a
> better idea to leave the bug unresolved until a final solution is feasible?
>

Once we have dropping-only, the server won't really have a concept of 'swapinterval' anymore (which makes it simpler there). We will probably be best to remove the Renderable::swap_interval information.

> By landing this now, we create a regression that's worse than the bug itself.
> That is a future mirserver will never overlay unless we remember to also
> revert this change.

Its not a regression once it lands, its only a regression if we forget how this works when we change the submission mode in the future. I can keep tabs on it so that when we switch to dropping-only, we will change the behavior. Nested passthrough's behavior will have to change even more when that part of the system is reworked.

Its useful now for fixing android support for this option, and the interval information is needed for nested passthrough to prevent loss of swapinterval 0 on passthrough clients.

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

lgtm

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

subsequent branches showing how the swapinterval() function are used in nested pasthrough are up.

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

Alright

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/platform/mir/graphics/renderable.h'
2--- include/platform/mir/graphics/renderable.h 2015-04-28 07:54:10 +0000
3+++ include/platform/mir/graphics/renderable.h 2016-10-07 18:58:00 +0000
4@@ -70,6 +70,7 @@
5
6 virtual bool shaped() const = 0; // meaning the pixel format has alpha
7
8+ virtual unsigned int swap_interval() const = 0;
9 protected:
10 Renderable() = default;
11 Renderable(Renderable const&) = delete;
12
13=== modified file 'src/include/server/mir/compositor/buffer_stream.h'
14--- src/include/server/mir/compositor/buffer_stream.h 2016-05-03 06:55:25 +0000
15+++ src/include/server/mir/compositor/buffer_stream.h 2016-10-07 18:58:00 +0000
16@@ -50,6 +50,7 @@
17 virtual int buffers_ready_for_compositor(void const* user_id) const = 0;
18 virtual void drop_old_buffers() = 0;
19 virtual bool has_submitted_buffer() const = 0;
20+ virtual bool framedropping() const = 0;
21 };
22
23 }
24
25=== modified file 'src/platform/symbols.map'
26--- src/platform/symbols.map 2016-09-19 06:09:48 +0000
27+++ src/platform/symbols.map 2016-10-07 18:58:00 +0000
28@@ -90,6 +90,7 @@
29 mir::graphics::Renderable::screen_position*;
30 mir::graphics::Renderable::shaped*;
31 mir::graphics::Renderable::transformation*;
32+ mir::graphics::Renderable::swap_interval*;
33 mir::graphics::UserDisplayConfigurationOutput::extents*;
34 mir::graphics::UserDisplayConfigurationOutput::UserDisplayConfigurationOutput*;
35 mir::options::arw_server_socket_opt*;
36
37=== modified file 'src/platforms/android/server/hwc_device.cpp'
38--- src/platforms/android/server/hwc_device.cpp 2016-05-03 06:55:25 +0000
39+++ src/platforms/android/server/hwc_device.cpp 2016-10-07 18:58:00 +0000
40@@ -56,7 +56,8 @@
41 //TODO: enable planeAlpha for (hwc version >= 1.2), 90 deg rotation
42 static glm::mat4 const identity;
43 if (plane_alpha_is_translucent(*renderable) ||
44- (renderable->transformation() != identity))
45+ (renderable->transformation() != identity) ||
46+ (renderable->swap_interval() == 0)) //See LP: #1369763
47 {
48 return false;
49 }
50
51=== modified file 'src/platforms/android/utils/render_overlays.cpp'
52--- src/platforms/android/utils/render_overlays.cpp 2016-09-19 06:09:48 +0000
53+++ src/platforms/android/utils/render_overlays.cpp 2016-10-07 18:58:00 +0000
54@@ -142,6 +142,11 @@
55 {
56 }
57
58+ unsigned int swap_interval() const override
59+ {
60+ return 1u;
61+ }
62+
63 ID id() const override
64 {
65 return this;
66
67=== modified file 'src/platforms/android/utils/test_android_hardware_sanity.cpp'
68--- src/platforms/android/utils/test_android_hardware_sanity.cpp 2016-09-19 06:09:48 +0000
69+++ src/platforms/android/utils/test_android_hardware_sanity.cpp 2016-10-07 18:58:00 +0000
70@@ -240,6 +240,10 @@
71 buffer_(buffer)
72 {
73 }
74+ unsigned int swap_interval() const override
75+ {
76+ return 1u;
77+ }
78 ID id() const override
79 {
80 return this;
81
82=== modified file 'src/server/compositor/stream.cpp'
83--- src/server/compositor/stream.cpp 2016-09-22 11:38:46 +0000
84+++ src/server/compositor/stream.cpp 2016-10-07 18:58:00 +0000
85@@ -164,6 +164,11 @@
86 }
87 }
88
89+bool mc::Stream::framedropping() const
90+{
91+ return schedule_mode == ScheduleMode::Dropping;
92+}
93+
94 void mc::Stream::transition_schedule(
95 std::shared_ptr<mc::Schedule>&& new_schedule, std::lock_guard<std::mutex> const&)
96 {
97
98=== modified file 'src/server/compositor/stream.h'
99--- src/server/compositor/stream.h 2016-09-22 11:38:46 +0000
100+++ src/server/compositor/stream.h 2016-10-07 18:58:00 +0000
101@@ -57,6 +57,7 @@
102 geometry::Size stream_size() override;
103 void resize(geometry::Size const& size) override;
104 void allow_framedropping(bool) override;
105+ bool framedropping() const override;
106 void drop_outstanding_requests() override;
107 int buffers_ready_for_compositor(void const* user_id) const override;
108 void drop_old_buffers() override;
109
110=== modified file 'src/server/graphics/software_cursor.cpp'
111--- src/server/graphics/software_cursor.cpp 2016-09-15 13:44:43 +0000
112+++ src/server/graphics/software_cursor.cpp 2016-10-07 18:58:00 +0000
113@@ -65,6 +65,11 @@
114 {
115 }
116
117+ unsigned int swap_interval() const override
118+ {
119+ return 1;
120+ }
121+
122 mg::Renderable::ID id() const override
123 {
124 return this;
125
126=== modified file 'src/server/input/touchspot_controller.cpp'
127--- src/server/input/touchspot_controller.cpp 2016-08-16 19:34:28 +0000
128+++ src/server/input/touchspot_controller.cpp 2016-10-07 18:58:00 +0000
129@@ -52,6 +52,12 @@
130 }
131
132 // mg::Renderable
133+
134+ unsigned int swap_interval() const override
135+ {
136+ return 1;
137+ }
138+
139 mg::Renderable::ID id() const override
140 {
141 return this;
142
143=== modified file 'src/server/scene/basic_surface.cpp'
144--- src/server/scene/basic_surface.cpp 2016-09-19 04:16:15 +0000
145+++ src/server/scene/basic_surface.cpp 2016-10-07 18:58:00 +0000
146@@ -825,6 +825,11 @@
147 ~SurfaceSnapshot()
148 {
149 }
150+
151+ unsigned int swap_interval() const override
152+ {
153+ return underlying_buffer_stream->framedropping() ? 0 : 1;
154+ }
155
156 std::shared_ptr<mg::Buffer> buffer() const override
157 {
158
159=== modified file 'tests/include/mir/test/doubles/fake_renderable.h'
160--- tests/include/mir/test/doubles/fake_renderable.h 2015-04-28 07:54:10 +0000
161+++ tests/include/mir/test/doubles/fake_renderable.h 2016-10-07 18:58:00 +0000
162@@ -95,6 +95,11 @@
163 return rect;
164 }
165
166+ unsigned int swap_interval() const override
167+ {
168+ return 1u;
169+ }
170+
171 private:
172 std::shared_ptr<graphics::Buffer> buf;
173 mir::geometry::Rectangle rect;
174
175=== modified file 'tests/include/mir/test/doubles/mock_buffer_stream.h'
176--- tests/include/mir/test/doubles/mock_buffer_stream.h 2016-08-16 19:34:28 +0000
177+++ tests/include/mir/test/doubles/mock_buffer_stream.h 2016-10-07 18:58:00 +0000
178@@ -69,6 +69,7 @@
179 MOCK_METHOD1(resize, void(geometry::Size const&));
180 MOCK_METHOD0(force_client_completion, void());
181 MOCK_METHOD1(allow_framedropping, void(bool));
182+ MOCK_CONST_METHOD0(framedropping, bool());
183
184 MOCK_METHOD0(drop_outstanding_requests, void());
185 MOCK_CONST_METHOD1(buffers_ready_for_compositor, int(void const*));
186
187=== modified file 'tests/include/mir/test/doubles/mock_renderable.h'
188--- tests/include/mir/test/doubles/mock_renderable.h 2015-06-25 03:00:08 +0000
189+++ tests/include/mir/test/doubles/mock_renderable.h 2016-10-07 18:58:00 +0000
190@@ -52,6 +52,7 @@
191 MOCK_CONST_METHOD0(transformation, glm::mat4());
192 MOCK_CONST_METHOD0(visible, bool());
193 MOCK_CONST_METHOD0(shaped, bool());
194+ MOCK_CONST_METHOD0(swap_interval, unsigned int());
195 };
196 }
197 }
198
199=== modified file 'tests/include/mir/test/doubles/stub_buffer_stream.h'
200--- tests/include/mir/test/doubles/stub_buffer_stream.h 2016-09-19 04:16:15 +0000
201+++ tests/include/mir/test/doubles/stub_buffer_stream.h 2016-10-07 18:58:00 +0000
202@@ -63,7 +63,10 @@
203 void allow_framedropping(bool) override
204 {
205 }
206-
207+ bool framedropping() const override
208+ {
209+ return false;
210+ }
211 int buffers_ready_for_compositor(void const*) const override { return nready; }
212
213 void drop_old_buffers() override {}
214
215=== modified file 'tests/include/mir/test/doubles/stub_renderable.h'
216--- tests/include/mir/test/doubles/stub_renderable.h 2016-09-08 18:59:56 +0000
217+++ tests/include/mir/test/doubles/stub_renderable.h 2016-10-07 18:58:00 +0000
218@@ -85,6 +85,10 @@
219 {
220 return false;
221 }
222+ unsigned int swap_interval() const override
223+ {
224+ return 1;
225+ }
226
227 private:
228 std::shared_ptr<graphics::Buffer> make_stub_buffer(geometry::Rectangle const& rect)
229@@ -146,6 +150,15 @@
230 return 1.0f - ( 3.0f / 1024.0f );
231 }
232 };
233+
234+struct IntervalZeroRenderable : StubRenderable
235+{
236+ unsigned int swap_interval() const override
237+ {
238+ return 0;
239+ }
240+};
241+
242 }
243 }
244 }
245
246=== modified file 'tests/unit-tests/platforms/android/server/test_hwc_device.cpp'
247--- tests/unit-tests/platforms/android/server/test_hwc_device.cpp 2016-05-03 06:55:25 +0000
248+++ tests/unit-tests/platforms/android/server/test_hwc_device.cpp 2016-10-07 18:58:00 +0000
249@@ -599,6 +599,17 @@
250 EXPECT_FALSE(device.compatible_renderlist(renderlist));
251 }
252
253+//LP: #1369763. We could get swapinterval 0 to work with overlays, but we'd need
254+//the vsync signal from hwc to reach the client, so the client can rate-limit its submissions.
255+TEST_F(HwcDevice, rejects_list_containing_interval_0)
256+{
257+ mga::HwcDevice device(mock_device);
258+
259+ auto renderable = std::make_shared<mtd::StubTransformedRenderable>();
260+ mg::RenderableList renderlist{renderable};
261+ EXPECT_FALSE(device.compatible_renderlist(renderlist));
262+}
263+
264 //TODO: we could accept a 90 degree transform
265 TEST_F(HwcDevice, rejects_list_containing_transformed)
266 {

Subscribers

People subscribed via source and target branches