Merge lp:~mir-team/mir/0.26-old into lp:mir/ubuntu
- 0.26-old
- Merge into ubuntu
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir CI Bot | continuous-integration | Approve | |
Daniel van Vugt | Approve | ||
Cemil Azizoglu (community) | Approve | ||
Brandon Schaefer (community) | Approve | ||
Review via email: mp+320092@code.launchpad.net |
Commit message
Mir 0.26.2 release.
Description of the change
Mir 0.26.2 release.
Mir CI Bot (mir-ci-bot) wrote : | # |
Brandon Schaefer (brandontschaefer) wrote : | # |
lgtm
Cemil Azizoglu (cemil-azizoglu) wrote : | # |
1- Should
mir_connection_
mir_presentatio
be marked deprecated?
2- Should
mir_buffer_
be marked deprecated?
Kevin DuBois (kdub) wrote : | # |
1) I'd say don't mark deprecated, hiding the MirRenderSurface stuff in the rs/ directory should be enough discourangement for people trying to use that before the rename
2) iirc, its still used in nested, so may have to use a pragma to suppress there. Externally, the only thing I'm aware that's using it is the vulkan wsi to get the gbm fd (and that should transition). So ideally, should be marked deprecated, but if its not for practical reasons in this release, thats alright by me too
Alan Griffiths (alan-griffiths) wrote : | # |
> 1) I'd say don't mark deprecated, hiding the MirRenderSurface stuff in the rs/
> directory should be enough discourangement for people trying to use that
> before the rename
According to 1a/7 the ABIs ought to remain after 1.0, so it won't be a disaster if someone uses them. Vis: "Rename MirRenderSurface to MirSurface etc, but export RS ABIs"
So, no need to deprecate.
- 4042. By Cemil Azizoglu
-
Possible fix for 1661498. Needs to run through the silo to be sure.
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:4042
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
- 4043. By Cemil Azizoglu
-
Testing
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:4043
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
- 4044. By Daniel van Vugt
-
Fix build failure in Cemil's experimental change
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:4044
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: 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:
https:/
Daniel van Vugt (vanvugt) wrote : | # |
Experimental revisions 4043 and 4044 need removing before any release.
Cemil Azizoglu (cemil-azizoglu) wrote : | # |
> Experimental revisions 4043 and 4044 need removing before any release.
I am not sure why but I cannot 'push --overwrite' this branch. Perhaps you put a lock on it?
- 4045. By Cemil Azizoglu
-
Reverse the previous "fix" as it doesn't work.
- 4046. By Cemil Azizoglu
-
Fix lp:1661498
Cemil Azizoglu (cemil-azizoglu) wrote : | # |
Everything should be good now.
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:4046
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Daniel van Vugt (vanvugt) wrote : | # |
^^^
Bug 1646375. Try again.
Daniel van Vugt (vanvugt) : | # |
Daniel van Vugt (vanvugt) wrote : | # |
Passes basic sanity checks. No visible ABI breaks.
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:4046
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Cemil Azizoglu (cemil-azizoglu) wrote : | # |
^^^
Another https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:4046
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: 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:
https:/
Preview Diff
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2017-02-02 14:25:53 +0000 |
3 | +++ CMakeLists.txt 2017-03-22 01:44:09 +0000 |
4 | @@ -29,7 +29,7 @@ |
5 | |
6 | set(MIR_VERSION_MAJOR 0) |
7 | set(MIR_VERSION_MINOR 26) |
8 | -set(MIR_VERSION_PATCH 1) |
9 | +set(MIR_VERSION_PATCH 2) |
10 | |
11 | add_definitions(-DMIR_VERSION_MAJOR=${MIR_VERSION_MAJOR}) |
12 | add_definitions(-DMIR_VERSION_MINOR=${MIR_VERSION_MINOR}) |
13 | |
14 | === modified file 'debian/changelog' |
15 | --- debian/changelog 2017-02-09 21:46:32 +0000 |
16 | +++ debian/changelog 2017-03-22 01:44:09 +0000 |
17 | @@ -1,3 +1,30 @@ |
18 | +mir (0.26.2-0ubuntu1) UNRELEASED; urgency=medium |
19 | + |
20 | + * New upstream release 0.26.2 (https://launchpad.net/mir/+milestone/0.26.2) |
21 | + - Bugs fixed: |
22 | + . EDID does not change when hotplugging a monitor (LP: #1660017) |
23 | + . [regression] mirout crashes when connecting to unity8 or any nested |
24 | + server: [libprotobuf FATAL /usr/include/google/protobuf/repeated_field. |
25 | + h:1408] CHECK failed: (index) < (current_size_) (LP: #1661163) |
26 | + . Mir server crashed with SIGSEGV in |
27 | + mir::compositor::TemporaryBuffer::size() called from |
28 | + mir::gl::tessellate_renderable_into_rectangle() (LP: #1664760) |
29 | + . Nested servers (Unity8) periodically stutter (half frame rate) with |
30 | + Mir 0.26.1 (LP: #1666372) |
31 | + . Don't dereference the end iterator in ms::ApplicationSession:: |
32 | + surface_after() (LP: #1667645) |
33 | + . [regression] OSK input shaping no longer works correctly (LP: #1669444) |
34 | + . Setting MirWindowSpec parameters always causes window's input_region |
35 | + to be reset (LP: #1670876) |
36 | + . Subpixel order not included in Mir display information (LP: #1393578) |
37 | + . Presentation chains should support various swap interval modes |
38 | + (LP: #1673533) |
39 | + . Need an extension for GBM buffers to replace |
40 | + mir_buffer_get_buffer_package() (LP: #1673534) |
41 | + . Seg fault on detect_fd_leaks (LP: #1661498) |
42 | + |
43 | + -- Daniel van Vugt <daniel.van.vugt@canonical.com> Mon, 20 Feb 2017 13:37:13 +0800 |
44 | + |
45 | mir (0.26.1+17.04.20170209.1-0ubuntu1) zesty; urgency=medium |
46 | |
47 | * New upstream release 0.26.1 (https://launchpad.net/mir/+milestone/0.26.1) |
48 | |
49 | === modified file 'include/client/mir_toolkit/client_types.h' |
50 | --- include/client/mir_toolkit/client_types.h 2017-02-02 19:52:04 +0000 |
51 | +++ include/client/mir_toolkit/client_types.h 2017-03-22 01:44:09 +0000 |
52 | @@ -254,6 +254,15 @@ |
53 | mir_buffer_layout_linear = 1, |
54 | } MirBufferLayout; |
55 | |
56 | +typedef enum MirPresentMode |
57 | +{ |
58 | + mir_present_mode_immediate, //same as VK_PRESENT_MODE_IMMEDIATE_KHR |
59 | + mir_present_mode_mailbox, //same as VK_PRESENT_MODE_MAILBOX_KHR |
60 | + mir_present_mode_fifo, //same as VK_PRESENT_MODE_FIFO_KHR |
61 | + mir_present_mode_fifo_relaxed, //same as VK_PRESENT_MODE_FIFO_RELAXED_KHR |
62 | + mir_present_mode_num_modes |
63 | +} MirPresentMode; |
64 | + |
65 | /** |
66 | * Retrieved information about a MirWindow. This is most useful for learning |
67 | * how and where to write to a 'mir_buffer_usage_software' surface. |
68 | |
69 | === modified file 'include/client/mir_toolkit/extensions/gbm_buffer.h' |
70 | --- include/client/mir_toolkit/extensions/gbm_buffer.h 2017-02-02 19:38:06 +0000 |
71 | +++ include/client/mir_toolkit/extensions/gbm_buffer.h 2017-03-22 01:44:09 +0000 |
72 | @@ -29,6 +29,8 @@ |
73 | |
74 | /** Allocate a MirBuffer via gbm |
75 | * |
76 | + * available in V1 and V2. |
77 | + * |
78 | * The callback will be called when the buffer is available for use. |
79 | * It will be called once when created, and once per every |
80 | * mir_presentation_chain_submit_buffer. |
81 | @@ -53,6 +55,15 @@ |
82 | unsigned int gbm_bo_flags, |
83 | MirBufferCallback available_callback, void* available_context); |
84 | |
85 | +/** v2 version of mir_connection_allocate_buffer_gbm, with more accurate types. |
86 | + */ |
87 | +typedef void (*MirConnectionAllocateBufferGbm)( |
88 | + MirConnection* connection, |
89 | + uint32_t width, uint32_t height, |
90 | + uint32_t gbm_pixel_format, |
91 | + uint32_t gbm_bo_flags, |
92 | + MirBufferCallback available_callback, void* available_context); |
93 | + |
94 | typedef struct MirExtensionGbmBufferV1 |
95 | { |
96 | mir_connection_allocate_buffer_gbm allocate_buffer_gbm; |
97 | @@ -65,6 +76,85 @@ |
98 | connection, "mir_extension_gbm_buffer", 1); |
99 | } |
100 | |
101 | +/** Allocate a MirBuffer via gbm and wait for the allocation. |
102 | + * available in V2. |
103 | + * The buffer can be destroyed via mir_buffer_release(). |
104 | + * |
105 | + * \param [in] connection The connection |
106 | + * \param [in] width Requested buffer width |
107 | + * \param [in] height Requested buffer height |
108 | + * \param [in] gbm_pixel_format The pixel format, one of the GBM_FORMATs |
109 | + * \param [in] gbm_bo_flags The gbm_bo_flags for the buffer. |
110 | + * \return The buffer |
111 | + **/ |
112 | +typedef MirBuffer* (*MirConnectionAllocateBufferGbmSync)( |
113 | + MirConnection* connection, |
114 | + uint32_t width, uint32_t height, |
115 | + uint32_t gbm_pixel_format, |
116 | + uint32_t gbm_bo_flags); |
117 | + |
118 | +/** Check if a MirBuffer is suitable for import via GBM_BO_IMPORT_FD |
119 | + * |
120 | + * \param [in] buffer The buffer |
121 | + * \return True if suitable, false if unsuitable |
122 | + */ |
123 | +typedef bool (*MirBufferIsGbmImportable)(MirBuffer* buffer); |
124 | + |
125 | +/** Access the fd a MirBuffer suitable for gbm import |
126 | + * \pre The buffer is suitable for GBM_BO_IMPORT_FD |
127 | + * \warning The fd is owned by the buffer. Do not close() it. |
128 | + * \param [in] buffer The buffer |
129 | + * \return The fd |
130 | + */ |
131 | +typedef int (*MirBufferGbmFd)(MirBuffer* buffer); |
132 | + |
133 | +/** Get the stride of a MirBuffer |
134 | + * \pre The buffer is suitable for GBM_BO_IMPORT_FD |
135 | + * \param [in] buffer The buffer |
136 | + * \return The stride of the buffer |
137 | + */ |
138 | +typedef uint32_t (*MirBufferGbmStride)(MirBuffer* buffer); |
139 | + |
140 | +/** Get the GBM_FORMAT of a MirBuffer |
141 | + * \pre The buffer is suitable for GBM_BO_IMPORT_FD |
142 | + * \param [in] buffer The buffer |
143 | + * \return The GBM_FORMAT of the buffer |
144 | + */ |
145 | +typedef uint32_t (*MirBufferGbmFormat)(MirBuffer* buffer); |
146 | + |
147 | +/** Get the gbm_bo_flags of a MirBuffer |
148 | + * \pre The buffer is suitable for GBM_BO_IMPORT_FD |
149 | + * \param [in] buffer The buffer |
150 | + * \return The gbm_bo_flags of the buffer |
151 | + */ |
152 | +typedef uint32_t (*MirBufferGbmFlags)(MirBuffer* buffer); |
153 | + |
154 | +/** Get the age of a MirBuffer |
155 | + * \pre The buffer is suitable for GBM_BO_IMPORT_FD |
156 | + * \param [in] buffer The buffer |
157 | + * \return The age of the buffer |
158 | + */ |
159 | +typedef unsigned int (*MirBufferGbmAge)(MirBuffer* buffer); |
160 | + |
161 | +typedef struct MirExtensionGbmBufferV2 |
162 | +{ |
163 | + MirConnectionAllocateBufferGbm allocate_buffer_gbm; |
164 | + MirConnectionAllocateBufferGbmSync allocate_buffer_gbm_sync; |
165 | + MirBufferIsGbmImportable is_gbm_importable; |
166 | + MirBufferGbmFd fd; |
167 | + MirBufferGbmStride stride; |
168 | + MirBufferGbmFormat format; |
169 | + MirBufferGbmFlags flags; |
170 | + MirBufferGbmAge age; |
171 | +} MirExtensionGbmBufferV2; |
172 | + |
173 | +static inline MirExtensionGbmBufferV2 const* mir_extension_gbm_buffer_v2( |
174 | + MirConnection* connection) |
175 | +{ |
176 | + return (MirExtensionGbmBufferV2 const*) mir_connection_request_extension( |
177 | + connection, "mir_extension_gbm_buffer", 2); |
178 | +} |
179 | + |
180 | #ifdef __cplusplus |
181 | } |
182 | #endif |
183 | |
184 | === modified file 'include/client/mir_toolkit/mir_display_configuration.h' |
185 | --- include/client/mir_toolkit/mir_display_configuration.h 2017-01-26 19:58:38 +0000 |
186 | +++ include/client/mir_toolkit/mir_display_configuration.h 2017-03-22 01:44:09 +0000 |
187 | @@ -59,7 +59,8 @@ |
188 | * supportable at this time. |
189 | */ |
190 | int mir_display_config_get_max_simultaneous_outputs( |
191 | - MirDisplayConfig const* config); |
192 | + MirDisplayConfig const* config) |
193 | + __attribute__((deprecated("Not accurate in Mir 0.26 and later. May be removed in future."))); |
194 | |
195 | /** |
196 | * Get the number of outputs available in this display configuration. |
197 | |
198 | === modified file 'include/client/mir_toolkit/rs/mir_render_surface.h' |
199 | --- include/client/mir_toolkit/rs/mir_render_surface.h 2017-02-02 19:38:06 +0000 |
200 | +++ include/client/mir_toolkit/rs/mir_render_surface.h 2017-03-22 01:44:09 +0000 |
201 | @@ -145,7 +145,8 @@ |
202 | __attribute__((deprecated("This function is slated for rename due to MirRenderSurface-->MirSurface transition"))); |
203 | |
204 | /** |
205 | - * Obtain the presentation chain backing a given render surface |
206 | + * Obtain the presentation chain backing a given render surface. |
207 | + * The MirPresentationChain is created in mir_present_mode_fifo submission mode. |
208 | * |
209 | * \return The chain contained in the given render surface |
210 | * or 'nullptr' if it, or |
211 | @@ -156,6 +157,26 @@ |
212 | MirRenderSurface* render_surface) |
213 | __attribute__((deprecated("This function is slated for rename due to MirRenderSurface-->MirSurface transition"))); |
214 | |
215 | +/** Query whether the server supports a given presentation mode. |
216 | + * |
217 | + * \param [in] connection The connection |
218 | + * \param [in] mode The MirPresentMode |
219 | + * \return True if supported, false if not |
220 | + */ |
221 | +bool mir_connection_present_mode_supported( |
222 | + MirConnection* connection, MirPresentMode mode); |
223 | + |
224 | +/** Respecify the submission mode that the MirPresentationChain is operating with. |
225 | + * The buffers currently queued will immediately be requeued according |
226 | + * to the new mode. |
227 | + * |
228 | + * \pre mir_connection_present_mode_supported must indicate that the mode is supported |
229 | + * \param [in] chain The chain |
230 | + * \param [in] mode The mode to change to |
231 | + */ |
232 | +void mir_presentation_chain_set_mode( |
233 | + MirPresentationChain* chain, MirPresentMode mode); |
234 | + |
235 | /** |
236 | * Set the MirWindowSpec to contain a specific cursor. |
237 | * |
238 | |
239 | === modified file 'src/client/display_configuration_api.cpp' |
240 | --- src/client/display_configuration_api.cpp 2017-01-26 19:58:38 +0000 |
241 | +++ src/client/display_configuration_api.cpp 2017-03-22 01:44:09 +0000 |
242 | @@ -113,7 +113,7 @@ |
243 | |
244 | int mir_display_config_get_max_simultaneous_outputs(MirDisplayConfig const* config) |
245 | { |
246 | - return config->display_card(0).max_simultaneous_outputs(); |
247 | + return mir_display_config_get_num_outputs(config); |
248 | } |
249 | |
250 | int mir_output_get_id(MirOutput const* output) |
251 | |
252 | === modified file 'src/client/mir_presentation_chain_api.cpp' |
253 | --- src/client/mir_presentation_chain_api.cpp 2017-01-25 03:34:22 +0000 |
254 | +++ src/client/mir_presentation_chain_api.cpp 2017-03-22 01:44:09 +0000 |
255 | @@ -20,6 +20,7 @@ |
256 | #include "mir_toolkit/mir_buffer.h" |
257 | #include "mir_toolkit/mir_buffer_private.h" |
258 | #include "mir_connection.h" |
259 | +#include "connection_surface_map.h" |
260 | #include "buffer.h" |
261 | #include "mir_presentation_chain.h" |
262 | #include "mir/uncaught.h" |
263 | @@ -90,3 +91,24 @@ |
264 | { |
265 | MIR_LOG_UNCAUGHT_EXCEPTION(ex); |
266 | } |
267 | + |
268 | +bool mir_connection_present_mode_supported( |
269 | + MirConnection*, MirPresentMode mode) |
270 | +{ |
271 | + return mode == mir_present_mode_fifo || mode == mir_present_mode_mailbox; |
272 | +} |
273 | + |
274 | +void mir_presentation_chain_set_mode( |
275 | + MirPresentationChain* chain, MirPresentMode mode) |
276 | +try |
277 | +{ |
278 | + mir::require(chain && mir_connection_present_mode_supported(chain->connection(), mode)); |
279 | + if (mode == mir_present_mode_fifo) |
280 | + chain->set_queueing_mode(); |
281 | + if (mode == mir_present_mode_mailbox) |
282 | + chain->set_dropping_mode(); |
283 | +} |
284 | +catch (std::exception const& ex) |
285 | +{ |
286 | + MIR_LOG_UNCAUGHT_EXCEPTION(ex); |
287 | +} |
288 | |
289 | === modified file 'src/client/mir_render_surface_api.cpp' |
290 | --- src/client/mir_render_surface_api.cpp 2017-02-06 09:43:47 +0000 |
291 | +++ src/client/mir_render_surface_api.cpp 2017-03-22 01:44:09 +0000 |
292 | @@ -18,6 +18,7 @@ |
293 | |
294 | #include "mir_connection.h" |
295 | #include "render_surface.h" |
296 | +#include "presentation_chain.h" |
297 | #include "mir/uncaught.h" |
298 | #include "mir/require.h" |
299 | #include "connection_surface_map.h" |
300 | |
301 | === modified file 'src/client/symbols.map' |
302 | --- src/client/symbols.map 2017-02-06 09:43:47 +0000 |
303 | +++ src/client/symbols.map 2017-03-22 01:44:09 +0000 |
304 | @@ -374,6 +374,8 @@ |
305 | mir_render_surface_get_size; |
306 | mir_render_surface_set_size; |
307 | mir_render_surface_release; |
308 | + mir_connection_present_mode_supported; |
309 | + mir_presentation_chain_set_mode; |
310 | mir_window_spec_add_render_surface; |
311 | mir_window_spec_set_cursor_render_surface; |
312 | |
313 | |
314 | === modified file 'src/platform/options/default_configuration.cpp' |
315 | --- src/platform/options/default_configuration.cpp 2017-01-18 02:29:37 +0000 |
316 | +++ src/platform/options/default_configuration.cpp 2017-03-22 01:44:09 +0000 |
317 | @@ -174,7 +174,7 @@ |
318 | "How to handle the SharedLibraryProber report. [{log,lttng,off}]") |
319 | (shell_report_opt, po::value<std::string>()->default_value(off_opt_value), |
320 | "How to handle the Shell report. [{log,off}]") |
321 | - (composite_delay_opt, po::value<int>()->default_value(-1), |
322 | + (composite_delay_opt, po::value<int>()->default_value(0), |
323 | "Compositor frame delay in milliseconds (how long to wait for new " |
324 | "frames from clients before compositing). Higher values result in " |
325 | "lower latency but risk causing frame skipping. " |
326 | |
327 | === modified file 'src/platforms/mesa/client/client_buffer.cpp' |
328 | --- src/platforms/mesa/client/client_buffer.cpp 2017-02-03 19:28:14 +0000 |
329 | +++ src/platforms/mesa/client/client_buffer.cpp 2017-03-22 01:44:09 +0000 |
330 | @@ -76,10 +76,14 @@ |
331 | size_t const size_in_bytes; |
332 | }; |
333 | |
334 | -std::shared_ptr<mir::graphics::mesa::NativeBuffer> to_native_buffer(MirBufferPackage const& package) |
335 | +std::shared_ptr<mir::graphics::mesa::NativeBuffer> to_native_buffer( |
336 | + MirBufferPackage const& package, bool gbm, uint32_t native_format, uint32_t native_flags) |
337 | { |
338 | auto buffer = std::make_shared<mir::graphics::mesa::NativeBuffer>(); |
339 | *static_cast<MirBufferPackage*>(buffer.get()) = package; |
340 | + buffer->is_gbm_buffer = gbm; |
341 | + buffer->native_format = native_format; |
342 | + buffer->native_flags = native_flags; |
343 | return buffer; |
344 | } |
345 | |
346 | @@ -90,7 +94,7 @@ |
347 | std::shared_ptr<MirBufferPackage> const& package, |
348 | geom::Size size, MirPixelFormat pf) : |
349 | buffer_file_ops{buffer_file_ops}, |
350 | - creation_package{to_native_buffer(*package)}, |
351 | + creation_package{to_native_buffer(*package, false, 0, 0)}, |
352 | rect({geom::Point{0, 0}, size}), |
353 | buffer_pf{pf}, |
354 | egl_image_attrs{ |
355 | @@ -117,9 +121,9 @@ |
356 | std::shared_ptr<BufferFileOps> const& buffer_file_ops, |
357 | std::shared_ptr<MirBufferPackage> const& package, |
358 | geometry::Size size, |
359 | - unsigned int native_pf, unsigned int /*native_flags*/) : |
360 | + unsigned int native_pf, unsigned int native_flags) : |
361 | buffer_file_ops{buffer_file_ops}, |
362 | - creation_package{to_native_buffer(*package)}, |
363 | + creation_package{to_native_buffer(*package, true, native_pf, native_flags)}, |
364 | rect({geom::Point{0, 0}, size}), |
365 | buffer_pf{mir::graphics::mesa::gbm_format_to_mir_format(native_pf)}, |
366 | egl_image_attrs{ |
367 | |
368 | === modified file 'src/platforms/mesa/client/client_platform.cpp' |
369 | --- src/platforms/mesa/client/client_platform.cpp 2017-02-02 19:38:06 +0000 |
370 | +++ src/platforms/mesa/client/client_platform.cpp 2017-03-22 01:44:09 +0000 |
371 | @@ -23,7 +23,9 @@ |
372 | #include "native_surface.h" |
373 | #include "mir/client_buffer_factory.h" |
374 | #include "mir/client_context.h" |
375 | +#include "mir/client_buffer.h" |
376 | #include "mir/mir_render_surface.h" |
377 | +#include "mir/mir_buffer.h" |
378 | #include "mir/weak_egl.h" |
379 | #include "mir/platform_message.h" |
380 | #include "mir_toolkit/mesa/platform_operation.h" |
381 | @@ -33,6 +35,8 @@ |
382 | #include <boost/throw_exception.hpp> |
383 | #include <stdexcept> |
384 | #include <cstring> |
385 | +#include <mutex> |
386 | +#include <condition_variable> |
387 | |
388 | namespace mgm=mir::graphics::mesa; |
389 | namespace mcl=mir::client; |
390 | @@ -123,9 +127,9 @@ |
391 | |
392 | void allocate_buffer_gbm( |
393 | MirConnection* connection, |
394 | - int width, int height, |
395 | - unsigned int gbm_pixel_format, |
396 | - unsigned int gbm_bo_flags, |
397 | + uint32_t width, uint32_t height, |
398 | + uint32_t gbm_pixel_format, |
399 | + uint32_t gbm_bo_flags, |
400 | MirBufferCallback available_callback, void* available_context) |
401 | { |
402 | auto context = mcl::to_client_context(connection); |
403 | @@ -134,6 +138,142 @@ |
404 | available_callback, available_context); |
405 | } |
406 | |
407 | +void allocate_buffer_gbm_legacy( |
408 | + MirConnection* connection, |
409 | + int width, int height, |
410 | + unsigned int gbm_pixel_format, |
411 | + unsigned int gbm_bo_flags, |
412 | + MirBufferCallback available_callback, void* available_context) |
413 | +{ |
414 | + allocate_buffer_gbm( |
415 | + connection, static_cast<uint32_t>(width), static_cast<uint32_t>(height), |
416 | + static_cast<uint32_t>(gbm_pixel_format), static_cast<uint32_t>(gbm_bo_flags), |
417 | + available_callback, available_context); |
418 | +} |
419 | + |
420 | +MirBuffer* allocate_buffer_gbm_sync( |
421 | + MirConnection* connection, |
422 | + uint32_t width, uint32_t height, |
423 | + uint32_t gbm_pixel_format, |
424 | + uint32_t gbm_bo_flags) |
425 | +try |
426 | +{ |
427 | + struct BufferSync |
428 | + { |
429 | + void set_buffer(MirBuffer* b) |
430 | + { |
431 | + std::unique_lock<decltype(mutex)> lk(mutex); |
432 | + buffer = b; |
433 | + cv.notify_all(); |
434 | + } |
435 | + |
436 | + MirBuffer* wait_for_buffer() |
437 | + { |
438 | + std::unique_lock<decltype(mutex)> lk(mutex); |
439 | + cv.wait(lk, [this]{ return buffer; }); |
440 | + return buffer; |
441 | + } |
442 | + private: |
443 | + std::mutex mutex; |
444 | + std::condition_variable cv; |
445 | + MirBuffer* buffer = nullptr; |
446 | + } sync; |
447 | + |
448 | + allocate_buffer_gbm( |
449 | + connection, width, height, gbm_pixel_format, gbm_bo_flags, |
450 | + [](auto* b, auto* context){ reinterpret_cast<BufferSync*>(context)->set_buffer(b); }, &sync); |
451 | + return sync.wait_for_buffer(); |
452 | +} |
453 | +catch (...) |
454 | +{ |
455 | + return nullptr; |
456 | +} |
457 | + |
458 | +bool is_gbm_importable(MirBuffer* b) |
459 | +try |
460 | +{ |
461 | + if (!b) |
462 | + return false; |
463 | + auto buffer = reinterpret_cast<mcl::MirBuffer*>(b); |
464 | + auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get()); |
465 | + if (!native) |
466 | + return false; |
467 | + return native->is_gbm_buffer; |
468 | +} |
469 | +catch (...) |
470 | +{ |
471 | + return false; |
472 | +} |
473 | + |
474 | +int import_fd(MirBuffer* b) |
475 | +try |
476 | +{ |
477 | + if (!is_gbm_importable(b)) |
478 | + return -1; |
479 | + auto buffer = reinterpret_cast<mcl::MirBuffer*>(b); |
480 | + auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get()); |
481 | + return native->fd[0]; |
482 | +} |
483 | +catch (...) |
484 | +{ |
485 | + return -1; |
486 | +} |
487 | + |
488 | +uint32_t buffer_stride(MirBuffer* b) |
489 | +try |
490 | +{ |
491 | + if (!is_gbm_importable(b)) |
492 | + return 0; |
493 | + auto buffer = reinterpret_cast<mcl::MirBuffer*>(b); |
494 | + auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get()); |
495 | + return native->stride; |
496 | +} |
497 | +catch (...) |
498 | +{ |
499 | + return 0; |
500 | +} |
501 | + |
502 | +uint32_t buffer_format(MirBuffer* b) |
503 | +try |
504 | +{ |
505 | + if (!is_gbm_importable(b)) |
506 | + return 0; |
507 | + auto buffer = reinterpret_cast<mcl::MirBuffer*>(b); |
508 | + auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get()); |
509 | + return native->native_format; |
510 | +} |
511 | +catch (...) |
512 | +{ |
513 | + return 0; |
514 | +} |
515 | + |
516 | +uint32_t buffer_flags(MirBuffer* b) |
517 | +try |
518 | +{ |
519 | + if (!is_gbm_importable(b)) |
520 | + return 0; |
521 | + auto buffer = reinterpret_cast<mcl::MirBuffer*>(b); |
522 | + auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get()); |
523 | + return native->native_flags; |
524 | +} |
525 | +catch (...) |
526 | +{ |
527 | + return 0; |
528 | +} |
529 | + |
530 | +unsigned int buffer_age(MirBuffer* b) |
531 | +try |
532 | +{ |
533 | + if (!is_gbm_importable(b)) |
534 | + return 0; |
535 | + auto buffer = reinterpret_cast<mcl::MirBuffer*>(b); |
536 | + auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get()); |
537 | + return native->age; |
538 | +} |
539 | +catch (...) |
540 | +{ |
541 | + return 0; |
542 | +} |
543 | #pragma GCC diagnostic push |
544 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
545 | MirBufferStream* get_hw_stream( |
546 | @@ -164,7 +304,9 @@ |
547 | gbm_dev{nullptr}, |
548 | drm_extensions{auth_fd_ext, auth_magic_ext}, |
549 | mesa_auth{set_device, this}, |
550 | - gbm_buffer{allocate_buffer_gbm}, |
551 | + gbm_buffer1{allocate_buffer_gbm_legacy}, |
552 | + gbm_buffer2{allocate_buffer_gbm, allocate_buffer_gbm_sync, |
553 | + is_gbm_importable, import_fd, buffer_stride, buffer_format, buffer_flags, buffer_age}, |
554 | hw_stream{get_hw_stream} |
555 | { |
556 | } |
557 | @@ -289,7 +431,9 @@ |
558 | if (!strcmp(extension_name, "mir_extension_set_gbm_device") && (version == 1)) |
559 | return &mesa_auth; |
560 | if (!strcmp(extension_name, "mir_extension_gbm_buffer") && (version == 1)) |
561 | - return &gbm_buffer; |
562 | + return &gbm_buffer1; |
563 | + if (!strcmp(extension_name, "mir_extension_gbm_buffer") && (version == 2)) |
564 | + return &gbm_buffer2; |
565 | if (!strcmp(extension_name, "mir_extension_hardware_buffer_stream") && (version == 1)) |
566 | return &hw_stream; |
567 | |
568 | |
569 | === modified file 'src/platforms/mesa/client/client_platform.h' |
570 | --- src/platforms/mesa/client/client_platform.h 2017-02-02 18:32:54 +0000 |
571 | +++ src/platforms/mesa/client/client_platform.h 2017-03-22 01:44:09 +0000 |
572 | @@ -65,7 +65,8 @@ |
573 | gbm_device* gbm_dev; |
574 | MirExtensionMesaDRMAuthV1 drm_extensions; |
575 | MirExtensionSetGbmDeviceV1 mesa_auth; |
576 | - MirExtensionGbmBufferV1 gbm_buffer; |
577 | + MirExtensionGbmBufferV1 gbm_buffer1; |
578 | + MirExtensionGbmBufferV2 gbm_buffer2; |
579 | MirExtensionHardwareBufferStreamV1 hw_stream; |
580 | }; |
581 | |
582 | |
583 | === modified file 'src/platforms/mesa/include/native_buffer.h' |
584 | --- src/platforms/mesa/include/native_buffer.h 2017-01-18 02:29:37 +0000 |
585 | +++ src/platforms/mesa/include/native_buffer.h 2017-03-22 01:44:09 +0000 |
586 | @@ -34,6 +34,9 @@ |
587 | struct NativeBuffer : graphics::NativeBuffer, MirBufferPackage |
588 | { |
589 | struct gbm_bo *bo; |
590 | + bool is_gbm_buffer; |
591 | + uint32_t native_format; |
592 | + uint32_t native_flags; |
593 | }; |
594 | } |
595 | } |
596 | |
597 | === modified file 'src/platforms/mesa/server/kms/real_kms_display_configuration.cpp' |
598 | --- src/platforms/mesa/server/kms/real_kms_display_configuration.cpp 2017-01-18 02:29:37 +0000 |
599 | +++ src/platforms/mesa/server/kms/real_kms_display_configuration.cpp 2017-03-22 01:44:09 +0000 |
600 | @@ -370,6 +370,7 @@ |
601 | output.current_format = mir_pixel_format_xrgb_8888; |
602 | output.subpixel_arrangement = kms_subpixel_to_mir_subpixel(connector.subpixel); |
603 | output.gamma = gamma; |
604 | + output.edid = edid; |
605 | } |
606 | } |
607 | |
608 | |
609 | === modified file 'src/server/compositor/multi_monitor_arbiter.cpp' |
610 | --- src/server/compositor/multi_monitor_arbiter.cpp 2017-01-18 02:29:37 +0000 |
611 | +++ src/server/compositor/multi_monitor_arbiter.cpp 2017-03-22 01:44:09 +0000 |
612 | @@ -67,9 +67,10 @@ |
613 | |
614 | auto& last_entry = onscreen_buffers.front(); |
615 | last_entry.use_count++; |
616 | + auto last_entry_buffer = last_entry.buffer; |
617 | if (mode == mc::MultiMonitorMode::multi_monitor_sync) |
618 | clean_onscreen_buffers(lk); |
619 | - return last_entry.buffer; |
620 | + return last_entry_buffer; |
621 | } |
622 | |
623 | void mc::MultiMonitorArbiter::compositor_release(std::shared_ptr<mg::Buffer> const& buffer) |
624 | |
625 | === modified file 'src/server/frontend/session_mediator.cpp' |
626 | --- src/server/frontend/session_mediator.cpp 2017-02-08 20:22:59 +0000 |
627 | +++ src/server/frontend/session_mediator.cpp 2017-03-22 01:44:09 +0000 |
628 | @@ -678,7 +678,8 @@ |
629 | id, geom::Displacement{surface_specification.hotspot_x(), surface_specification.hotspot_y()} }; |
630 | } |
631 | |
632 | - mods.input_shape = extract_input_shape_from(&surface_specification); |
633 | + if (surface_specification.input_shape_size() > 0) |
634 | + mods.input_shape = extract_input_shape_from(&surface_specification); |
635 | |
636 | auto const id = mf::SurfaceId(request->surface_id().value()); |
637 | |
638 | |
639 | === modified file 'src/server/graphics/nested/nested_display_configuration.cpp' |
640 | --- src/server/graphics/nested/nested_display_configuration.cpp 2017-01-18 13:59:18 +0000 |
641 | +++ src/server/graphics/nested/nested_display_configuration.cpp 2017-03-22 01:44:09 +0000 |
642 | @@ -103,7 +103,7 @@ |
643 | auto current_format = mir_output_get_current_pixel_format(output); |
644 | auto power_mode = mir_output_get_power_mode(output); |
645 | auto orientation = mir_output_get_orientation(output); |
646 | - auto local_config = get_local_config_for(output_id); |
647 | + auto local_config = get_local_config_for(output); |
648 | uint32_t preferred_index = mir_output_get_preferred_mode_index(output); |
649 | uint32_t current_index = mir_output_get_current_mode_index(output); |
650 | |
651 | @@ -198,13 +198,16 @@ |
652 | } |
653 | |
654 | mgn::NestedDisplayConfiguration::LocalOutputConfig |
655 | -mgn::NestedDisplayConfiguration::get_local_config_for(uint32_t output_id) const |
656 | +mgn::NestedDisplayConfiguration::get_local_config_for(MirOutput const* output) const |
657 | { |
658 | std::lock_guard<std::mutex> lock{local_config_mutex}; |
659 | |
660 | - LocalOutputConfig const default_values {1.0f, mir_form_factor_monitor, |
661 | - mir_subpixel_arrangement_unknown, |
662 | - {}, mir_output_gamma_unsupported}; |
663 | + auto const output_id = mir_output_get_id(output); |
664 | + |
665 | + LocalOutputConfig const default_values{ |
666 | + 1.0f, mir_form_factor_monitor, |
667 | + mir_output_get_subpixel_arrangement(output), |
668 | + {}, mir_output_gamma_unsupported}; |
669 | |
670 | bool inserted; |
671 | decltype(local_config)::iterator keypair; |
672 | |
673 | === modified file 'src/server/graphics/nested/nested_display_configuration.h' |
674 | --- src/server/graphics/nested/nested_display_configuration.h 2017-01-18 02:29:37 +0000 |
675 | +++ src/server/graphics/nested/nested_display_configuration.h 2017-03-22 01:44:09 +0000 |
676 | @@ -67,7 +67,7 @@ |
677 | }; |
678 | std::unordered_map<uint32_t, LocalOutputConfig> mutable local_config; |
679 | |
680 | - LocalOutputConfig get_local_config_for(uint32_t output_id) const; |
681 | + LocalOutputConfig get_local_config_for(MirOutput const* output) const; |
682 | void set_local_config_for(uint32_t output_id, LocalOutputConfig const& config); |
683 | }; |
684 | |
685 | |
686 | === modified file 'src/server/scene/application_session.cpp' |
687 | --- src/server/scene/application_session.cpp 2017-02-02 18:25:05 +0000 |
688 | +++ src/server/scene/application_session.cpp 2017-03-22 01:44:09 +0000 |
689 | @@ -235,6 +235,9 @@ |
690 | if (next == surfaces.end()) |
691 | next = std::find_if(begin(surfaces), current, can_take_focus); |
692 | |
693 | + if (next == end(surfaces)) |
694 | + return {}; |
695 | + |
696 | return next->second; |
697 | } |
698 | |
699 | |
700 | === modified file 'src/server/shell/surface_specification.cpp' |
701 | --- src/server/shell/surface_specification.cpp 2015-10-15 04:20:44 +0000 |
702 | +++ src/server/shell/surface_specification.cpp 2017-03-22 01:44:09 +0000 |
703 | @@ -37,6 +37,7 @@ |
704 | !aux_rect.is_set() && |
705 | !edge_attachment.is_set() && |
706 | !min_width.is_set() && |
707 | + !min_height.is_set() && |
708 | !max_width.is_set() && |
709 | !max_height.is_set() && |
710 | !width_inc.is_set() && |
711 | @@ -45,5 +46,6 @@ |
712 | !max_aspect.is_set() && |
713 | !streams.is_set() && |
714 | !parent.is_set() && |
715 | - !input_shape.is_set(); |
716 | + !input_shape.is_set() && |
717 | + !shell_chrome.is_set(); |
718 | } |
719 | |
720 | === modified file 'src/utils/out.c' |
721 | --- src/utils/out.c 2017-01-18 02:29:37 +0000 |
722 | +++ src/utils/out.c 2017-03-22 01:44:09 +0000 |
723 | @@ -410,9 +410,6 @@ |
724 | |
725 | int num_outputs = mir_display_config_get_num_outputs(conf); |
726 | |
727 | - printf("Max %d simultaneous outputs\n", |
728 | - mir_display_config_get_max_simultaneous_outputs(conf)); |
729 | - |
730 | for (int i = 0; i < num_outputs; ++i) |
731 | { |
732 | MirOutput const* out = mir_display_config_get_output(conf, i); |
733 | |
734 | === modified file 'tests/acceptance-tests/test_custom_window_management.cpp' |
735 | --- tests/acceptance-tests/test_custom_window_management.cpp 2017-01-18 04:43:15 +0000 |
736 | +++ tests/acceptance-tests/test_custom_window_management.cpp 2017-03-22 01:44:09 +0000 |
737 | @@ -363,6 +363,53 @@ |
738 | mir_connection_release(connection); |
739 | } |
740 | |
741 | +TEST_F(CustomWindowManagement, apply_input_shape_to_surface) |
742 | +{ |
743 | + start_server(); |
744 | + |
745 | + auto connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__); |
746 | + |
747 | + int const width{800}, height{600}; |
748 | + MirPixelFormat const format{mir_pixel_format_bgr_888}; |
749 | + auto surface_spec = mir_create_normal_window_spec(connection, width, height); |
750 | + mir_window_spec_set_pixel_format(surface_spec, format); |
751 | + |
752 | + auto window = mir_create_window_sync(surface_spec); |
753 | + mir_window_spec_release(surface_spec); |
754 | + |
755 | + surface_spec = mir_create_window_spec(connection); |
756 | + |
757 | + mt::Signal received; |
758 | + |
759 | + MirRectangle rect{ 0, 0, 100, 101 }; |
760 | + mir_window_spec_set_input_shape(surface_spec, &rect, 1); |
761 | + |
762 | + auto const check_apply_surface = [&received]( |
763 | + std::shared_ptr<ms::Session> const&, |
764 | + std::shared_ptr<ms::Surface> const&, |
765 | + msh::SurfaceSpecification const& spec) |
766 | + { |
767 | + EXPECT_TRUE(spec.input_shape.is_set()); |
768 | + received.raise(); |
769 | + }; |
770 | + EXPECT_CALL(window_manager, modify_surface(_,_,_)).WillOnce(Invoke(check_apply_surface)); |
771 | + |
772 | + mir_window_apply_spec(window, surface_spec); |
773 | + mir_window_spec_release(surface_spec); |
774 | + |
775 | + EXPECT_TRUE(received.wait_for(400ms)); |
776 | + |
777 | + surface_spec = mir_create_window_spec(connection); |
778 | + mir_window_spec_set_input_shape(surface_spec, nullptr, 0); |
779 | + |
780 | + mir_window_apply_spec(window, surface_spec); |
781 | + mir_window_spec_release(surface_spec); |
782 | + EXPECT_TRUE(received.wait_for(400ms)); |
783 | + |
784 | + mir_window_release_sync(window); |
785 | + mir_connection_release(connection); |
786 | +} |
787 | + |
788 | TEST_F(CustomWindowManagement, when_the_client_places_a_new_surface_the_request_reaches_the_window_manager) |
789 | { |
790 | int const width{800}; |
791 | |
792 | === modified file 'tests/acceptance-tests/test_new_display_configuration.cpp' |
793 | --- tests/acceptance-tests/test_new_display_configuration.cpp 2017-01-26 19:58:38 +0000 |
794 | +++ tests/acceptance-tests/test_new_display_configuration.cpp 2017-03-22 01:44:09 +0000 |
795 | @@ -475,9 +475,10 @@ |
796 | using namespace testing; |
797 | |
798 | auto format = GetParam(); |
799 | - mtd::StubDisplayConfig single_format_config(1, {format}); |
800 | + auto single_format_config = |
801 | + std::make_shared<mtd::StubDisplayConfig>(1, std::vector<MirPixelFormat>{format}); |
802 | |
803 | - apply_config_change_and_wait_for_propagation(mt::fake_shared(single_format_config)); |
804 | + apply_config_change_and_wait_for_propagation(single_format_config); |
805 | |
806 | DisplayClient client{new_connection()}; |
807 | |
808 | @@ -507,9 +508,11 @@ |
809 | 60.0, |
810 | true, |
811 | subpixel_arrangement}; |
812 | - mtd::StubDisplayConfig single_subpixel_config({output}); |
813 | - |
814 | - apply_config_change_and_wait_for_propagation(mt::fake_shared(single_subpixel_config)); |
815 | + |
816 | + auto single_subpixel_config = |
817 | + std::make_shared<mtd::StubDisplayConfig>(std::vector<mg::DisplayConfigurationOutput>{output}); |
818 | + |
819 | + apply_config_change_and_wait_for_propagation(single_subpixel_config); |
820 | |
821 | DisplayClient client{new_connection()}; |
822 | |
823 | |
824 | === modified file 'tests/acceptance-tests/test_presentation_chain.cpp' |
825 | --- tests/acceptance-tests/test_presentation_chain.cpp 2017-02-02 19:38:06 +0000 |
826 | +++ tests/acceptance-tests/test_presentation_chain.cpp 2017-03-22 01:44:09 +0000 |
827 | @@ -24,9 +24,15 @@ |
828 | #include "mir_toolkit/mir_extension_core.h" |
829 | #include "mir_toolkit/extensions/fenced_buffers.h" |
830 | #include "mir_test_framework/connected_client_headless_server.h" |
831 | +#include "mir/test/doubles/null_display_buffer_compositor_factory.h" |
832 | #include "mir/geometry/size.h" |
833 | +#include "mir/graphics/buffer.h" |
834 | +#include "mir/graphics/renderable.h" |
835 | +#include "mir/compositor/scene_element.h" |
836 | #include "mir/fd.h" |
837 | +#include "mir/raii.h" |
838 | |
839 | +#include <atomic> |
840 | #include <gtest/gtest.h> |
841 | #include <gmock/gmock.h> |
842 | |
843 | @@ -35,6 +41,7 @@ |
844 | namespace mt = mir::test; |
845 | namespace mc = mir::compositor; |
846 | namespace geom = mir::geometry; |
847 | +namespace mtd = mir::test::doubles; |
848 | using namespace testing; |
849 | using namespace std::chrono_literals; |
850 | |
851 | @@ -47,10 +54,11 @@ |
852 | Chain(Chain const&) = delete; |
853 | Chain& operator=(Chain const&) = delete; |
854 | |
855 | - Chain(MirConnection* connection) : |
856 | + Chain(MirConnection* connection, MirPresentMode mode) : |
857 | rs(mir_connection_create_render_surface_sync(connection, 0, 0)), |
858 | chain(mir_render_surface_get_presentation_chain(rs)) |
859 | { |
860 | + mir_presentation_chain_set_mode(chain, mode); |
861 | } |
862 | |
863 | MirRenderSurface* content() |
864 | @@ -94,8 +102,11 @@ |
865 | mir_window_release_sync(window); |
866 | } |
867 | protected: |
868 | - SurfaceWithChain(MirConnection* connection, std::function<MirWindow*(Chain&)> const& fn) : |
869 | - chain_(connection), |
870 | + SurfaceWithChain( |
871 | + MirConnection* connection, |
872 | + MirPresentMode mode, |
873 | + std::function<MirWindow*(Chain&)> const& fn) : |
874 | + chain_(connection, mode), |
875 | window(fn(chain_)) |
876 | { |
877 | } |
878 | @@ -109,8 +120,10 @@ |
879 | SurfaceWithChainFromStart(SurfaceWithChainFromStart const&) = delete; |
880 | SurfaceWithChainFromStart& operator=(SurfaceWithChainFromStart const&) = delete; |
881 | |
882 | - SurfaceWithChainFromStart(MirConnection* connection, geom::Size size, MirPixelFormat pf) : |
883 | - SurfaceWithChain(connection, |
884 | + SurfaceWithChainFromStart( |
885 | + MirConnection* connection, MirPresentMode mode, |
886 | + geom::Size size, MirPixelFormat pf) : |
887 | + SurfaceWithChain(connection, mode, |
888 | std::bind(&SurfaceWithChainFromStart::create_surface, this, |
889 | std::placeholders::_1, connection, size, pf)) |
890 | { |
891 | @@ -132,38 +145,43 @@ |
892 | } |
893 | }; |
894 | |
895 | -struct SurfaceWithChainFromReassociation : SurfaceWithChain |
896 | -{ |
897 | - SurfaceWithChainFromReassociation(SurfaceWithChainFromReassociation const&) = delete; |
898 | - SurfaceWithChainFromReassociation& operator=(SurfaceWithChainFromReassociation const&) = delete; |
899 | - SurfaceWithChainFromReassociation(MirConnection* connection, geom::Size size, MirPixelFormat pf) : |
900 | - SurfaceWithChain(connection, |
901 | - std::bind(&SurfaceWithChainFromReassociation::create_surface, this, |
902 | - std::placeholders::_1, connection, size, pf)) |
903 | - { |
904 | - } |
905 | -private: |
906 | - MirWindow* create_surface(Chain& chain, MirConnection* connection, geom::Size size, MirPixelFormat pf) |
907 | - { |
908 | - MirWindowSpec* spec = mir_create_normal_window_spec( |
909 | - connection, size.width.as_int(), size.height.as_int()); |
910 | - mir_window_spec_set_pixel_format(spec, pf); |
911 | - auto window = mir_create_window_sync(spec); |
912 | - mir_window_spec_release(spec); |
913 | - spec = mir_create_window_spec(connection); |
914 | -#pragma GCC diagnostic push |
915 | -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
916 | - mir_window_spec_add_render_surface( |
917 | - spec, chain.content(), size.width.as_int(), size.height.as_int(), 0, 0); |
918 | -#pragma GCC diagnostic pop |
919 | - mir_window_apply_spec(window, spec); |
920 | - mir_window_spec_release(spec); |
921 | - return window; |
922 | - } |
923 | -}; |
924 | - |
925 | struct PresentationChain : mtf::ConnectedClientHeadlessServer |
926 | { |
927 | + bool stall_compositor = false; |
928 | + void SetUp() |
929 | + { |
930 | + server.override_the_display_buffer_compositor_factory( |
931 | + [&] |
932 | + { |
933 | + struct StubDBCFactory : mc::DisplayBufferCompositorFactory |
934 | + { |
935 | + StubDBCFactory(bool& stall_compositor) : stall_compositor(stall_compositor) {} |
936 | + |
937 | + std::unique_ptr<mir::compositor::DisplayBufferCompositor> |
938 | + create_compositor_for(mir::graphics::DisplayBuffer&) override |
939 | + { |
940 | + struct StubDBC : mir::compositor::DisplayBufferCompositor |
941 | + { |
942 | + StubDBC(bool& stall_compositor) : stall_compositor(stall_compositor) {} |
943 | + |
944 | + void composite(mir::compositor::SceneElementSequence&& seq) override |
945 | + { |
946 | + while (stall_compositor) |
947 | + std::this_thread::yield(); |
948 | + for (auto& s : seq) |
949 | + s->renderable()->buffer(); |
950 | + } |
951 | + bool& stall_compositor; |
952 | + }; |
953 | + return std::make_unique<StubDBC>(stall_compositor); |
954 | + } |
955 | + bool& stall_compositor; |
956 | + }; |
957 | + return std::make_unique<StubDBCFactory>(stall_compositor); |
958 | + }); |
959 | + mtf::ConnectedClientHeadlessServer::SetUp(); |
960 | + } |
961 | + |
962 | geom::Size const size {100, 20}; |
963 | MirPixelFormat const pf = mir_pixel_format_abgr_8888; |
964 | }; |
965 | @@ -221,9 +239,22 @@ |
966 | |
967 | } |
968 | |
969 | +TEST_F(PresentationChain, supported_modes) |
970 | +{ |
971 | + EXPECT_TRUE(mir_connection_present_mode_supported( |
972 | + connection, mir_present_mode_fifo)); |
973 | + EXPECT_TRUE(mir_connection_present_mode_supported( |
974 | + connection, mir_present_mode_mailbox)); |
975 | + //TODOs: |
976 | + EXPECT_FALSE(mir_connection_present_mode_supported( |
977 | + connection, mir_present_mode_fifo_relaxed)); |
978 | + EXPECT_FALSE(mir_connection_present_mode_supported( |
979 | + connection, mir_present_mode_immediate)); |
980 | +} |
981 | + |
982 | TEST_F(PresentationChain, allocation_calls_callback) |
983 | { |
984 | - SurfaceWithChainFromStart window(connection, size, pf); |
985 | + SurfaceWithChainFromStart window(connection, mir_present_mode_fifo, size, pf); |
986 | |
987 | MirBufferSync context; |
988 | mir_connection_allocate_buffer( |
989 | @@ -237,7 +268,7 @@ |
990 | |
991 | TEST_F(PresentationChain, can_access_platform_message_representing_buffer) |
992 | { |
993 | - SurfaceWithChainFromStart window(connection, size, pf); |
994 | + SurfaceWithChainFromStart window(connection, mir_present_mode_fifo, size, pf); |
995 | |
996 | MirBufferSync context; |
997 | mir_connection_allocate_buffer( |
998 | @@ -259,7 +290,7 @@ |
999 | |
1000 | TEST_F(PresentationChain, has_native_fence) |
1001 | { |
1002 | - SurfaceWithChainFromStart window(connection, size, pf); |
1003 | + SurfaceWithChainFromStart window(connection, mir_present_mode_fifo, size, pf); |
1004 | |
1005 | auto ext = mir_extension_fenced_buffers_v1(connection); |
1006 | ASSERT_THAT(ext, Ne(nullptr)); |
1007 | @@ -281,7 +312,7 @@ |
1008 | |
1009 | TEST_F(PresentationChain, can_map_for_cpu_render) |
1010 | { |
1011 | - SurfaceWithChainFromStart window(connection, size, pf); |
1012 | + SurfaceWithChainFromStart window(connection, mir_present_mode_fifo, size, pf); |
1013 | |
1014 | MirGraphicsRegion region; |
1015 | MirBufferLayout region_layout = mir_buffer_layout_unknown; |
1016 | @@ -307,7 +338,7 @@ |
1017 | |
1018 | TEST_F(PresentationChain, submission_will_eventually_call_callback) |
1019 | { |
1020 | - SurfaceWithChainFromStart window(connection, size, pf); |
1021 | + SurfaceWithChainFromStart window(connection, mir_present_mode_fifo, size, pf); |
1022 | |
1023 | auto const num_buffers = 2u; |
1024 | std::array<MirBufferSync, num_buffers> contexts; |
1025 | @@ -338,7 +369,7 @@ |
1026 | |
1027 | TEST_F(PresentationChain, buffers_can_be_destroyed_before_theyre_returned) |
1028 | { |
1029 | - SurfaceWithChainFromStart window(connection, size, pf); |
1030 | + SurfaceWithChainFromStart window(connection, mir_present_mode_fifo, size, pf); |
1031 | |
1032 | MirBufferSync context; |
1033 | auto buffer = mir_connection_allocate_buffer_sync( |
1034 | @@ -350,7 +381,7 @@ |
1035 | |
1036 | TEST_F(PresentationChain, buffers_can_be_flushed) |
1037 | { |
1038 | - SurfaceWithChainFromStart window(connection, size, pf); |
1039 | + SurfaceWithChainFromStart window(connection, mir_present_mode_fifo,size, pf); |
1040 | |
1041 | auto buffer = mir_connection_allocate_buffer_sync( |
1042 | connection, size.width.as_int(), size.height.as_int(), pf); |
1043 | @@ -409,7 +440,7 @@ |
1044 | geom::Height height { 33 }; |
1045 | auto format = mir_pixel_format_abgr_8888; |
1046 | |
1047 | - SurfaceWithChainFromStart window(connection, size, pf); |
1048 | + SurfaceWithChainFromStart window(connection, mir_present_mode_fifo, size, pf); |
1049 | auto buffer = mir_connection_allocate_buffer_sync( |
1050 | connection, width.as_int(), height.as_int(), format); |
1051 | EXPECT_THAT(mir_buffer_get_width(buffer), Eq(width.as_uint32_t())); |
1052 | @@ -434,3 +465,157 @@ |
1053 | EXPECT_THAT(mir_buffer_get_error_message(buffer), Not(StrEq(""))); |
1054 | mir_buffer_release(buffer); |
1055 | } |
1056 | + |
1057 | +namespace |
1058 | +{ |
1059 | + struct TrackedBuffer |
1060 | + { |
1061 | + TrackedBuffer(MirConnection* connection, std::atomic<unsigned int>& counter) : |
1062 | + buffer(mir_connection_allocate_buffer_sync(connection, 100, 100, pf)), |
1063 | + counter(counter) |
1064 | + { |
1065 | + } |
1066 | + ~TrackedBuffer() |
1067 | + { |
1068 | + mir_buffer_release(buffer); |
1069 | + } |
1070 | + |
1071 | + void submit_to(MirPresentationChain* chain) |
1072 | + { |
1073 | + std::unique_lock<std::mutex> lk(mutex); |
1074 | + if (!avail) |
1075 | + throw std::runtime_error("test problem"); |
1076 | + avail = false; |
1077 | + mir_presentation_chain_submit_buffer(chain, buffer, tavailable, this); |
1078 | + } |
1079 | + |
1080 | + static void tavailable(MirBuffer*, void* ctxt) |
1081 | + { |
1082 | + TrackedBuffer* buf = reinterpret_cast<TrackedBuffer*>(ctxt); |
1083 | + buf->ready(); |
1084 | + } |
1085 | + |
1086 | + void ready() |
1087 | + { |
1088 | + last_count_ = counter.fetch_add(1); |
1089 | + std::unique_lock<std::mutex> lk(mutex); |
1090 | + avail = true; |
1091 | + cv.notify_all(); |
1092 | + } |
1093 | + |
1094 | + bool wait_ready(std::chrono::milliseconds ms) |
1095 | + { |
1096 | + std::unique_lock<std::mutex> lk(mutex); |
1097 | + return cv.wait_for(lk, ms, [this] { return avail; }); |
1098 | + } |
1099 | + |
1100 | + bool is_ready() { return avail; } |
1101 | + unsigned int last_count() const |
1102 | + { |
1103 | + return last_count_; |
1104 | + } |
1105 | + |
1106 | + MirPixelFormat pf = mir_pixel_format_abgr_8888; |
1107 | + MirBuffer* buffer; |
1108 | + std::atomic<unsigned int>& counter; |
1109 | + unsigned int last_count_ = 0u; |
1110 | + bool avail = true; |
1111 | + std::condition_variable cv; |
1112 | + std::mutex mutex; |
1113 | + }; |
1114 | +} |
1115 | + |
1116 | +TEST_F(PresentationChain, fifo_looks_correct_from_client_perspective) |
1117 | +{ |
1118 | + SurfaceWithChainFromStart window( |
1119 | + connection, mir_present_mode_fifo, size, pf); |
1120 | + |
1121 | + int const num_buffers = 5; |
1122 | + |
1123 | + std::atomic<unsigned int> counter{ 0u }; |
1124 | + std::array<std::unique_ptr<TrackedBuffer>, num_buffers> buffers; |
1125 | + for (auto& buffer : buffers) |
1126 | + buffer = std::make_unique<TrackedBuffer>(connection, counter); |
1127 | + for(auto& b : buffers) |
1128 | + b->submit_to(window.chain()); |
1129 | + |
1130 | + //the last one that will return; |
1131 | + EXPECT_TRUE(buffers[3]->wait_ready(5s)); |
1132 | + EXPECT_THAT(buffers[0]->last_count(), Lt(buffers[1]->last_count())); |
1133 | + EXPECT_THAT(buffers[1]->last_count(), Lt(buffers[2]->last_count())); |
1134 | + EXPECT_THAT(buffers[2]->last_count(), Lt(buffers[3]->last_count())); |
1135 | + EXPECT_FALSE(buffers[4]->is_ready()); |
1136 | +} |
1137 | + |
1138 | +TEST_F(PresentationChain, fifo_queues_when_compositor_isnt_consuming) |
1139 | +{ |
1140 | + SurfaceWithChainFromStart window( |
1141 | + connection, mir_present_mode_fifo, size, pf); |
1142 | + int const num_buffers = 5; |
1143 | + std::atomic<unsigned int> counter{ 0u }; |
1144 | + std::array<std::unique_ptr<TrackedBuffer>, num_buffers> buffers; |
1145 | + for (auto& buffer : buffers) |
1146 | + buffer = std::make_unique<TrackedBuffer>(connection, counter); |
1147 | + { |
1148 | + auto const stall = mir::raii::paired_calls( |
1149 | + [this] { stall_compositor = true; }, |
1150 | + [this] { stall_compositor = false; }); |
1151 | + for (auto& b : buffers) |
1152 | + b->submit_to(window.chain()); |
1153 | + for (auto &b : buffers) |
1154 | + EXPECT_FALSE(b->is_ready()); |
1155 | + } |
1156 | + for (auto i = 0u; i < buffers.size() - 1; i++) |
1157 | + EXPECT_TRUE(buffers[i]->wait_ready(5s)); |
1158 | +} |
1159 | + |
1160 | +TEST_F(PresentationChain, mailbox_looks_correct_from_client_perspective) |
1161 | +{ |
1162 | + auto const stall = mir::raii::paired_calls( |
1163 | + [this] { stall_compositor = true; }, |
1164 | + [this] { stall_compositor = false; }); |
1165 | + SurfaceWithChainFromStart window( |
1166 | + connection, mir_present_mode_mailbox, size, pf); |
1167 | + |
1168 | + int const num_buffers = 5; |
1169 | + |
1170 | + std::atomic<unsigned int> counter{ 0u }; |
1171 | + std::array<std::unique_ptr<TrackedBuffer>, num_buffers> buffers; |
1172 | + for (auto& buffer : buffers) |
1173 | + buffer = std::make_unique<TrackedBuffer>(connection, counter); |
1174 | + |
1175 | + for(auto i = 0u; i < buffers.size(); i++) |
1176 | + { |
1177 | + buffers[i]->submit_to(window.chain()); |
1178 | + if (i > 0) |
1179 | + EXPECT_TRUE(buffers[i-1]->wait_ready(5s)); |
1180 | + } |
1181 | + |
1182 | + for(auto i = 0u; i < num_buffers - 1; i++) |
1183 | + EXPECT_TRUE(buffers[i]->is_ready()); |
1184 | + EXPECT_FALSE(buffers[4]->is_ready()); |
1185 | +} |
1186 | + |
1187 | +TEST_F(PresentationChain, fifo_queues_clears_out_on_transition_to_mailbox) |
1188 | +{ |
1189 | + SurfaceWithChainFromStart window( |
1190 | + connection, mir_present_mode_fifo, size, pf); |
1191 | + int const num_buffers = 5; |
1192 | + std::atomic<unsigned int> counter{ 0u }; |
1193 | + std::array<std::unique_ptr<TrackedBuffer>, num_buffers> buffers; |
1194 | + for (auto& buffer : buffers) |
1195 | + buffer = std::make_unique<TrackedBuffer>(connection, counter); |
1196 | + |
1197 | + auto const stall = mir::raii::paired_calls( |
1198 | + [this] { stall_compositor = true; }, |
1199 | + [this] { stall_compositor = false; }); |
1200 | + for (auto& b : buffers) |
1201 | + b->submit_to(window.chain()); |
1202 | + for (auto &b : buffers) |
1203 | + EXPECT_FALSE(b->is_ready()); |
1204 | + |
1205 | + mir_presentation_chain_set_mode(window.chain(), mir_present_mode_mailbox); |
1206 | + |
1207 | + for (auto i = 0u; i < buffers.size() - 1; i++) |
1208 | + EXPECT_TRUE(buffers[i]->wait_ready(5s)); |
1209 | +} |
1210 | |
1211 | === modified file 'tests/unit-tests/compositor/test_multi_monitor_arbiter.cpp' |
1212 | --- tests/unit-tests/compositor/test_multi_monitor_arbiter.cpp 2017-01-18 02:29:37 +0000 |
1213 | +++ tests/unit-tests/compositor/test_multi_monitor_arbiter.cpp 2017-03-22 01:44:09 +0000 |
1214 | @@ -538,6 +538,23 @@ |
1215 | EXPECT_THAT(b3->id(), Eq(buffers[2]->id())); |
1216 | } |
1217 | |
1218 | +TEST_F(MultiMonitorArbiter, checks_if_buffer_is_valid_after_clean_onscreen_buffer) |
1219 | +{ |
1220 | + int comp_id1{0}; |
1221 | + |
1222 | + schedule.set_schedule({buffers[0], buffers[1], buffers[2], buffers[3]}); |
1223 | + |
1224 | + arbiter.advance_schedule(); |
1225 | + arbiter.advance_schedule(); |
1226 | + arbiter.advance_schedule(); |
1227 | + arbiter.advance_schedule(); |
1228 | + |
1229 | + auto b1 = arbiter.compositor_acquire(&comp_id1); |
1230 | + |
1231 | + EXPECT_THAT(b1->id(), Eq(buffers[3]->id())); |
1232 | + EXPECT_THAT(b1->size(), Eq(buffers[3]->size())); |
1233 | +} |
1234 | + |
1235 | TEST_F(MultiMonitorArbiter, releases_buffer_on_destruction) |
1236 | { |
1237 | mc::MultiMonitorArbiter arbiter{guarantee, mt::fake_shared(mock_map), mt::fake_shared(schedule)}; |
1238 | |
1239 | === modified file 'tests/unit-tests/frontend/test_session_mediator.cpp' |
1240 | --- tests/unit-tests/frontend/test_session_mediator.cpp 2017-02-08 20:22:59 +0000 |
1241 | +++ tests/unit-tests/frontend/test_session_mediator.cpp 2017-03-22 01:44:09 +0000 |
1242 | @@ -706,6 +706,28 @@ |
1243 | mediator.modify_surface(&mods, &null, null_callback.get()); |
1244 | } |
1245 | |
1246 | +//LP: #1670876 |
1247 | +MATCHER(InputRegionSet, "input region set") |
1248 | +{ |
1249 | + return arg.input_shape.is_set(); |
1250 | +} |
1251 | +TEST_F(SessionMediator, does_not_reset_input_region_if_region_not_set) |
1252 | +{ |
1253 | + using namespace testing; |
1254 | + mp::Void null; |
1255 | + mp::SurfaceModifications mods; |
1256 | + |
1257 | + mediator.connect(&connect_parameters, &connection, null_callback.get()); |
1258 | + mediator.create_surface(&surface_parameters, &surface_response, null_callback.get()); |
1259 | + mods.mutable_surface_id()->set_value(surface_response.id().value()); |
1260 | + mods.mutable_surface_specification()->set_min_width(1); |
1261 | + |
1262 | + EXPECT_CALL(*shell, modify_surface(_, |
1263 | + mf::SurfaceId{surface_response.id().value()}, Not(InputRegionSet()))); |
1264 | + |
1265 | + mediator.modify_surface(&mods, &null, null_callback.get()); |
1266 | +} |
1267 | + |
1268 | TEST_F(SessionMediator, allocates_software_buffers_from_the_session) |
1269 | { |
1270 | using namespace testing; |
1271 | |
1272 | === modified file 'tests/unit-tests/platforms/mesa/client/test_client_platform.cpp' |
1273 | --- tests/unit-tests/platforms/mesa/client/test_client_platform.cpp 2017-02-02 18:25:05 +0000 |
1274 | +++ tests/unit-tests/platforms/mesa/client/test_client_platform.cpp 2017-03-22 01:44:09 +0000 |
1275 | @@ -19,9 +19,12 @@ |
1276 | #include "mir/client_platform.h" |
1277 | #include "mir/shared_library.h" |
1278 | #include "mir/raii.h" |
1279 | +#include "src/platforms/mesa/client/buffer_file_ops.h" |
1280 | +#include "src/platforms/mesa/client/client_buffer.h" |
1281 | #include "src/platforms/mesa/client/mesa_native_display_container.h" |
1282 | #include "src/client/rpc/mir_basic_rpc_channel.h" |
1283 | #include "src/client/mir_connection.h" |
1284 | +#include "src/client/buffer.h" |
1285 | #include "mir_test_framework/client_platform_factory.h" |
1286 | #include "mir/test/doubles/mock_egl.h" |
1287 | #include "mir/test/doubles/mock_egl_native_surface.h" |
1288 | @@ -50,6 +53,12 @@ |
1289 | |
1290 | namespace |
1291 | { |
1292 | +struct StubOps : mclm::BufferFileOps |
1293 | +{ |
1294 | + int close(int) const override { return 0; } |
1295 | + void* map(int, off_t, size_t) const override { return nullptr; } |
1296 | + void unmap(void*, size_t) const override {} |
1297 | +}; |
1298 | |
1299 | struct StubClientContext : mcl::ClientContext |
1300 | { |
1301 | @@ -98,10 +107,28 @@ |
1302 | return platform->platform_operation(request_msg.get()); |
1303 | } |
1304 | |
1305 | + std::shared_ptr<MirBufferPackage> make_pkg() |
1306 | + { |
1307 | + auto pkg = std::make_shared<MirBufferPackage>(); |
1308 | + pkg->width = width; |
1309 | + pkg->height = height; |
1310 | + pkg->stride = stride; |
1311 | + pkg->fd_items = 1; |
1312 | + pkg->fd[0] = fake_fd; |
1313 | + pkg->data_items = 0; |
1314 | + return pkg; |
1315 | + } |
1316 | + |
1317 | StubClientContext client_context; |
1318 | std::shared_ptr<mir::client::ClientPlatform> platform = |
1319 | mtf::create_mesa_client_platform(&client_context); |
1320 | mir::test::doubles::MockEGL mock_egl; |
1321 | + int fake_fd = 11; |
1322 | + int width = 23; |
1323 | + int height = 230; |
1324 | + int stride = 81290; |
1325 | + int flags = GBM_BO_USE_RENDERING; |
1326 | + int pf = GBM_FORMAT_ABGR8888; |
1327 | }; |
1328 | |
1329 | } |
1330 | @@ -203,16 +230,14 @@ |
1331 | EXPECT_NE(nullptr, egl_native_window); |
1332 | } |
1333 | |
1334 | -TEST_F(MesaClientPlatformTest, can_allocate_buffer) |
1335 | +TEST_F(MesaClientPlatformTest, can_allocate_buffer_v1) |
1336 | { |
1337 | using namespace std::literals::chrono_literals; |
1338 | |
1339 | mtd::StubConnectionConfiguration conf(platform); |
1340 | MirConnection connection(conf); |
1341 | -#pragma GCC diagnostic push |
1342 | -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
1343 | - mir_wait_for(connection.connect("", [](MirConnection*, void*){}, nullptr)); |
1344 | -#pragma GCC diagnostic pop |
1345 | + if (auto wh = connection.connect("", [](MirConnection*, void*){}, nullptr)) |
1346 | + wh->wait_for_all(); |
1347 | |
1348 | int width = 32; |
1349 | int height = 90; |
1350 | @@ -230,6 +255,73 @@ |
1351 | EXPECT_THAT(conf.channel->channel_call_count, Eq(call_count + 1)); |
1352 | } |
1353 | |
1354 | +TEST_F(MesaClientPlatformTest, can_allocate_buffer_v2) |
1355 | +{ |
1356 | + using namespace std::literals::chrono_literals; |
1357 | + |
1358 | + mtd::StubConnectionConfiguration conf(platform); |
1359 | + MirConnection connection(conf); |
1360 | + if (auto wh = connection.connect("", [](MirConnection*, void*){}, nullptr)) |
1361 | + wh->wait_for_all(); |
1362 | + |
1363 | + int width = 32; |
1364 | + int height = 90; |
1365 | + auto ext = static_cast<MirExtensionGbmBufferV1*>( |
1366 | + platform->request_interface("mir_extension_gbm_buffer", 2)); |
1367 | + ASSERT_THAT(ext, Ne(nullptr)); |
1368 | + ASSERT_THAT(ext->allocate_buffer_gbm, Ne(nullptr)); |
1369 | + |
1370 | + auto call_count = conf.channel->channel_call_count; |
1371 | + ext->allocate_buffer_gbm( |
1372 | + &connection, width, height, pf, flags, |
1373 | + [] (::MirBuffer*, void*) {}, nullptr); |
1374 | + EXPECT_THAT(conf.channel->channel_call_count, Eq(call_count + 1)); |
1375 | +} |
1376 | + |
1377 | +TEST_F(MesaClientPlatformTest, shm_buffer_is_not_gbm_compatible) |
1378 | +{ |
1379 | + mtd::StubConnectionConfiguration conf(platform); |
1380 | + MirConnection connection(conf); |
1381 | + if (auto wh = connection.connect("", [](MirConnection*, void*){}, nullptr)) |
1382 | + wh->wait_for_all(); |
1383 | + auto ext = static_cast<MirExtensionGbmBufferV2*>( |
1384 | + platform->request_interface("mir_extension_gbm_buffer", 2)); |
1385 | + ASSERT_THAT(ext, Ne(nullptr)); |
1386 | + ASSERT_THAT(ext->is_gbm_importable, Ne(nullptr)); |
1387 | + |
1388 | + auto client_buffer = std::make_shared<mclm::ClientBuffer>( |
1389 | + std::make_shared<StubOps>(), make_pkg(), geom::Size{width, height}, mir_pixel_format_rgb_888); |
1390 | + mcl::Buffer mirbuffer(nullptr, nullptr, 0, client_buffer, nullptr, mir_buffer_usage_software); |
1391 | + EXPECT_FALSE(ext->is_gbm_importable(reinterpret_cast<MirBuffer*>(&mirbuffer))); |
1392 | +} |
1393 | + |
1394 | +TEST_F(MesaClientPlatformTest, bo_buffer_is_gbm_compatible) |
1395 | +{ |
1396 | + mtd::StubConnectionConfiguration conf(platform); |
1397 | + MirConnection connection(conf); |
1398 | + if (auto wh = connection.connect("", [](MirConnection*, void*){}, nullptr)) |
1399 | + wh->wait_for_all(); |
1400 | + auto ext = static_cast<MirExtensionGbmBufferV2*>( |
1401 | + platform->request_interface("mir_extension_gbm_buffer", 2)); |
1402 | + auto client_buffer = std::make_shared<mclm::ClientBuffer>( |
1403 | + std::make_shared<StubOps>(), make_pkg(), geom::Size{width, height}, pf, flags); |
1404 | + mcl::Buffer mirbuffer(nullptr, nullptr, 0, client_buffer, nullptr, mir_buffer_usage_hardware); |
1405 | + |
1406 | + ASSERT_THAT(ext, Ne(nullptr)); |
1407 | + ASSERT_THAT(ext->is_gbm_importable, Ne(nullptr)); |
1408 | + ASSERT_THAT(ext->fd, Ne(nullptr)); |
1409 | + ASSERT_THAT(ext->stride, Ne(nullptr)); |
1410 | + ASSERT_THAT(ext->format, Ne(nullptr)); |
1411 | + ASSERT_THAT(ext->flags, Ne(nullptr)); |
1412 | + ASSERT_THAT(ext->age, Ne(nullptr)); |
1413 | + EXPECT_TRUE(ext->is_gbm_importable(reinterpret_cast<MirBuffer*>(&mirbuffer))); |
1414 | + EXPECT_THAT(ext->fd(reinterpret_cast<MirBuffer*>(&mirbuffer)), Eq(fake_fd)); |
1415 | + EXPECT_THAT(ext->stride(reinterpret_cast<MirBuffer*>(&mirbuffer)), Eq(stride)); |
1416 | + EXPECT_THAT(ext->format(reinterpret_cast<MirBuffer*>(&mirbuffer)), Eq(pf)); |
1417 | + EXPECT_THAT(ext->flags(reinterpret_cast<MirBuffer*>(&mirbuffer)), Eq(flags)); |
1418 | + EXPECT_THAT(ext->age(reinterpret_cast<MirBuffer*>(&mirbuffer)), Eq(0)); |
1419 | +} |
1420 | + |
1421 | TEST_F(MesaClientPlatformTest, converts_gbm_format_correctly) |
1422 | { |
1423 | EXPECT_THAT(platform->native_format_for(mir_pixel_format_argb_8888), Eq(GBM_FORMAT_ARGB8888)); |
1424 | |
1425 | === modified file 'tests/unit-tests/platforms/nested/mir_display_configuration_builder.cpp' |
1426 | --- tests/unit-tests/platforms/nested/mir_display_configuration_builder.cpp 2017-01-18 13:59:18 +0000 |
1427 | +++ tests/unit-tests/platforms/nested/mir_display_configuration_builder.cpp 2017-03-22 01:44:09 +0000 |
1428 | @@ -81,6 +81,7 @@ |
1429 | output->set_power_mode(mir_power_mode_on); |
1430 | output->set_orientation(mir_orientation_normal); |
1431 | output->set_edid(valid_edid, sizeof(valid_edid)); |
1432 | + output->set_subpixel_arrangement(mir_subpixel_arrangement_horizontal_rgb); |
1433 | |
1434 | return std::make_shared<MirDisplayConfig>(conf); |
1435 | } |
1436 | @@ -121,6 +122,7 @@ |
1437 | output->set_power_mode(mir_power_mode_on); |
1438 | output->set_orientation(mir_orientation_normal); |
1439 | output->set_edid(valid_edid, sizeof(valid_edid)); |
1440 | + output->set_subpixel_arrangement(mir_subpixel_arrangement_horizontal_rgb); |
1441 | } |
1442 | |
1443 | return std::make_shared<MirDisplayConfig>(conf); |
1444 | |
1445 | === modified file 'tests/unit-tests/platforms/nested/test_nested_display_configuration.cpp' |
1446 | --- tests/unit-tests/platforms/nested/test_nested_display_configuration.cpp 2017-01-18 13:59:18 +0000 |
1447 | +++ tests/unit-tests/platforms/nested/test_nested_display_configuration.cpp 2017-03-22 01:44:09 +0000 |
1448 | @@ -169,6 +169,22 @@ |
1449 | EXPECT_NE(0, matches); |
1450 | } |
1451 | |
1452 | +TEST(NestedDisplayConfiguration, includes_host_subpixel_arrangement) |
1453 | +{ |
1454 | + auto host_conf = mt::build_trivial_configuration(); |
1455 | + auto const output = mir_display_config_get_output(host_conf.get(), 0); |
1456 | + auto host_subpixel = mir_output_get_subpixel_arrangement(output); |
1457 | + |
1458 | + mgn::NestedDisplayConfiguration nested_conf(host_conf); |
1459 | + int matches = 0; |
1460 | + nested_conf.for_each_output([&](mg::DisplayConfigurationOutput const& output) |
1461 | + { |
1462 | + ASSERT_EQ(host_subpixel, output.subpixel_arrangement); |
1463 | + ++matches; |
1464 | + }); |
1465 | + EXPECT_NE(0, matches); |
1466 | +} |
1467 | + |
1468 | TEST(NestedDisplayConfiguration, clone_matches_original_configuration) |
1469 | { |
1470 | mgn::NestedDisplayConfiguration config(mt::build_non_trivial_configuration()); |
PASSED: Continuous integration, rev:4041 /mir-jenkins. ubuntu. com/job/ mir-ubuntu- ci/95/ /mir-jenkins. ubuntu. com/job/ build-mir/ 4274 /mir-jenkins. ubuntu. com/job/ build-0- fetch/4361 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= vivid+overlay/ 4351 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial+ overlay/ 4351 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= zesty/4351 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= zesty/4301 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= zesty/4301/ artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4301 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4301/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= zesty/4301 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= zesty/4301/ artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 4301 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 4301/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 4301 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 4301/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4301 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4301/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: 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-ubuntu- ci/95/rebuild
https:/