Mir

Merge lp:~peat-new/mir/use-hwc-blanking-control-with-hwc10 into lp:mir

Proposed by Ratchanan Srirattanamet
Status: Merged
Merged at revision: 3661
Proposed branch: lp:~peat-new/mir/use-hwc-blanking-control-with-hwc10
Merge into: lp:mir
Diff against target: 132 lines (+48/-5)
4 files modified
src/platforms/android/server/hal_component_factory.cpp (+4/-1)
src/platforms/android/server/hwc_blanking_control.cpp (+11/-2)
src/platforms/android/server/hwc_configuration.h (+2/-1)
tests/unit-tests/platforms/android/server/test_output_builder.cpp (+31/-1)
To merge this branch: bzr merge lp:~peat-new/mir/use-hwc-blanking-control-with-hwc10
Reviewer Review Type Date Requested Status
Kevin DuBois (community) Approve
Alan Griffiths Approve
Daniel van Vugt Approve
Review via email: mp+303325@code.launchpad.net

Description of the change

android: create HwcBlankingControl as HWC configuration on HWC 1.0

This changes screen initialization on a device using HWC 1.0 from the FB HAL way to the HWC way. This makes vsync works, as previously vsync is not enabled in FbControl.

This fix, together with the hack from lp:~peat-new/mir/hack-eglswapbuffer-call-fbpost , makes graphics with HWComposer works on Samsung Galaxy Tab 2 7.0. So, to properly support this device, the hack must be verified if it's the correct way to do. This is beyond my knowledge and requires a developer to have a look at it.

To post a comment you must log in.
Revision history for this message
Daniel van Vugt (vanvugt) wrote :
review: Needs Information
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Sounds reasonable and Jenkins is happy too:
https://code.launchpad.net/~mir-team/mir/use-hwc-blanking-control-with-hwc10/+merge/303359

Now just waiting for kdub I guess.

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

LGTM, but I think paranoia dictates that we autoland from a branch controlled by a team member.

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

iirc, - if (force_backup_display || hwc_version == mga::HwcVersion::hwc10) was for the Galaxy Nexus, but that's not really a supported device anymore.

The only 'supported' device that uses hwc 1.0 is the goldfish emulator used in the Ubuntu SDK. We'll have to check that in the test plan for whatever release this goes out with. lgtm otherwsie.

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

OK then, per Alan's comment please put your approvals here:
https://code.launchpad.net/~mir-team/mir/use-hwc-blanking-control-with-hwc10/+merge/303359

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

Forget it. CI is broken in multiple new ways almost every day.

