Mir

Merge lp:~vanvugt/mir/fix-1638774 into lp:mir

Proposed by Daniel van Vugt
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 3805
Proposed branch: lp:~vanvugt/mir/fix-1638774
Merge into: lp:mir
Diff against target: 203 lines (+39/-32)
5 files modified
tests/include/mir/test/doubles/mock_android_native_buffer.h (+3/-2)
tests/include/mir/test/doubles/stub_android_native_buffer.h (+3/-2)
tests/unit-tests/platforms/android/server/test_hwc_fb_device.cpp (+2/-2)
tests/unit-tests/platforms/android/server/test_hwc_logger.cpp (+20/-16)
tests/unit-tests/platforms/android/server/test_hwc_wrapper.cpp (+11/-10)
To merge this branch: bzr merge lp:~vanvugt/mir/fix-1638774
Reviewer Review Type Date Requested Status
Chris Halse Rogers Approve
Kevin DuBois (community) Approve
Mir CI Bot continuous-integration Approve
Review via email: mp+309910@code.launchpad.net

Commit message

Fix zesty build failures: Structures which contain variable-length
arrays can only be instantiated correctly using dynamic memory
allocation (LP: #1638774)

As usual gcc becomes more pedantic over time.

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

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

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

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

lgtm

review: Approve
Revision history for this message
Chris Halse Rogers (raof) wrote :

Yeah, seems sensible.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/include/mir/test/doubles/mock_android_native_buffer.h'
2--- tests/include/mir/test/doubles/mock_android_native_buffer.h 2016-10-12 13:31:04 +0000
3+++ tests/include/mir/test/doubles/mock_android_native_buffer.h 2016-11-03 04:14:33 +0000
4@@ -38,7 +38,7 @@
5 ON_CALL(*this, anwb())
6 .WillByDefault(Return(&stub_anwb));
7 ON_CALL(*this, handle())
8- .WillByDefault(Return(&native_handle));
9+ .WillByDefault(Return(native_handle.get()));
10 ON_CALL(*this, copy_fence())
11 .WillByDefault(Return(-1));
12 }
13@@ -62,7 +62,8 @@
14 MOCK_METHOD0(lock_for_gpu, void());
15 MOCK_METHOD0(wait_for_unlock_by_gpu, void());
16 ANativeWindowBuffer stub_anwb;
17- native_handle_t native_handle;
18+ std::unique_ptr<native_handle_t> native_handle =
19+ std::make_unique<native_handle_t>();
20 };
21 }
22 }
23
24=== modified file 'tests/include/mir/test/doubles/stub_android_native_buffer.h'
25--- tests/include/mir/test/doubles/stub_android_native_buffer.h 2016-10-12 13:31:04 +0000
26+++ tests/include/mir/test/doubles/stub_android_native_buffer.h 2016-11-03 04:14:33 +0000
27@@ -41,7 +41,7 @@
28 }
29
30 auto anwb() const -> ANativeWindowBuffer* override { return const_cast<ANativeWindowBuffer*>(&stub_anwb); }
31- auto handle() const -> buffer_handle_t override { return &native_handle; }
32+ auto handle() const -> buffer_handle_t override { return native_handle.get(); }
33 auto copy_fence() const -> graphics::android::NativeFence override { return -1; }
34
35 void ensure_available_for(graphics::android::BufferAccess) {}
36@@ -53,7 +53,8 @@
37 void wait_for_unlock_by_gpu() {};
38
39 ANativeWindowBuffer stub_anwb;
40- native_handle_t native_handle;
41+ std::unique_ptr<native_handle_t> native_handle =
42+ std::make_unique<native_handle_t>();
43 };
44 }
45 }
46
47=== modified file 'tests/unit-tests/platforms/android/server/test_hwc_fb_device.cpp'
48--- tests/unit-tests/platforms/android/server/test_hwc_fb_device.cpp 2016-09-02 08:19:31 +0000
49+++ tests/unit-tests/platforms/android/server/test_hwc_fb_device.cpp 2016-11-03 04:14:33 +0000
50@@ -65,7 +65,7 @@
51 skip_layer.compositionType = HWC_FRAMEBUFFER;
52 skip_layer.hints = 0;
53 skip_layer.flags = HWC_SKIP_LAYER;
54- skip_layer.handle = &stub_native_buffer->native_handle;
55+ skip_layer.handle = stub_native_buffer->native_handle.get();
56 skip_layer.transform = 0;
57 skip_layer.blending = HWC_BLENDING_NONE;
58 skip_layer.sourceCrop = region;
59@@ -175,7 +175,7 @@
60 EXPECT_CALL(*mock_buffer, native_buffer_handle())
61 .InSequence(seq)
62 .WillOnce(Return(stub_native_buffer));
63- EXPECT_CALL(*mock_fb_device, post_interface(mock_fb_device.get(), &stub_native_buffer->native_handle))
64+ EXPECT_CALL(*mock_fb_device, post_interface(mock_fb_device.get(), stub_native_buffer->native_handle.get()))
65 .InSequence(seq);
66
67 mga::DisplayContents content{primary, list, geom::Displacement{}, mock_context, stub_compositor};
68
69=== modified file 'tests/unit-tests/platforms/android/server/test_hwc_logger.cpp'
70--- tests/unit-tests/platforms/android/server/test_hwc_logger.cpp 2015-06-17 05:20:42 +0000
71+++ tests/unit-tests/platforms/android/server/test_hwc_logger.cpp 2016-11-03 04:14:33 +0000
72@@ -34,7 +34,7 @@
73
74 display_list->hwLayers[0].compositionType = HWC_OVERLAY;
75 display_list->hwLayers[0].flags = 0;
76- display_list->hwLayers[0].handle = &native_handle1;
77+ display_list->hwLayers[0].handle = native_handle1.get();
78 display_list->hwLayers[0].transform = HWC_TRANSFORM_ROT_90;
79 display_list->hwLayers[0].blending = HWC_BLENDING_NONE;
80 display_list->hwLayers[0].displayFrame = {1, 1, 2, 1};
81@@ -44,7 +44,7 @@
82
83 display_list->hwLayers[1].compositionType = HWC_FRAMEBUFFER;
84 display_list->hwLayers[1].flags = 0;
85- display_list->hwLayers[1].handle = &native_handle2;
86+ display_list->hwLayers[1].handle = native_handle2.get();
87 display_list->hwLayers[1].transform = HWC_TRANSFORM_ROT_180;
88 display_list->hwLayers[1].blending = HWC_BLENDING_PREMULT;
89 display_list->hwLayers[1].displayFrame = {8, 5, 13, 8};
90@@ -54,7 +54,7 @@
91
92 display_list->hwLayers[2].compositionType = HWC_FRAMEBUFFER;
93 display_list->hwLayers[2].flags = HWC_SKIP_LAYER;
94- display_list->hwLayers[2].handle = &native_handle3;
95+ display_list->hwLayers[2].handle = native_handle3.get();
96 display_list->hwLayers[2].transform = HWC_TRANSFORM_ROT_270;
97 display_list->hwLayers[2].blending = HWC_BLENDING_COVERAGE;
98 display_list->hwLayers[2].displayFrame = {55, 34, 89, 55};
99@@ -64,7 +64,7 @@
100
101 display_list->hwLayers[3].compositionType = HWC_FRAMEBUFFER_TARGET;
102 display_list->hwLayers[3].flags = 0;
103- display_list->hwLayers[3].handle = &native_handle4;
104+ display_list->hwLayers[3].handle = native_handle4.get();
105 display_list->hwLayers[3].transform = 0;
106 display_list->hwLayers[3].blending = HWC_BLENDING_NONE;
107 display_list->hwLayers[3].displayFrame = {377, 233, 610, 337};
108@@ -104,10 +104,14 @@
109 std::shared_ptr<hwc_display_contents_1_t> const external_list;
110 std::array<hwc_display_contents_1_t*, HWC_NUM_DISPLAY_TYPES> display_list;
111 std::array<int, 8> const fake_fence{ {4,5,6,7,8,9,10,11} };
112- native_handle_t native_handle1;
113- native_handle_t native_handle2;
114- native_handle_t native_handle3;
115- native_handle_t native_handle4;
116+ std::unique_ptr<native_handle_t> native_handle1 =
117+ std::make_unique<native_handle_t>();
118+ std::unique_ptr<native_handle_t> native_handle2 =
119+ std::make_unique<native_handle_t>();
120+ std::unique_ptr<native_handle_t> native_handle3 =
121+ std::make_unique<native_handle_t>();
122+ std::unique_ptr<native_handle_t> native_handle4 =
123+ std::make_unique<native_handle_t>();
124 };
125 }
126
127@@ -153,14 +157,14 @@
128 std::stringstream str;
129 str << "set list():" << std::endl
130 << " # | display | Type | handle | acquireFenceFd" << std::endl
131- << " 0 | primary | OVERLAY | " << &native_handle1 << " | " << fake_fence[0] << std::endl
132- << " 1 | primary | GL_RENDER | " << &native_handle2 << " | " << fake_fence[2] << std::endl
133- << " 2 | primary | FORCE_GL | " << &native_handle3 << " | " << fake_fence[4] << std::endl
134- << " 3 | primary | FB_TARGET | " << &native_handle4 << " | " << fake_fence[6] << std::endl
135- << " 0 | external | OVERLAY | " << &native_handle1 << " | " << fake_fence[0] << std::endl
136- << " 1 | external | GL_RENDER | " << &native_handle2 << " | " << fake_fence[2] << std::endl
137- << " 2 | external | FORCE_GL | " << &native_handle3 << " | " << fake_fence[4] << std::endl
138- << " 3 | external | FB_TARGET | " << &native_handle4 << " | " << fake_fence[6] << std::endl;
139+ << " 0 | primary | OVERLAY | " << native_handle1.get() << " | " << fake_fence[0] << std::endl
140+ << " 1 | primary | GL_RENDER | " << native_handle2.get() << " | " << fake_fence[2] << std::endl
141+ << " 2 | primary | FORCE_GL | " << native_handle3.get() << " | " << fake_fence[4] << std::endl
142+ << " 3 | primary | FB_TARGET | " << native_handle4.get() << " | " << fake_fence[6] << std::endl
143+ << " 0 | external | OVERLAY | " << native_handle1.get() << " | " << fake_fence[0] << std::endl
144+ << " 1 | external | GL_RENDER | " << native_handle2.get() << " | " << fake_fence[2] << std::endl
145+ << " 2 | external | FORCE_GL | " << native_handle3.get() << " | " << fake_fence[4] << std::endl
146+ << " 3 | external | FB_TARGET | " << native_handle4.get() << " | " << fake_fence[6] << std::endl;
147
148 mga::HwcFormattedLogger logger;
149 logger.report_set_list(display_list);
150
151=== modified file 'tests/unit-tests/platforms/android/server/test_hwc_wrapper.cpp'
152--- tests/unit-tests/platforms/android/server/test_hwc_wrapper.cpp 2016-09-02 08:19:31 +0000
153+++ tests/unit-tests/platforms/android/server/test_hwc_wrapper.cpp 2016-11-03 04:14:33 +0000
154@@ -55,13 +55,14 @@
155 return 0;
156 }
157
158- hwc_display_contents_1_t primary_list;
159- hwc_display_contents_1_t external_list;
160- hwc_display_contents_1_t virtual_list;
161+ std::unique_ptr<hwc_display_contents_1_t> primary_list =
162+ std::make_unique<hwc_display_contents_1_t>();
163+ std::unique_ptr<hwc_display_contents_1_t> external_list =
164+ std::make_unique<hwc_display_contents_1_t>();
165 std::array<hwc_display_contents_1_t*, HWC_NUM_DISPLAY_TYPES> primary_displays{{
166- &primary_list, nullptr, nullptr}};
167+ primary_list.get(), nullptr, nullptr}};
168 std::array<hwc_display_contents_1_t*, HWC_NUM_DISPLAY_TYPES> both_displays{{
169- &primary_list, &external_list, nullptr}};
170+ primary_list.get(), external_list.get(), nullptr}};
171
172 std::shared_ptr<mtd::MockHWCComposerDevice1> const mock_device;
173 std::shared_ptr<mtd::MockHwcReport> const mock_report;
174@@ -85,7 +86,7 @@
175 mga::RealHwcWrapper wrapper(mock_device, mock_report);
176 wrapper.prepare(primary_displays);
177
178- EXPECT_EQ(&primary_list, primary_display);
179+ EXPECT_EQ(primary_list.get(), primary_display);
180 EXPECT_EQ(nullptr, virtual_display);
181 EXPECT_EQ(nullptr, external_display);
182 }
183@@ -105,8 +106,8 @@
184 mga::RealHwcWrapper wrapper(mock_device, mock_report);
185 wrapper.prepare(both_displays);
186
187- EXPECT_EQ(&primary_list, primary_display);
188- EXPECT_EQ(&external_list, external_display);
189+ EXPECT_EQ(primary_list.get(), primary_display);
190+ EXPECT_EQ(external_list.get(), external_display);
191 EXPECT_EQ(nullptr, virtual_display);
192 }
193
194@@ -140,8 +141,8 @@
195 mga::RealHwcWrapper wrapper(mock_device, mock_report);
196 wrapper.set(both_displays);
197
198- EXPECT_EQ(&primary_list, primary_display);
199- EXPECT_EQ(&external_list, external_display);
200+ EXPECT_EQ(primary_list.get(), primary_display);
201+ EXPECT_EQ(external_list.get(), external_display);
202 EXPECT_EQ(nullptr, virtual_display);
203 }
204

Subscribers

People subscribed via source and target branches