Merge lp:~kdub/mir/no-display-attribs into lp:mir
- no-display-attribs
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Alan Griffiths |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2446 |
Proposed branch: | lp:~kdub/mir/no-display-attribs |
Merge into: | lp:mir |
Diff against target: |
979 lines (+239/-201) 18 files modified
src/platforms/android/server/display.cpp (+12/-14) src/platforms/android/server/display.h (+0/-2) src/platforms/android/server/display_component_factory.h (+2/-2) src/platforms/android/server/display_configuration.cpp (+8/-54) src/platforms/android/server/display_configuration.h (+2/-2) src/platforms/android/server/fb_device.cpp (+19/-11) src/platforms/android/server/fb_device.h (+1/-1) src/platforms/android/server/hal_component_factory.cpp (+8/-5) src/platforms/android/server/hal_component_factory.h (+4/-1) src/platforms/android/server/hwc_blanking_control.cpp (+49/-10) src/platforms/android/server/hwc_configuration.h (+2/-13) tests/include/mir_test_doubles/stub_display_builder.h (+13/-14) tests/include/mir_test_doubles/stub_display_configuration.h (+32/-0) tests/unit-tests/graphics/android/test_display.cpp (+38/-36) tests/unit-tests/graphics/android/test_display_hotplug.cpp (+6/-5) tests/unit-tests/graphics/android/test_fb_device.cpp (+3/-13) tests/unit-tests/graphics/android/test_hwc_configuration.cpp (+20/-18) tests/unit-tests/graphics/android/test_output_builder.cpp (+20/-0) |
To merge this branch: | bzr merge lp:~kdub/mir/no-display-attribs |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Alexandros Frantzis (community) | Approve | ||
Alan Griffiths | Approve | ||
Review via email: mp+253853@code.launchpad.net |
Commit message
android: remove the DisplayAttribs struct, which was just a subset of the information contained in DisplayConfigur
Description of the change
android: remove the DisplayAttribs struct, which was just a subset of the information contained in DisplayConfigur
Alan Griffiths (alan-griffiths) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2415
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2416
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Kevin DuBois (kdub) wrote : | # |
> 646 - EXPECT_
> 647 + EXPECT_
>
> Why? It isn't clear to me why this expectation changes as a result of changing
> the way data is held.
Launchpad lost my comment yesterday...
It is a correction of incorrect behavior. The external monitor was always reported as not used (even when on and used), which I noticed while going through and fixing things up to remove the DisplayAttribs struct.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2417
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alan Griffiths (alan-griffiths) wrote : | # |
> > 646 - EXPECT_
> > 647 + EXPECT_
> >
> > Why? It isn't clear to me why this expectation changes as a result of
> changing
> > the way data is held.
>
> Launchpad lost my comment yesterday...
> It is a correction of incorrect behavior. The external monitor was always
> reported as not used (even when on and used), which I noticed while going
> through and fixing things up to remove the DisplayAttribs struct.
OK
Kevin DuBois (kdub) wrote : | # |
failure was in nested server+clang, not related
Alan Griffiths (alan-griffiths) wrote : | # |
lp:1430000 strikes again.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2417
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alexandros Frantzis (afrantzis) wrote : | # |
Looks good.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Kevin DuBois (kdub) wrote : | # |
mako failed to restart:
subprocess.
run 1280 seemed to pass, retriggering
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Alan Griffiths (alan-griffiths) wrote : | # |
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === modified file 'src/platforms/android/server/display.cpp' | |||
2 | --- src/platforms/android/server/display.cpp 2015-03-24 16:02:48 +0000 | |||
3 | +++ src/platforms/android/server/display.cpp 2015-03-24 19:59:11 +0000 | |||
4 | @@ -107,14 +107,14 @@ | |||
5 | 107 | std::shared_ptr<mga::DisplayDevice> const& display_device, | 107 | std::shared_ptr<mga::DisplayDevice> const& display_device, |
6 | 108 | mga::DisplayName name, | 108 | mga::DisplayName name, |
7 | 109 | mga::DisplayComponentFactory& display_buffer_builder, | 109 | mga::DisplayComponentFactory& display_buffer_builder, |
9 | 110 | mga::DisplayAttribs const& attribs, | 110 | mg::DisplayConfigurationOutput const& config, |
10 | 111 | std::shared_ptr<mg::GLProgramFactory> const& gl_program_factory, | 111 | std::shared_ptr<mg::GLProgramFactory> const& gl_program_factory, |
11 | 112 | mga::PbufferGLContext const& gl_context, | 112 | mga::PbufferGLContext const& gl_context, |
12 | 113 | mga::OverlayOptimization overlay_option) | 113 | mga::OverlayOptimization overlay_option) |
13 | 114 | { | 114 | { |
15 | 115 | std::shared_ptr<mga::FramebufferBundle> fbs{display_buffer_builder.create_framebuffers(attribs)}; | 115 | std::shared_ptr<mga::FramebufferBundle> fbs{display_buffer_builder.create_framebuffers(config)}; |
16 | 116 | auto cache = std::make_shared<mga::InterpreterCache>(); | 116 | auto cache = std::make_shared<mga::InterpreterCache>(); |
18 | 117 | auto interpreter = std::make_shared<mga::ServerRenderWindow>(fbs, attribs.display_format, cache); | 117 | auto interpreter = std::make_shared<mga::ServerRenderWindow>(fbs, config.current_format, cache); |
19 | 118 | auto native_window = std::make_shared<mga::MirNativeWindow>(interpreter); | 118 | auto native_window = std::make_shared<mga::MirNativeWindow>(interpreter); |
20 | 119 | return std::unique_ptr<mga::ConfigurableDisplayBuffer>(new mga::DisplayBuffer( | 119 | return std::unique_ptr<mga::ConfigurableDisplayBuffer>(new mga::DisplayBuffer( |
21 | 120 | name, | 120 | name, |
22 | @@ -141,12 +141,10 @@ | |||
23 | 141 | hotplug_subscription{hwc_config->subscribe_to_config_changes( | 141 | hotplug_subscription{hwc_config->subscribe_to_config_changes( |
24 | 142 | std::bind(&mga::Display::on_hotplug, this), | 142 | std::bind(&mga::Display::on_hotplug, this), |
25 | 143 | std::bind(&mga::Display::on_vsync, this, std::placeholders::_1))}, | 143 | std::bind(&mga::Display::on_vsync, this, std::placeholders::_1))}, |
26 | 144 | primary_attribs(hwc_config->active_attribs_for(mga::DisplayName::primary)), | ||
27 | 145 | external_attribs(hwc_config->active_attribs_for(mga::DisplayName::external)), | ||
28 | 146 | config( | 144 | config( |
30 | 147 | primary_attribs, | 145 | hwc_config->active_config_for(mga::DisplayName::primary), |
31 | 148 | mir_power_mode_off, | 146 | mir_power_mode_off, |
33 | 149 | external_attribs, | 147 | hwc_config->active_config_for(mga::DisplayName::external), |
34 | 150 | mir_power_mode_off), | 148 | mir_power_mode_off), |
35 | 151 | gl_context{config.primary().current_format, *gl_config, *display_report}, | 149 | gl_context{config.primary().current_format, *gl_config, *display_report}, |
36 | 152 | display_device(display_buffer_builder->create_display_device()), | 150 | display_device(display_buffer_builder->create_display_device()), |
37 | @@ -158,7 +156,7 @@ | |||
38 | 158 | display_device, | 156 | display_device, |
39 | 159 | mga::DisplayName::primary, | 157 | mga::DisplayName::primary, |
40 | 160 | *display_buffer_builder, | 158 | *display_buffer_builder, |
42 | 161 | primary_attribs, | 159 | config.primary(), |
43 | 162 | gl_program_factory, | 160 | gl_program_factory, |
44 | 163 | gl_context, | 161 | gl_context, |
45 | 164 | overlay_option)) | 162 | overlay_option)) |
46 | @@ -173,7 +171,7 @@ | |||
47 | 173 | display_device, | 171 | display_device, |
48 | 174 | mga::DisplayName::external, | 172 | mga::DisplayName::external, |
49 | 175 | *display_buffer_builder, | 173 | *display_buffer_builder, |
51 | 176 | external_attribs, | 174 | config.external(), |
52 | 177 | gl_program_factory, | 175 | gl_program_factory, |
53 | 178 | gl_context, | 176 | gl_context, |
54 | 179 | mga::OverlayOptimization::disabled)); | 177 | mga::OverlayOptimization::disabled)); |
55 | @@ -196,16 +194,16 @@ | |||
56 | 196 | { | 194 | { |
57 | 197 | if (configuration_dirty) | 195 | if (configuration_dirty) |
58 | 198 | { | 196 | { |
61 | 199 | external_attribs = hwc_config->active_attribs_for(mga::DisplayName::external); | 197 | auto external_config = hwc_config->active_config_for(mga::DisplayName::external); |
62 | 200 | if (external_attribs.connected) | 198 | if (external_config.connected) |
63 | 201 | power_mode(mga::DisplayName::external, *hwc_config, config.external(), mir_power_mode_on); | 199 | power_mode(mga::DisplayName::external, *hwc_config, config.external(), mir_power_mode_on); |
64 | 202 | else | 200 | else |
65 | 203 | config.external().power_mode = mir_power_mode_off; | 201 | config.external().power_mode = mir_power_mode_off; |
66 | 204 | 202 | ||
67 | 205 | config = mga::DisplayConfiguration( | 203 | config = mga::DisplayConfiguration( |
69 | 206 | hwc_config->active_attribs_for(mga::DisplayName::primary), | 204 | hwc_config->active_config_for(mga::DisplayName::primary), |
70 | 207 | config.primary().power_mode, | 205 | config.primary().power_mode, |
72 | 208 | external_attribs, | 206 | std::move(external_config), |
73 | 209 | config.external().power_mode); | 207 | config.external().power_mode); |
74 | 210 | configuration_dirty = false; | 208 | configuration_dirty = false; |
75 | 211 | } | 209 | } |
76 | @@ -221,7 +219,7 @@ | |||
77 | 221 | display_device, | 219 | display_device, |
78 | 222 | mga::DisplayName::external, | 220 | mga::DisplayName::external, |
79 | 223 | *display_buffer_builder, | 221 | *display_buffer_builder, |
81 | 224 | external_attribs, | 222 | config.external(), |
82 | 225 | gl_program_factory, | 223 | gl_program_factory, |
83 | 226 | gl_context, | 224 | gl_context, |
84 | 227 | mga::OverlayOptimization::disabled)); | 225 | mga::OverlayOptimization::disabled)); |
85 | 228 | 226 | ||
86 | === modified file 'src/platforms/android/server/display.h' | |||
87 | --- src/platforms/android/server/display.h 2015-03-24 16:02:48 +0000 | |||
88 | +++ src/platforms/android/server/display.h 2015-03-24 19:59:11 +0000 | |||
89 | @@ -88,8 +88,6 @@ | |||
90 | 88 | bool mutable configuration_dirty{false}; | 88 | bool mutable configuration_dirty{false}; |
91 | 89 | std::unique_ptr<HwcConfiguration> const hwc_config; | 89 | std::unique_ptr<HwcConfiguration> const hwc_config; |
92 | 90 | ConfigChangeSubscription const hotplug_subscription; | 90 | ConfigChangeSubscription const hotplug_subscription; |
93 | 91 | DisplayAttribs const primary_attribs; //TODO: could be removed, really only useful in construction | ||
94 | 92 | DisplayAttribs mutable external_attribs; //TODO: could be removed, really only useful in construction | ||
95 | 93 | DisplayConfiguration mutable config; | 91 | DisplayConfiguration mutable config; |
96 | 94 | PbufferGLContext gl_context; | 92 | PbufferGLContext gl_context; |
97 | 95 | std::shared_ptr<DisplayDevice> display_device; | 93 | std::shared_ptr<DisplayDevice> display_device; |
98 | 96 | 94 | ||
99 | === modified file 'src/platforms/android/server/display_component_factory.h' | |||
100 | --- src/platforms/android/server/display_component_factory.h 2015-02-02 12:18:18 +0000 | |||
101 | +++ src/platforms/android/server/display_component_factory.h 2015-03-24 19:59:11 +0000 | |||
102 | @@ -27,10 +27,10 @@ | |||
103 | 27 | { | 27 | { |
104 | 28 | namespace graphics | 28 | namespace graphics |
105 | 29 | { | 29 | { |
106 | 30 | class DisplayConfigurationOutput; | ||
107 | 30 | namespace android | 31 | namespace android |
108 | 31 | { | 32 | { |
109 | 32 | class HwcConfiguration; | 33 | class HwcConfiguration; |
110 | 33 | class DisplayAttribs; | ||
111 | 34 | 34 | ||
112 | 35 | //TODO: this name needs improvement. | 35 | //TODO: this name needs improvement. |
113 | 36 | class DisplayComponentFactory | 36 | class DisplayComponentFactory |
114 | @@ -38,7 +38,7 @@ | |||
115 | 38 | public: | 38 | public: |
116 | 39 | virtual ~DisplayComponentFactory() = default; | 39 | virtual ~DisplayComponentFactory() = default; |
117 | 40 | 40 | ||
119 | 41 | virtual std::unique_ptr<FramebufferBundle> create_framebuffers(DisplayAttribs const&) = 0; | 41 | virtual std::unique_ptr<FramebufferBundle> create_framebuffers(DisplayConfigurationOutput const&) = 0; |
120 | 42 | virtual std::unique_ptr<DisplayDevice> create_display_device() = 0; | 42 | virtual std::unique_ptr<DisplayDevice> create_display_device() = 0; |
121 | 43 | virtual std::unique_ptr<HwcConfiguration> create_hwc_configuration() = 0; | 43 | virtual std::unique_ptr<HwcConfiguration> create_hwc_configuration() = 0; |
122 | 44 | virtual std::unique_ptr<LayerList> create_layer_list() = 0; | 44 | virtual std::unique_ptr<LayerList> create_layer_list() = 0; |
123 | 45 | 45 | ||
124 | === modified file 'src/platforms/android/server/display_configuration.cpp' | |||
125 | --- src/platforms/android/server/display_configuration.cpp 2015-03-24 16:02:48 +0000 | |||
126 | +++ src/platforms/android/server/display_configuration.cpp 2015-03-24 19:59:11 +0000 | |||
127 | @@ -25,67 +25,21 @@ | |||
128 | 25 | { | 25 | { |
129 | 26 | int const primary_id{0}; | 26 | int const primary_id{0}; |
130 | 27 | int const external_id{1}; | 27 | int const external_id{1}; |
131 | 28 | geom::Point const origin{0,0}; | ||
132 | 29 | size_t const preferred_format_index{0}; | ||
133 | 30 | size_t const preferred_mode_index{0}; | ||
134 | 31 | |||
135 | 32 | mg::DisplayConfigurationOutput external_output( | ||
136 | 33 | mga::DisplayAttribs const& external_attribs, | ||
137 | 34 | MirPowerMode external_mode) | ||
138 | 35 | { | ||
139 | 36 | std::vector<mg::DisplayConfigurationMode> external_modes; | ||
140 | 37 | if (external_attribs.connected) | ||
141 | 38 | { | ||
142 | 39 | external_modes.emplace_back( | ||
143 | 40 | mg::DisplayConfigurationMode{external_attribs.pixel_size, external_attribs.vrefresh_hz}); | ||
144 | 41 | } | ||
145 | 42 | |||
146 | 43 | bool used{false}; | ||
147 | 44 | return { | ||
148 | 45 | mg::DisplayConfigurationOutputId{external_id}, | ||
149 | 46 | mg::DisplayConfigurationCardId{0}, | ||
150 | 47 | mg::DisplayConfigurationOutputType::displayport, | ||
151 | 48 | {external_attribs.display_format}, | ||
152 | 49 | external_modes, | ||
153 | 50 | preferred_mode_index, | ||
154 | 51 | external_attribs.mm_size, | ||
155 | 52 | external_attribs.connected, | ||
156 | 53 | used, | ||
157 | 54 | origin, | ||
158 | 55 | preferred_format_index, | ||
159 | 56 | external_attribs.display_format, | ||
160 | 57 | external_mode, | ||
161 | 58 | mir_orientation_normal | ||
162 | 59 | }; | ||
163 | 60 | } | ||
164 | 61 | } | 28 | } |
165 | 62 | 29 | ||
166 | 63 | mga::DisplayConfiguration::DisplayConfiguration( | 30 | mga::DisplayConfiguration::DisplayConfiguration( |
168 | 64 | mga::DisplayAttribs const& primary_attribs, | 31 | mg::DisplayConfigurationOutput primary_config, |
169 | 65 | MirPowerMode primary_mode, | 32 | MirPowerMode primary_mode, |
171 | 66 | mga::DisplayAttribs const& external_attribs, | 33 | mg::DisplayConfigurationOutput external_config, |
172 | 67 | MirPowerMode external_mode) : | 34 | MirPowerMode external_mode) : |
192 | 68 | configurations{{ | 35 | configurations{ |
193 | 69 | mg::DisplayConfigurationOutput{ | 36 | {std::move(primary_config), |
194 | 70 | mg::DisplayConfigurationOutputId{primary_id}, | 37 | std::move(external_config)} |
195 | 71 | mg::DisplayConfigurationCardId{0}, | 38 | }, |
177 | 72 | mg::DisplayConfigurationOutputType::lvds, | ||
178 | 73 | {primary_attribs.display_format}, | ||
179 | 74 | {mg::DisplayConfigurationMode{primary_attribs.pixel_size, primary_attribs.vrefresh_hz}}, | ||
180 | 75 | preferred_mode_index, | ||
181 | 76 | primary_attribs.mm_size, | ||
182 | 77 | primary_attribs.connected, | ||
183 | 78 | true, | ||
184 | 79 | origin, | ||
185 | 80 | preferred_format_index, | ||
186 | 81 | primary_attribs.display_format, | ||
187 | 82 | primary_mode, | ||
188 | 83 | mir_orientation_normal | ||
189 | 84 | }, | ||
190 | 85 | external_output(external_attribs, external_mode) | ||
191 | 86 | }}, | ||
196 | 87 | card{mg::DisplayConfigurationCardId{0}, 1} | 39 | card{mg::DisplayConfigurationCardId{0}, 1} |
197 | 88 | { | 40 | { |
198 | 41 | primary().power_mode = primary_mode; | ||
199 | 42 | external().power_mode = external_mode; | ||
200 | 89 | } | 43 | } |
201 | 90 | 44 | ||
202 | 91 | mga::DisplayConfiguration::DisplayConfiguration(DisplayConfiguration const& other) : | 45 | mga::DisplayConfiguration::DisplayConfiguration(DisplayConfiguration const& other) : |
203 | 92 | 46 | ||
204 | === modified file 'src/platforms/android/server/display_configuration.h' | |||
205 | --- src/platforms/android/server/display_configuration.h 2015-03-24 16:02:48 +0000 | |||
206 | +++ src/platforms/android/server/display_configuration.h 2015-03-24 19:59:11 +0000 | |||
207 | @@ -31,9 +31,9 @@ | |||
208 | 31 | class DisplayConfiguration : public graphics::DisplayConfiguration | 31 | class DisplayConfiguration : public graphics::DisplayConfiguration |
209 | 32 | { | 32 | { |
210 | 33 | public: | 33 | public: |
212 | 34 | DisplayConfiguration(DisplayAttribs const& primary, | 34 | DisplayConfiguration(DisplayConfigurationOutput primary, |
213 | 35 | MirPowerMode primary_mode, | 35 | MirPowerMode primary_mode, |
215 | 36 | DisplayAttribs const& external, | 36 | DisplayConfigurationOutput external, |
216 | 37 | MirPowerMode external_mode); | 37 | MirPowerMode external_mode); |
217 | 38 | 38 | ||
218 | 39 | DisplayConfiguration(DisplayConfiguration const& other); | 39 | DisplayConfiguration(DisplayConfiguration const& other); |
219 | 40 | 40 | ||
220 | === modified file 'src/platforms/android/server/fb_device.cpp' | |||
221 | --- src/platforms/android/server/fb_device.cpp 2015-03-24 16:02:48 +0000 | |||
222 | +++ src/platforms/android/server/fb_device.cpp 2015-03-24 19:59:11 +0000 | |||
223 | @@ -54,18 +54,26 @@ | |||
224 | 54 | fb_device->enableScreen(fb_device.get(), enable); | 54 | fb_device->enableScreen(fb_device.get(), enable); |
225 | 55 | } | 55 | } |
226 | 56 | 56 | ||
228 | 57 | mga::DisplayAttribs mga::FbControl::active_attribs_for(DisplayName) | 57 | mg::DisplayConfigurationOutput mga::FbControl::active_config_for(DisplayName) |
229 | 58 | { | 58 | { |
240 | 59 | //guarantee always 2 fb's allocated | 59 | return { |
241 | 60 | auto fb_num = static_cast<unsigned int>(fb_device->numFramebuffers); | 60 | mg::DisplayConfigurationOutputId{0}, |
242 | 61 | fb_num = std::max(2u, fb_num); | 61 | mg::DisplayConfigurationCardId{0}, |
243 | 62 | return mga::DisplayAttribs{ | 62 | mg::DisplayConfigurationOutputType::lvds, |
244 | 63 | {fb_device->width, fb_device->height}, | 63 | std::vector<MirPixelFormat>{mga::to_mir_format(fb_device->format)}, |
245 | 64 | {0,0}, | 64 | std::vector<mg::DisplayConfigurationMode>{ |
246 | 65 | fb_device->fps, | 65 | mg::DisplayConfigurationMode{{fb_device->width, fb_device->height}, fb_device->fps} |
247 | 66 | true, | 66 | }, |
248 | 67 | mga::to_mir_format(fb_device->format), | 67 | 0, |
249 | 68 | fb_num}; | 68 | {0,0}, |
250 | 69 | true, | ||
251 | 70 | false, | ||
252 | 71 | {0,0}, | ||
253 | 72 | 0, | ||
254 | 73 | mir_pixel_format_abgr_8888, | ||
255 | 74 | mir_power_mode_on, | ||
256 | 75 | mir_orientation_normal | ||
257 | 76 | }; | ||
258 | 69 | } | 77 | } |
259 | 70 | 78 | ||
260 | 71 | mga::ConfigChangeSubscription mga::FbControl::subscribe_to_config_changes( | 79 | mga::ConfigChangeSubscription mga::FbControl::subscribe_to_config_changes( |
261 | 72 | 80 | ||
262 | === modified file 'src/platforms/android/server/fb_device.h' | |||
263 | --- src/platforms/android/server/fb_device.h 2015-03-24 16:02:48 +0000 | |||
264 | +++ src/platforms/android/server/fb_device.h 2015-03-24 19:59:11 +0000 | |||
265 | @@ -36,7 +36,7 @@ | |||
266 | 36 | public: | 36 | public: |
267 | 37 | FbControl(std::shared_ptr<framebuffer_device_t> const& fbdev); | 37 | FbControl(std::shared_ptr<framebuffer_device_t> const& fbdev); |
268 | 38 | void power_mode(DisplayName, MirPowerMode) override; | 38 | void power_mode(DisplayName, MirPowerMode) override; |
270 | 39 | DisplayAttribs active_attribs_for(DisplayName) override; | 39 | DisplayConfigurationOutput active_config_for(DisplayName) override; |
271 | 40 | ConfigChangeSubscription subscribe_to_config_changes( | 40 | ConfigChangeSubscription subscribe_to_config_changes( |
272 | 41 | std::function<void()> const& hotplug_cb, | 41 | std::function<void()> const& hotplug_cb, |
273 | 42 | std::function<void(DisplayName)> const& vsync_cb) override; | 42 | std::function<void(DisplayName)> const& vsync_cb) override; |
274 | 43 | 43 | ||
275 | === modified file 'src/platforms/android/server/hal_component_factory.cpp' | |||
276 | --- src/platforms/android/server/hal_component_factory.cpp 2015-03-18 19:38:43 +0000 | |||
277 | +++ src/platforms/android/server/hal_component_factory.cpp 2015-03-24 19:59:11 +0000 | |||
278 | @@ -47,7 +47,8 @@ | |||
279 | 47 | : buffer_allocator(buffer_allocator), | 47 | : buffer_allocator(buffer_allocator), |
280 | 48 | res_factory(res_factory), | 48 | res_factory(res_factory), |
281 | 49 | hwc_report(hwc_report), | 49 | hwc_report(hwc_report), |
283 | 50 | force_backup_display(false) | 50 | force_backup_display(false), |
284 | 51 | num_framebuffers{quirks.num_framebuffers()} | ||
285 | 51 | { | 52 | { |
286 | 52 | try | 53 | try |
287 | 53 | { | 54 | { |
288 | @@ -60,16 +61,18 @@ | |||
289 | 60 | if (force_backup_display || hwc_version == mga::HwcVersion::hwc10) | 61 | if (force_backup_display || hwc_version == mga::HwcVersion::hwc10) |
290 | 61 | { | 62 | { |
291 | 62 | fb_native = res_factory->create_fb_native_device(); | 63 | fb_native = res_factory->create_fb_native_device(); |
292 | 64 | //guarantee always 2 fb's allocated | ||
293 | 65 | num_framebuffers = std::max(2u, static_cast<unsigned int>(fb_native->numFramebuffers)); | ||
294 | 63 | } | 66 | } |
295 | 64 | } | 67 | } |
296 | 65 | 68 | ||
298 | 66 | std::unique_ptr<mga::FramebufferBundle> mga::HalComponentFactory::create_framebuffers(mga::DisplayAttribs const& attribs) | 69 | std::unique_ptr<mga::FramebufferBundle> mga::HalComponentFactory::create_framebuffers(mg::DisplayConfigurationOutput const& config) |
299 | 67 | { | 70 | { |
300 | 68 | return std::unique_ptr<mga::FramebufferBundle>(new mga::Framebuffers( | 71 | return std::unique_ptr<mga::FramebufferBundle>(new mga::Framebuffers( |
301 | 69 | *buffer_allocator, | 72 | *buffer_allocator, |
305 | 70 | attribs.pixel_size, | 73 | config.modes[config.current_mode_index].size, |
306 | 71 | attribs.display_format, | 74 | config.current_format, |
307 | 72 | attribs.num_framebuffers)); | 75 | num_framebuffers)); |
308 | 73 | } | 76 | } |
309 | 74 | 77 | ||
310 | 75 | std::unique_ptr<mga::LayerList> mga::HalComponentFactory::create_layer_list() | 78 | std::unique_ptr<mga::LayerList> mga::HalComponentFactory::create_layer_list() |
311 | 76 | 79 | ||
312 | === modified file 'src/platforms/android/server/hal_component_factory.h' | |||
313 | --- src/platforms/android/server/hal_component_factory.h 2015-02-02 12:18:18 +0000 | |||
314 | +++ src/platforms/android/server/hal_component_factory.h 2015-03-24 19:59:11 +0000 | |||
315 | @@ -21,6 +21,7 @@ | |||
316 | 21 | 21 | ||
317 | 22 | #include "display_component_factory.h" | 22 | #include "display_component_factory.h" |
318 | 23 | #include "display_resource_factory.h" | 23 | #include "display_resource_factory.h" |
319 | 24 | #include "device_quirks.h" | ||
320 | 24 | 25 | ||
321 | 25 | namespace mir | 26 | namespace mir |
322 | 26 | { | 27 | { |
323 | @@ -46,18 +47,20 @@ | |||
324 | 46 | std::shared_ptr<DisplayResourceFactory> const& res_factory, | 47 | std::shared_ptr<DisplayResourceFactory> const& res_factory, |
325 | 47 | std::shared_ptr<HwcReport> const& hwc_report); | 48 | std::shared_ptr<HwcReport> const& hwc_report); |
326 | 48 | 49 | ||
328 | 49 | std::unique_ptr<FramebufferBundle> create_framebuffers(DisplayAttribs const&) override; | 50 | std::unique_ptr<FramebufferBundle> create_framebuffers(DisplayConfigurationOutput const&) override; |
329 | 50 | std::unique_ptr<DisplayDevice> create_display_device() override; | 51 | std::unique_ptr<DisplayDevice> create_display_device() override; |
330 | 51 | std::unique_ptr<HwcConfiguration> create_hwc_configuration() override; | 52 | std::unique_ptr<HwcConfiguration> create_hwc_configuration() override; |
331 | 52 | std::unique_ptr<LayerList> create_layer_list() override; | 53 | std::unique_ptr<LayerList> create_layer_list() override; |
332 | 53 | 54 | ||
333 | 54 | private: | 55 | private: |
334 | 56 | DeviceQuirks quirks{PropertiesOps{}}; | ||
335 | 55 | std::shared_ptr<GraphicBufferAllocator> const buffer_allocator; | 57 | std::shared_ptr<GraphicBufferAllocator> const buffer_allocator; |
336 | 56 | std::shared_ptr<DisplayResourceFactory> const res_factory; | 58 | std::shared_ptr<DisplayResourceFactory> const res_factory; |
337 | 57 | std::shared_ptr<HwcReport> const hwc_report; | 59 | std::shared_ptr<HwcReport> const hwc_report; |
338 | 58 | 60 | ||
339 | 59 | std::shared_ptr<FramebufferBundle> framebuffers; | 61 | std::shared_ptr<FramebufferBundle> framebuffers; |
340 | 60 | bool force_backup_display; | 62 | bool force_backup_display; |
341 | 63 | size_t num_framebuffers; | ||
342 | 61 | 64 | ||
343 | 62 | std::shared_ptr<HwcWrapper> hwc_wrapper; | 65 | std::shared_ptr<HwcWrapper> hwc_wrapper; |
344 | 63 | std::shared_ptr<framebuffer_device_t> fb_native; | 66 | std::shared_ptr<framebuffer_device_t> fb_native; |
345 | 64 | 67 | ||
346 | === modified file 'src/platforms/android/server/hwc_blanking_control.cpp' | |||
347 | --- src/platforms/android/server/hwc_blanking_control.cpp 2015-03-24 16:02:48 +0000 | |||
348 | +++ src/platforms/android/server/hwc_blanking_control.cpp 2015-03-24 19:59:11 +0000 | |||
349 | @@ -27,6 +27,7 @@ | |||
350 | 27 | #include <stdexcept> | 27 | #include <stdexcept> |
351 | 28 | #include <chrono> | 28 | #include <chrono> |
352 | 29 | 29 | ||
353 | 30 | namespace mg = mir::graphics; | ||
354 | 30 | namespace mga = mir::graphics::android; | 31 | namespace mga = mir::graphics::android; |
355 | 31 | namespace geom = mir::geometry; | 32 | namespace geom = mir::geometry; |
356 | 32 | 33 | ||
357 | @@ -111,9 +112,47 @@ | |||
358 | 111 | geom::Length length(pixel_num / dpi_inches, geom::Length::Units::inches); | 112 | geom::Length length(pixel_num / dpi_inches, geom::Length::Units::inches); |
359 | 112 | return length.as(geom::Length::Units::millimetres); | 113 | return length.as(geom::Length::Units::millimetres); |
360 | 113 | } | 114 | } |
364 | 114 | } | 115 | |
365 | 115 | 116 | mg::DisplayConfigurationOutput populate_config( | |
366 | 116 | mga::DisplayAttribs mga::HwcBlankingControl::active_attribs_for(DisplayName display_name) | 117 | mga::DisplayName name, |
367 | 118 | geom::Size pixel_size, | ||
368 | 119 | double vrefresh_hz, | ||
369 | 120 | geom::Size mm_size, | ||
370 | 121 | MirPowerMode external_mode, | ||
371 | 122 | MirPixelFormat display_format, | ||
372 | 123 | bool connected) | ||
373 | 124 | { | ||
374 | 125 | geom::Point const origin{0,0}; | ||
375 | 126 | size_t const preferred_format_index{0}; | ||
376 | 127 | size_t const preferred_mode_index{0}; | ||
377 | 128 | std::vector<mg::DisplayConfigurationMode> external_modes; | ||
378 | 129 | if (connected) | ||
379 | 130 | external_modes.emplace_back(mg::DisplayConfigurationMode{pixel_size, vrefresh_hz}); | ||
380 | 131 | |||
381 | 132 | auto type = mg::DisplayConfigurationOutputType::lvds; | ||
382 | 133 | if (name == mga::DisplayName::external) | ||
383 | 134 | type = mg::DisplayConfigurationOutputType::displayport; | ||
384 | 135 | |||
385 | 136 | return { | ||
386 | 137 | static_cast<mg::DisplayConfigurationOutputId>(name), | ||
387 | 138 | mg::DisplayConfigurationCardId{0}, | ||
388 | 139 | type, | ||
389 | 140 | {display_format}, | ||
390 | 141 | external_modes, | ||
391 | 142 | preferred_mode_index, | ||
392 | 143 | mm_size, | ||
393 | 144 | connected, | ||
394 | 145 | connected, | ||
395 | 146 | origin, | ||
396 | 147 | preferred_format_index, | ||
397 | 148 | display_format, | ||
398 | 149 | external_mode, | ||
399 | 150 | mir_orientation_normal | ||
400 | 151 | }; | ||
401 | 152 | } | ||
402 | 153 | } | ||
403 | 154 | |||
404 | 155 | mg::DisplayConfigurationOutput mga::HwcBlankingControl::active_config_for(DisplayName display_name) | ||
405 | 117 | { | 156 | { |
406 | 118 | auto configs = hwc_device->display_configs(display_name); | 157 | auto configs = hwc_device->display_configs(display_name); |
407 | 119 | if (configs.empty()) | 158 | if (configs.empty()) |
408 | @@ -121,7 +160,7 @@ | |||
409 | 121 | if (display_name == mga::DisplayName::primary) | 160 | if (display_name == mga::DisplayName::primary) |
410 | 122 | BOOST_THROW_EXCEPTION(std::runtime_error("primary display disconnected")); | 161 | BOOST_THROW_EXCEPTION(std::runtime_error("primary display disconnected")); |
411 | 123 | else | 162 | else |
413 | 124 | return {{}, {}, 0.0, false, format, quirks.num_framebuffers()}; | 163 | return populate_config(display_name, {0,0}, 0.0f, {0,0}, mir_power_mode_off, mir_pixel_format_invalid, false); |
414 | 125 | } | 164 | } |
415 | 126 | 165 | ||
416 | 127 | /* note: some drivers (qcom msm8960) choke if this is not the same size array | 166 | /* note: some drivers (qcom msm8960) choke if this is not the same size array |
417 | @@ -145,17 +184,17 @@ | |||
418 | 145 | if (display_name == mga::DisplayName::primary) | 184 | if (display_name == mga::DisplayName::primary) |
419 | 146 | BOOST_THROW_EXCEPTION(std::runtime_error("primary display disconnected")); | 185 | BOOST_THROW_EXCEPTION(std::runtime_error("primary display disconnected")); |
420 | 147 | else | 186 | else |
422 | 148 | return {{}, {}, 0.0, false, format, quirks.num_framebuffers()}; | 187 | return populate_config(display_name, {0,0}, 0.0f, {0,0}, mir_power_mode_off, mir_pixel_format_invalid, false); |
423 | 149 | } | 188 | } |
424 | 150 | 189 | ||
426 | 151 | return { | 190 | return populate_config( |
427 | 191 | display_name, | ||
428 | 152 | {values[0], values[1]}, | 192 | {values[0], values[1]}, |
429 | 193 | period_to_hz(std::chrono::nanoseconds{values[2]}), | ||
430 | 153 | {dpi_to_mm(values[3], values[0]), dpi_to_mm(values[4], values[1])}, | 194 | {dpi_to_mm(values[3], values[0]), dpi_to_mm(values[4], values[1])}, |
433 | 154 | period_to_hz(std::chrono::nanoseconds{values[2]}), | 195 | mir_power_mode_off, |
432 | 155 | true, | ||
434 | 156 | format, | 196 | format, |
437 | 157 | quirks.num_framebuffers() | 197 | true); |
436 | 158 | }; | ||
438 | 159 | } | 198 | } |
439 | 160 | 199 | ||
440 | 161 | mga::ConfigChangeSubscription mga::HwcBlankingControl::subscribe_to_config_changes( | 200 | mga::ConfigChangeSubscription mga::HwcBlankingControl::subscribe_to_config_changes( |
441 | 162 | 201 | ||
442 | === modified file 'src/platforms/android/server/hwc_configuration.h' | |||
443 | --- src/platforms/android/server/hwc_configuration.h 2015-03-24 16:02:48 +0000 | |||
444 | +++ src/platforms/android/server/hwc_configuration.h 2015-03-24 19:59:11 +0000 | |||
445 | @@ -22,7 +22,6 @@ | |||
446 | 22 | #include "mir/graphics/display_configuration.h" | 22 | #include "mir/graphics/display_configuration.h" |
447 | 23 | #include "mir/geometry/size.h" | 23 | #include "mir/geometry/size.h" |
448 | 24 | #include "display_name.h" | 24 | #include "display_name.h" |
449 | 25 | #include "device_quirks.h" | ||
450 | 26 | #include <memory> | 25 | #include <memory> |
451 | 27 | #include <functional> | 26 | #include <functional> |
452 | 28 | 27 | ||
453 | @@ -32,15 +31,6 @@ | |||
454 | 32 | { | 31 | { |
455 | 33 | namespace android | 32 | namespace android |
456 | 34 | { | 33 | { |
457 | 35 | struct DisplayAttribs | ||
458 | 36 | { | ||
459 | 37 | geometry::Size pixel_size; | ||
460 | 38 | geometry::Size mm_size; | ||
461 | 39 | double vrefresh_hz; | ||
462 | 40 | bool connected; | ||
463 | 41 | MirPixelFormat display_format; | ||
464 | 42 | size_t num_framebuffers; | ||
465 | 43 | }; | ||
466 | 44 | 34 | ||
467 | 45 | using ConfigChangeSubscription = std::shared_ptr<void>; | 35 | using ConfigChangeSubscription = std::shared_ptr<void>; |
468 | 46 | //interface adapting for the blanking interface differences between fb, HWC 1.0-1.3, and HWC 1.4+ | 36 | //interface adapting for the blanking interface differences between fb, HWC 1.0-1.3, and HWC 1.4+ |
469 | @@ -49,7 +39,7 @@ | |||
470 | 49 | public: | 39 | public: |
471 | 50 | virtual ~HwcConfiguration() = default; | 40 | virtual ~HwcConfiguration() = default; |
472 | 51 | virtual void power_mode(DisplayName, MirPowerMode) = 0; | 41 | virtual void power_mode(DisplayName, MirPowerMode) = 0; |
474 | 52 | virtual DisplayAttribs active_attribs_for(DisplayName) = 0; | 42 | virtual DisplayConfigurationOutput active_config_for(DisplayName) = 0; |
475 | 53 | virtual ConfigChangeSubscription subscribe_to_config_changes( | 43 | virtual ConfigChangeSubscription subscribe_to_config_changes( |
476 | 54 | std::function<void()> const& hotplug_cb, | 44 | std::function<void()> const& hotplug_cb, |
477 | 55 | std::function<void(DisplayName)> const& vsync_cb) = 0; | 45 | std::function<void(DisplayName)> const& vsync_cb) = 0; |
478 | @@ -66,13 +56,12 @@ | |||
479 | 66 | public: | 56 | public: |
480 | 67 | HwcBlankingControl(std::shared_ptr<HwcWrapper> const&); | 57 | HwcBlankingControl(std::shared_ptr<HwcWrapper> const&); |
481 | 68 | void power_mode(DisplayName, MirPowerMode) override; | 58 | void power_mode(DisplayName, MirPowerMode) override; |
483 | 69 | DisplayAttribs active_attribs_for(DisplayName) override; | 59 | DisplayConfigurationOutput active_config_for(DisplayName) override; |
484 | 70 | ConfigChangeSubscription subscribe_to_config_changes( | 60 | ConfigChangeSubscription subscribe_to_config_changes( |
485 | 71 | std::function<void()> const& hotplug_cb, | 61 | std::function<void()> const& hotplug_cb, |
486 | 72 | std::function<void(DisplayName)> const& vsync_cb) override; | 62 | std::function<void(DisplayName)> const& vsync_cb) override; |
487 | 73 | 63 | ||
488 | 74 | private: | 64 | private: |
489 | 75 | DeviceQuirks quirks{PropertiesOps{}}; | ||
490 | 76 | std::shared_ptr<HwcWrapper> const hwc_device; | 65 | std::shared_ptr<HwcWrapper> const hwc_device; |
491 | 77 | bool off; | 66 | bool off; |
492 | 78 | MirPixelFormat format; | 67 | MirPixelFormat format; |
493 | 79 | 68 | ||
494 | === modified file 'tests/include/mir_test_doubles/stub_display_builder.h' | |||
495 | --- tests/include/mir_test_doubles/stub_display_builder.h 2015-03-24 16:02:48 +0000 | |||
496 | +++ tests/include/mir_test_doubles/stub_display_builder.h 2015-03-24 19:59:11 +0000 | |||
497 | @@ -23,6 +23,7 @@ | |||
498 | 23 | #include "src/platforms/android/server/display_component_factory.h" | 23 | #include "src/platforms/android/server/display_component_factory.h" |
499 | 24 | #include "src/platforms/android/server/configurable_display_buffer.h" | 24 | #include "src/platforms/android/server/configurable_display_buffer.h" |
500 | 25 | #include "src/platforms/android/server/hwc_configuration.h" | 25 | #include "src/platforms/android/server/hwc_configuration.h" |
501 | 26 | #include "stub_display_configuration.h" | ||
502 | 26 | #include "mock_display_device.h" | 27 | #include "mock_display_device.h" |
503 | 27 | #include <gmock/gmock.h> | 28 | #include <gmock/gmock.h> |
504 | 28 | 29 | ||
505 | @@ -45,16 +46,15 @@ | |||
506 | 45 | MockHwcConfiguration() | 46 | MockHwcConfiguration() |
507 | 46 | { | 47 | { |
508 | 47 | using namespace testing; | 48 | using namespace testing; |
509 | 49 | StubDisplayConfig config({{true, true}, {false, false}}); | ||
510 | 48 | ON_CALL(*this, subscribe_to_config_changes(_,_)).WillByDefault(Return(nullptr)); | 50 | ON_CALL(*this, subscribe_to_config_changes(_,_)).WillByDefault(Return(nullptr)); |
517 | 49 | ON_CALL(*this, active_attribs_for(graphics::android::DisplayName::primary)) | 51 | ON_CALL(*this, active_config_for(graphics::android::DisplayName::primary)) |
518 | 50 | .WillByDefault(testing::Return(graphics::android::DisplayAttribs{ | 52 | .WillByDefault(testing::Return(config.outputs[0])); |
519 | 51 | {0,0},{0,0}, 0.0, true, mir_pixel_format_abgr_8888, 2})); | 53 | ON_CALL(*this, active_config_for(graphics::android::DisplayName::external)) |
520 | 52 | ON_CALL(*this, active_attribs_for(graphics::android::DisplayName::external)) | 54 | .WillByDefault(testing::Return(config.outputs[1])); |
515 | 53 | .WillByDefault(testing::Return(graphics::android::DisplayAttribs{ | ||
516 | 54 | {0,0},{0,0}, 0.0, false, mir_pixel_format_abgr_8888, 2})); | ||
521 | 55 | } | 55 | } |
522 | 56 | MOCK_METHOD2(power_mode, void(graphics::android::DisplayName, MirPowerMode)); | 56 | MOCK_METHOD2(power_mode, void(graphics::android::DisplayName, MirPowerMode)); |
524 | 57 | MOCK_METHOD1(active_attribs_for, graphics::android::DisplayAttribs(graphics::android::DisplayName)); | 57 | MOCK_METHOD1(active_config_for, graphics::DisplayConfigurationOutput(graphics::android::DisplayName)); |
525 | 58 | MOCK_METHOD2(subscribe_to_config_changes, | 58 | MOCK_METHOD2(subscribe_to_config_changes, |
526 | 59 | graphics::android::ConfigChangeSubscription( | 59 | graphics::android::ConfigChangeSubscription( |
527 | 60 | std::function<void()> const&, std::function<void(graphics::android::DisplayName)> const&)); | 60 | std::function<void()> const&, std::function<void(graphics::android::DisplayName)> const&)); |
528 | @@ -66,14 +66,13 @@ | |||
529 | 66 | { | 66 | { |
530 | 67 | } | 67 | } |
531 | 68 | 68 | ||
533 | 69 | graphics::android::DisplayAttribs active_attribs_for(graphics::android::DisplayName name) override | 69 | graphics::DisplayConfigurationOutput active_config_for(graphics::android::DisplayName name) override |
534 | 70 | { | 70 | { |
539 | 71 | if (name == graphics::android::DisplayName::external) | 71 | bool connected{name == graphics::android::DisplayName::primary}; |
540 | 72 | return graphics::android::DisplayAttribs{{20,20}, {4,4}, 50.0f, false, mir_pixel_format_abgr_8888, 2}; | 72 | auto config = StubDisplayConfig({{connected, connected}}).outputs[0]; |
541 | 73 | else | 73 | config.id = static_cast<graphics::DisplayConfigurationOutputId>(name); |
542 | 74 | return graphics::android::DisplayAttribs{{20,20}, {4,4}, 350.0f, true, mir_pixel_format_abgr_8888, 2}; | 74 | return config; |
543 | 75 | } | 75 | } |
544 | 76 | |||
545 | 77 | 76 | ||
546 | 78 | graphics::android::ConfigChangeSubscription subscribe_to_config_changes( | 77 | graphics::android::ConfigChangeSubscription subscribe_to_config_changes( |
547 | 79 | std::function<void()> const&, std::function<void(graphics::android::DisplayName)> const&) override | 78 | std::function<void()> const&, std::function<void(graphics::android::DisplayName)> const&) override |
548 | @@ -101,7 +100,7 @@ | |||
549 | 101 | new graphics::android::LayerList(std::make_shared<graphics::android::IntegerSourceCrop>(), {})); | 100 | new graphics::android::LayerList(std::make_shared<graphics::android::IntegerSourceCrop>(), {})); |
550 | 102 | } | 101 | } |
551 | 103 | 102 | ||
553 | 104 | std::unique_ptr<graphics::android::FramebufferBundle> create_framebuffers(graphics::android::DisplayAttribs const&) override | 103 | std::unique_ptr<graphics::android::FramebufferBundle> create_framebuffers(graphics::DisplayConfigurationOutput const&) override |
554 | 105 | { | 104 | { |
555 | 106 | return std::unique_ptr<graphics::android::FramebufferBundle>(new StubFramebufferBundle()); | 105 | return std::unique_ptr<graphics::android::FramebufferBundle>(new StubFramebufferBundle()); |
556 | 107 | } | 106 | } |
557 | 108 | 107 | ||
558 | === modified file 'tests/include/mir_test_doubles/stub_display_configuration.h' | |||
559 | --- tests/include/mir_test_doubles/stub_display_configuration.h 2015-03-24 16:02:48 +0000 | |||
560 | +++ tests/include/mir_test_doubles/stub_display_configuration.h 2015-03-24 19:59:11 +0000 | |||
561 | @@ -32,6 +32,36 @@ | |||
562 | 32 | namespace doubles | 32 | namespace doubles |
563 | 33 | { | 33 | { |
564 | 34 | 34 | ||
565 | 35 | struct StubDisplayConfigurationOutput : public graphics::DisplayConfigurationOutput | ||
566 | 36 | { | ||
567 | 37 | StubDisplayConfigurationOutput( | ||
568 | 38 | geometry::Size px_size, geometry::Size mm_size, MirPixelFormat format, double vrefresh, bool connected) : | ||
569 | 39 | StubDisplayConfigurationOutput(graphics::DisplayConfigurationOutputId{0}, px_size, mm_size, format, vrefresh, connected) | ||
570 | 40 | { | ||
571 | 41 | } | ||
572 | 42 | |||
573 | 43 | StubDisplayConfigurationOutput(graphics::DisplayConfigurationOutputId id, | ||
574 | 44 | geometry::Size px_size, geometry::Size mm_size, MirPixelFormat format, double vrefresh, bool connected) : | ||
575 | 45 | DisplayConfigurationOutput{ | ||
576 | 46 | id, | ||
577 | 47 | graphics::DisplayConfigurationCardId{0}, | ||
578 | 48 | graphics::DisplayConfigurationOutputType::lvds, | ||
579 | 49 | {format}, | ||
580 | 50 | {{px_size, vrefresh}}, | ||
581 | 51 | 0, | ||
582 | 52 | mm_size, | ||
583 | 53 | connected, | ||
584 | 54 | connected, | ||
585 | 55 | {0,0}, | ||
586 | 56 | 0, | ||
587 | 57 | format, | ||
588 | 58 | mir_power_mode_on, | ||
589 | 59 | mir_orientation_normal | ||
590 | 60 | } | ||
591 | 61 | { | ||
592 | 62 | } | ||
593 | 63 | }; | ||
594 | 64 | |||
595 | 35 | class StubDisplayConfig : public graphics::DisplayConfiguration | 65 | class StubDisplayConfig : public graphics::DisplayConfiguration |
596 | 36 | { | 66 | { |
597 | 37 | public: | 67 | public: |
598 | @@ -64,6 +94,8 @@ | |||
599 | 64 | { | 94 | { |
600 | 65 | outputs[i].connected = connected_used[i].first; | 95 | outputs[i].connected = connected_used[i].first; |
601 | 66 | outputs[i].used = connected_used[i].second; | 96 | outputs[i].used = connected_used[i].second; |
602 | 97 | outputs[i].current_format = mir_pixel_format_abgr_8888; | ||
603 | 98 | outputs[i].id = graphics::DisplayConfigurationOutputId{static_cast<int>(i)}; | ||
604 | 67 | } | 99 | } |
605 | 68 | } | 100 | } |
606 | 69 | 101 | ||
607 | 70 | 102 | ||
608 | === modified file 'tests/unit-tests/graphics/android/test_display.cpp' | |||
609 | --- tests/unit-tests/graphics/android/test_display.cpp 2015-03-24 16:02:48 +0000 | |||
610 | +++ tests/unit-tests/graphics/android/test_display.cpp 2015-03-24 19:59:11 +0000 | |||
611 | @@ -30,6 +30,7 @@ | |||
612 | 30 | #include "mir_test_doubles/stub_gl_config.h" | 30 | #include "mir_test_doubles/stub_gl_config.h" |
613 | 31 | #include "mir_test_doubles/mock_gl_config.h" | 31 | #include "mir_test_doubles/mock_gl_config.h" |
614 | 32 | #include "mir_test_doubles/stub_gl_program_factory.h" | 32 | #include "mir_test_doubles/stub_gl_program_factory.h" |
615 | 33 | #include "mir_test_doubles/stub_display_configuration.h" | ||
616 | 33 | #include "mir/graphics/android/mir_native_window.h" | 34 | #include "mir/graphics/android/mir_native_window.h" |
617 | 34 | #include "mir_test_doubles/stub_driver_interpreter.h" | 35 | #include "mir_test_doubles/stub_driver_interpreter.h" |
618 | 35 | 36 | ||
619 | @@ -401,10 +402,12 @@ | |||
620 | 401 | 402 | ||
621 | 402 | stub_db_factory->with_next_config([&](mtd::MockHwcConfiguration& mock_config) | 403 | stub_db_factory->with_next_config([&](mtd::MockHwcConfiguration& mock_config) |
622 | 403 | { | 404 | { |
627 | 404 | ON_CALL(mock_config, active_attribs_for(mga::DisplayName::primary)) | 405 | ON_CALL(mock_config, active_config_for(mga::DisplayName::primary)) |
628 | 405 | .WillByDefault(Return(mga::DisplayAttribs{pixel_size, physical_size, vrefresh, true, format, true})); | 406 | .WillByDefault(Return(mtd::StubDisplayConfigurationOutput{ |
629 | 406 | ON_CALL(mock_config, active_attribs_for(mga::DisplayName::external)) | 407 | pixel_size, physical_size, format, vrefresh, true})); |
630 | 407 | .WillByDefault(Return(mga::DisplayAttribs{pixel_size, physical_size, vrefresh, false, format, true})); | 408 | ON_CALL(mock_config, active_config_for(mga::DisplayName::external)) |
631 | 409 | .WillByDefault(Return(mtd::StubDisplayConfigurationOutput{ | ||
632 | 410 | pixel_size, physical_size, format, vrefresh, false})); | ||
633 | 408 | }); | 411 | }); |
634 | 409 | 412 | ||
635 | 410 | mga::Display display( | 413 | mga::Display display( |
636 | @@ -448,12 +451,12 @@ | |||
637 | 448 | 451 | ||
638 | 449 | stub_db_factory->with_next_config([&](mtd::MockHwcConfiguration& mock_config) | 452 | stub_db_factory->with_next_config([&](mtd::MockHwcConfiguration& mock_config) |
639 | 450 | { | 453 | { |
646 | 451 | ON_CALL(mock_config, active_attribs_for(mga::DisplayName::primary)) | 454 | ON_CALL(mock_config, active_config_for(mga::DisplayName::primary)) |
647 | 452 | .WillByDefault(Return( | 455 | .WillByDefault(Return(mtd::StubDisplayConfigurationOutput{ |
648 | 453 | mga::DisplayAttribs{primary_pixel_size, primary_physical_size, primary_vrefresh, true, format, 2})); | 456 | primary_pixel_size, primary_physical_size, format, primary_vrefresh, true})); |
649 | 454 | ON_CALL(mock_config, active_attribs_for(mga::DisplayName::external)) | 457 | ON_CALL(mock_config, active_config_for(mga::DisplayName::external)) |
650 | 455 | .WillByDefault(Return( | 458 | .WillByDefault(Return(mtd::StubDisplayConfigurationOutput{mg::DisplayConfigurationOutputId{1}, |
651 | 456 | mga::DisplayAttribs{external_pixel_size, external_physical_size, external_vrefresh, true, format, 2})); | 459 | external_pixel_size, external_physical_size, format, external_vrefresh, true})); |
652 | 457 | }); | 460 | }); |
653 | 458 | 461 | ||
654 | 459 | mga::Display display( | 462 | mga::Display display( |
655 | @@ -491,7 +494,7 @@ | |||
656 | 491 | EXPECT_EQ(mg::DisplayConfigurationOutputId{1}, outputs[1].id); | 494 | EXPECT_EQ(mg::DisplayConfigurationOutputId{1}, outputs[1].id); |
657 | 492 | EXPECT_EQ(mg::DisplayConfigurationCardId{0}, outputs[1].card_id); | 495 | EXPECT_EQ(mg::DisplayConfigurationCardId{0}, outputs[1].card_id); |
658 | 493 | EXPECT_TRUE(outputs[1].connected); | 496 | EXPECT_TRUE(outputs[1].connected); |
660 | 494 | EXPECT_FALSE(outputs[1].used); | 497 | EXPECT_TRUE(outputs[1].used); |
661 | 495 | EXPECT_EQ(origin, outputs[1].top_left); | 498 | EXPECT_EQ(origin, outputs[1].top_left); |
662 | 496 | EXPECT_EQ(0, outputs[1].current_mode_index); | 499 | EXPECT_EQ(0, outputs[1].current_mode_index); |
663 | 497 | EXPECT_EQ(external_physical_size, outputs[1].physical_size_mm); | 500 | EXPECT_EQ(external_physical_size, outputs[1].physical_size_mm); |
664 | @@ -575,34 +578,33 @@ | |||
665 | 575 | std::shared_ptr<void> subscription = std::make_shared<int>(3433); | 578 | std::shared_ptr<void> subscription = std::make_shared<int>(3433); |
666 | 576 | std::function<void()> hotplug_fn = []{}; | 579 | std::function<void()> hotplug_fn = []{}; |
667 | 577 | 580 | ||
669 | 578 | mga::DisplayAttribs attribs1 | 581 | mtd::StubDisplayConfigurationOutput attribs1 |
670 | 579 | { | 582 | { |
671 | 580 | {33, 32}, | 583 | {33, 32}, |
672 | 581 | {31, 35}, | 584 | {31, 35}, |
673 | 585 | mir_pixel_format_abgr_8888, | ||
674 | 582 | 0.44, | 586 | 0.44, |
675 | 583 | true, | 587 | true, |
676 | 584 | mir_pixel_format_abgr_8888, | ||
677 | 585 | 2 | ||
678 | 586 | }; | 588 | }; |
680 | 587 | mga::DisplayAttribs attribs2 | 589 | mtd::StubDisplayConfigurationOutput attribs2 |
681 | 588 | { | 590 | { |
682 | 589 | {3, 3}, | 591 | {3, 3}, |
683 | 590 | {1, 5}, | 592 | {1, 5}, |
684 | 593 | mir_pixel_format_abgr_8888, | ||
685 | 591 | 0.5544, | 594 | 0.5544, |
686 | 592 | true, | 595 | true, |
687 | 593 | mir_pixel_format_abgr_8888, | ||
688 | 594 | 2 | ||
689 | 595 | }; | 596 | }; |
690 | 596 | 597 | ||
691 | 597 | stub_db_factory->with_next_config([&](mtd::MockHwcConfiguration& mock_config) | 598 | stub_db_factory->with_next_config([&](mtd::MockHwcConfiguration& mock_config) |
692 | 598 | { | 599 | { |
693 | 599 | EXPECT_CALL(mock_config, subscribe_to_config_changes(_,_)) | 600 | EXPECT_CALL(mock_config, subscribe_to_config_changes(_,_)) |
694 | 600 | .WillOnce(DoAll(SaveArg<0>(&hotplug_fn), Return(subscription))); | 601 | .WillOnce(DoAll(SaveArg<0>(&hotplug_fn), Return(subscription))); |
696 | 601 | EXPECT_CALL(mock_config, active_attribs_for(mga::DisplayName::primary)) | 602 | |
697 | 603 | EXPECT_CALL(mock_config, active_config_for(mga::DisplayName::primary)) | ||
698 | 602 | .Times(2) | 604 | .Times(2) |
699 | 603 | .WillOnce(testing::Return(attribs1)) | 605 | .WillOnce(testing::Return(attribs1)) |
700 | 604 | .WillOnce(testing::Return(attribs2)); | 606 | .WillOnce(testing::Return(attribs2)); |
702 | 605 | EXPECT_CALL(mock_config, active_attribs_for(mga::DisplayName::external)) | 607 | EXPECT_CALL(mock_config, active_config_for(mga::DisplayName::external)) |
703 | 606 | .Times(2) | 608 | .Times(2) |
704 | 607 | .WillOnce(testing::Return(attribs1)) | 609 | .WillOnce(testing::Return(attribs1)) |
705 | 608 | .WillOnce(testing::Return(attribs2)); | 610 | .WillOnce(testing::Return(attribs2)); |
706 | @@ -617,14 +619,14 @@ | |||
707 | 617 | 619 | ||
708 | 618 | auto config = display.configuration(); | 620 | auto config = display.configuration(); |
709 | 619 | config->for_each_output([&](mg::UserDisplayConfigurationOutput const& c){ | 621 | config->for_each_output([&](mg::UserDisplayConfigurationOutput const& c){ |
711 | 620 | EXPECT_THAT(c.modes[c.current_mode_index].size, Eq(attribs1.pixel_size)); | 622 | EXPECT_THAT(c.modes[c.current_mode_index].size, Eq(attribs1.modes[attribs1.current_mode_index].size)); |
712 | 621 | }); | 623 | }); |
713 | 622 | 624 | ||
714 | 623 | hotplug_fn(); | 625 | hotplug_fn(); |
715 | 624 | config = display.configuration(); | 626 | config = display.configuration(); |
716 | 625 | config = display.configuration(); | 627 | config = display.configuration(); |
717 | 626 | config->for_each_output([&](mg::UserDisplayConfigurationOutput const& c){ | 628 | config->for_each_output([&](mg::UserDisplayConfigurationOutput const& c){ |
719 | 627 | EXPECT_THAT(c.modes[c.current_mode_index].size, Eq(attribs2.pixel_size)); | 629 | EXPECT_THAT(c.modes[c.current_mode_index].size, Eq(attribs2.modes[attribs2.current_mode_index].size)); |
720 | 628 | }); | 630 | }); |
721 | 629 | } | 631 | } |
722 | 630 | 632 | ||
723 | @@ -635,15 +637,15 @@ | |||
724 | 635 | bool external_connected = true; | 637 | bool external_connected = true; |
725 | 636 | stub_db_factory->with_next_config([&](mtd::MockHwcConfiguration& mock_config) | 638 | stub_db_factory->with_next_config([&](mtd::MockHwcConfiguration& mock_config) |
726 | 637 | { | 639 | { |
730 | 638 | ON_CALL(mock_config, active_attribs_for(mga::DisplayName::primary)) | 640 | ON_CALL(mock_config, active_config_for(mga::DisplayName::primary)) |
731 | 639 | .WillByDefault(Return( | 641 | .WillByDefault(Return(mtd::StubDisplayConfigurationOutput{ |
732 | 640 | mga::DisplayAttribs{{20,20}, {4,4}, 50.0f, true, mir_pixel_format_abgr_8888, 2})); | 642 | mg::DisplayConfigurationOutputId{0}, {20,20}, {4,4}, mir_pixel_format_abgr_8888, 50.0f, true})); |
733 | 641 | 643 | ||
735 | 642 | ON_CALL(mock_config, active_attribs_for(mga::DisplayName::external)) | 644 | ON_CALL(mock_config, active_config_for(mga::DisplayName::external)) |
736 | 643 | .WillByDefault(Invoke([&](mga::DisplayName) | 645 | .WillByDefault(Invoke([&](mga::DisplayName) |
737 | 644 | { | 646 | { |
740 | 645 | return mga::DisplayAttribs{ | 647 | return mtd::StubDisplayConfigurationOutput{mg::DisplayConfigurationOutputId{1}, |
741 | 646 | {20,20}, {4,4}, 50.0f, external_connected, mir_pixel_format_abgr_8888, 2}; | 648 | {20,20}, {4,4}, mir_pixel_format_abgr_8888, 50.0f, external_connected}; |
742 | 647 | })); | 649 | })); |
743 | 648 | EXPECT_CALL(mock_config, subscribe_to_config_changes(_,_)) | 650 | EXPECT_CALL(mock_config, subscribe_to_config_changes(_,_)) |
744 | 649 | .WillOnce(DoAll(SaveArg<0>(&hotplug_fn), Return(std::make_shared<char>('2')))); | 651 | .WillOnce(DoAll(SaveArg<0>(&hotplug_fn), Return(std::make_shared<char>('2')))); |
745 | @@ -696,14 +698,14 @@ | |||
746 | 696 | { | 698 | { |
747 | 697 | EXPECT_CALL(mock_config, subscribe_to_config_changes(_,_)) | 699 | EXPECT_CALL(mock_config, subscribe_to_config_changes(_,_)) |
748 | 698 | .WillOnce(DoAll(SaveArg<0>(&hotplug_fn), Return(std::make_shared<char>('2')))); | 700 | .WillOnce(DoAll(SaveArg<0>(&hotplug_fn), Return(std::make_shared<char>('2')))); |
753 | 699 | ON_CALL(mock_config, active_attribs_for(mga::DisplayName::primary)) | 701 | ON_CALL(mock_config, active_config_for(mga::DisplayName::primary)) |
754 | 700 | .WillByDefault(Return( | 702 | .WillByDefault(Return(mtd::StubDisplayConfigurationOutput{ |
755 | 701 | mga::DisplayAttribs{{20,20}, {4,4}, 50.0f, true, mir_pixel_format_abgr_8888, 2})); | 703 | {20,20}, {4,4}, mir_pixel_format_abgr_8888, 50.0f, true})); |
756 | 702 | ON_CALL(mock_config, active_attribs_for(mga::DisplayName::external)) | 704 | ON_CALL(mock_config, active_config_for(mga::DisplayName::external)) |
757 | 703 | .WillByDefault(Invoke([&](mga::DisplayName) | 705 | .WillByDefault(Invoke([&](mga::DisplayName) |
758 | 704 | { | 706 | { |
761 | 705 | return mga::DisplayAttribs{ | 707 | return mtd::StubDisplayConfigurationOutput{ |
762 | 706 | {20,20}, {4,4}, 50.0f, external_connected, mir_pixel_format_abgr_8888, 2}; | 708 | {20,20}, {4,4}, mir_pixel_format_abgr_8888, 50.0f, external_connected}; |
763 | 707 | })); | 709 | })); |
764 | 708 | 710 | ||
765 | 709 | 711 | ||
766 | @@ -738,9 +740,9 @@ | |||
767 | 738 | using namespace testing; | 740 | using namespace testing; |
768 | 739 | stub_db_factory->with_next_config([&](mtd::MockHwcConfiguration& mock_config) | 741 | stub_db_factory->with_next_config([&](mtd::MockHwcConfiguration& mock_config) |
769 | 740 | { | 742 | { |
773 | 741 | ON_CALL(mock_config, active_attribs_for(mga::DisplayName::external)) | 743 | ON_CALL(mock_config, active_config_for(mga::DisplayName::external)) |
774 | 742 | .WillByDefault(Return(mga::DisplayAttribs{ | 744 | .WillByDefault(Return(mtd::StubDisplayConfigurationOutput{ |
775 | 743 | {0,0},{0,0}, 0.0, true, mir_pixel_format_abgr_8888, 2})); | 745 | mg::DisplayConfigurationOutputId{1}, {0,0}, {0,0}, mir_pixel_format_abgr_8888, 0.0, true})); |
776 | 744 | EXPECT_CALL(mock_config, power_mode(mga::DisplayName::primary, _)) | 746 | EXPECT_CALL(mock_config, power_mode(mga::DisplayName::primary, _)) |
777 | 745 | .Times(AnyNumber()); | 747 | .Times(AnyNumber()); |
778 | 746 | InSequence seq; | 748 | InSequence seq; |
779 | 747 | 749 | ||
780 | === modified file 'tests/unit-tests/graphics/android/test_display_hotplug.cpp' | |||
781 | --- tests/unit-tests/graphics/android/test_display_hotplug.cpp 2015-03-24 16:02:48 +0000 | |||
782 | +++ tests/unit-tests/graphics/android/test_display_hotplug.cpp 2015-03-24 19:59:11 +0000 | |||
783 | @@ -26,6 +26,7 @@ | |||
784 | 26 | #include "mir_test_doubles/mock_display_device.h" | 26 | #include "mir_test_doubles/mock_display_device.h" |
785 | 27 | #include "mir_test_doubles/mock_framebuffer_bundle.h" | 27 | #include "mir_test_doubles/mock_framebuffer_bundle.h" |
786 | 28 | #include "mir_test_doubles/stub_gl_config.h" | 28 | #include "mir_test_doubles/stub_gl_config.h" |
787 | 29 | #include "mir_test_doubles/stub_display_configuration.h" | ||
788 | 29 | #include "mir_test_doubles/mock_egl.h" | 30 | #include "mir_test_doubles/mock_egl.h" |
789 | 30 | #include "mir_test_doubles/mock_gl.h" | 31 | #include "mir_test_doubles/mock_gl.h" |
790 | 31 | #include "mir_test/auto_unblock_thread.h" | 32 | #include "mir_test/auto_unblock_thread.h" |
791 | @@ -42,9 +43,9 @@ | |||
792 | 42 | struct StubHwcConfig : public mga::HwcConfiguration | 43 | struct StubHwcConfig : public mga::HwcConfiguration |
793 | 43 | { | 44 | { |
794 | 44 | void power_mode(mga::DisplayName, MirPowerMode) override {} | 45 | void power_mode(mga::DisplayName, MirPowerMode) override {} |
796 | 45 | mga::DisplayAttribs active_attribs_for(mga::DisplayName) override | 46 | mg::DisplayConfigurationOutput active_config_for(mga::DisplayName) override |
797 | 46 | { | 47 | { |
799 | 47 | return mga::DisplayAttribs{{0,0}, {0,0}, 0.0, true, mir_pixel_format_abgr_8888, 2}; | 48 | return mtd::StubDisplayConfig({{true,true}}).outputs[0]; |
800 | 48 | } | 49 | } |
801 | 49 | mga::ConfigChangeSubscription subscribe_to_config_changes( | 50 | mga::ConfigChangeSubscription subscribe_to_config_changes( |
802 | 50 | std::function<void()> const& cb, std::function<void(mga::DisplayName)> const&) override | 51 | std::function<void()> const& cb, std::function<void(mga::DisplayName)> const&) override |
803 | @@ -67,9 +68,9 @@ | |||
804 | 67 | { | 68 | { |
805 | 68 | wrapped.power_mode(d, m); | 69 | wrapped.power_mode(d, m); |
806 | 69 | } | 70 | } |
808 | 70 | mga::DisplayAttribs active_attribs_for(mga::DisplayName d) override | 71 | mg::DisplayConfigurationOutput active_config_for(mga::DisplayName d) override |
809 | 71 | { | 72 | { |
811 | 72 | return wrapped.active_attribs_for(d); | 73 | return wrapped.active_config_for(d); |
812 | 73 | } | 74 | } |
813 | 74 | mga::ConfigChangeSubscription subscribe_to_config_changes( | 75 | mga::ConfigChangeSubscription subscribe_to_config_changes( |
814 | 75 | std::function<void()> const& hotplug, std::function<void(mga::DisplayName)> const& vsync) override | 76 | std::function<void()> const& hotplug, std::function<void(mga::DisplayName)> const& vsync) override |
815 | @@ -81,7 +82,7 @@ | |||
816 | 81 | 82 | ||
817 | 82 | struct StubOutputBuilder : public mga::DisplayComponentFactory | 83 | struct StubOutputBuilder : public mga::DisplayComponentFactory |
818 | 83 | { | 84 | { |
820 | 84 | std::unique_ptr<mga::FramebufferBundle> create_framebuffers(mga::DisplayAttribs const&) override | 85 | std::unique_ptr<mga::FramebufferBundle> create_framebuffers(mg::DisplayConfigurationOutput const&) override |
821 | 85 | { | 86 | { |
822 | 86 | return std::unique_ptr<mga::FramebufferBundle>(new testing::NiceMock<mtd::MockFBBundle>()); | 87 | return std::unique_ptr<mga::FramebufferBundle>(new testing::NiceMock<mtd::MockFBBundle>()); |
823 | 87 | } | 88 | } |
824 | 88 | 89 | ||
825 | === modified file 'tests/unit-tests/graphics/android/test_fb_device.cpp' | |||
826 | --- tests/unit-tests/graphics/android/test_fb_device.cpp 2015-03-24 16:02:48 +0000 | |||
827 | +++ tests/unit-tests/graphics/android/test_fb_device.cpp 2015-03-24 19:59:11 +0000 | |||
828 | @@ -139,17 +139,7 @@ | |||
829 | 139 | { | 139 | { |
830 | 140 | using namespace testing; | 140 | using namespace testing; |
831 | 141 | mga::FbControl fb_control(fb_hal_mock); | 141 | mga::FbControl fb_control(fb_hal_mock); |
845 | 142 | auto attribs = fb_control.active_attribs_for(mga::DisplayName::primary); | 142 | auto attribs = fb_control.active_config_for(mga::DisplayName::primary); |
846 | 143 | EXPECT_EQ(display_size, attribs.pixel_size); | 143 | EXPECT_EQ(display_size, attribs.modes[attribs.current_mode_index].size); |
847 | 144 | EXPECT_EQ(mir_pixel_format_abgr_8888, attribs.display_format); | 144 | EXPECT_EQ(mir_pixel_format_abgr_8888, attribs.current_format); |
835 | 145 | EXPECT_EQ(fbnum, attribs.num_framebuffers); | ||
836 | 146 | } | ||
837 | 147 | |||
838 | 148 | //some drivers incorrectly report 0 buffers available. request 2 fbs in this case. | ||
839 | 149 | TEST_F(FBDevice, determine_fbnum_always_reports_2_minimum) | ||
840 | 150 | { | ||
841 | 151 | auto slightly_malformed_fb_hal_mock = std::make_shared<mtd::MockFBHalDevice>( | ||
842 | 152 | display_size.width.as_int(), display_size.height.as_int(), format, 0); | ||
843 | 153 | mga::FbControl fb_control(slightly_malformed_fb_hal_mock); | ||
844 | 154 | EXPECT_EQ(2u, fb_control.active_attribs_for(mga::DisplayName::primary).num_framebuffers); | ||
848 | 155 | } | 145 | } |
849 | 156 | 146 | ||
850 | === modified file 'tests/unit-tests/graphics/android/test_hwc_configuration.cpp' | |||
851 | --- tests/unit-tests/graphics/android/test_hwc_configuration.cpp 2015-03-24 16:02:48 +0000 | |||
852 | +++ tests/unit-tests/graphics/android/test_hwc_configuration.cpp 2015-03-24 19:59:11 +0000 | |||
853 | @@ -68,7 +68,7 @@ | |||
854 | 68 | .InSequence(seq); | 68 | .InSequence(seq); |
855 | 69 | 69 | ||
856 | 70 | mga::HwcBlankingControl hwc_config{mock_hwc_wrapper}; | 70 | mga::HwcBlankingControl hwc_config{mock_hwc_wrapper}; |
858 | 71 | EXPECT_EQ(mir_pixel_format_argb_8888, hwc_config.active_attribs_for(mga::DisplayName::primary).display_format); | 71 | EXPECT_EQ(mir_pixel_format_argb_8888, hwc_config.active_config_for(mga::DisplayName::primary).current_format); |
859 | 72 | } | 72 | } |
860 | 73 | 73 | ||
861 | 74 | //not all hwc implementations give a hint about their framebuffer formats in their configuration. | 74 | //not all hwc implementations give a hint about their framebuffer formats in their configuration. |
862 | @@ -92,7 +92,7 @@ | |||
863 | 92 | .InSequence(seq); | 92 | .InSequence(seq); |
864 | 93 | 93 | ||
865 | 94 | mga::HwcBlankingControl hwc_config{mock_hwc_wrapper}; | 94 | mga::HwcBlankingControl hwc_config{mock_hwc_wrapper}; |
867 | 95 | EXPECT_EQ(mir_pixel_format_abgr_8888, hwc_config.active_attribs_for(mga::DisplayName::primary).display_format); | 95 | EXPECT_EQ(mir_pixel_format_abgr_8888, hwc_config.active_config_for(mga::DisplayName::primary).current_format); |
868 | 96 | } | 96 | } |
869 | 97 | 97 | ||
870 | 98 | TEST_F(HwcConfiguration, turns_screen_on) | 98 | TEST_F(HwcConfiguration, turns_screen_on) |
871 | @@ -173,11 +173,13 @@ | |||
872 | 173 | })); | 173 | })); |
873 | 174 | 174 | ||
874 | 175 | auto vrefresh_hz = 1000.0 / vrefresh_period.count(); | 175 | auto vrefresh_hz = 1000.0 / vrefresh_period.count(); |
879 | 176 | auto attribs = config.active_attribs_for(display); | 176 | auto attribs = config.active_config_for(display); |
880 | 177 | EXPECT_THAT(attribs.pixel_size, Eq(px_size)); | 177 | ASSERT_THAT(attribs.modes.size(), Eq(1)); |
881 | 178 | EXPECT_THAT(attribs.mm_size, Eq(mm_size)); | 178 | EXPECT_THAT(attribs.modes[0].size, Eq(px_size)); |
882 | 179 | EXPECT_THAT(attribs.vrefresh_hz, Eq(vrefresh_hz)); | 179 | EXPECT_THAT(attribs.modes[0].vrefresh_hz, Eq(vrefresh_hz)); |
883 | 180 | EXPECT_THAT(attribs.physical_size_mm, Eq(mm_size)); | ||
884 | 180 | EXPECT_TRUE(attribs.connected); | 181 | EXPECT_TRUE(attribs.connected); |
885 | 182 | EXPECT_TRUE(attribs.used); | ||
886 | 181 | } | 183 | } |
887 | 182 | 184 | ||
888 | 183 | //the primary display should not be disconnected, but this is how to tell if the external one is | 185 | //the primary display should not be disconnected, but this is how to tell if the external one is |
889 | @@ -188,12 +190,12 @@ | |||
890 | 188 | .WillByDefault(Return(std::vector<mga::ConfigId>{})); | 190 | .WillByDefault(Return(std::vector<mga::ConfigId>{})); |
891 | 189 | 191 | ||
892 | 190 | EXPECT_THROW({ | 192 | EXPECT_THROW({ |
894 | 191 | config.active_attribs_for(mga::DisplayName::primary); | 193 | config.active_config_for(mga::DisplayName::primary); |
895 | 192 | }, std::runtime_error); | 194 | }, std::runtime_error); |
899 | 193 | auto external_attribs = config.active_attribs_for(mga::DisplayName::external); | 195 | auto external_attribs = config.active_config_for(mga::DisplayName::external); |
900 | 194 | EXPECT_THAT(external_attribs.pixel_size, Eq(geom::Size{0,0})); | 196 | EXPECT_THAT(external_attribs.modes.size(), Eq(0)); |
898 | 195 | EXPECT_THAT(external_attribs.vrefresh_hz, Eq(0.0)); | ||
901 | 196 | EXPECT_FALSE(external_attribs.connected); | 197 | EXPECT_FALSE(external_attribs.connected); |
902 | 198 | EXPECT_FALSE(external_attribs.used); | ||
903 | 197 | } | 199 | } |
904 | 198 | 200 | ||
905 | 199 | //some devices (bq) only report an error later in the display attributes call, make sure to report disconnected on error to this call. | 201 | //some devices (bq) only report an error later in the display attributes call, make sure to report disconnected on error to this call. |
906 | @@ -204,12 +206,12 @@ | |||
907 | 204 | .WillByDefault(Return(-22)); | 206 | .WillByDefault(Return(-22)); |
908 | 205 | 207 | ||
909 | 206 | EXPECT_THROW({ | 208 | EXPECT_THROW({ |
911 | 207 | config.active_attribs_for(mga::DisplayName::primary); | 209 | config.active_config_for(mga::DisplayName::primary); |
912 | 208 | }, std::runtime_error); | 210 | }, std::runtime_error); |
916 | 209 | auto external_attribs = config.active_attribs_for(mga::DisplayName::external); | 211 | auto external_attribs = config.active_config_for(mga::DisplayName::external); |
917 | 210 | EXPECT_THAT(external_attribs.pixel_size, Eq(geom::Size{0,0})); | 212 | EXPECT_THAT(external_attribs.modes.size(), Eq(0)); |
915 | 211 | EXPECT_THAT(external_attribs.vrefresh_hz, Eq(0.0)); | ||
918 | 212 | EXPECT_FALSE(external_attribs.connected); | 213 | EXPECT_FALSE(external_attribs.connected); |
919 | 214 | EXPECT_FALSE(external_attribs.used); | ||
920 | 213 | } | 215 | } |
921 | 214 | 216 | ||
922 | 215 | TEST_F(HwcConfiguration, no_fpe_from_malformed_refresh) | 217 | TEST_F(HwcConfiguration, no_fpe_from_malformed_refresh) |
923 | @@ -224,8 +226,8 @@ | |||
924 | 224 | values[i++] = 0; | 226 | values[i++] = 0; |
925 | 225 | return 0; | 227 | return 0; |
926 | 226 | })); | 228 | })); |
929 | 227 | auto attribs = config.active_attribs_for(mga::DisplayName::external); | 229 | auto attribs = config.active_config_for(mga::DisplayName::external); |
930 | 228 | EXPECT_THAT(attribs.vrefresh_hz, Eq(0.0f)); | 230 | EXPECT_THAT(attribs.modes[attribs.current_mode_index].vrefresh_hz, Eq(0.0f)); |
931 | 229 | } | 231 | } |
932 | 230 | 232 | ||
933 | 231 | TEST_F(HwcConfiguration, no_fpe_from_malformed_dpi) | 233 | TEST_F(HwcConfiguration, no_fpe_from_malformed_dpi) |
934 | @@ -240,8 +242,8 @@ | |||
935 | 240 | values[i++] = 0; | 242 | values[i++] = 0; |
936 | 241 | return 0; | 243 | return 0; |
937 | 242 | })); | 244 | })); |
940 | 243 | auto attribs = config.active_attribs_for(mga::DisplayName::external); | 245 | auto attribs = config.active_config_for(mga::DisplayName::external); |
941 | 244 | EXPECT_THAT(attribs.mm_size, Eq(geom::Size{0,0})); | 246 | EXPECT_THAT(attribs.physical_size_mm, Eq(geom::Size{0,0})); |
942 | 245 | } | 247 | } |
943 | 246 | 248 | ||
944 | 247 | TEST_F(HwcConfiguration, subscribes_to_hotplug_and_vsync) | 249 | TEST_F(HwcConfiguration, subscribes_to_hotplug_and_vsync) |
945 | 248 | 250 | ||
946 | === modified file 'tests/unit-tests/graphics/android/test_output_builder.cpp' | |||
947 | --- tests/unit-tests/graphics/android/test_output_builder.cpp 2015-01-22 09:00:14 +0000 | |||
948 | +++ tests/unit-tests/graphics/android/test_output_builder.cpp 2015-03-24 19:59:11 +0000 | |||
949 | @@ -33,6 +33,7 @@ | |||
950 | 33 | #include "mir_test_doubles/mock_hwc_device_wrapper.h" | 33 | #include "mir_test_doubles/mock_hwc_device_wrapper.h" |
951 | 34 | #include "mir_test_doubles/stub_gl_config.h" | 34 | #include "mir_test_doubles/stub_gl_config.h" |
952 | 35 | #include "mir_test_doubles/stub_gl_program_factory.h" | 35 | #include "mir_test_doubles/stub_gl_program_factory.h" |
953 | 36 | #include "mir_test_doubles/stub_display_configuration.h" | ||
954 | 36 | #include <system/window.h> | 37 | #include <system/window.h> |
955 | 37 | #include <gtest/gtest.h> | 38 | #include <gtest/gtest.h> |
956 | 38 | 39 | ||
957 | @@ -159,3 +160,22 @@ | |||
958 | 159 | mock_hwc_report); | 160 | mock_hwc_report); |
959 | 160 | }, std::runtime_error); | 161 | }, std::runtime_error); |
960 | 161 | } | 162 | } |
961 | 163 | |||
962 | 164 | //some drivers incorrectly report 0 buffers available. request 2 fbs in this case. | ||
963 | 165 | TEST_F(HalComponentFactory, determine_fbnum_always_reports_2_minimum) | ||
964 | 166 | { | ||
965 | 167 | using namespace testing; | ||
966 | 168 | EXPECT_CALL(*mock_resource_factory, create_hwc_wrapper(_)) | ||
967 | 169 | .WillOnce(Throw(std::runtime_error(""))); | ||
968 | 170 | EXPECT_CALL(*mock_resource_factory, create_fb_native_device()) | ||
969 | 171 | .WillOnce(Return(std::make_shared<mtd::MockFBHalDevice>( | ||
970 | 172 | 0, 0, mir_pixel_format_abgr_8888, 0))); | ||
971 | 173 | EXPECT_CALL(mock_buffer_allocator, alloc_buffer_platform(_,_,_)) | ||
972 | 174 | .Times(2); | ||
973 | 175 | |||
974 | 176 | mga::HalComponentFactory factory( | ||
975 | 177 | mt::fake_shared(mock_buffer_allocator), | ||
976 | 178 | mock_resource_factory, | ||
977 | 179 | mock_hwc_report); | ||
978 | 180 | factory.create_framebuffers(mtd::StubDisplayConfig(1).outputs[0]); | ||
979 | 181 | } |
646 - EXPECT_ FALSE(outputs[ 1].used) ; TRUE(outputs[ 1].used) ;
647 + EXPECT_
Why? It isn't clear to me why this expectation changes as a result of changing the way data is held.