I've had enough and will land some things by hand. Just like the good old days...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/platforms/android/server/hal_component_factory.cpp'
2--- src/platforms/android/server/hal_component_factory.cpp 2016-08-14 10:00:08 +0000
3+++ src/platforms/android/server/hal_component_factory.cpp 2016-08-18 19:52:21 +0000
4@@ -31,6 +31,7 @@
5 #include "hwc_fb_device.h"
6 #include "graphic_buffer_allocator.h"
7 #include "cmdstream_sync_factory.h"
8+#include "android_format_conversion-inl.h"
9
10 #include <boost/throw_exception.hpp>
11 #include <stdexcept>
12@@ -184,8 +185,10 @@
13
14 std::unique_ptr<mga::HwcConfiguration> mga::HalComponentFactory::create_hwc_configuration()
15 {
16- if (force_backup_display || hwc_version == mga::HwcVersion::hwc10)
17+ if (force_backup_display)
18 return std::unique_ptr<mga::HwcConfiguration>(new mga::FbControl(fb_native));
19+ else if (hwc_version == mga::HwcVersion::hwc10)
20+ return std::unique_ptr<mga::HwcConfiguration>(new mga::HwcBlankingControl(hwc_wrapper, mga::to_mir_format(fb_native->format)));
21 else if (hwc_version < mga::HwcVersion::hwc14)
22 return std::unique_ptr<mga::HwcConfiguration>(new mga::HwcBlankingControl(hwc_wrapper));
23 else
24
25=== modified file 'src/platforms/android/server/hwc_blanking_control.cpp'
26--- src/platforms/android/server/hwc_blanking_control.cpp 2016-08-09 06:44:52 +0000
27+++ src/platforms/android/server/hwc_blanking_control.cpp 2016-08-18 19:52:21 +0000
28@@ -99,6 +99,15 @@
29 {
30 }
31
32+mga::HwcBlankingControl::HwcBlankingControl(
33+ std::shared_ptr<mga::HwcWrapper> const& hwc_device,
34+ MirPixelFormat format) :
35+ hwc_device{hwc_device},
36+ off{false},
37+ format{format}
38+{
39+}
40+
41 void mga::HwcBlankingControl::power_mode(DisplayName display_name, MirPowerMode mode_request)
42 {
43 if (mode_request == mir_power_mode_on)
44@@ -149,7 +158,7 @@
45 type = mg::DisplayConfigurationOutputType::displayport;
46 form_factor = mir_form_factor_monitor;
47 }
48-
49+
50 return {
51 as_output_id(name),
52 mg::DisplayConfigurationCardId{0},
53@@ -239,7 +248,7 @@
54 {
55 if (display_name == mga::DisplayName::primary)
56 BOOST_THROW_EXCEPTION(std::runtime_error("primary display disconnected"));
57- else
58+ else
59 return populate_config(display_name, {0,0}, 0.0f, {0,0}, mir_power_mode_off, mir_pixel_format_invalid, false);
60 }
61
62
63=== modified file 'src/platforms/android/server/hwc_configuration.h'
64--- src/platforms/android/server/hwc_configuration.h 2015-06-17 05:20:42 +0000
65+++ src/platforms/android/server/hwc_configuration.h 2016-08-18 19:52:21 +0000
66@@ -39,7 +39,7 @@
67 public:
68 virtual ~HwcConfiguration() = default;
69 virtual void power_mode(DisplayName, MirPowerMode) = 0;
70- virtual DisplayConfigurationOutput active_config_for(DisplayName) = 0;
71+ virtual DisplayConfigurationOutput active_config_for(DisplayName) = 0;
72 virtual ConfigChangeSubscription subscribe_to_config_changes(
73 std::function<void()> const& hotplug_cb,
74 std::function<void(DisplayName)> const& vsync_cb) = 0;
75@@ -55,6 +55,7 @@
76 {
77 public:
78 HwcBlankingControl(std::shared_ptr<HwcWrapper> const&);
79+ HwcBlankingControl(std::shared_ptr<HwcWrapper> const&, MirPixelFormat format);
80 void power_mode(DisplayName, MirPowerMode) override;
81 DisplayConfigurationOutput active_config_for(DisplayName) override;
82 ConfigChangeSubscription subscribe_to_config_changes(
83
84=== modified file 'tests/unit-tests/platforms/android/server/test_output_builder.cpp'
85--- tests/unit-tests/platforms/android/server/test_output_builder.cpp 2016-08-14 10:00:08 +0000
86+++ tests/unit-tests/platforms/android/server/test_output_builder.cpp 2016-08-18 19:52:21 +0000
87@@ -21,6 +21,7 @@
88 #include "src/platforms/android/server/resource_factory.h"
89 #include "src/platforms/android/server/hwc_loggers.h"
90 #include "src/platforms/android/server/hwc_configuration.h"
91+#include "src/platforms/android/server/fb_device.h"
92 #include "src/platforms/android/server/device_quirks.h"
93 #include "src/platforms/android/server/hwc_layerlist.h"
94 #include "mir/test/doubles/mock_buffer.h"
95@@ -127,7 +128,36 @@
96 factory.create_display_device();
97 }
98
99-TEST_F(HalComponentFactory, allocates_correct_hwc_configuration)
100+TEST_F(HalComponentFactory, allocates_correct_hwc_configuration_for_backup_display)
101+{
102+ using namespace testing;
103+ EXPECT_CALL(*mock_resource_factory, create_fb_native_device());
104+ EXPECT_CALL(*mock_resource_factory, create_hwc_wrapper(_))
105+ .WillOnce(Throw(std::runtime_error("")));
106+
107+ mga::HalComponentFactory factory(
108+ mock_resource_factory,
109+ mock_hwc_report,
110+ quirks);
111+ auto hwc_config = factory.create_hwc_configuration();
112+ EXPECT_THAT(dynamic_cast<mga::FbControl*>(hwc_config.get()), Ne(nullptr));
113+}
114+
115+TEST_F(HalComponentFactory, allocates_correct_hwc_configuration_for_hwc_version_10_to_13)
116+{
117+ using namespace testing;
118+ EXPECT_CALL(*mock_resource_factory, create_hwc_wrapper(_))
119+ .WillOnce(Return(std::make_tuple(mock_wrapper, mga::HwcVersion::hwc10)));
120+
121+ mga::HalComponentFactory factory(
122+ mock_resource_factory,
123+ mock_hwc_report,
124+ quirks);
125+ auto hwc_config = factory.create_hwc_configuration();
126+ EXPECT_THAT(dynamic_cast<mga::HwcBlankingControl*>(hwc_config.get()), Ne(nullptr));
127+}
128+
129+TEST_F(HalComponentFactory, allocates_correct_hwc_configuration_for_hwc_version_14_and_later)
130 {
131 using namespace testing;
132 EXPECT_CALL(*mock_resource_factory, create_hwc_wrapper(_))

Subscribers

People subscribed via source and target branches