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
=== modified file 'tests/include/mir/test/doubles/mock_android_native_buffer.h'
--- tests/include/mir/test/doubles/mock_android_native_buffer.h 2016-10-12 13:31:04 +0000
+++ tests/include/mir/test/doubles/mock_android_native_buffer.h 2016-11-03 04:14:33 +0000
@@ -38,7 +38,7 @@
38 ON_CALL(*this, anwb())38 ON_CALL(*this, anwb())
39 .WillByDefault(Return(&stub_anwb));39 .WillByDefault(Return(&stub_anwb));
40 ON_CALL(*this, handle())40 ON_CALL(*this, handle())
41 .WillByDefault(Return(&native_handle));41 .WillByDefault(Return(native_handle.get()));
42 ON_CALL(*this, copy_fence())42 ON_CALL(*this, copy_fence())
43 .WillByDefault(Return(-1));43 .WillByDefault(Return(-1));
44 }44 }
@@ -62,7 +62,8 @@
62 MOCK_METHOD0(lock_for_gpu, void());62 MOCK_METHOD0(lock_for_gpu, void());
63 MOCK_METHOD0(wait_for_unlock_by_gpu, void());63 MOCK_METHOD0(wait_for_unlock_by_gpu, void());
64 ANativeWindowBuffer stub_anwb;64 ANativeWindowBuffer stub_anwb;
65 native_handle_t native_handle;65 std::unique_ptr<native_handle_t> native_handle =
66 std::make_unique<native_handle_t>();
66};67};
67}68}
68}69}
6970
=== modified file 'tests/include/mir/test/doubles/stub_android_native_buffer.h'
--- tests/include/mir/test/doubles/stub_android_native_buffer.h 2016-10-12 13:31:04 +0000
+++ tests/include/mir/test/doubles/stub_android_native_buffer.h 2016-11-03 04:14:33 +0000
@@ -41,7 +41,7 @@
41 }41 }
4242
43 auto anwb() const -> ANativeWindowBuffer* override { return const_cast<ANativeWindowBuffer*>(&stub_anwb); }43 auto anwb() const -> ANativeWindowBuffer* override { return const_cast<ANativeWindowBuffer*>(&stub_anwb); }
44 auto handle() const -> buffer_handle_t override { return &native_handle; }44 auto handle() const -> buffer_handle_t override { return native_handle.get(); }
45 auto copy_fence() const -> graphics::android::NativeFence override { return -1; }45 auto copy_fence() const -> graphics::android::NativeFence override { return -1; }
4646
47 void ensure_available_for(graphics::android::BufferAccess) {}47 void ensure_available_for(graphics::android::BufferAccess) {}
@@ -53,7 +53,8 @@
53 void wait_for_unlock_by_gpu() {};53 void wait_for_unlock_by_gpu() {};
5454
55 ANativeWindowBuffer stub_anwb;55 ANativeWindowBuffer stub_anwb;
56 native_handle_t native_handle;56 std::unique_ptr<native_handle_t> native_handle =
57 std::make_unique<native_handle_t>();
57};58};
58}59}
59}60}
6061
=== modified file 'tests/unit-tests/platforms/android/server/test_hwc_fb_device.cpp'
--- tests/unit-tests/platforms/android/server/test_hwc_fb_device.cpp 2016-09-02 08:19:31 +0000
+++ tests/unit-tests/platforms/android/server/test_hwc_fb_device.cpp 2016-11-03 04:14:33 +0000
@@ -65,7 +65,7 @@
65 skip_layer.compositionType = HWC_FRAMEBUFFER;65 skip_layer.compositionType = HWC_FRAMEBUFFER;
66 skip_layer.hints = 0;66 skip_layer.hints = 0;
67 skip_layer.flags = HWC_SKIP_LAYER;67 skip_layer.flags = HWC_SKIP_LAYER;
68 skip_layer.handle = &stub_native_buffer->native_handle;68 skip_layer.handle = stub_native_buffer->native_handle.get();
69 skip_layer.transform = 0;69 skip_layer.transform = 0;
70 skip_layer.blending = HWC_BLENDING_NONE;70 skip_layer.blending = HWC_BLENDING_NONE;
71 skip_layer.sourceCrop = region;71 skip_layer.sourceCrop = region;
@@ -175,7 +175,7 @@
175 EXPECT_CALL(*mock_buffer, native_buffer_handle())175 EXPECT_CALL(*mock_buffer, native_buffer_handle())
176 .InSequence(seq)176 .InSequence(seq)
177 .WillOnce(Return(stub_native_buffer));177 .WillOnce(Return(stub_native_buffer));
178 EXPECT_CALL(*mock_fb_device, post_interface(mock_fb_device.get(), &stub_native_buffer->native_handle))178 EXPECT_CALL(*mock_fb_device, post_interface(mock_fb_device.get(), stub_native_buffer->native_handle.get()))
179 .InSequence(seq);179 .InSequence(seq);
180180
181 mga::DisplayContents content{primary, list, geom::Displacement{}, mock_context, stub_compositor};181 mga::DisplayContents content{primary, list, geom::Displacement{}, mock_context, stub_compositor};
182182
=== modified file 'tests/unit-tests/platforms/android/server/test_hwc_logger.cpp'
--- tests/unit-tests/platforms/android/server/test_hwc_logger.cpp 2015-06-17 05:20:42 +0000
+++ tests/unit-tests/platforms/android/server/test_hwc_logger.cpp 2016-11-03 04:14:33 +0000
@@ -34,7 +34,7 @@
3434
35 display_list->hwLayers[0].compositionType = HWC_OVERLAY;35 display_list->hwLayers[0].compositionType = HWC_OVERLAY;
36 display_list->hwLayers[0].flags = 0; 36 display_list->hwLayers[0].flags = 0;
37 display_list->hwLayers[0].handle = &native_handle1; 37 display_list->hwLayers[0].handle = native_handle1.get();
38 display_list->hwLayers[0].transform = HWC_TRANSFORM_ROT_90;38 display_list->hwLayers[0].transform = HWC_TRANSFORM_ROT_90;
39 display_list->hwLayers[0].blending = HWC_BLENDING_NONE;39 display_list->hwLayers[0].blending = HWC_BLENDING_NONE;
40 display_list->hwLayers[0].displayFrame = {1, 1, 2, 1}; 40 display_list->hwLayers[0].displayFrame = {1, 1, 2, 1};
@@ -44,7 +44,7 @@
4444
45 display_list->hwLayers[1].compositionType = HWC_FRAMEBUFFER; 45 display_list->hwLayers[1].compositionType = HWC_FRAMEBUFFER;
46 display_list->hwLayers[1].flags = 0;46 display_list->hwLayers[1].flags = 0;
47 display_list->hwLayers[1].handle = &native_handle2;47 display_list->hwLayers[1].handle = native_handle2.get();
48 display_list->hwLayers[1].transform = HWC_TRANSFORM_ROT_180;48 display_list->hwLayers[1].transform = HWC_TRANSFORM_ROT_180;
49 display_list->hwLayers[1].blending = HWC_BLENDING_PREMULT;49 display_list->hwLayers[1].blending = HWC_BLENDING_PREMULT;
50 display_list->hwLayers[1].displayFrame = {8, 5, 13, 8}; 50 display_list->hwLayers[1].displayFrame = {8, 5, 13, 8};
@@ -54,7 +54,7 @@
5454
55 display_list->hwLayers[2].compositionType = HWC_FRAMEBUFFER; 55 display_list->hwLayers[2].compositionType = HWC_FRAMEBUFFER;
56 display_list->hwLayers[2].flags = HWC_SKIP_LAYER;56 display_list->hwLayers[2].flags = HWC_SKIP_LAYER;
57 display_list->hwLayers[2].handle = &native_handle3; 57 display_list->hwLayers[2].handle = native_handle3.get();
58 display_list->hwLayers[2].transform = HWC_TRANSFORM_ROT_270;58 display_list->hwLayers[2].transform = HWC_TRANSFORM_ROT_270;
59 display_list->hwLayers[2].blending = HWC_BLENDING_COVERAGE; 59 display_list->hwLayers[2].blending = HWC_BLENDING_COVERAGE;
60 display_list->hwLayers[2].displayFrame = {55, 34, 89, 55}; 60 display_list->hwLayers[2].displayFrame = {55, 34, 89, 55};
@@ -64,7 +64,7 @@
6464
65 display_list->hwLayers[3].compositionType = HWC_FRAMEBUFFER_TARGET; 65 display_list->hwLayers[3].compositionType = HWC_FRAMEBUFFER_TARGET;
66 display_list->hwLayers[3].flags = 0; 66 display_list->hwLayers[3].flags = 0;
67 display_list->hwLayers[3].handle = &native_handle4; 67 display_list->hwLayers[3].handle = native_handle4.get();
68 display_list->hwLayers[3].transform = 0;68 display_list->hwLayers[3].transform = 0;
69 display_list->hwLayers[3].blending = HWC_BLENDING_NONE; 69 display_list->hwLayers[3].blending = HWC_BLENDING_NONE;
70 display_list->hwLayers[3].displayFrame = {377, 233, 610, 337}; 70 display_list->hwLayers[3].displayFrame = {377, 233, 610, 337};
@@ -104,10 +104,14 @@
104 std::shared_ptr<hwc_display_contents_1_t> const external_list;104 std::shared_ptr<hwc_display_contents_1_t> const external_list;
105 std::array<hwc_display_contents_1_t*, HWC_NUM_DISPLAY_TYPES> display_list;105 std::array<hwc_display_contents_1_t*, HWC_NUM_DISPLAY_TYPES> display_list;
106 std::array<int, 8> const fake_fence{ {4,5,6,7,8,9,10,11} };106 std::array<int, 8> const fake_fence{ {4,5,6,7,8,9,10,11} };
107 native_handle_t native_handle1;107 std::unique_ptr<native_handle_t> native_handle1 =
108 native_handle_t native_handle2;108 std::make_unique<native_handle_t>();
109 native_handle_t native_handle3;109 std::unique_ptr<native_handle_t> native_handle2 =
110 native_handle_t native_handle4;110 std::make_unique<native_handle_t>();
111 std::unique_ptr<native_handle_t> native_handle3 =
112 std::make_unique<native_handle_t>();
113 std::unique_ptr<native_handle_t> native_handle4 =
114 std::make_unique<native_handle_t>();
111};115};
112}116}
113117
@@ -153,14 +157,14 @@
153 std::stringstream str;157 std::stringstream str;
154 str << "set list():" << std::endl158 str << "set list():" << std::endl
155 << " # | display | Type | handle | acquireFenceFd" << std::endl159 << " # | display | Type | handle | acquireFenceFd" << std::endl
156 << " 0 | primary | OVERLAY | " << &native_handle1 << " | " << fake_fence[0] << std::endl160 << " 0 | primary | OVERLAY | " << native_handle1.get() << " | " << fake_fence[0] << std::endl
157 << " 1 | primary | GL_RENDER | " << &native_handle2 << " | " << fake_fence[2] << std::endl161 << " 1 | primary | GL_RENDER | " << native_handle2.get() << " | " << fake_fence[2] << std::endl
158 << " 2 | primary | FORCE_GL | " << &native_handle3 << " | " << fake_fence[4] << std::endl162 << " 2 | primary | FORCE_GL | " << native_handle3.get() << " | " << fake_fence[4] << std::endl
159 << " 3 | primary | FB_TARGET | " << &native_handle4 << " | " << fake_fence[6] << std::endl163 << " 3 | primary | FB_TARGET | " << native_handle4.get() << " | " << fake_fence[6] << std::endl
160 << " 0 | external | OVERLAY | " << &native_handle1 << " | " << fake_fence[0] << std::endl164 << " 0 | external | OVERLAY | " << native_handle1.get() << " | " << fake_fence[0] << std::endl
161 << " 1 | external | GL_RENDER | " << &native_handle2 << " | " << fake_fence[2] << std::endl165 << " 1 | external | GL_RENDER | " << native_handle2.get() << " | " << fake_fence[2] << std::endl
162 << " 2 | external | FORCE_GL | " << &native_handle3 << " | " << fake_fence[4] << std::endl166 << " 2 | external | FORCE_GL | " << native_handle3.get() << " | " << fake_fence[4] << std::endl
163 << " 3 | external | FB_TARGET | " << &native_handle4 << " | " << fake_fence[6] << std::endl;167 << " 3 | external | FB_TARGET | " << native_handle4.get() << " | " << fake_fence[6] << std::endl;
164168
165 mga::HwcFormattedLogger logger;169 mga::HwcFormattedLogger logger;
166 logger.report_set_list(display_list);170 logger.report_set_list(display_list);
167171
=== modified file 'tests/unit-tests/platforms/android/server/test_hwc_wrapper.cpp'
--- tests/unit-tests/platforms/android/server/test_hwc_wrapper.cpp 2016-09-02 08:19:31 +0000
+++ tests/unit-tests/platforms/android/server/test_hwc_wrapper.cpp 2016-11-03 04:14:33 +0000
@@ -55,13 +55,14 @@
55 return 0;55 return 0;
56 }56 }
5757
58 hwc_display_contents_1_t primary_list;58 std::unique_ptr<hwc_display_contents_1_t> primary_list =
59 hwc_display_contents_1_t external_list;59 std::make_unique<hwc_display_contents_1_t>();
60 hwc_display_contents_1_t virtual_list;60 std::unique_ptr<hwc_display_contents_1_t> external_list =
61 std::make_unique<hwc_display_contents_1_t>();
61 std::array<hwc_display_contents_1_t*, HWC_NUM_DISPLAY_TYPES> primary_displays{{62 std::array<hwc_display_contents_1_t*, HWC_NUM_DISPLAY_TYPES> primary_displays{{
62 &primary_list, nullptr, nullptr}};63 primary_list.get(), nullptr, nullptr}};
63 std::array<hwc_display_contents_1_t*, HWC_NUM_DISPLAY_TYPES> both_displays{{64 std::array<hwc_display_contents_1_t*, HWC_NUM_DISPLAY_TYPES> both_displays{{
64 &primary_list, &external_list, nullptr}};65 primary_list.get(), external_list.get(), nullptr}};
65 66
66 std::shared_ptr<mtd::MockHWCComposerDevice1> const mock_device;67 std::shared_ptr<mtd::MockHWCComposerDevice1> const mock_device;
67 std::shared_ptr<mtd::MockHwcReport> const mock_report;68 std::shared_ptr<mtd::MockHwcReport> const mock_report;
@@ -85,7 +86,7 @@
85 mga::RealHwcWrapper wrapper(mock_device, mock_report);86 mga::RealHwcWrapper wrapper(mock_device, mock_report);
86 wrapper.prepare(primary_displays);87 wrapper.prepare(primary_displays);
8788
88 EXPECT_EQ(&primary_list, primary_display);89 EXPECT_EQ(primary_list.get(), primary_display);
89 EXPECT_EQ(nullptr, virtual_display);90 EXPECT_EQ(nullptr, virtual_display);
90 EXPECT_EQ(nullptr, external_display);91 EXPECT_EQ(nullptr, external_display);
91}92}
@@ -105,8 +106,8 @@
105 mga::RealHwcWrapper wrapper(mock_device, mock_report);106 mga::RealHwcWrapper wrapper(mock_device, mock_report);
106 wrapper.prepare(both_displays);107 wrapper.prepare(both_displays);
107108
108 EXPECT_EQ(&primary_list, primary_display);109 EXPECT_EQ(primary_list.get(), primary_display);
109 EXPECT_EQ(&external_list, external_display);110 EXPECT_EQ(external_list.get(), external_display);
110 EXPECT_EQ(nullptr, virtual_display);111 EXPECT_EQ(nullptr, virtual_display);
111}112}
112113
@@ -140,8 +141,8 @@
140 mga::RealHwcWrapper wrapper(mock_device, mock_report);141 mga::RealHwcWrapper wrapper(mock_device, mock_report);
141 wrapper.set(both_displays);142 wrapper.set(both_displays);
142143
143 EXPECT_EQ(&primary_list, primary_display);144 EXPECT_EQ(primary_list.get(), primary_display);
144 EXPECT_EQ(&external_list, external_display);145 EXPECT_EQ(external_list.get(), external_display);
145 EXPECT_EQ(nullptr, virtual_display);146 EXPECT_EQ(nullptr, virtual_display);
146}147}
147148

Subscribers

People subscribed via source and target branches