Merge lp:~vanvugt/mir/set-logical-size into lp:mir
- set-logical-size
- Merge into development-branch
Status: | Superseded |
---|---|
Proposed branch: | lp:~vanvugt/mir/set-logical-size |
Merge into: | lp:mir |
Prerequisite: | lp:~vanvugt/mir/output-transformation |
Diff against target: |
900 lines (+314/-21) 28 files modified
include/client/mir_toolkit/mir_display_configuration.h (+23/-0) include/platform/mir/graphics/display_configuration.h (+16/-0) src/client/display_configuration_api.cpp (+20/-0) src/client/symbols.map (+7/-1) src/platform/graphics/display_configuration.cpp (+35/-3) src/platform/graphics/overlapping_output_grouping.cpp (+2/-2) src/platform/symbols.map (+7/-0) src/platforms/eglstream-kms/server/display.cpp (+1/-1) src/platforms/mesa/server/kms/display.cpp (+5/-9) src/platforms/mesa/server/kms/real_kms_display_configuration.cpp (+1/-0) src/platforms/mesa/server/x11/graphics/display.cpp (+3/-1) src/platforms/mesa/server/x11/graphics/display_configuration.cpp (+1/-0) src/protobuf/mir_protobuf.proto (+7/-0) src/server/frontend/protobuf_buffer_packer.cpp (+1/-0) src/server/frontend/session_mediator.cpp (+14/-0) src/server/graphics/nested/nested_display_configuration.cpp (+9/-1) src/server/graphics/offscreen/display_configuration.cpp (+1/-0) src/utils/out.c (+19/-0) tests/acceptance-tests/test_latency.cpp (+1/-0) tests/acceptance-tests/test_new_display_configuration.cpp (+57/-0) tests/mir_test/display_config_matchers.cpp (+27/-2) tests/mir_test_doubles/stub_display_configuration.cpp (+4/-0) tests/unit-tests/graphics/test_default_display_configuration_policy.cpp (+4/-1) tests/unit-tests/graphics/test_display_configuration.cpp (+28/-0) tests/unit-tests/graphics/test_overlapping_output_grouping.cpp (+1/-0) tests/unit-tests/platforms/mesa/kms/test_cursor.cpp (+3/-0) tests/unit-tests/platforms/mesa/kms/test_display_configuration.cpp (+9/-0) tests/unit-tests/platforms/nested/mir_display_configuration_builder.cpp (+8/-0) |
To merge this branch: | bzr merge lp:~vanvugt/mir/set-logical-size |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir CI Bot | continuous-integration | Needs Fixing | |
Mir development team | Pending | ||
Review via email: mp+322512@code.launchpad.net |
This proposal supersedes a proposal from 2017-04-13.
Commit message
Add the ability to set custom display resolutions (or fake modes if
you like). These affect the logical view area and scaling that appears
on screen but do not affect the actual display mode the monitor is set
to. So the renderer will scale up/down and letter-box (add black bars)
as required. (LP: #1639226 mostly complete)
This now works apparently perfectly (try mirout fakemode ...) with the
one caveat that the hardware cursor doesn't match up yet. You can work
around that by simply running your server with '--cursor software'.
Description of the change
Mir CI Bot (mir-ci-bot) wrote : | # |
Daniel van Vugt (vanvugt) wrote : | # |
I think the remaining problem (only visible in manual testing) is that the GL renderer still expects DB.view_area means physical size. It now means logical size. So effectively the renderer is applying each scale operation twice instead of once. Where it should be doubling I now see 4x scaling and vice-versa.
Daniel van Vugt (vanvugt) wrote : | # |
Also clang is failing for almost unrelated reasons. Only on this branch :P
Preview Diff
1 | === modified file 'include/client/mir_toolkit/mir_display_configuration.h' |
2 | --- include/client/mir_toolkit/mir_display_configuration.h 2017-02-17 08:46:05 +0000 |
3 | +++ include/client/mir_toolkit/mir_display_configuration.h 2017-04-21 07:38:12 +0000 |
4 | @@ -333,6 +333,29 @@ |
5 | unsigned int mir_output_get_logical_height(MirOutput const* output); |
6 | |
7 | /** |
8 | + * Set the logical size of the virtual display space occupied by an output. |
9 | + * By default this is the dimensions of the output's current mode, but you |
10 | + * can now set it to an arbitrary size and the compositor will scale |
11 | + * accordingly. |
12 | + * |
13 | + * \param [in] output The output to modify |
14 | + * \param [in] w The width in logical view area pixels, or zero to |
15 | + * revert to the current display mode dimensions. |
16 | + * \param [in] h The height in logical view area pixels, or zero to |
17 | + * revert to the current display mode dimensions. |
18 | + */ |
19 | +void mir_output_set_logical_size(MirOutput* output, unsigned w, unsigned h); |
20 | + |
21 | +/* |
22 | + * Determine if the logical size of an output is user-customized or just |
23 | + * automatically calculated. |
24 | + * |
25 | + * \param [in] output The MirOutput to query |
26 | + * \returns Whether the logical output size has been user-customized. |
27 | + */ |
28 | +bool mir_output_has_custom_logical_size(MirOutput const* output); |
29 | + |
30 | +/** |
31 | * Set the coordinates of the top-left point of the output in the virtual |
32 | * display space. |
33 | * |
34 | |
35 | === modified file 'include/platform/mir/graphics/display_configuration.h' |
36 | --- include/platform/mir/graphics/display_configuration.h 2017-01-18 02:29:37 +0000 |
37 | +++ include/platform/mir/graphics/display_configuration.h 2017-04-21 07:38:12 +0000 |
38 | @@ -24,8 +24,11 @@ |
39 | #include "mir/geometry/rectangle.h" |
40 | #include "mir/geometry/point.h" |
41 | #include "mir/graphics/gamma_curves.h" |
42 | +#include "mir/optional_value.h" |
43 | #include "mir_toolkit/common.h" |
44 | |
45 | +#include <glm/glm.hpp> |
46 | + |
47 | #include <functional> |
48 | #include <vector> |
49 | #include <memory> |
50 | @@ -130,10 +133,22 @@ |
51 | /** EDID of the display, if non-empty */ |
52 | std::vector<uint8_t> edid; |
53 | |
54 | + mir::optional_value<geometry::Size> custom_logical_size; |
55 | + |
56 | /** The logical rectangle occupied by the output, based on its position, |
57 | current mode and orientation (rotation) */ |
58 | geometry::Rectangle extents() const; |
59 | bool valid() const; |
60 | + |
61 | + /** |
62 | + * The additional transformation (if any) that this output must undergo |
63 | + * to appear correctly on screen, including rotation (orientation), |
64 | + * inversion and skew. |
65 | + * Note that scaling and translation are not part of this transformation |
66 | + * matrix because those are already built in to the extents() rectangle |
67 | + * for the renderer to use in compositing. |
68 | + */ |
69 | + glm::mat2 transformation() const; |
70 | }; |
71 | |
72 | /** |
73 | @@ -162,6 +177,7 @@ |
74 | GammaCurves& gamma; |
75 | MirOutputGammaSupported const& gamma_supported; |
76 | std::vector<uint8_t const> const& edid; |
77 | + mir::optional_value<geometry::Size>& custom_logical_size; |
78 | |
79 | UserDisplayConfigurationOutput(DisplayConfigurationOutput& master); |
80 | geometry::Rectangle extents() const; |
81 | |
82 | === modified file 'src/client/display_configuration_api.cpp' |
83 | --- src/client/display_configuration_api.cpp 2017-02-17 08:46:05 +0000 |
84 | +++ src/client/display_configuration_api.cpp 2017-04-21 07:38:12 +0000 |
85 | @@ -261,6 +261,26 @@ |
86 | return output->logical_height(); |
87 | } |
88 | |
89 | +void mir_output_set_logical_size(MirOutput* output, unsigned w, unsigned h) |
90 | +{ |
91 | + if (w && h) |
92 | + { |
93 | + output->set_logical_width(w); |
94 | + output->set_logical_height(h); |
95 | + output->set_custom_logical_size(true); |
96 | + } |
97 | + else |
98 | + { |
99 | + output->set_custom_logical_size(false); |
100 | + } |
101 | +} |
102 | + |
103 | +bool mir_output_has_custom_logical_size(MirOutput const* output) |
104 | +{ |
105 | + return output->has_custom_logical_size() && // has the protobuf field and |
106 | + output->custom_logical_size(); // ... a custom size is set |
107 | +} |
108 | + |
109 | void mir_output_set_position(MirOutput* output, int x, int y) |
110 | { |
111 | output->set_position_x(x); |
112 | |
113 | === modified file 'src/client/symbols.map' |
114 | --- src/client/symbols.map 2017-04-13 04:26:20 +0000 |
115 | +++ src/client/symbols.map 2017-04-21 07:38:12 +0000 |
116 | @@ -579,7 +579,7 @@ |
117 | }; |
118 | } MIR_CLIENT_DETAIL_0.26.1; |
119 | |
120 | -MIR_CLIENT_0.27 { # New functions in Mir 0.27 or 1.0 |
121 | +MIR_CLIENT_0.27 { # New functions in Mir 0.27 |
122 | global: |
123 | mir_connection_apply_session_input_config; |
124 | mir_connection_set_base_input_config; |
125 | @@ -611,3 +611,9 @@ |
126 | mir_touchscreen_config_set_mapping_mode; |
127 | mir_touchscreen_config_set_output_id; |
128 | } MIR_CLIENT_0.26.1; |
129 | + |
130 | +MIR_CLIENT_0.28 { # New functions in Mir 0.28 |
131 | + global: |
132 | + mir_output_has_custom_logical_size; |
133 | + mir_output_set_logical_size; |
134 | +} MIR_CLIENT_0.27; |
135 | |
136 | === modified file 'src/platform/graphics/display_configuration.cpp' |
137 | --- src/platform/graphics/display_configuration.cpp 2017-01-18 02:29:37 +0000 |
138 | +++ src/platform/graphics/display_configuration.cpp 2017-04-21 07:38:12 +0000 |
139 | @@ -18,6 +18,7 @@ |
140 | |
141 | #include "mir/graphics/display_configuration.h" |
142 | #include "mir/output_type_names.h" |
143 | +#include "mir/graphics/transformation.h" |
144 | |
145 | #include <ostream> |
146 | #include <algorithm> |
147 | @@ -118,6 +119,19 @@ |
148 | |
149 | out << "\tscale: " << val.scale << std::endl; |
150 | out << "\tform factor: " << as_string(val.form_factor) << std::endl; |
151 | + |
152 | + out << "\tcustom logical size: "; |
153 | + if (val.custom_logical_size.is_set()) |
154 | + { |
155 | + auto const& size = val.custom_logical_size.value(); |
156 | + out << size.width.as_int() << "x" << size.height.as_int(); |
157 | + } |
158 | + else |
159 | + { |
160 | + out << "not set"; |
161 | + } |
162 | + out << std::endl; |
163 | + |
164 | out << "\torientation: " << val.orientation << '\n'; |
165 | out << "}" << std::endl; |
166 | |
167 | @@ -172,6 +186,7 @@ |
168 | (val1.orientation == val2.orientation) && |
169 | (val1.current_mode_index == val2.current_mode_index) && |
170 | (val1.modes.size() == val2.modes.size()) && |
171 | + (val1.custom_logical_size == val2.custom_logical_size) && |
172 | (val1.scale == val2.scale) && |
173 | (val1.form_factor == val2.form_factor)}; |
174 | |
175 | @@ -243,7 +258,14 @@ |
176 | |
177 | mir::geometry::Rectangle mg::DisplayConfigurationOutput::extents() const |
178 | { |
179 | - return extents_of(modes, current_mode_index, orientation, top_left); |
180 | + return custom_logical_size.is_set() ? |
181 | + mir::geometry::Rectangle(top_left, custom_logical_size.value()) : |
182 | + extents_of(modes, current_mode_index, orientation, top_left); |
183 | +} |
184 | + |
185 | +glm::mat2 mg::DisplayConfigurationOutput::transformation() const |
186 | +{ |
187 | + return mg::transformation(orientation); |
188 | } |
189 | |
190 | bool mg::DisplayConfigurationOutput::valid() const |
191 | @@ -260,6 +282,13 @@ |
192 | if (current_mode_index >= nmodes) |
193 | return false; |
194 | |
195 | + if (custom_logical_size.is_set()) |
196 | + { |
197 | + auto const& logical_size = custom_logical_size.value(); |
198 | + if (!logical_size.width.as_int() || !logical_size.height.as_int()) |
199 | + return false; |
200 | + } |
201 | + |
202 | return true; |
203 | } |
204 | |
205 | @@ -297,13 +326,16 @@ |
206 | subpixel_arrangement(master.subpixel_arrangement), |
207 | gamma(master.gamma), |
208 | gamma_supported(master.gamma_supported), |
209 | - edid(*reinterpret_cast<std::vector<uint8_t const>*>(&master.edid)) |
210 | + edid(*reinterpret_cast<std::vector<uint8_t const>*>(&master.edid)), |
211 | + custom_logical_size(master.custom_logical_size) |
212 | { |
213 | } |
214 | |
215 | mir::geometry::Rectangle mg::UserDisplayConfigurationOutput::extents() const |
216 | { |
217 | - return extents_of(modes, current_mode_index, orientation, top_left); |
218 | + return custom_logical_size.is_set() ? |
219 | + mir::geometry::Rectangle(top_left, custom_logical_size.value()) : |
220 | + extents_of(modes, current_mode_index, orientation, top_left); |
221 | } |
222 | |
223 | |
224 | |
225 | === modified file 'src/platform/graphics/overlapping_output_grouping.cpp' |
226 | --- src/platform/graphics/overlapping_output_grouping.cpp 2015-02-22 07:46:25 +0000 |
227 | +++ src/platform/graphics/overlapping_output_grouping.cpp 2017-04-21 07:38:12 +0000 |
228 | @@ -112,11 +112,11 @@ |
229 | { |
230 | /* |
231 | * Prevent grouping of outputs when they have differing |
232 | - * orientations. It's safer to assume the hardware can't |
233 | + * transformations. It's safer to assume the hardware can't |
234 | * handle it for now... until proven otherwise. |
235 | */ |
236 | if (conf_o.extents().overlaps(rect_output) && |
237 | - conf_o.orientation == conf_output.orientation) |
238 | + conf_o.transformation() == conf_output.transformation()) |
239 | found_overlap = true; |
240 | }); |
241 | |
242 | |
243 | === modified file 'src/platform/symbols.map' |
244 | --- src/platform/symbols.map 2017-04-19 16:50:46 +0000 |
245 | +++ src/platform/symbols.map 2017-04-21 07:38:12 +0000 |
246 | @@ -152,3 +152,10 @@ |
247 | }; |
248 | local: *; |
249 | }; |
250 | + |
251 | +MIRPLATFORM_0.28 { |
252 | + global: |
253 | + extern "C++" { |
254 | + mir::graphics::DisplayConfigurationOutput::transformation*; |
255 | + }; |
256 | +} MIRPLATFORM_0.27; |
257 | |
258 | === modified file 'src/platforms/eglstream-kms/server/display.cpp' |
259 | --- src/platforms/eglstream-kms/server/display.cpp 2017-04-05 03:11:28 +0000 |
260 | +++ src/platforms/eglstream-kms/server/display.cpp 2017-04-21 07:38:12 +0000 |
261 | @@ -126,7 +126,7 @@ |
262 | ctx{create_context(dpy, config, ctx)}, |
263 | layer{output.output_layer()}, |
264 | view_area_{output.extents()}, |
265 | - transform{mg::transformation(output.orientation)} |
266 | + transform{output.transformation()} |
267 | { |
268 | EGLint const stream_attribs[] = { |
269 | EGL_STREAM_FIFO_LENGTH_KHR, 1, |
270 | |
271 | === modified file 'src/platforms/mesa/server/kms/display.cpp' |
272 | --- src/platforms/mesa/server/kms/display.cpp 2017-04-05 03:11:28 +0000 |
273 | +++ src/platforms/mesa/server/kms/display.cpp 2017-04-21 07:38:12 +0000 |
274 | @@ -521,7 +521,7 @@ |
275 | auto bounding_rect = group.bounding_rectangle(); |
276 | // Each vector<KMSOutput> is a single GPU memory domain |
277 | std::vector<std::vector<std::shared_ptr<KMSOutput>>> kms_output_groups; |
278 | - MirOrientation orientation = mir_orientation_normal; |
279 | + glm::mat2 transformation; |
280 | |
281 | group.for_each_output( |
282 | [&](DisplayConfigurationOutput const& conf_output) |
283 | @@ -539,16 +539,12 @@ |
284 | } |
285 | |
286 | /* |
287 | - * Presently OverlappingOutputGroup guarantees all grouped |
288 | - * outputs have the same orientation. |
289 | - */ |
290 | - orientation = conf_output.orientation; |
291 | + * Presently OverlappingOutputGroup guarantees all grouped |
292 | + * outputs have the same transformation. |
293 | + */ |
294 | + transformation = conf_output.transformation(); |
295 | }); |
296 | |
297 | - // TODO in future outputs should emit transformation instead of |
298 | - // orientation |
299 | - auto const transformation = mg::transformation(orientation); |
300 | - |
301 | if (comp) |
302 | { |
303 | display_buffers[group_idx++]->set_transformation(transformation, |
304 | |
305 | === modified file 'src/platforms/mesa/server/kms/real_kms_display_configuration.cpp' |
306 | --- src/platforms/mesa/server/kms/real_kms_display_configuration.cpp 2017-04-05 03:11:28 +0000 |
307 | +++ src/platforms/mesa/server/kms/real_kms_display_configuration.cpp 2017-04-21 07:38:12 +0000 |
308 | @@ -209,6 +209,7 @@ |
309 | clone.subpixel_arrangement = conf1.outputs[i].first.subpixel_arrangement; |
310 | clone.scale = conf1.outputs[i].first.scale; |
311 | clone.form_factor = conf1.outputs[i].first.form_factor; |
312 | + clone.custom_logical_size = conf1.outputs[i].first.custom_logical_size; |
313 | compatible &= (conf1.outputs[i].first == clone); |
314 | } |
315 | else |
316 | |
317 | === modified file 'src/platforms/mesa/server/x11/graphics/display.cpp' |
318 | --- src/platforms/mesa/server/x11/graphics/display.cpp 2017-04-05 03:11:28 +0000 |
319 | +++ src/platforms/mesa/server/x11/graphics/display.cpp 2017-04-21 07:38:12 +0000 |
320 | @@ -289,12 +289,14 @@ |
321 | std::logic_error("Invalid or inconsistent display configuration")); |
322 | } |
323 | |
324 | + glm::mat2 trans; |
325 | MirOrientation o = mir_orientation_normal; |
326 | float new_scale = scale; |
327 | geom::Rectangle logical_area; |
328 | |
329 | new_configuration.for_each_output([&](DisplayConfigurationOutput const& conf_output) |
330 | { |
331 | + trans = conf_output.transformation(); |
332 | o = conf_output.orientation; |
333 | new_scale = conf_output.scale; |
334 | logical_area = conf_output.extents(); |
335 | @@ -302,7 +304,7 @@ |
336 | |
337 | orientation = o; |
338 | display_buffer->set_view_area(logical_area); |
339 | - display_buffer->set_transformation(mg::transformation(orientation)); |
340 | + display_buffer->set_transformation(trans); |
341 | scale = new_scale; |
342 | } |
343 | |
344 | |
345 | === modified file 'src/platforms/mesa/server/x11/graphics/display_configuration.cpp' |
346 | --- src/platforms/mesa/server/x11/graphics/display_configuration.cpp 2017-01-18 02:29:37 +0000 |
347 | +++ src/platforms/mesa/server/x11/graphics/display_configuration.cpp 2017-04-21 07:38:12 +0000 |
348 | @@ -48,6 +48,7 @@ |
349 | mir_subpixel_arrangement_unknown, |
350 | {}, |
351 | mir_output_gamma_unsupported, |
352 | + {}, |
353 | {}}, |
354 | card{mg::DisplayConfigurationCardId{0}, 1} |
355 | { |
356 | |
357 | === modified file 'src/protobuf/mir_protobuf.proto' |
358 | --- src/protobuf/mir_protobuf.proto 2017-04-13 04:26:20 +0000 |
359 | +++ src/protobuf/mir_protobuf.proto 2017-04-21 07:38:12 +0000 |
360 | @@ -244,8 +244,15 @@ |
361 | optional uint32 gamma_supported = 23; |
362 | optional bytes edid = 24; |
363 | optional string model = 25; |
364 | + |
365 | + // Until recently logical_width/height were read-only fields calculated |
366 | + // by the server from the current mode and orientation. However they are |
367 | + // now user-customizable, so we need to be able to tell the difference |
368 | + // between logical dimensions calculated automatically (change dynamically) |
369 | + // and those chosen by the user (may only change by user intervention). |
370 | optional uint32 logical_width = 26; |
371 | optional uint32 logical_height = 27; |
372 | + optional bool custom_logical_size = 28; |
373 | } |
374 | |
375 | message Extension |
376 | |
377 | === modified file 'src/server/frontend/protobuf_buffer_packer.cpp' |
378 | --- src/server/frontend/protobuf_buffer_packer.cpp 2017-02-17 08:46:05 +0000 |
379 | +++ src/server/frontend/protobuf_buffer_packer.cpp 2017-04-21 07:38:12 +0000 |
380 | @@ -91,6 +91,7 @@ |
381 | auto const& logical_size = display_output.extents().size; |
382 | protobuf_output.set_logical_width(logical_size.width.as_int()); |
383 | protobuf_output.set_logical_height(logical_size.height.as_int()); |
384 | + protobuf_output.set_custom_logical_size(display_output.custom_logical_size.is_set()); |
385 | } |
386 | |
387 | } |
388 | |
389 | === modified file 'src/server/frontend/session_mediator.cpp' |
390 | --- src/server/frontend/session_mediator.cpp 2017-04-13 04:26:20 +0000 |
391 | +++ src/server/frontend/session_mediator.cpp 2017-04-21 07:38:12 +0000 |
392 | @@ -1273,6 +1273,20 @@ |
393 | dest.gamma = {convert_string_to_gamma_curve(src.gamma_red()), |
394 | convert_string_to_gamma_curve(src.gamma_green()), |
395 | convert_string_to_gamma_curve(src.gamma_blue())}; |
396 | + |
397 | + if (src.has_custom_logical_size()) |
398 | + { |
399 | + if (!src.custom_logical_size()) |
400 | + { // User has explicitly removed logical size customization |
401 | + if (dest.custom_logical_size.is_set()) |
402 | + (void)dest.custom_logical_size.consume(); |
403 | + } |
404 | + else if (src.has_logical_width() && src.has_logical_height()) |
405 | + { // User has explicitly set a logical size customization |
406 | + dest.custom_logical_size = {src.logical_width(), |
407 | + src.logical_height()}; |
408 | + } |
409 | + } |
410 | }); |
411 | |
412 | return config; |
413 | |
414 | === modified file 'src/server/graphics/nested/nested_display_configuration.cpp' |
415 | --- src/server/graphics/nested/nested_display_configuration.cpp 2017-03-13 09:09:22 +0000 |
416 | +++ src/server/graphics/nested/nested_display_configuration.cpp 2017-04-21 07:38:12 +0000 |
417 | @@ -113,6 +113,13 @@ |
418 | if (edid_size && edid_start) |
419 | edid.assign(edid_start, edid_start+edid_size); |
420 | |
421 | + mir::optional_value<geometry::Size> custom_logical_size; |
422 | + if (mir_output_has_custom_logical_size(output)) |
423 | + { |
424 | + custom_logical_size = {mir_output_get_logical_width(output), |
425 | + mir_output_get_logical_height(output)}; |
426 | + } |
427 | + |
428 | return mg::DisplayConfigurationOutput{ |
429 | DisplayConfigurationOutputId(output_id), |
430 | DisplayConfigurationCardId(0), // Information not around |
431 | @@ -133,7 +140,8 @@ |
432 | local_config.subpixel_arrangement, |
433 | local_config.gamma, |
434 | local_config.gamma_supported, |
435 | - std::move(edid) |
436 | + std::move(edid), |
437 | + custom_logical_size |
438 | }; |
439 | } |
440 | |
441 | |
442 | === modified file 'src/server/graphics/offscreen/display_configuration.cpp' |
443 | --- src/server/graphics/offscreen/display_configuration.cpp 2017-03-09 12:47:27 +0000 |
444 | +++ src/server/graphics/offscreen/display_configuration.cpp 2017-04-21 07:38:12 +0000 |
445 | @@ -40,6 +40,7 @@ |
446 | mir_subpixel_arrangement_unknown, |
447 | {}, |
448 | mir_output_gamma_unsupported, |
449 | + {}, |
450 | {}}, |
451 | card{mg::DisplayConfigurationCardId{0}, 1} |
452 | { |
453 | |
454 | === modified file 'src/utils/out.c' |
455 | --- src/utils/out.c 2017-04-13 04:26:20 +0000 |
456 | +++ src/utils/out.c 2017-04-21 07:38:12 +0000 |
457 | @@ -397,6 +397,8 @@ |
458 | if (set_mode) |
459 | { |
460 | mir_output_set_current_mode(target[t], set_mode); |
461 | + /* Clear the fake mode when a real one is getting set. */ |
462 | + mir_output_set_logical_size(target[t], 0, 0); |
463 | } |
464 | else |
465 | { |
466 | @@ -405,6 +407,22 @@ |
467 | } |
468 | } |
469 | } |
470 | + else if (!strcmp(*action, "fakemode")) |
471 | + { |
472 | + if (++action >= action_end) |
473 | + { |
474 | + fprintf(stderr, "Missing parameter after `%s'\n", action[-1]); |
475 | + return false; |
476 | + } |
477 | + unsigned w, h; |
478 | + if (2 != sscanf(*action, "%ux%u", &w, &h)) |
479 | + { |
480 | + fprintf(stderr, "Invalid fake resolution `%s'\n", *action); |
481 | + return false; |
482 | + } |
483 | + for (int t = 0; t < targets; ++t) |
484 | + mir_output_set_logical_size(target[t], w, h); |
485 | + } |
486 | else |
487 | { |
488 | fprintf(stderr, "Unrecognized action `%s'\n", *action); |
489 | @@ -469,6 +487,7 @@ |
490 | " rotate (normal | inverted | left | right)\n" |
491 | " place +X+Y\n" |
492 | " mode (WIDTHxHEIGHT | preferred) [rate HZ]\n" |
493 | + " fakemode WIDTHxHEIGHT\n" |
494 | " rate HZ\n" |
495 | , argv[0]); |
496 | return 0; |
497 | |
498 | === modified file 'tests/acceptance-tests/test_latency.cpp' |
499 | --- tests/acceptance-tests/test_latency.cpp 2017-04-11 14:13:20 +0000 |
500 | +++ tests/acceptance-tests/test_latency.cpp 2017-04-21 07:38:12 +0000 |
501 | @@ -255,6 +255,7 @@ |
502 | mir_subpixel_arrangement_unknown, |
503 | {}, |
504 | mir_output_gamma_unsupported, |
505 | + {}, |
506 | {} |
507 | }; |
508 | outputs.push_back(output); |
509 | |
510 | === modified file 'tests/acceptance-tests/test_new_display_configuration.cpp' |
511 | --- tests/acceptance-tests/test_new_display_configuration.cpp 2017-04-13 04:26:20 +0000 |
512 | +++ tests/acceptance-tests/test_new_display_configuration.cpp 2017-04-21 07:38:12 +0000 |
513 | @@ -934,6 +934,63 @@ |
514 | client.disconnect(); |
515 | } |
516 | |
517 | +TEST_F(DisplayConfigurationTest, client_can_set_logical_size) |
518 | +{ |
519 | + DisplayClient client{new_connection()}; |
520 | + |
521 | + client.connect(); |
522 | + |
523 | + auto client_config = client.get_base_config(); |
524 | + int num_outputs = mir_display_config_get_num_outputs(client_config.get()); |
525 | + |
526 | + for (int i = 0; i < num_outputs; ++i) |
527 | + { |
528 | + auto output = |
529 | + mir_display_config_get_mutable_output(client_config.get(), i); |
530 | + EXPECT_FALSE(mir_output_has_custom_logical_size(output)); |
531 | + mir_output_set_logical_size(output, (i+1)*123, (i+3)*345); |
532 | + ASSERT_TRUE(mir_output_has_custom_logical_size(output)); |
533 | + } |
534 | + |
535 | + DisplayConfigMatchingContext context; |
536 | + context.matcher = [c = client_config.get()](MirDisplayConfig* conf) |
537 | + { |
538 | + EXPECT_THAT(conf, mt::DisplayConfigMatches(c)); |
539 | + }; |
540 | + |
541 | + mir_connection_set_display_config_change_callback( |
542 | + client.connection, |
543 | + &new_display_config_matches, |
544 | + &context); |
545 | + |
546 | + mir_connection_preview_base_display_configuration(client.connection, |
547 | + client_config.get(), 10); |
548 | + |
549 | + EXPECT_TRUE(context.done.wait_for(std::chrono::seconds(30))); |
550 | + |
551 | + mir_connection_confirm_base_display_configuration(client.connection, |
552 | + client_config.get()); |
553 | + |
554 | + std::shared_ptr<mg::DisplayConfiguration> current_config = |
555 | + server.the_display()->configuration(); |
556 | + |
557 | + int j = 0; |
558 | + current_config->for_each_output( |
559 | + [&j](mg::UserDisplayConfigurationOutput& output) mutable |
560 | + { |
561 | + ASSERT_TRUE(output.custom_logical_size.is_set()); |
562 | + auto const& size = output.custom_logical_size.value(); |
563 | + int w = size.width.as_int(); |
564 | + int h = size.height.as_int(); |
565 | + EXPECT_EQ((j+1)*123, w); |
566 | + EXPECT_EQ((j+3)*345, h); |
567 | + ++j; |
568 | + }); |
569 | + |
570 | + EXPECT_TRUE(j); |
571 | + |
572 | + client.disconnect(); |
573 | +} |
574 | |
575 | TEST_F(DisplayConfigurationTest, client_sees_server_set_form_factor) |
576 | { |
577 | |
578 | === modified file 'tests/mir_test/display_config_matchers.cpp' |
579 | --- tests/mir_test/display_config_matchers.cpp 2017-01-27 04:57:53 +0000 |
580 | +++ tests/mir_test/display_config_matchers.cpp 2017-04-21 07:38:12 +0000 |
581 | @@ -52,6 +52,17 @@ |
582 | for (int i = 0; i < protobuf_config.display_output_size(); i++) |
583 | { |
584 | auto const& protobuf_output = protobuf_config.display_output(i); |
585 | + |
586 | + mir::optional_value<geom::Size> custom_logical_size; |
587 | + if (protobuf_output.has_custom_logical_size() && |
588 | + protobuf_output.custom_logical_size() && |
589 | + protobuf_output.has_logical_width() && |
590 | + protobuf_output.has_logical_height()) |
591 | + { |
592 | + custom_logical_size = {protobuf_output.logical_width(), |
593 | + protobuf_output.logical_height()}; |
594 | + } |
595 | + |
596 | mg::DisplayConfigurationOutput display_output |
597 | { |
598 | mg::DisplayConfigurationOutputId(protobuf_output.output_id()), |
599 | @@ -75,7 +86,8 @@ |
600 | mir_subpixel_arrangement_unknown, |
601 | {}, |
602 | mir_output_gamma_unsupported, |
603 | - {} |
604 | + {}, |
605 | + custom_logical_size |
606 | }; |
607 | |
608 | /* Modes */ |
609 | @@ -134,6 +146,7 @@ |
610 | mir_subpixel_arrangement_unknown, |
611 | {}, |
612 | mir_output_gamma_unsupported, |
613 | + {}, |
614 | {} |
615 | }; |
616 | |
617 | @@ -169,6 +182,17 @@ |
618 | for (int i = 0; i < mir_display_config_get_num_outputs(config); i++) |
619 | { |
620 | auto const client_output = mir_display_config_get_output(config, i); |
621 | + |
622 | + mir::optional_value<geom::Size> custom_logical_size; |
623 | + if (mir_output_has_custom_logical_size(client_output)) |
624 | + { |
625 | + custom_logical_size = |
626 | + { |
627 | + mir_output_get_logical_width(client_output), |
628 | + mir_output_get_logical_height(client_output) |
629 | + }; |
630 | + } |
631 | + |
632 | mg::DisplayConfigurationOutput display_output |
633 | { |
634 | mg::DisplayConfigurationOutputId(mir_output_get_id(client_output)), |
635 | @@ -192,7 +216,8 @@ |
636 | mir_subpixel_arrangement_unknown, |
637 | {}, |
638 | mir_output_gamma_unsupported, |
639 | - {} |
640 | + {}, |
641 | + custom_logical_size |
642 | }; |
643 | |
644 | /* Modes */ |
645 | |
646 | === modified file 'tests/mir_test_doubles/stub_display_configuration.cpp' |
647 | --- tests/mir_test_doubles/stub_display_configuration.cpp 2017-04-19 16:50:46 +0000 |
648 | +++ tests/mir_test_doubles/stub_display_configuration.cpp 2017-04-21 07:38:12 +0000 |
649 | @@ -93,6 +93,7 @@ |
650 | subpixel_arrangement, |
651 | {}, |
652 | mir_output_gamma_unsupported, |
653 | + {}, |
654 | {} |
655 | } |
656 | { |
657 | @@ -122,6 +123,7 @@ |
658 | mir_subpixel_arrangement_unknown, |
659 | {}, |
660 | mir_output_gamma_unsupported, |
661 | + {}, |
662 | {} |
663 | } |
664 | { |
665 | @@ -224,6 +226,7 @@ |
666 | mir_subpixel_arrangement_unknown, |
667 | {}, |
668 | mir_output_gamma_unsupported, |
669 | + {}, |
670 | {} |
671 | }; |
672 | |
673 | @@ -251,6 +254,7 @@ |
674 | mir_subpixel_arrangement_unknown, |
675 | {}, |
676 | mir_output_gamma_unsupported, |
677 | + {}, |
678 | {} |
679 | }; |
680 | |
681 | |
682 | === modified file 'tests/unit-tests/graphics/test_default_display_configuration_policy.cpp' |
683 | --- tests/unit-tests/graphics/test_default_display_configuration_policy.cpp 2017-01-30 05:18:36 +0000 |
684 | +++ tests/unit-tests/graphics/test_default_display_configuration_policy.cpp 2017-04-21 07:38:12 +0000 |
685 | @@ -47,7 +47,8 @@ |
686 | |
687 | DisplayConfigurationOutput default_output(DisplayConfigurationOutputId id) |
688 | { |
689 | - return { id, DisplayConfigurationCardId{1}, |
690 | + // We name the return value just to work around an apparent clang bug/quirk |
691 | + DisplayConfigurationOutput ret{ id, DisplayConfigurationCardId{1}, |
692 | DisplayConfigurationOutputType::vga, |
693 | {mir_pixel_format_abgr_8888}, |
694 | { {Size{523, 555}, 60.0} }, |
695 | @@ -65,8 +66,10 @@ |
696 | mir_subpixel_arrangement_unknown, |
697 | {}, |
698 | mir_output_gamma_unsupported, |
699 | + {}, |
700 | {} |
701 | }; |
702 | + return ret; |
703 | } |
704 | |
705 | DisplayConfigurationOutput connected_with_modes() |
706 | |
707 | === modified file 'tests/unit-tests/graphics/test_display_configuration.cpp' |
708 | --- tests/unit-tests/graphics/test_display_configuration.cpp 2017-01-18 02:29:37 +0000 |
709 | +++ tests/unit-tests/graphics/test_display_configuration.cpp 2017-04-21 07:38:12 +0000 |
710 | @@ -53,6 +53,7 @@ |
711 | mir_subpixel_arrangement_unknown, |
712 | {}, |
713 | mir_output_gamma_unsupported, |
714 | + {}, |
715 | {} |
716 | }; |
717 | |
718 | @@ -286,6 +287,16 @@ |
719 | EXPECT_EQ(out.modes[out.current_mode_index].size, out.extents().size); |
720 | } |
721 | |
722 | +TEST(DisplayConfiguration, output_extents_are_customizable) |
723 | +{ |
724 | + mg::DisplayConfigurationOutput out = tmpl_output; |
725 | + |
726 | + geom::Size const custom_size{1234, 9876}; |
727 | + out.custom_logical_size = custom_size; |
728 | + |
729 | + EXPECT_EQ(custom_size, out.extents().size); |
730 | +} |
731 | + |
732 | TEST(DisplayConfiguration, output_extents_rotates_with_orientation) |
733 | { |
734 | mg::DisplayConfigurationOutput out = tmpl_output; |
735 | @@ -329,6 +340,23 @@ |
736 | EXPECT_FALSE(out.valid()); |
737 | } |
738 | |
739 | +TEST(DisplayConfiguration, only_nonzero_custom_sizes_are_valid) |
740 | +{ |
741 | + mg::DisplayConfigurationOutput out = tmpl_output; |
742 | + |
743 | + out.custom_logical_size = {12, 34}; |
744 | + EXPECT_TRUE(out.valid()); |
745 | + |
746 | + out.custom_logical_size = {0, 56}; |
747 | + EXPECT_FALSE(out.valid()); |
748 | + |
749 | + out.custom_logical_size = {78, 0}; |
750 | + EXPECT_FALSE(out.valid()); |
751 | + |
752 | + out.custom_logical_size = {0, 0}; |
753 | + EXPECT_FALSE(out.valid()); |
754 | +} |
755 | + |
756 | TEST(DisplayConfiguration, unsupported_format_invalid) |
757 | { |
758 | mg::DisplayConfigurationOutput out = tmpl_output; |
759 | |
760 | === modified file 'tests/unit-tests/graphics/test_overlapping_output_grouping.cpp' |
761 | --- tests/unit-tests/graphics/test_overlapping_output_grouping.cpp 2017-01-18 02:29:37 +0000 |
762 | +++ tests/unit-tests/graphics/test_overlapping_output_grouping.cpp 2017-04-21 07:38:12 +0000 |
763 | @@ -100,6 +100,7 @@ |
764 | mir_subpixel_arrangement_unknown, |
765 | {}, |
766 | mir_output_gamma_unsupported, |
767 | + {}, |
768 | {} |
769 | }; |
770 | |
771 | |
772 | === modified file 'tests/unit-tests/platforms/mesa/kms/test_cursor.cpp' |
773 | --- tests/unit-tests/platforms/mesa/kms/test_cursor.cpp 2017-03-10 10:20:24 +0000 |
774 | +++ tests/unit-tests/platforms/mesa/kms/test_cursor.cpp 2017-04-21 07:38:12 +0000 |
775 | @@ -121,6 +121,7 @@ |
776 | mir_subpixel_arrangement_unknown, |
777 | {}, |
778 | mir_output_gamma_unsupported, |
779 | + {}, |
780 | {} |
781 | }, |
782 | { |
783 | @@ -146,6 +147,7 @@ |
784 | mir_subpixel_arrangement_unknown, |
785 | {}, |
786 | mir_output_gamma_unsupported, |
787 | + {}, |
788 | {} |
789 | }, |
790 | { |
791 | @@ -171,6 +173,7 @@ |
792 | mir_subpixel_arrangement_unknown, |
793 | {}, |
794 | mir_output_gamma_unsupported, |
795 | + {}, |
796 | {} |
797 | }}} |
798 | { |
799 | |
800 | === modified file 'tests/unit-tests/platforms/mesa/kms/test_display_configuration.cpp' |
801 | --- tests/unit-tests/platforms/mesa/kms/test_display_configuration.cpp 2017-04-05 03:11:28 +0000 |
802 | +++ tests/unit-tests/platforms/mesa/kms/test_display_configuration.cpp 2017-04-21 07:38:12 +0000 |
803 | @@ -300,6 +300,7 @@ |
804 | mir_subpixel_arrangement_unknown, |
805 | {}, |
806 | mir_output_gamma_unsupported, |
807 | + {}, |
808 | {} |
809 | }, |
810 | { |
811 | @@ -322,6 +323,7 @@ |
812 | mir_subpixel_arrangement_unknown, |
813 | {}, |
814 | mir_output_gamma_unsupported, |
815 | + {}, |
816 | {} |
817 | }, |
818 | { |
819 | @@ -344,6 +346,7 @@ |
820 | mir_subpixel_arrangement_unknown, |
821 | {}, |
822 | mir_output_gamma_unsupported, |
823 | + {}, |
824 | {} |
825 | } |
826 | }; |
827 | @@ -577,6 +580,7 @@ |
828 | mir_subpixel_arrangement_unknown, |
829 | {}, |
830 | mir_output_gamma_unsupported, |
831 | + {}, |
832 | {} |
833 | }, |
834 | { |
835 | @@ -599,6 +603,7 @@ |
836 | mir_subpixel_arrangement_unknown, |
837 | {}, |
838 | mir_output_gamma_unsupported, |
839 | + {}, |
840 | {} |
841 | }, |
842 | }; |
843 | @@ -625,6 +630,7 @@ |
844 | mir_subpixel_arrangement_unknown, |
845 | {}, |
846 | mir_output_gamma_unsupported, |
847 | + {}, |
848 | {} |
849 | }, |
850 | { |
851 | @@ -647,6 +653,7 @@ |
852 | mir_subpixel_arrangement_unknown, |
853 | {}, |
854 | mir_output_gamma_unsupported, |
855 | + {}, |
856 | {} |
857 | }, |
858 | }; |
859 | @@ -794,6 +801,7 @@ |
860 | mir_subpixel_arrangement_unknown, |
861 | {}, |
862 | mir_output_gamma_unsupported, |
863 | + {}, |
864 | {} |
865 | }, |
866 | }; |
867 | @@ -822,6 +830,7 @@ |
868 | mir_subpixel_arrangement_unknown, |
869 | {}, |
870 | mir_output_gamma_unsupported, |
871 | + {}, |
872 | {} |
873 | }, |
874 | }; |
875 | |
876 | === modified file 'tests/unit-tests/platforms/nested/mir_display_configuration_builder.cpp' |
877 | --- tests/unit-tests/platforms/nested/mir_display_configuration_builder.cpp 2017-02-17 07:35:08 +0000 |
878 | +++ tests/unit-tests/platforms/nested/mir_display_configuration_builder.cpp 2017-04-21 07:38:12 +0000 |
879 | @@ -83,6 +83,10 @@ |
880 | output->set_edid(valid_edid, sizeof(valid_edid)); |
881 | output->set_subpixel_arrangement(mir_subpixel_arrangement_horizontal_rgb); |
882 | |
883 | + auto const& current_mode = output->mode(output->current_mode()); |
884 | + output->set_logical_width(current_mode.horizontal_resolution()); |
885 | + output->set_logical_height(current_mode.vertical_resolution()); |
886 | + |
887 | return std::make_shared<MirDisplayConfig>(conf); |
888 | } |
889 | |
890 | @@ -123,6 +127,10 @@ |
891 | output->set_orientation(mir_orientation_normal); |
892 | output->set_edid(valid_edid, sizeof(valid_edid)); |
893 | output->set_subpixel_arrangement(mir_subpixel_arrangement_horizontal_rgb); |
894 | + |
895 | + auto const& current_mode = output->mode(output->current_mode()); |
896 | + output->set_logical_width(current_mode.horizontal_resolution()); |
897 | + output->set_logical_height(current_mode.vertical_resolution()); |
898 | } |
899 | |
900 | return std::make_shared<MirDisplayConfig>(conf); |
FAILED: Continuous integration, rev:3980 /mir-jenkins. ubuntu. com/job/ mir-ci/ 3364/ /mir-jenkins. ubuntu. com/job/ build-mir/ 4551/console /mir-jenkins. ubuntu. com/job/ build-0- fetch/4671 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= vivid+overlay/ 4660 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial/ 4660 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial+ overlay/ 4660 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= zesty/4660 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= zesty/4583/ console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4583 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4583/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= zesty/4583 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= zesty/4583/ artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 4583 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 4583/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 4583 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 4583/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4583 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4583/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /mir-jenkins. ubuntu. com/job/ mir-ci/ 3364/rebuild
https:/