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
1=== modified file 'src/platform/graphics/android/hwc_common_device.cpp'
2--- src/platform/graphics/android/hwc_common_device.cpp 2014-07-22 03:26:35 +0000
3+++ src/platform/graphics/android/hwc_common_device.cpp 2014-07-31 19:11:18 +0000
4@@ -124,10 +124,15 @@
5 hwc_device->vsync_signal_on();
6 }
7
8-void mga::HWCCommonDevice::turn_screen_off() const
9+void mga::HWCCommonDevice::turn_screen_off()
10 {
11 hwc_device->vsync_signal_off();
12 hwc_device->display_off();
13+ turned_screen_off();
14+}
15+
16+void mga::HWCCommonDevice::turned_screen_off()
17+{
18 }
19
20 bool mga::HWCCommonDevice::apply_orientation(MirOrientation) const
21
22=== modified file 'src/platform/graphics/android/hwc_common_device.h'
23--- src/platform/graphics/android/hwc_common_device.h 2014-06-25 22:22:45 +0000
24+++ src/platform/graphics/android/hwc_common_device.h 2014-07-31 19:11:18 +0000
25@@ -60,7 +60,8 @@
26
27 private:
28 void turn_screen_on() const;
29- void turn_screen_off() const;
30+ void turn_screen_off();
31+ virtual void turned_screen_off();
32
33 HWCCallbacks callbacks;
34
35
36=== modified file 'src/platform/graphics/android/hwc_device.cpp'
37--- src/platform/graphics/android/hwc_device.cpp 2014-07-11 19:28:07 +0000
38+++ src/platform/graphics/android/hwc_device.cpp 2014-07-31 19:11:18 +0000
39@@ -173,3 +173,8 @@
40 mir::Fd retire_fd(hwc_list.retirement_fence());
41 return true;
42 }
43+
44+void mga::HwcDevice::turned_screen_off()
45+{
46+ onscreen_overlay_buffers.clear();
47+}
48
49=== modified file 'src/platform/graphics/android/hwc_device.h'
50--- src/platform/graphics/android/hwc_device.h 2014-07-09 14:36:49 +0000
51+++ src/platform/graphics/android/hwc_device.h 2014-07-31 19:11:18 +0000
52@@ -52,6 +52,7 @@
53 RenderableListCompositor const& list_compositor);
54
55 private:
56+ void turned_screen_off() override;
57 LayerList hwc_list;
58 std::vector<std::shared_ptr<Buffer>> onscreen_overlay_buffers;
59
60
61=== modified file 'tests/unit-tests/graphics/android/test_hwc_device.cpp'
62--- tests/unit-tests/graphics/android/test_hwc_device.cpp 2014-07-11 19:58:53 +0000
63+++ tests/unit-tests/graphics/android/test_hwc_device.cpp 2014-07-31 19:11:18 +0000
64@@ -567,3 +567,19 @@
65 mg::RenderableList renderlist{std::make_shared<mtd::PlaneAlphaRenderable>()};
66 EXPECT_FALSE(device.post_overlays(stub_context, renderlist, stub_compositor));
67 }
68+
69+TEST_F(HwcDevice, does_not_own_overlay_buffers_after_screen_off)
70+{
71+ using namespace testing;
72+ EXPECT_CALL(*mock_device, prepare(_))
73+ .WillOnce(Invoke(set_all_layers_to_overlay));
74+
75+ mga::HwcDevice device(mock_device, mock_vsync, mock_file_ops);
76+
77+ auto use_count_before = stub_buffer1.use_count();
78+ EXPECT_TRUE(device.post_overlays(stub_context, {stub_renderable1}, stub_compositor));
79+ EXPECT_THAT(stub_buffer1.use_count(), Gt(use_count_before));
80+
81+ device.mode(MirPowerMode::mir_power_mode_off);
82+ EXPECT_THAT(stub_buffer1.use_count(), Eq(use_count_before));
83+}

Subscribers

People subscribed via source and target branches