Mir

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

Proposed by Alberto Aguirre
Status: Merged
Approved by: Alberto Aguirre
Approved revision: no longer in the source branch.
Merged at revision: 1809
Proposed branch: lp:~albaguirre/mir/fix-1350961
Merge into: lp:mir
Diff against target: 83 lines (+30/-2)
5 files modified
src/platform/graphics/android/hwc_common_device.cpp (+6/-1)
src/platform/graphics/android/hwc_common_device.h (+2/-1)
src/platform/graphics/android/hwc_device.cpp (+5/-0)
src/platform/graphics/android/hwc_device.h (+1/-0)
tests/unit-tests/graphics/android/test_hwc_device.cpp (+16/-0)
To merge this branch: bzr merge lp:~albaguirre/mir/fix-1350961
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Kevin DuBois (community) Approve
Review via email: mp+229107@code.launchpad.net

Commit message

Release overlay buffers when screen is turned off (LP: #1350961)

Description of the change

Release overlay buffers when screen is turned off (LP: #1350961)

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

Small preference for having the derived class call the base class, but looks good to me.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/platform/graphics/android/hwc_common_device.cpp'
--- src/platform/graphics/android/hwc_common_device.cpp 2014-07-22 03:26:35 +0000
+++ src/platform/graphics/android/hwc_common_device.cpp 2014-07-31 19:11:18 +0000
@@ -124,10 +124,15 @@
124 hwc_device->vsync_signal_on();124 hwc_device->vsync_signal_on();
125}125}
126126
127void mga::HWCCommonDevice::turn_screen_off() const127void mga::HWCCommonDevice::turn_screen_off()
128{128{
129 hwc_device->vsync_signal_off();129 hwc_device->vsync_signal_off();
130 hwc_device->display_off();130 hwc_device->display_off();
131 turned_screen_off();
132}
133
134void mga::HWCCommonDevice::turned_screen_off()
135{
131}136}
132137
133bool mga::HWCCommonDevice::apply_orientation(MirOrientation) const138bool mga::HWCCommonDevice::apply_orientation(MirOrientation) const
134139
=== modified file 'src/platform/graphics/android/hwc_common_device.h'
--- src/platform/graphics/android/hwc_common_device.h 2014-06-25 22:22:45 +0000
+++ src/platform/graphics/android/hwc_common_device.h 2014-07-31 19:11:18 +0000
@@ -60,7 +60,8 @@
6060
61private:61private:
62 void turn_screen_on() const;62 void turn_screen_on() const;
63 void turn_screen_off() const;63 void turn_screen_off();
64 virtual void turned_screen_off();
6465
65 HWCCallbacks callbacks;66 HWCCallbacks callbacks;
6667
6768
=== modified file 'src/platform/graphics/android/hwc_device.cpp'
--- src/platform/graphics/android/hwc_device.cpp 2014-07-11 19:28:07 +0000
+++ src/platform/graphics/android/hwc_device.cpp 2014-07-31 19:11:18 +0000
@@ -173,3 +173,8 @@
173 mir::Fd retire_fd(hwc_list.retirement_fence());173 mir::Fd retire_fd(hwc_list.retirement_fence());
174 return true;174 return true;
175}175}
176
177void mga::HwcDevice::turned_screen_off()
178{
179 onscreen_overlay_buffers.clear();
180}
176181
=== modified file 'src/platform/graphics/android/hwc_device.h'
--- src/platform/graphics/android/hwc_device.h 2014-07-09 14:36:49 +0000
+++ src/platform/graphics/android/hwc_device.h 2014-07-31 19:11:18 +0000
@@ -52,6 +52,7 @@
52 RenderableListCompositor const& list_compositor);52 RenderableListCompositor const& list_compositor);
5353
54private:54private:
55 void turned_screen_off() override;
55 LayerList hwc_list;56 LayerList hwc_list;
56 std::vector<std::shared_ptr<Buffer>> onscreen_overlay_buffers;57 std::vector<std::shared_ptr<Buffer>> onscreen_overlay_buffers;
5758
5859
=== modified file 'tests/unit-tests/graphics/android/test_hwc_device.cpp'
--- tests/unit-tests/graphics/android/test_hwc_device.cpp 2014-07-11 19:58:53 +0000
+++ tests/unit-tests/graphics/android/test_hwc_device.cpp 2014-07-31 19:11:18 +0000
@@ -567,3 +567,19 @@
567 mg::RenderableList renderlist{std::make_shared<mtd::PlaneAlphaRenderable>()};567 mg::RenderableList renderlist{std::make_shared<mtd::PlaneAlphaRenderable>()};
568 EXPECT_FALSE(device.post_overlays(stub_context, renderlist, stub_compositor));568 EXPECT_FALSE(device.post_overlays(stub_context, renderlist, stub_compositor));
569}569}
570
571TEST_F(HwcDevice, does_not_own_overlay_buffers_after_screen_off)
572{
573 using namespace testing;
574 EXPECT_CALL(*mock_device, prepare(_))
575 .WillOnce(Invoke(set_all_layers_to_overlay));
576
577 mga::HwcDevice device(mock_device, mock_vsync, mock_file_ops);
578
579 auto use_count_before = stub_buffer1.use_count();
580 EXPECT_TRUE(device.post_overlays(stub_context, {stub_renderable1}, stub_compositor));
581 EXPECT_THAT(stub_buffer1.use_count(), Gt(use_count_before));
582
583 device.mode(MirPowerMode::mir_power_mode_off);
584 EXPECT_THAT(stub_buffer1.use_count(), Eq(use_count_before));
585}

Subscribers

People subscribed via source and target branches