Merge lp:~mir-team/mir/trunk-0.1.5 into lp:mir/0.1
- trunk-0.1.5
- Merge into trusty
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 1175 | ||||
Proposed branch: | lp:~mir-team/mir/trunk-0.1.5 | ||||
Merge into: | lp:mir/0.1 | ||||
Diff against target: |
5417 lines (+1934/-662) 121 files modified
CMakeLists.txt (+1/-1) debian/changelog (+49/-0) debian/control (+4/-4) debian/libmirclient7.install (+1/-1) debian/libmirserver15.install (+1/-1) debian/mir-utils.install (+1/-0) examples/demo-inprocess-surface-client/inprocess_egl_client.cpp (+4/-2) examples/render_surfaces.cpp (+3/-2) include/platform/mir/graphics/display.h (+2/-2) include/server/mir/compositor/buffer_stream.h (+1/-1) include/server/mir/default_server_configuration.h (+3/-0) include/server/mir/frontend/message_processor.h (+15/-1) include/server/mir/frontend/screencast.h (+55/-0) include/server/mir/frontend/shell.h (+8/-2) include/server/mir/frontend/surface.h (+8/-1) include/server/mir/frontend/template_protobuf_message_processor.h (+1/-3) include/server/mir/shell/session.h (+6/-5) include/shared/mir/int_wrapper.h (+16/-18) include/test/mir_test_doubles/mock_buffer_bundle.h (+1/-1) include/test/mir_test_doubles/mock_buffer_stream.h (+1/-1) include/test/mir_test_doubles/mock_display.h (+1/-1) include/test/mir_test_doubles/mock_fb_hal_device.h (+1/-3) include/test/mir_test_doubles/mock_frontend_surface.h (+1/-1) include/test/mir_test_doubles/mock_hwc_composer_device_1.h (+9/-1) include/test/mir_test_doubles/mock_screencast.h (+50/-0) include/test/mir_test_doubles/mock_shell.h (+6/-3) include/test/mir_test_doubles/mock_shell_session.h (+2/-1) include/test/mir_test_doubles/null_display.h (+4/-2) include/test/mir_test_doubles/null_screencast.h (+52/-0) include/test/mir_test_doubles/stub_buffer_stream.h (+2/-2) include/test/mir_test_doubles/stub_display_configuration.h (+7/-0) include/test/mir_test_doubles/stub_ipc_factory.h (+2/-2) include/test/mir_test_doubles/stub_shell.h (+1/-1) include/test/mir_test_doubles/stub_shell_session.h (+6/-1) src/client/CMakeLists.txt (+2/-2) src/client/mir_screencast.cpp (+13/-3) src/client/mir_screencast.h (+1/-0) src/client/mir_screencast_api.cpp (+15/-8) src/client/rpc/mir_socket_rpc_channel.cpp (+7/-0) src/platform/graphics/android/android_alloc_adaptor.cpp (+1/-1) src/platform/graphics/android/android_display.cpp (+4/-2) src/platform/graphics/android/android_display.h (+2/-2) src/platform/graphics/android/android_platform.cpp (+1/-3) src/platform/graphics/android/display_buffer.h (+0/-1) src/platform/graphics/android/hwc_device.cpp (+4/-7) src/platform/graphics/android/hwc_device.h (+2/-5) src/platform/graphics/android/hwc_layers.cpp (+6/-2) src/platform/graphics/android/internal_client_window.cpp (+6/-1) src/platform/graphics/android/output_builder.cpp (+8/-12) src/platform/graphics/android/output_builder.h (+1/-2) src/platform/graphics/android/resource_factory.cpp (+3/-1) src/platform/graphics/android/server_render_window.cpp (+6/-1) src/platform/graphics/mesa/display.cpp (+4/-2) src/platform/graphics/mesa/display.h (+4/-4) src/server/CMakeLists.txt (+1/-1) src/server/compositor/buffer_bundle.h (+1/-1) src/server/compositor/buffer_stream_surfaces.cpp (+5/-4) src/server/compositor/buffer_stream_surfaces.h (+1/-1) src/server/compositor/default_configuration.cpp (+32/-0) src/server/compositor/switching_bundle.cpp (+2/-2) src/server/compositor/switching_bundle.h (+1/-1) src/server/display_server.cpp (+5/-2) src/server/frontend/default_configuration.cpp (+15/-6) src/server/frontend/protobuf_ipc_factory.h (+7/-2) src/server/frontend/protobuf_message_processor.cpp (+81/-5) src/server/frontend/protobuf_message_processor.h (+3/-1) src/server/frontend/protobuf_session_creator.cpp (+2/-2) src/server/frontend/session_mediator.cpp (+144/-81) src/server/frontend/session_mediator.h (+24/-3) src/server/frontend/surface.cpp (+25/-1) src/server/graphics/nested/nested_display.cpp (+6/-2) src/server/graphics/nested/nested_display.h (+1/-1) src/server/graphics/offscreen/display.cpp (+4/-2) src/server/graphics/offscreen/display.h (+3/-3) src/server/scene/application_session.cpp (+8/-1) src/server/scene/application_session.h (+4/-1) src/server/scene/basic_surface.cpp (+3/-3) src/server/scene/basic_surface.h (+1/-1) src/server/scene/session_manager.cpp (+6/-4) src/server/scene/session_manager.h (+5/-2) src/server/scene/surface_impl.cpp (+2/-2) src/server/scene/surface_impl.h (+1/-1) src/utils/CMakeLists.txt (+9/-0) src/utils/screencast.cpp (+313/-0) tests/acceptance-tests/test_client_screencast.cpp (+45/-133) tests/acceptance-tests/test_display_configuration.cpp (+6/-4) tests/acceptance-tests/test_protobuf.cpp (+1/-1) tests/acceptance-tests/test_surfaces_with_output_id.cpp (+4/-2) tests/draw/android_graphics.cpp (+0/-22) tests/integration-tests/client/CMakeLists.txt (+6/-1) tests/integration-tests/client/test_screencast.cpp (+191/-0) tests/integration-tests/compositor/test_buffer_stream.cpp (+47/-21) tests/integration-tests/compositor/test_swapping_swappers.cpp (+27/-2) tests/integration-tests/graphics/android/test_buffer_integration.cpp (+25/-1) tests/integration-tests/graphics/android/test_display_integration.cpp (+12/-37) tests/integration-tests/graphics/android/test_internal_client.cpp (+3/-2) tests/integration-tests/test_display_server_main_loop_events.cpp (+4/-2) tests/integration-tests/test_session.cpp (+3/-2) tests/integration-tests/test_session_manager.cpp (+6/-6) tests/integration-tests/test_swapinterval.cpp (+15/-7) tests/mir_test_framework/stubbed_server_configuration.cpp (+5/-3) tests/unit-tests/client/test_mir_screencast.cpp (+52/-2) tests/unit-tests/compositor/test_buffer_stream.cpp (+39/-9) tests/unit-tests/compositor/test_switching_bundle.cpp (+58/-30) tests/unit-tests/compositor/test_temporary_buffers.cpp (+2/-2) tests/unit-tests/frontend/test_session_mediator.cpp (+67/-14) tests/unit-tests/frontend/test_session_mediator_android.cpp (+3/-2) tests/unit-tests/frontend/test_session_mediator_mesa.cpp (+4/-3) tests/unit-tests/frontend/test_socket_session.cpp (+1/-1) tests/unit-tests/graphics/android/test_android_alloc_adaptor.cpp (+1/-1) tests/unit-tests/graphics/android/test_buffer_tex_bind.cpp (+14/-7) tests/unit-tests/graphics/android/test_hwc_common_device.cpp (+3/-1) tests/unit-tests/graphics/android/test_hwc_device.cpp (+25/-7) tests/unit-tests/graphics/android/test_output_builder.cpp (+7/-7) tests/unit-tests/graphics/mesa/test_display_configuration.cpp (+2/-2) tests/unit-tests/scene/test_application_session.cpp (+91/-34) tests/unit-tests/scene/test_session_manager.cpp (+8/-8) tests/unit-tests/scene/test_surface.cpp (+19/-20) tests/unit-tests/scene/test_surface_impl.cpp (+2/-1) tests/unit-tests/scene/test_surface_stack.cpp (+1/-1) tests/unit-tests/shell/test_graphics_display_layout.cpp (+5/-5) |
||||
To merge this branch: | bzr merge lp:~mir-team/mir/trunk-0.1.5 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
kevin gunn (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Daniel van Vugt | Approve | ||
Review via email: mp+205432@code.launchpad.net |
Commit message
Latest upstream release of Mir0.1.5 (lp:~mir-team/mir/development-branch r1377)
plus upcoming enhancement:
https:/
Description of the change
.
PS Jenkins bot (ps-jenkins) wrote : | # |
Daniel van Vugt (vanvugt) wrote : | # |
I figured out what this branch is composed of and it's not r1372...
1. Start with dev r1377, but there's still about 1000 lines different.
2. Manually patch in https:/
3. Add an unexplained change to debian/rules
4. debian/changelog additions.
I think we need to do this more cleanly so we know what's actually going in to the merge. Otherwise there's no accurate historical log of what has changed and why.
I suggest starting dropping #2 and proposing it separately, directly to lp:mir with the trunk-0.15 branch as prereq. Unless it lands in development-branch beforehand, which would be cleaner. I also would like to know where #3 (debian/rules change) has come from, and some documentation of that change.
It would reflect badly on mir-team if we review changes to development-branch carefully, but don't do the same for lp:mir and let in undocumented changes.
Daniel van Vugt (vanvugt) wrote : | # |
BTW, if Ubuntu is desperate for it then you can always merge fix-1276704 directly to lp:mir without review. But it could become a major conflict headache if we find it needs fixing before it hits development-branch. So best to let it land in development-branch first.
Daniel van Vugt (vanvugt) wrote : | # |
Oooh, the mysterious debian/rules change #3 comes from the destination lp:mir. We'll have to revisit that...
I'll track issue #2 manually in LP and do an upstream Mir 0.1.5 release from r1377 to keep things as consistent as possible. So approved!
Daniel van Vugt (vanvugt) wrote : | # |
I've made major enhancements to the changelog text. Needs review again.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1178
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1181
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
kevin gunn (kgunn72) wrote : | # |
thanks for the clean up, looks good (i see now how you want to handle tag vs promotion)
Kevin DuBois (kdub) wrote : | # |
Please make sure not to pick up rev1383 because it contains a nexus 10 bug: https:/
Kevin DuBois (kdub) wrote : | # |
> Please make sure not to pick up rev1383 because it contains a nexus 10 bug:
> https:/
fixed in lp:mir/devel rev 1388
Preview Diff
1 | === modified file 'CMakeLists.txt' | |||
2 | --- CMakeLists.txt 2014-01-22 08:32:55 +0000 | |||
3 | +++ CMakeLists.txt 2014-02-10 09:00:06 +0000 | |||
4 | @@ -28,7 +28,7 @@ | |||
5 | 28 | 28 | ||
6 | 29 | set(MIR_VERSION_MAJOR 0) | 29 | set(MIR_VERSION_MAJOR 0) |
7 | 30 | set(MIR_VERSION_MINOR 1) | 30 | set(MIR_VERSION_MINOR 1) |
9 | 31 | set(MIR_VERSION_PATCH 4) | 31 | set(MIR_VERSION_PATCH 5) |
10 | 32 | 32 | ||
11 | 33 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) | 33 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
12 | 34 | 34 | ||
13 | 35 | 35 | ||
14 | === modified file 'debian/changelog' | |||
15 | --- debian/changelog 2014-02-04 14:49:07 +0000 | |||
16 | +++ debian/changelog 2014-02-10 09:00:06 +0000 | |||
17 | @@ -1,3 +1,52 @@ | |||
18 | 1 | mir (0.1.5-0ubuntu1) UNRELEASED; urgency=medium | ||
19 | 2 | |||
20 | 3 | * Cherry-picked from future release 0.1.6: | ||
21 | 4 | - frontend, shell: provide the client process ID in the shell::Session | ||
22 | 5 | interface (LP: #1276704) | ||
23 | 6 | * New upstream release 0.1.5 (https://launchpad.net/mir/+milestone/0.1.5) | ||
24 | 7 | - mirclient ABI bumped to 7 | ||
25 | 8 | - mirserver ABI bumped to 15 | ||
26 | 9 | - Refactoring to support client-controled RPC. | ||
27 | 10 | - Add an translucent server example (use sparingly, this will kill | ||
28 | 11 | performance!) | ||
29 | 12 | - Add workaround for Qualcomm Snapdragon 8960 driver bug. | ||
30 | 13 | - android-input: Improve debug output | ||
31 | 14 | - Screen rotation support half done (rotation of the screen works but input | ||
32 | 15 | rotation not implemented yet). | ||
33 | 16 | - Add groundwork for overlay support to take better advantage of mobile | ||
34 | 17 | hardware features and optimize composition in future. | ||
35 | 18 | - Add support for HWC 1.2 (Android 4.4) | ||
36 | 19 | - Add groundwork for screencasting (screen recording). | ||
37 | 20 | - Optimized surface resizing, significantly reducing event flooding for | ||
38 | 21 | some input configurations like touch. | ||
39 | 22 | - Bugs fixed: | ||
40 | 23 | . Surfaces no longer visible at all on Nexus 10 (LP: #1271853) | ||
41 | 24 | . mir nested server failure: what(): error binding buffer to texture | ||
42 | 25 | (LP: #1272041) | ||
43 | 26 | . Unity does not process events from evdev device created before unity is | ||
44 | 27 | restarted (autopilot tests) (LP: #1238417) | ||
45 | 28 | . mir_unit_tests can't run on touch images any more (missing | ||
46 | 29 | libumockdev.so.0) (LP: #1271434) | ||
47 | 30 | . chmod 777 /tmp/mir_socket is no longer sufficient for non-root clients | ||
48 | 31 | to connect to a root server (LP: #1272143) | ||
49 | 32 | . Nexus7(2013) flo framerate maxes out at 30fps (LP: #1274189) | ||
50 | 33 | . libmirserver user is unable to #include | ||
51 | 34 | <mir/frontend/template_protobuf_message_processor.h> (LP: #1276162) | ||
52 | 35 | . libmirclient user cannot "#include <mir/client/private.h>" | ||
53 | 36 | (LP: #1276565) | ||
54 | 37 | . AndroidInternalClient.internal_client_creation_and_use hangs on Nexus | ||
55 | 38 | 10 (LP: #1270685) | ||
56 | 39 | . Tests that use the InProcessServer bind the default socket file | ||
57 | 40 | (LP: #1271604) | ||
58 | 41 | . BasicConnector threads exit immediately (LP: #1271655) | ||
59 | 42 | . Integration tests TestClientIPCRender.test_accelerated_render fails on | ||
60 | 43 | Galaxy Nexus and Nexus4 (LP: #1272597) | ||
61 | 44 | . Android backend unit-tests FTBS on amd64 (LP: #1276621) | ||
62 | 45 | . Erroneous use of last_consumed in SwitchingBundle::compositor_acquire | ||
63 | 46 | (LP: #1270964) | ||
64 | 47 | |||
65 | 48 | -- Kevin Gunn <kevin.gunn@canonical.com> Thu, 06 Feb 2014 10:54:17 -0600 | ||
66 | 49 | |||
67 | 1 | mir (0.1.4+14.04.20140204-0ubuntu1) trusty; urgency=medium | 50 | mir (0.1.4+14.04.20140204-0ubuntu1) trusty; urgency=medium |
68 | 2 | 51 | ||
69 | 3 | [ Daniel van Vugt ] | 52 | [ Daniel van Vugt ] |
70 | 4 | 53 | ||
71 | === modified file 'debian/control' | |||
72 | --- debian/control 2014-01-23 08:21:21 +0000 | |||
73 | +++ debian/control 2014-02-10 09:00:06 +0000 | |||
74 | @@ -70,7 +70,7 @@ | |||
75 | 70 | . | 70 | . |
76 | 71 | Contains the protocol's definition files. | 71 | Contains the protocol's definition files. |
77 | 72 | 72 | ||
79 | 73 | Package: libmirserver14 | 73 | Package: libmirserver15 |
80 | 74 | Section: libs | 74 | Section: libs |
81 | 75 | Architecture: i386 amd64 armhf arm64 | 75 | Architecture: i386 amd64 armhf arm64 |
82 | 76 | Multi-Arch: same | 76 | Multi-Arch: same |
83 | @@ -116,7 +116,7 @@ | |||
84 | 116 | Architecture: i386 amd64 armhf arm64 | 116 | Architecture: i386 amd64 armhf arm64 |
85 | 117 | Multi-Arch: same | 117 | Multi-Arch: same |
86 | 118 | Pre-Depends: ${misc:Pre-Depends} | 118 | Pre-Depends: ${misc:Pre-Depends} |
88 | 119 | Depends: libmirserver14 (= ${binary:Version}), | 119 | Depends: libmirserver15 (= ${binary:Version}), |
89 | 120 | libmirprotobuf-dev (= ${binary:Version}), | 120 | libmirprotobuf-dev (= ${binary:Version}), |
90 | 121 | mircommon-dev (= ${binary:Version}), | 121 | mircommon-dev (= ${binary:Version}), |
91 | 122 | libglm-dev, | 122 | libglm-dev, |
92 | @@ -128,7 +128,7 @@ | |||
93 | 128 | . | 128 | . |
94 | 129 | Contains header files required to build Mir servers. | 129 | Contains header files required to build Mir servers. |
95 | 130 | 130 | ||
97 | 131 | Package: libmirclient6 | 131 | Package: libmirclient7 |
98 | 132 | Section: libs | 132 | Section: libs |
99 | 133 | Architecture: i386 amd64 armhf arm64 | 133 | Architecture: i386 amd64 armhf arm64 |
100 | 134 | Multi-Arch: same | 134 | Multi-Arch: same |
101 | @@ -146,7 +146,7 @@ | |||
102 | 146 | Architecture: i386 amd64 armhf arm64 | 146 | Architecture: i386 amd64 armhf arm64 |
103 | 147 | Multi-Arch: same | 147 | Multi-Arch: same |
104 | 148 | Pre-Depends: ${misc:Pre-Depends} | 148 | Pre-Depends: ${misc:Pre-Depends} |
106 | 149 | Depends: libmirclient6 (= ${binary:Version}), | 149 | Depends: libmirclient7 (= ${binary:Version}), |
107 | 150 | libmirprotobuf-dev (= ${binary:Version}), | 150 | libmirprotobuf-dev (= ${binary:Version}), |
108 | 151 | mircommon-dev (= ${binary:Version}), | 151 | mircommon-dev (= ${binary:Version}), |
109 | 152 | ${misc:Depends}, | 152 | ${misc:Depends}, |
110 | 153 | 153 | ||
111 | === renamed file 'debian/libmirclient6.install' => 'debian/libmirclient7.install' | |||
112 | --- debian/libmirclient6.install 2014-01-17 06:22:01 +0000 | |||
113 | +++ debian/libmirclient7.install 2014-02-10 09:00:06 +0000 | |||
114 | @@ -1,1 +1,1 @@ | |||
116 | 1 | usr/lib/*/libmirclient.so.6 | 1 | usr/lib/*/libmirclient.so.7 |
117 | 2 | 2 | ||
118 | === renamed file 'debian/libmirserver14.install' => 'debian/libmirserver15.install' | |||
119 | --- debian/libmirserver14.install 2014-01-17 06:22:01 +0000 | |||
120 | +++ debian/libmirserver15.install 2014-02-10 09:00:06 +0000 | |||
121 | @@ -1,1 +1,1 @@ | |||
123 | 1 | usr/lib/*/libmirserver.so.14 | 1 | usr/lib/*/libmirserver.so.15 |
124 | 2 | 2 | ||
125 | === modified file 'debian/mir-utils.install' | |||
126 | --- debian/mir-utils.install 2014-01-10 05:48:41 +0000 | |||
127 | +++ debian/mir-utils.install 2014-02-10 09:00:06 +0000 | |||
128 | @@ -1,2 +1,3 @@ | |||
129 | 1 | usr/bin/mirping | 1 | usr/bin/mirping |
130 | 2 | usr/bin/mirout | 2 | usr/bin/mirout |
131 | 3 | usr/bin/mirscreencast | ||
132 | 3 | 4 | ||
133 | === modified file 'examples/demo-inprocess-surface-client/inprocess_egl_client.cpp' | |||
134 | --- examples/demo-inprocess-surface-client/inprocess_egl_client.cpp 2014-01-13 06:12:33 +0000 | |||
135 | +++ examples/demo-inprocess-surface-client/inprocess_egl_client.cpp 2014-02-10 09:00:06 +0000 | |||
136 | @@ -1,5 +1,5 @@ | |||
137 | 1 | /* | 1 | /* |
139 | 2 | * Copyright © 2013 Canonical Ltd. | 2 | * Copyright © 2013-2014 Canonical Ltd. |
140 | 3 | * | 3 | * |
141 | 4 | * This program is free software: you can redistribute it and/or modify | 4 | * This program is free software: you can redistribute it and/or modify |
142 | 5 | * it under the terms of the GNU General Public License version 3 as | 5 | * it under the terms of the GNU General Public License version 3 as |
143 | @@ -41,6 +41,8 @@ | |||
144 | 41 | 41 | ||
145 | 42 | #include <xkbcommon/xkbcommon-keysyms.h> | 42 | #include <xkbcommon/xkbcommon-keysyms.h> |
146 | 43 | 43 | ||
147 | 44 | #include <unistd.h> | ||
148 | 45 | |||
149 | 44 | #include <functional> | 46 | #include <functional> |
150 | 45 | 47 | ||
151 | 46 | #include <assert.h> | 48 | #include <assert.h> |
152 | @@ -93,7 +95,7 @@ | |||
153 | 93 | .of_size(surface_size) | 95 | .of_size(surface_size) |
154 | 94 | .of_buffer_usage(mg::BufferUsage::hardware) | 96 | .of_buffer_usage(mg::BufferUsage::hardware) |
155 | 95 | .of_pixel_format(mir_pixel_format_argb_8888); | 97 | .of_pixel_format(mir_pixel_format_argb_8888); |
157 | 96 | auto session = shell->open_session("Inprocess client", std::make_shared<NullEventSink>()); | 98 | auto session = shell->open_session(getpid(), "Inprocess client", std::make_shared<NullEventSink>()); |
158 | 97 | // TODO: Why do we get an ID? ~racarr | 99 | // TODO: Why do we get an ID? ~racarr |
159 | 98 | auto surface = session->get_surface(shell->create_surface_for(session, params)); | 100 | auto surface = session->get_surface(shell->create_surface_for(session, params)); |
160 | 99 | 101 | ||
161 | 100 | 102 | ||
162 | === modified file 'examples/render_surfaces.cpp' | |||
163 | --- examples/render_surfaces.cpp 2014-01-29 12:51:30 +0000 | |||
164 | +++ examples/render_surfaces.cpp 2014-02-10 09:00:06 +0000 | |||
165 | @@ -419,8 +419,9 @@ | |||
166 | 419 | */ | 419 | */ |
167 | 420 | { | 420 | { |
168 | 421 | mg::Buffer* buffer{nullptr}; | 421 | mg::Buffer* buffer{nullptr}; |
171 | 422 | s->swap_buffers(buffer); | 422 | auto const complete = [&](mg::Buffer* new_buf){ buffer = new_buf; }; |
172 | 423 | s->swap_buffers(buffer); | 423 | s->swap_buffers(buffer, complete); |
173 | 424 | s->swap_buffers(buffer, complete); | ||
174 | 424 | } | 425 | } |
175 | 425 | 426 | ||
176 | 426 | /* | 427 | /* |
177 | 427 | 428 | ||
178 | === modified file 'include/platform/mir/graphics/display.h' | |||
179 | --- include/platform/mir/graphics/display.h 2013-08-28 03:41:48 +0000 | |||
180 | +++ include/platform/mir/graphics/display.h 2014-02-10 09:00:06 +0000 | |||
181 | @@ -50,9 +50,9 @@ | |||
182 | 50 | virtual void for_each_display_buffer(std::function<void(DisplayBuffer&)> const& f) = 0; | 50 | virtual void for_each_display_buffer(std::function<void(DisplayBuffer&)> const& f) = 0; |
183 | 51 | 51 | ||
184 | 52 | /** | 52 | /** |
186 | 53 | * Gets the current output configuration. | 53 | * Gets a copy of the current output configuration. |
187 | 54 | */ | 54 | */ |
189 | 55 | virtual std::shared_ptr<DisplayConfiguration> configuration() = 0; | 55 | virtual std::unique_ptr<DisplayConfiguration> configuration() const = 0; |
190 | 56 | 56 | ||
191 | 57 | /** | 57 | /** |
192 | 58 | * Sets a new output configuration. | 58 | * Sets a new output configuration. |
193 | 59 | 59 | ||
194 | === modified file 'include/server/mir/compositor/buffer_stream.h' | |||
195 | --- include/server/mir/compositor/buffer_stream.h 2014-01-13 06:12:33 +0000 | |||
196 | +++ include/server/mir/compositor/buffer_stream.h 2014-02-10 09:00:06 +0000 | |||
197 | @@ -41,7 +41,7 @@ | |||
198 | 41 | public: | 41 | public: |
199 | 42 | virtual ~BufferStream() = default; | 42 | virtual ~BufferStream() = default; |
200 | 43 | 43 | ||
202 | 44 | virtual void swap_client_buffers(graphics::Buffer*& buffer) = 0; | 44 | virtual void swap_client_buffers(graphics::Buffer* old_buffer, std::function<void(graphics::Buffer* new_buffer)> complete) = 0; |
203 | 45 | virtual std::shared_ptr<graphics::Buffer> | 45 | virtual std::shared_ptr<graphics::Buffer> |
204 | 46 | lock_compositor_buffer(unsigned long frameno) = 0; | 46 | lock_compositor_buffer(unsigned long frameno) = 0; |
205 | 47 | virtual std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() = 0; | 47 | virtual std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() = 0; |
206 | 48 | 48 | ||
207 | === modified file 'include/server/mir/default_server_configuration.h' | |||
208 | --- include/server/mir/default_server_configuration.h 2014-01-27 17:47:06 +0000 | |||
209 | +++ include/server/mir/default_server_configuration.h 2014-02-10 09:00:06 +0000 | |||
210 | @@ -50,6 +50,7 @@ | |||
211 | 50 | class SessionAuthorizer; | 50 | class SessionAuthorizer; |
212 | 51 | class EventSink; | 51 | class EventSink; |
213 | 52 | class DisplayChanger; | 52 | class DisplayChanger; |
214 | 53 | class Screencast; | ||
215 | 53 | } | 54 | } |
216 | 54 | 55 | ||
217 | 55 | namespace shell | 56 | namespace shell |
218 | @@ -171,6 +172,7 @@ | |||
219 | 171 | virtual std::shared_ptr<frontend::Shell> the_frontend_shell(); | 172 | virtual std::shared_ptr<frontend::Shell> the_frontend_shell(); |
220 | 172 | virtual std::shared_ptr<frontend::EventSink> the_global_event_sink(); | 173 | virtual std::shared_ptr<frontend::EventSink> the_global_event_sink(); |
221 | 173 | virtual std::shared_ptr<frontend::DisplayChanger> the_frontend_display_changer(); | 174 | virtual std::shared_ptr<frontend::DisplayChanger> the_frontend_display_changer(); |
222 | 175 | virtual std::shared_ptr<frontend::Screencast> the_screencast(); | ||
223 | 174 | /** @name frontend configuration - internal dependencies | 176 | /** @name frontend configuration - internal dependencies |
224 | 175 | * internal dependencies of frontend | 177 | * internal dependencies of frontend |
225 | 176 | * @{ */ | 178 | * @{ */ |
226 | @@ -266,6 +268,7 @@ | |||
227 | 266 | CachedPtr<frontend::SessionAuthorizer> session_authorizer; | 268 | CachedPtr<frontend::SessionAuthorizer> session_authorizer; |
228 | 267 | CachedPtr<frontend::EventSink> global_event_sink; | 269 | CachedPtr<frontend::EventSink> global_event_sink; |
229 | 268 | CachedPtr<frontend::SessionCreator> session_creator; | 270 | CachedPtr<frontend::SessionCreator> session_creator; |
230 | 271 | CachedPtr<frontend::Screencast> screencast; | ||
231 | 269 | CachedPtr<compositor::RendererFactory> renderer_factory; | 272 | CachedPtr<compositor::RendererFactory> renderer_factory; |
232 | 270 | CachedPtr<compositor::BufferStreamFactory> buffer_stream_factory; | 273 | CachedPtr<compositor::BufferStreamFactory> buffer_stream_factory; |
233 | 271 | CachedPtr<scene::SurfaceStack> surface_stack; | 274 | CachedPtr<scene::SurfaceStack> surface_stack; |
234 | 272 | 275 | ||
235 | === modified file 'include/server/mir/frontend/message_processor.h' | |||
236 | --- include/server/mir/frontend/message_processor.h 2014-01-22 15:54:11 +0000 | |||
237 | +++ include/server/mir/frontend/message_processor.h 2014-02-10 09:00:06 +0000 | |||
238 | @@ -19,6 +19,8 @@ | |||
239 | 19 | #ifndef MIR_FRONTEND_MESSAGE_PROCESSOR_H_ | 19 | #ifndef MIR_FRONTEND_MESSAGE_PROCESSOR_H_ |
240 | 20 | #define MIR_FRONTEND_MESSAGE_PROCESSOR_H_ | 20 | #define MIR_FRONTEND_MESSAGE_PROCESSOR_H_ |
241 | 21 | 21 | ||
242 | 22 | #include <google/protobuf/service.h> | ||
243 | 23 | |||
244 | 22 | namespace mir | 24 | namespace mir |
245 | 23 | { | 25 | { |
246 | 24 | namespace protobuf | 26 | namespace protobuf |
247 | @@ -32,11 +34,23 @@ | |||
248 | 32 | { | 34 | { |
249 | 33 | namespace detail | 35 | namespace detail |
250 | 34 | { | 36 | { |
251 | 37 | class Invocation | ||
252 | 38 | { | ||
253 | 39 | public: | ||
254 | 40 | Invocation(mir::protobuf::wire::Invocation const& invocation) : | ||
255 | 41 | invocation(invocation) {} | ||
256 | 42 | |||
257 | 43 | const ::std::string& method_name() const; | ||
258 | 44 | const ::std::string& parameters() const; | ||
259 | 45 | ::google::protobuf::uint32 id() const; | ||
260 | 46 | private: | ||
261 | 47 | mir::protobuf::wire::Invocation const& invocation; | ||
262 | 48 | }; | ||
263 | 35 | 49 | ||
264 | 36 | class MessageProcessor | 50 | class MessageProcessor |
265 | 37 | { | 51 | { |
266 | 38 | public: | 52 | public: |
268 | 39 | virtual bool dispatch(mir::protobuf::wire::Invocation const& invocation) = 0; | 53 | virtual bool dispatch(Invocation const& invocation) = 0; |
269 | 40 | 54 | ||
270 | 41 | protected: | 55 | protected: |
271 | 42 | MessageProcessor() = default; | 56 | MessageProcessor() = default; |
272 | 43 | 57 | ||
273 | === added file 'include/server/mir/frontend/screencast.h' | |||
274 | --- include/server/mir/frontend/screencast.h 1970-01-01 00:00:00 +0000 | |||
275 | +++ include/server/mir/frontend/screencast.h 2014-02-10 09:00:06 +0000 | |||
276 | @@ -0,0 +1,55 @@ | |||
277 | 1 | /* | ||
278 | 2 | * Copyright © 2014 Canonical Ltd. | ||
279 | 3 | * | ||
280 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
281 | 5 | * under the terms of the GNU General Public License version 3, | ||
282 | 6 | * as published by the Free Software Foundation. | ||
283 | 7 | * | ||
284 | 8 | * This program is distributed in the hope that it will be useful, | ||
285 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
286 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
287 | 11 | * GNU General Public License for more details. | ||
288 | 12 | * | ||
289 | 13 | * You should have received a copy of the GNU General Public License | ||
290 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
291 | 15 | * | ||
292 | 16 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> | ||
293 | 17 | */ | ||
294 | 18 | |||
295 | 19 | #ifndef MIR_FRONTEND_SCREENCAST_H_ | ||
296 | 20 | #define MIR_FRONTEND_SCREENCAST_H_ | ||
297 | 21 | |||
298 | 22 | #include "mir/int_wrapper.h" | ||
299 | 23 | #include "mir/graphics/display_configuration.h" | ||
300 | 24 | |||
301 | 25 | #include <memory> | ||
302 | 26 | |||
303 | 27 | namespace mir | ||
304 | 28 | { | ||
305 | 29 | namespace graphics { class Buffer; } | ||
306 | 30 | namespace frontend | ||
307 | 31 | { | ||
308 | 32 | namespace detail { struct ScreencastSessionIdTag; } | ||
309 | 33 | |||
310 | 34 | typedef IntWrapper<detail::ScreencastSessionIdTag,uint32_t> ScreencastSessionId; | ||
311 | 35 | |||
312 | 36 | class Screencast | ||
313 | 37 | { | ||
314 | 38 | public: | ||
315 | 39 | virtual ~Screencast() = default; | ||
316 | 40 | |||
317 | 41 | virtual ScreencastSessionId create_session( | ||
318 | 42 | graphics::DisplayConfigurationOutputId output_id) = 0; | ||
319 | 43 | virtual void destroy_session(ScreencastSessionId id) = 0; | ||
320 | 44 | virtual std::shared_ptr<graphics::Buffer> capture(ScreencastSessionId id) = 0; | ||
321 | 45 | |||
322 | 46 | protected: | ||
323 | 47 | Screencast() = default; | ||
324 | 48 | Screencast(Screencast const&) = delete; | ||
325 | 49 | Screencast& operator=(Screencast const&) = delete; | ||
326 | 50 | }; | ||
327 | 51 | |||
328 | 52 | } | ||
329 | 53 | } | ||
330 | 54 | |||
331 | 55 | #endif /* MIR_FRONTEND_SCREENCAST_H_ */ | ||
332 | 0 | 56 | ||
333 | === modified file 'include/server/mir/frontend/shell.h' | |||
334 | --- include/server/mir/frontend/shell.h 2014-01-13 06:12:33 +0000 | |||
335 | +++ include/server/mir/frontend/shell.h 2014-02-10 09:00:06 +0000 | |||
336 | @@ -1,5 +1,5 @@ | |||
337 | 1 | /* | 1 | /* |
339 | 2 | * Copyright © 2012 Canonical Ltd. | 2 | * Copyright © 2012-2014 Canonical Ltd. |
340 | 3 | * | 3 | * |
341 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
342 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
343 | @@ -20,6 +20,9 @@ | |||
344 | 20 | #define MIR_FRONTEND_SHELL_H_ | 20 | #define MIR_FRONTEND_SHELL_H_ |
345 | 21 | 21 | ||
346 | 22 | #include "mir/frontend/surface_id.h" | 22 | #include "mir/frontend/surface_id.h" |
347 | 23 | |||
348 | 24 | #include <sys/types.h> | ||
349 | 25 | |||
350 | 23 | #include <memory> | 26 | #include <memory> |
351 | 24 | 27 | ||
352 | 25 | namespace mir | 28 | namespace mir |
353 | @@ -39,7 +42,10 @@ | |||
354 | 39 | virtual ~Shell() = default; | 42 | virtual ~Shell() = default; |
355 | 40 | 43 | ||
356 | 41 | virtual std::shared_ptr<Session> open_session( | 44 | virtual std::shared_ptr<Session> open_session( |
358 | 42 | std::string const& name, std::shared_ptr<EventSink> const& sink) = 0; | 45 | pid_t client_pid, |
359 | 46 | std::string const& name, | ||
360 | 47 | std::shared_ptr<EventSink> const& sink) = 0; | ||
361 | 48 | |||
362 | 43 | virtual void close_session(std::shared_ptr<Session> const& session) = 0; | 49 | virtual void close_session(std::shared_ptr<Session> const& session) = 0; |
363 | 44 | 50 | ||
364 | 45 | virtual SurfaceId create_surface_for(std::shared_ptr<Session> const& session, | 51 | virtual SurfaceId create_surface_for(std::shared_ptr<Session> const& session, |
365 | 46 | 52 | ||
366 | === modified file 'include/server/mir/frontend/surface.h' | |||
367 | --- include/server/mir/frontend/surface.h 2014-01-13 06:12:33 +0000 | |||
368 | +++ include/server/mir/frontend/surface.h 2014-02-10 09:00:06 +0000 | |||
369 | @@ -56,13 +56,20 @@ | |||
370 | 56 | virtual geometry::Size size() const = 0; | 56 | virtual geometry::Size size() const = 0; |
371 | 57 | virtual MirPixelFormat pixel_format() const = 0; | 57 | virtual MirPixelFormat pixel_format() const = 0; |
372 | 58 | 58 | ||
374 | 59 | virtual void swap_buffers(graphics::Buffer*&) = 0; | 59 | virtual void swap_buffers(graphics::Buffer* old_buffer, std::function<void(graphics::Buffer* new_buffer)> complete) = 0; |
375 | 60 | 60 | ||
376 | 61 | virtual bool supports_input() const = 0; | 61 | virtual bool supports_input() const = 0; |
377 | 62 | virtual int client_input_fd() const = 0; | 62 | virtual int client_input_fd() const = 0; |
378 | 63 | 63 | ||
379 | 64 | virtual int configure(MirSurfaceAttrib attrib, int value) = 0; | 64 | virtual int configure(MirSurfaceAttrib attrib, int value) = 0; |
380 | 65 | 65 | ||
381 | 66 | /** | ||
382 | 67 | * swap_buffers_blocking() is a convenience wrapper around swap_buffers() | ||
383 | 68 | * it forces the current thread to block until complete() is called. | ||
384 | 69 | * Use with care! | ||
385 | 70 | */ | ||
386 | 71 | void swap_buffers_blocking(graphics::Buffer*& buffer); | ||
387 | 72 | |||
388 | 66 | protected: | 73 | protected: |
389 | 67 | Surface() = default; | 74 | Surface() = default; |
390 | 68 | Surface(Surface const&) = delete; | 75 | Surface(Surface const&) = delete; |
391 | 69 | 76 | ||
392 | === modified file 'include/server/mir/frontend/template_protobuf_message_processor.h' | |||
393 | --- include/server/mir/frontend/template_protobuf_message_processor.h 2014-01-21 12:49:00 +0000 | |||
394 | +++ include/server/mir/frontend/template_protobuf_message_processor.h 2014-02-10 09:00:06 +0000 | |||
395 | @@ -22,8 +22,6 @@ | |||
396 | 22 | 22 | ||
397 | 23 | #include "mir/frontend/message_processor.h" | 23 | #include "mir/frontend/message_processor.h" |
398 | 24 | 24 | ||
399 | 25 | #include "mir_protobuf_wire.pb.h" | ||
400 | 26 | |||
401 | 27 | #include <google/protobuf/service.h> | 25 | #include <google/protobuf/service.h> |
402 | 28 | 26 | ||
403 | 29 | #include <boost/exception/diagnostic_information.hpp> | 27 | #include <boost/exception/diagnostic_information.hpp> |
404 | @@ -54,7 +52,7 @@ | |||
405 | 54 | const ParameterMessage* request, | 52 | const ParameterMessage* request, |
406 | 55 | ResultMessage* response, | 53 | ResultMessage* response, |
407 | 56 | ::google::protobuf::Closure* done), | 54 | ::google::protobuf::Closure* done), |
409 | 57 | mir::protobuf::wire::Invocation const& invocation) | 55 | Invocation const& invocation) |
410 | 58 | { | 56 | { |
411 | 59 | ParameterMessage parameter_message; | 57 | ParameterMessage parameter_message; |
412 | 60 | parameter_message.ParseFromString(invocation.parameters()); | 58 | parameter_message.ParseFromString(invocation.parameters()); |
413 | 61 | 59 | ||
414 | === modified file 'include/server/mir/shell/session.h' | |||
415 | --- include/server/mir/shell/session.h 2014-01-13 06:12:33 +0000 | |||
416 | +++ include/server/mir/shell/session.h 2014-02-10 09:00:06 +0000 | |||
417 | @@ -1,5 +1,5 @@ | |||
418 | 1 | /* | 1 | /* |
420 | 2 | * Copyright © 2012 Canonical Ltd. | 2 | * Copyright © 2012-2014 Canonical Ltd. |
421 | 3 | * | 3 | * |
422 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
423 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
424 | @@ -7,11 +7,11 @@ | |||
425 | 7 | * | 7 | * |
426 | 8 | * This program is distributed in the hope that it will be useful, | 8 | * This program is distributed in the hope that it will be useful, |
427 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
429 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
430 | 11 | * GNU General Public License for more details. | 11 | * GNU General Public License for more details. |
431 | 12 | * | 12 | * |
432 | 13 | * You should have received a copy of the GNU General Public License | 13 | * You should have received a copy of the GNU General Public License |
434 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
435 | 15 | * | 15 | * |
436 | 16 | * Authored By: Robert Carr <racarr@canonical.com> | 16 | * Authored By: Robert Carr <racarr@canonical.com> |
437 | 17 | */ | 17 | */ |
438 | @@ -22,9 +22,10 @@ | |||
439 | 22 | #include "mir/frontend/session.h" | 22 | #include "mir/frontend/session.h" |
440 | 23 | #include "mir/shell/snapshot.h" | 23 | #include "mir/shell/snapshot.h" |
441 | 24 | 24 | ||
442 | 25 | #include <sys/types.h> | ||
443 | 26 | |||
444 | 25 | namespace mir | 27 | namespace mir |
445 | 26 | { | 28 | { |
446 | 27 | |||
447 | 28 | namespace shell | 29 | namespace shell |
448 | 29 | { | 30 | { |
449 | 30 | class Surface; | 31 | class Surface; |
450 | @@ -34,12 +35,12 @@ | |||
451 | 34 | public: | 35 | public: |
452 | 35 | virtual std::string name() const = 0; | 36 | virtual std::string name() const = 0; |
453 | 36 | virtual void force_requests_to_complete() = 0; | 37 | virtual void force_requests_to_complete() = 0; |
454 | 38 | virtual pid_t process_id() const = 0; | ||
455 | 37 | 39 | ||
456 | 38 | virtual void take_snapshot(SnapshotCallback const& snapshot_taken) = 0; | 40 | virtual void take_snapshot(SnapshotCallback const& snapshot_taken) = 0; |
457 | 39 | virtual std::shared_ptr<Surface> default_surface() const = 0; | 41 | virtual std::shared_ptr<Surface> default_surface() const = 0; |
458 | 40 | virtual void set_lifecycle_state(MirLifecycleState state) = 0; | 42 | virtual void set_lifecycle_state(MirLifecycleState state) = 0; |
459 | 41 | }; | 43 | }; |
460 | 42 | |||
461 | 43 | } | 44 | } |
462 | 44 | } | 45 | } |
463 | 45 | 46 | ||
464 | 46 | 47 | ||
465 | === modified file 'include/shared/mir/int_wrapper.h' | |||
466 | --- include/shared/mir/int_wrapper.h 2013-08-28 03:41:48 +0000 | |||
467 | +++ include/shared/mir/int_wrapper.h 2014-02-10 09:00:06 +0000 | |||
468 | @@ -23,12 +23,10 @@ | |||
469 | 23 | 23 | ||
470 | 24 | namespace mir | 24 | namespace mir |
471 | 25 | { | 25 | { |
473 | 26 | template<typename Tag> | 26 | template<typename Tag, typename ValueType=int> |
474 | 27 | class IntWrapper | 27 | class IntWrapper |
475 | 28 | { | 28 | { |
476 | 29 | public: | 29 | public: |
477 | 30 | typedef int ValueType; | ||
478 | 31 | |||
479 | 32 | IntWrapper() : value(0) {} | 30 | IntWrapper() : value(0) {} |
480 | 33 | 31 | ||
481 | 34 | explicit IntWrapper(ValueType value) : value(value) {} | 32 | explicit IntWrapper(ValueType value) : value(value) {} |
482 | @@ -38,39 +36,39 @@ | |||
483 | 38 | ValueType value; | 36 | ValueType value; |
484 | 39 | }; | 37 | }; |
485 | 40 | 38 | ||
488 | 41 | template<typename Tag> | 39 | template<typename Tag, typename ValueType> |
489 | 42 | std::ostream& operator<<(std::ostream& out, IntWrapper<Tag> const& value) | 40 | std::ostream& operator<<(std::ostream& out, IntWrapper<Tag,ValueType> const& value) |
490 | 43 | { | 41 | { |
491 | 44 | out << value.as_value(); | 42 | out << value.as_value(); |
492 | 45 | return out; | 43 | return out; |
493 | 46 | } | 44 | } |
494 | 47 | 45 | ||
497 | 48 | template<typename Tag> | 46 | template<typename Tag, typename ValueType> |
498 | 49 | inline bool operator == (IntWrapper<Tag> const& lhs, IntWrapper<Tag> const& rhs) | 47 | inline bool operator == (IntWrapper<Tag,ValueType> const& lhs, IntWrapper<Tag,ValueType> const& rhs) |
499 | 50 | { | 48 | { |
500 | 51 | return lhs.as_value() == rhs.as_value(); | 49 | return lhs.as_value() == rhs.as_value(); |
501 | 52 | } | 50 | } |
502 | 53 | 51 | ||
505 | 54 | template<typename Tag> | 52 | template<typename Tag, typename ValueType> |
506 | 55 | inline bool operator != (IntWrapper<Tag> const& lhs, IntWrapper<Tag> const& rhs) | 53 | inline bool operator != (IntWrapper<Tag,ValueType> const& lhs, IntWrapper<Tag,ValueType> const& rhs) |
507 | 56 | { | 54 | { |
508 | 57 | return lhs.as_value() != rhs.as_value(); | 55 | return lhs.as_value() != rhs.as_value(); |
509 | 58 | } | 56 | } |
510 | 59 | 57 | ||
513 | 60 | template<typename Tag> | 58 | template<typename Tag, typename ValueType> |
514 | 61 | inline bool operator <= (IntWrapper<Tag> const& lhs, IntWrapper<Tag> const& rhs) | 59 | inline bool operator <= (IntWrapper<Tag,ValueType> const& lhs, IntWrapper<Tag,ValueType> const& rhs) |
515 | 62 | { | 60 | { |
516 | 63 | return lhs.as_value() <= rhs.as_value(); | 61 | return lhs.as_value() <= rhs.as_value(); |
517 | 64 | } | 62 | } |
518 | 65 | 63 | ||
521 | 66 | template<typename Tag> | 64 | template<typename Tag, typename ValueType> |
522 | 67 | inline bool operator >= (IntWrapper<Tag> const& lhs, IntWrapper<Tag> const& rhs) | 65 | inline bool operator >= (IntWrapper<Tag,ValueType> const& lhs, IntWrapper<Tag,ValueType> const& rhs) |
523 | 68 | { | 66 | { |
524 | 69 | return lhs.as_value() >= rhs.as_value(); | 67 | return lhs.as_value() >= rhs.as_value(); |
525 | 70 | } | 68 | } |
526 | 71 | 69 | ||
529 | 72 | template<typename Tag> | 70 | template<typename Tag, typename ValueType> |
530 | 73 | inline bool operator < (IntWrapper<Tag> const& lhs, IntWrapper<Tag> const& rhs) | 71 | inline bool operator < (IntWrapper<Tag,ValueType> const& lhs, IntWrapper<Tag,ValueType> const& rhs) |
531 | 74 | { | 72 | { |
532 | 75 | return lhs.as_value() < rhs.as_value(); | 73 | return lhs.as_value() < rhs.as_value(); |
533 | 76 | } | 74 | } |
534 | @@ -79,11 +77,11 @@ | |||
535 | 79 | #include <functional> | 77 | #include <functional> |
536 | 80 | namespace std | 78 | namespace std |
537 | 81 | { | 79 | { |
540 | 82 | template<typename Tag> | 80 | template<typename Tag, typename ValueType> |
541 | 83 | struct hash< ::mir::IntWrapper<Tag> > | 81 | struct hash< ::mir::IntWrapper<Tag,ValueType> > |
542 | 84 | { | 82 | { |
543 | 85 | std::hash<int> self; | 83 | std::hash<int> self; |
545 | 86 | std::size_t operator()(::mir::IntWrapper<Tag> const& id) const | 84 | std::size_t operator()(::mir::IntWrapper<Tag,ValueType> const& id) const |
546 | 87 | { | 85 | { |
547 | 88 | return self(id.as_value()); | 86 | return self(id.as_value()); |
548 | 89 | } | 87 | } |
549 | 90 | 88 | ||
550 | === modified file 'include/test/mir_test_doubles/mock_buffer_bundle.h' | |||
551 | --- include/test/mir_test_doubles/mock_buffer_bundle.h 2014-01-13 06:12:33 +0000 | |||
552 | +++ include/test/mir_test_doubles/mock_buffer_bundle.h 2014-02-10 09:00:06 +0000 | |||
553 | @@ -37,7 +37,7 @@ | |||
554 | 37 | ~MockBufferBundle() noexcept | 37 | ~MockBufferBundle() noexcept |
555 | 38 | {} | 38 | {} |
556 | 39 | 39 | ||
558 | 40 | MOCK_METHOD0(client_acquire, graphics::Buffer*()); | 40 | MOCK_METHOD1(client_acquire, void(std::function<void(graphics::Buffer*)>)); |
559 | 41 | MOCK_METHOD1(client_release, void(graphics::Buffer*)); | 41 | MOCK_METHOD1(client_release, void(graphics::Buffer*)); |
560 | 42 | MOCK_METHOD1(compositor_acquire, std::shared_ptr<graphics::Buffer>(unsigned long)); | 42 | MOCK_METHOD1(compositor_acquire, std::shared_ptr<graphics::Buffer>(unsigned long)); |
561 | 43 | MOCK_METHOD1(compositor_release, void(std::shared_ptr<graphics::Buffer> const&)); | 43 | MOCK_METHOD1(compositor_release, void(std::shared_ptr<graphics::Buffer> const&)); |
562 | 44 | 44 | ||
563 | === modified file 'include/test/mir_test_doubles/mock_buffer_stream.h' | |||
564 | --- include/test/mir_test_doubles/mock_buffer_stream.h 2014-01-13 06:12:33 +0000 | |||
565 | +++ include/test/mir_test_doubles/mock_buffer_stream.h 2014-02-10 09:00:06 +0000 | |||
566 | @@ -31,7 +31,7 @@ | |||
567 | 31 | { | 31 | { |
568 | 32 | struct MockBufferStream : public compositor::BufferStream | 32 | struct MockBufferStream : public compositor::BufferStream |
569 | 33 | { | 33 | { |
571 | 34 | MOCK_METHOD1(swap_client_buffers, void(graphics::Buffer*&)); | 34 | MOCK_METHOD2(swap_client_buffers, void(graphics::Buffer*, std::function<void(graphics::Buffer*)> completee)); |
572 | 35 | MOCK_METHOD1(lock_compositor_buffer, | 35 | MOCK_METHOD1(lock_compositor_buffer, |
573 | 36 | std::shared_ptr<graphics::Buffer>(unsigned long)); | 36 | std::shared_ptr<graphics::Buffer>(unsigned long)); |
574 | 37 | MOCK_METHOD0(lock_snapshot_buffer, std::shared_ptr<graphics::Buffer>()); | 37 | MOCK_METHOD0(lock_snapshot_buffer, std::shared_ptr<graphics::Buffer>()); |
575 | 38 | 38 | ||
576 | === modified file 'include/test/mir_test_doubles/mock_display.h' | |||
577 | --- include/test/mir_test_doubles/mock_display.h 2013-08-28 03:41:48 +0000 | |||
578 | +++ include/test/mir_test_doubles/mock_display.h 2014-02-10 09:00:06 +0000 | |||
579 | @@ -36,7 +36,7 @@ | |||
580 | 36 | { | 36 | { |
581 | 37 | public: | 37 | public: |
582 | 38 | MOCK_METHOD1(for_each_display_buffer, void (std::function<void(graphics::DisplayBuffer&)> const&)); | 38 | MOCK_METHOD1(for_each_display_buffer, void (std::function<void(graphics::DisplayBuffer&)> const&)); |
584 | 39 | MOCK_METHOD0(configuration, std::shared_ptr<graphics::DisplayConfiguration>()); | 39 | MOCK_CONST_METHOD0(configuration, std::unique_ptr<graphics::DisplayConfiguration>()); |
585 | 40 | MOCK_METHOD1(configure, void(graphics::DisplayConfiguration const&)); | 40 | MOCK_METHOD1(configure, void(graphics::DisplayConfiguration const&)); |
586 | 41 | MOCK_METHOD2(register_configuration_change_handler, | 41 | MOCK_METHOD2(register_configuration_change_handler, |
587 | 42 | void(graphics::EventHandlerRegister&, graphics::DisplayConfigurationChangeHandler const&)); | 42 | void(graphics::EventHandlerRegister&, graphics::DisplayConfigurationChangeHandler const&)); |
588 | 43 | 43 | ||
589 | === modified file 'include/test/mir_test_doubles/mock_fb_hal_device.h' | |||
590 | --- include/test/mir_test_doubles/mock_fb_hal_device.h 2014-01-13 06:12:33 +0000 | |||
591 | +++ include/test/mir_test_doubles/mock_fb_hal_device.h 2014-02-10 09:00:06 +0000 | |||
592 | @@ -37,7 +37,7 @@ | |||
593 | 37 | MockFBHalDevice(unsigned int const width, unsigned int const height, | 37 | MockFBHalDevice(unsigned int const width, unsigned int const height, |
594 | 38 | int const pf, int const numfbs) | 38 | int const pf, int const numfbs) |
595 | 39 | : framebuffer_device_t({ | 39 | : framebuffer_device_t({ |
597 | 40 | empty_module, | 40 | hw_device_t(), |
598 | 41 | 0, | 41 | 0, |
599 | 42 | width, | 42 | width, |
600 | 43 | height, | 43 | height, |
601 | @@ -86,8 +86,6 @@ | |||
602 | 86 | MOCK_METHOD2(enableScreen_interface, int(struct framebuffer_device_t*, int)); | 86 | MOCK_METHOD2(enableScreen_interface, int(struct framebuffer_device_t*, int)); |
603 | 87 | MOCK_METHOD2(post_interface, int(struct framebuffer_device_t*, buffer_handle_t)); | 87 | MOCK_METHOD2(post_interface, int(struct framebuffer_device_t*, buffer_handle_t)); |
604 | 88 | MOCK_METHOD2(setSwapInterval_interface, int(struct framebuffer_device_t*, int)); | 88 | MOCK_METHOD2(setSwapInterval_interface, int(struct framebuffer_device_t*, int)); |
605 | 89 | |||
606 | 90 | hw_device_t empty_module; | ||
607 | 91 | }; | 89 | }; |
608 | 92 | 90 | ||
609 | 93 | } | 91 | } |
610 | 94 | 92 | ||
611 | === modified file 'include/test/mir_test_doubles/mock_frontend_surface.h' | |||
612 | --- include/test/mir_test_doubles/mock_frontend_surface.h 2014-01-13 06:12:33 +0000 | |||
613 | +++ include/test/mir_test_doubles/mock_frontend_surface.h 2014-02-10 09:00:06 +0000 | |||
614 | @@ -39,7 +39,7 @@ | |||
615 | 39 | 39 | ||
616 | 40 | MOCK_METHOD0(destroy, void()); | 40 | MOCK_METHOD0(destroy, void()); |
617 | 41 | MOCK_METHOD0(force_requests_to_complete, void()); | 41 | MOCK_METHOD0(force_requests_to_complete, void()); |
619 | 42 | MOCK_METHOD1(swap_buffers, void(graphics::Buffer*&)); | 42 | MOCK_METHOD2(swap_buffers, void(graphics::Buffer*, std::function<void(graphics::Buffer*)> complete)); |
620 | 43 | 43 | ||
621 | 44 | MOCK_CONST_METHOD0(size, geometry::Size()); | 44 | MOCK_CONST_METHOD0(size, geometry::Size()); |
622 | 45 | MOCK_CONST_METHOD0(pixel_format, MirPixelFormat()); | 45 | MOCK_CONST_METHOD0(pixel_format, MirPixelFormat()); |
623 | 46 | 46 | ||
624 | === modified file 'include/test/mir_test_doubles/mock_hwc_composer_device_1.h' | |||
625 | --- include/test/mir_test_doubles/mock_hwc_composer_device_1.h 2014-01-23 17:26:51 +0000 | |||
626 | +++ include/test/mir_test_doubles/mock_hwc_composer_device_1.h 2014-02-10 09:00:06 +0000 | |||
627 | @@ -76,6 +76,11 @@ | |||
628 | 76 | fb_fence = fence; | 76 | fb_fence = fence; |
629 | 77 | } | 77 | } |
630 | 78 | 78 | ||
631 | 79 | void hwc_set_retire_fence(int fence) | ||
632 | 80 | { | ||
633 | 81 | retire_fence = fence; | ||
634 | 82 | } | ||
635 | 83 | |||
636 | 79 | int save_last_prepare_arguments(struct hwc_composer_device_1 *, size_t size, hwc_display_contents_1_t** displays) | 84 | int save_last_prepare_arguments(struct hwc_composer_device_1 *, size_t size, hwc_display_contents_1_t** displays) |
637 | 80 | { | 85 | { |
638 | 81 | if ((size == 0) || (!displays)) | 86 | if ((size == 0) || (!displays)) |
639 | @@ -122,12 +127,14 @@ | |||
640 | 122 | set_layerlist.back().visibleRegionScreen = {0, nullptr}; | 127 | set_layerlist.back().visibleRegionScreen = {0, nullptr}; |
641 | 123 | } | 128 | } |
642 | 124 | 129 | ||
643 | 130 | save_args(&display0_set_content, displays); | ||
644 | 131 | |||
645 | 125 | if (displays[0]->numHwLayers >= 2) | 132 | if (displays[0]->numHwLayers >= 2) |
646 | 126 | { | 133 | { |
647 | 127 | displays[0]->hwLayers[1].releaseFenceFd = fb_fence; | 134 | displays[0]->hwLayers[1].releaseFenceFd = fb_fence; |
648 | 135 | displays[0]->retireFenceFd = retire_fence; | ||
649 | 128 | } | 136 | } |
650 | 129 | 137 | ||
651 | 130 | save_args(&display0_set_content, displays); | ||
652 | 131 | default: | 138 | default: |
653 | 132 | break; | 139 | break; |
654 | 133 | } | 140 | } |
655 | @@ -186,6 +193,7 @@ | |||
656 | 186 | std::vector<hwc_layer_1> prepare_layerlist; | 193 | std::vector<hwc_layer_1> prepare_layerlist; |
657 | 187 | hwc_display_contents_1_t display0_prepare_content; | 194 | hwc_display_contents_1_t display0_prepare_content; |
658 | 188 | int fb_fence; | 195 | int fb_fence; |
659 | 196 | int retire_fence; | ||
660 | 189 | }; | 197 | }; |
661 | 190 | 198 | ||
662 | 191 | } | 199 | } |
663 | 192 | 200 | ||
664 | === added file 'include/test/mir_test_doubles/mock_screencast.h' | |||
665 | --- include/test/mir_test_doubles/mock_screencast.h 1970-01-01 00:00:00 +0000 | |||
666 | +++ include/test/mir_test_doubles/mock_screencast.h 2014-02-10 09:00:06 +0000 | |||
667 | @@ -0,0 +1,50 @@ | |||
668 | 1 | /* | ||
669 | 2 | * Copyright © 2014 Canonical Ltd. | ||
670 | 3 | * | ||
671 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
672 | 5 | * under the terms of the GNU General Public License version 3, | ||
673 | 6 | * as published by the Free Software Foundation. | ||
674 | 7 | * | ||
675 | 8 | * This program is distributed in the hope that it will be useful, | ||
676 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
677 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
678 | 11 | * GNU General Public License for more details. | ||
679 | 12 | * | ||
680 | 13 | * You should have received a copy of the GNU General Public License | ||
681 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
682 | 15 | * | ||
683 | 16 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> | ||
684 | 17 | */ | ||
685 | 18 | |||
686 | 19 | #ifndef MIR_TEST_DOUBLES_MOCK_SCREENCAST_H_ | ||
687 | 20 | #define MIR_TEST_DOUBLES_MOCK_SCREENCAST_H_ | ||
688 | 21 | |||
689 | 22 | #include "mir/frontend/screencast.h" | ||
690 | 23 | |||
691 | 24 | #include <gmock/gmock.h> | ||
692 | 25 | |||
693 | 26 | namespace mir | ||
694 | 27 | { | ||
695 | 28 | namespace test | ||
696 | 29 | { | ||
697 | 30 | namespace doubles | ||
698 | 31 | { | ||
699 | 32 | |||
700 | 33 | class MockScreencast : public frontend::Screencast | ||
701 | 34 | { | ||
702 | 35 | public: | ||
703 | 36 | MOCK_METHOD1(create_session, | ||
704 | 37 | frontend::ScreencastSessionId( | ||
705 | 38 | graphics::DisplayConfigurationOutputId)); | ||
706 | 39 | MOCK_METHOD1(destroy_session, void(frontend::ScreencastSessionId)); | ||
707 | 40 | MOCK_METHOD1(capture, | ||
708 | 41 | std::shared_ptr<graphics::Buffer>( | ||
709 | 42 | frontend::ScreencastSessionId)); | ||
710 | 43 | }; | ||
711 | 44 | |||
712 | 45 | } | ||
713 | 46 | } | ||
714 | 47 | } | ||
715 | 48 | |||
716 | 49 | #endif /* MIR_TEST_DOUBLES_NULL_SCREENCAST_H_ */ | ||
717 | 50 | |||
718 | 0 | 51 | ||
719 | === modified file 'include/test/mir_test_doubles/mock_shell.h' | |||
720 | --- include/test/mir_test_doubles/mock_shell.h 2013-08-28 03:41:48 +0000 | |||
721 | +++ include/test/mir_test_doubles/mock_shell.h 2014-02-10 09:00:06 +0000 | |||
722 | @@ -1,5 +1,5 @@ | |||
723 | 1 | /* | 1 | /* |
725 | 2 | * Copyright © 2013 Canonical Ltd. | 2 | * Copyright © 2013-2014 Canonical Ltd. |
726 | 3 | * | 3 | * |
727 | 4 | * This program is free software: you can redistribute it and/or modify | 4 | * This program is free software: you can redistribute it and/or modify |
728 | 5 | * it under the terms of the GNU General Public License version 3 as | 5 | * it under the terms of the GNU General Public License version 3 as |
729 | @@ -34,8 +34,11 @@ | |||
730 | 34 | 34 | ||
731 | 35 | struct MockShell : public frontend::Shell | 35 | struct MockShell : public frontend::Shell |
732 | 36 | { | 36 | { |
735 | 37 | MOCK_METHOD2(open_session, std::shared_ptr<frontend::Session>( | 37 | MOCK_METHOD3(open_session, std::shared_ptr<frontend::Session>( |
736 | 38 | std::string const&, std::shared_ptr<frontend::EventSink> const&)); | 38 | pid_t client_pid, |
737 | 39 | std::string const&, | ||
738 | 40 | std::shared_ptr<frontend::EventSink> const&)); | ||
739 | 41 | |||
740 | 39 | MOCK_METHOD1(close_session, void(std::shared_ptr<frontend::Session> const&)); | 42 | MOCK_METHOD1(close_session, void(std::shared_ptr<frontend::Session> const&)); |
741 | 40 | 43 | ||
742 | 41 | MOCK_METHOD2(create_surface_for, frontend::SurfaceId(std::shared_ptr<frontend::Session> const&, shell::SurfaceCreationParameters const&)); | 44 | MOCK_METHOD2(create_surface_for, frontend::SurfaceId(std::shared_ptr<frontend::Session> const&, shell::SurfaceCreationParameters const&)); |
743 | 42 | 45 | ||
744 | === modified file 'include/test/mir_test_doubles/mock_shell_session.h' | |||
745 | --- include/test/mir_test_doubles/mock_shell_session.h 2014-01-13 06:12:33 +0000 | |||
746 | +++ include/test/mir_test_doubles/mock_shell_session.h 2014-02-10 09:00:06 +0000 | |||
747 | @@ -1,5 +1,5 @@ | |||
748 | 1 | /* | 1 | /* |
750 | 2 | * Copyright © 2013 Canonical Ltd. | 2 | * Copyright © 2013-2014 Canonical Ltd. |
751 | 3 | * | 3 | * |
752 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
753 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
754 | @@ -42,6 +42,7 @@ | |||
755 | 42 | MOCK_CONST_METHOD0(default_surface, std::shared_ptr<shell::Surface>()); | 42 | MOCK_CONST_METHOD0(default_surface, std::shared_ptr<shell::Surface>()); |
756 | 43 | 43 | ||
757 | 44 | MOCK_CONST_METHOD0(name, std::string()); | 44 | MOCK_CONST_METHOD0(name, std::string()); |
758 | 45 | MOCK_CONST_METHOD0(process_id, pid_t()); | ||
759 | 45 | MOCK_METHOD0(force_requests_to_complete, void()); | 46 | MOCK_METHOD0(force_requests_to_complete, void()); |
760 | 46 | 47 | ||
761 | 47 | MOCK_METHOD0(hide, void()); | 48 | MOCK_METHOD0(hide, void()); |
762 | 48 | 49 | ||
763 | === modified file 'include/test/mir_test_doubles/null_display.h' | |||
764 | --- include/test/mir_test_doubles/null_display.h 2013-08-28 03:41:48 +0000 | |||
765 | +++ include/test/mir_test_doubles/null_display.h 2014-02-10 09:00:06 +0000 | |||
766 | @@ -39,9 +39,11 @@ | |||
767 | 39 | /* yield() is needed to ensure reasonable runtime under valgrind for some tests */ | 39 | /* yield() is needed to ensure reasonable runtime under valgrind for some tests */ |
768 | 40 | std::this_thread::yield(); | 40 | std::this_thread::yield(); |
769 | 41 | } | 41 | } |
771 | 42 | std::shared_ptr<graphics::DisplayConfiguration> configuration() | 42 | std::unique_ptr<graphics::DisplayConfiguration> configuration() const override |
772 | 43 | { | 43 | { |
774 | 44 | return std::make_shared<NullDisplayConfiguration>(); | 44 | return std::unique_ptr<graphics::DisplayConfiguration>( |
775 | 45 | new NullDisplayConfiguration | ||
776 | 46 | ); | ||
777 | 45 | } | 47 | } |
778 | 46 | void configure(graphics::DisplayConfiguration const&) {} | 48 | void configure(graphics::DisplayConfiguration const&) {} |
779 | 47 | void register_configuration_change_handler( | 49 | void register_configuration_change_handler( |
780 | 48 | 50 | ||
781 | === added file 'include/test/mir_test_doubles/null_screencast.h' | |||
782 | --- include/test/mir_test_doubles/null_screencast.h 1970-01-01 00:00:00 +0000 | |||
783 | +++ include/test/mir_test_doubles/null_screencast.h 2014-02-10 09:00:06 +0000 | |||
784 | @@ -0,0 +1,52 @@ | |||
785 | 1 | /* | ||
786 | 2 | * Copyright © 2014 Canonical Ltd. | ||
787 | 3 | * | ||
788 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
789 | 5 | * under the terms of the GNU General Public License version 3, | ||
790 | 6 | * as published by the Free Software Foundation. | ||
791 | 7 | * | ||
792 | 8 | * This program is distributed in the hope that it will be useful, | ||
793 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
794 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
795 | 11 | * GNU General Public License for more details. | ||
796 | 12 | * | ||
797 | 13 | * You should have received a copy of the GNU General Public License | ||
798 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
799 | 15 | * | ||
800 | 16 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> | ||
801 | 17 | */ | ||
802 | 18 | |||
803 | 19 | #ifndef MIR_TEST_DOUBLES_NULL_SCREENCAST_H_ | ||
804 | 20 | #define MIR_TEST_DOUBLES_NULL_SCREENCAST_H_ | ||
805 | 21 | |||
806 | 22 | #include "mir/frontend/screencast.h" | ||
807 | 23 | |||
808 | 24 | namespace mir | ||
809 | 25 | { | ||
810 | 26 | namespace test | ||
811 | 27 | { | ||
812 | 28 | namespace doubles | ||
813 | 29 | { | ||
814 | 30 | |||
815 | 31 | class NullScreencast : public frontend::Screencast | ||
816 | 32 | { | ||
817 | 33 | public: | ||
818 | 34 | frontend::ScreencastSessionId create_session( | ||
819 | 35 | graphics::DisplayConfigurationOutputId) | ||
820 | 36 | { | ||
821 | 37 | return frontend::ScreencastSessionId{1}; | ||
822 | 38 | } | ||
823 | 39 | |||
824 | 40 | void destroy_session(frontend::ScreencastSessionId) {} | ||
825 | 41 | |||
826 | 42 | std::shared_ptr<graphics::Buffer> capture(frontend::ScreencastSessionId) | ||
827 | 43 | { | ||
828 | 44 | return nullptr; | ||
829 | 45 | } | ||
830 | 46 | }; | ||
831 | 47 | |||
832 | 48 | } | ||
833 | 49 | } | ||
834 | 50 | } | ||
835 | 51 | |||
836 | 52 | #endif /* MIR_TEST_DOUBLES_NULL_SCREENCAST_H_ */ | ||
837 | 0 | 53 | ||
838 | === modified file 'include/test/mir_test_doubles/stub_buffer_stream.h' | |||
839 | --- include/test/mir_test_doubles/stub_buffer_stream.h 2014-01-13 06:12:33 +0000 | |||
840 | +++ include/test/mir_test_doubles/stub_buffer_stream.h 2014-02-10 09:00:06 +0000 | |||
841 | @@ -36,9 +36,9 @@ | |||
842 | 36 | { | 36 | { |
843 | 37 | stub_compositor_buffer = std::make_shared<StubBuffer>(); | 37 | stub_compositor_buffer = std::make_shared<StubBuffer>(); |
844 | 38 | } | 38 | } |
846 | 39 | void swap_client_buffers(graphics::Buffer*& buffer) override | 39 | void swap_client_buffers(graphics::Buffer*, std::function<void(graphics::Buffer* new_buffer)> complete) override |
847 | 40 | { | 40 | { |
849 | 41 | buffer = &stub_client_buffer; | 41 | complete(&stub_client_buffer); |
850 | 42 | } | 42 | } |
851 | 43 | std::shared_ptr<graphics::Buffer> lock_compositor_buffer(unsigned long) override | 43 | std::shared_ptr<graphics::Buffer> lock_compositor_buffer(unsigned long) override |
852 | 44 | { | 44 | { |
853 | 45 | 45 | ||
854 | === modified file 'include/test/mir_test_doubles/stub_display_configuration.h' | |||
855 | --- include/test/mir_test_doubles/stub_display_configuration.h 2014-01-28 09:06:46 +0000 | |||
856 | +++ include/test/mir_test_doubles/stub_display_configuration.h 2014-02-10 09:00:06 +0000 | |||
857 | @@ -40,6 +40,13 @@ | |||
858 | 40 | { | 40 | { |
859 | 41 | } | 41 | } |
860 | 42 | 42 | ||
861 | 43 | StubDisplayConfig(StubDisplayConfig const& other) | ||
862 | 44 | : graphics::DisplayConfiguration(), | ||
863 | 45 | cards(other.cards), | ||
864 | 46 | outputs(other.outputs) | ||
865 | 47 | { | ||
866 | 48 | } | ||
867 | 49 | |||
868 | 43 | StubDisplayConfig(unsigned int num_displays) | 50 | StubDisplayConfig(unsigned int num_displays) |
869 | 44 | : StubDisplayConfig(num_displays, | 51 | : StubDisplayConfig(num_displays, |
870 | 45 | { | 52 | { |
871 | 46 | 53 | ||
872 | === modified file 'include/test/mir_test_doubles/stub_ipc_factory.h' | |||
873 | --- include/test/mir_test_doubles/stub_ipc_factory.h 2014-01-21 06:27:40 +0000 | |||
874 | +++ include/test/mir_test_doubles/stub_ipc_factory.h 2014-02-10 09:00:06 +0000 | |||
875 | @@ -1,5 +1,5 @@ | |||
876 | 1 | /* | 1 | /* |
878 | 2 | * Copyright © 2012 Canonical Ltd. | 2 | * Copyright © 2012-2014 Canonical Ltd. |
879 | 3 | * | 3 | * |
880 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
881 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
882 | @@ -41,7 +41,7 @@ | |||
883 | 41 | } | 41 | } |
884 | 42 | 42 | ||
885 | 43 | std::shared_ptr<protobuf::DisplayServer> make_ipc_server( | 43 | std::shared_ptr<protobuf::DisplayServer> make_ipc_server( |
887 | 44 | std::shared_ptr<frontend::EventSink> const&, bool) override | 44 | pid_t, std::shared_ptr<frontend::EventSink> const&, bool) override |
888 | 45 | { | 45 | { |
889 | 46 | return server; | 46 | return server; |
890 | 47 | } | 47 | } |
891 | 48 | 48 | ||
892 | === modified file 'include/test/mir_test_doubles/stub_shell.h' | |||
893 | --- include/test/mir_test_doubles/stub_shell.h 2013-08-28 03:41:48 +0000 | |||
894 | +++ include/test/mir_test_doubles/stub_shell.h 2014-02-10 09:00:06 +0000 | |||
895 | @@ -34,7 +34,7 @@ | |||
896 | 34 | StubShell() : stub_session(std::make_shared<StubSession>()) | 34 | StubShell() : stub_session(std::make_shared<StubSession>()) |
897 | 35 | { | 35 | { |
898 | 36 | } | 36 | } |
900 | 37 | std::shared_ptr<frontend::Session> open_session(std::string const& /* name */, std::shared_ptr<frontend::EventSink> const& /* sink */) override | 37 | std::shared_ptr<frontend::Session> open_session(pid_t, std::string const& /* name */, std::shared_ptr<frontend::EventSink> const& /* sink */) override |
901 | 38 | { | 38 | { |
902 | 39 | return stub_session; | 39 | return stub_session; |
903 | 40 | } | 40 | } |
904 | 41 | 41 | ||
905 | === modified file 'include/test/mir_test_doubles/stub_shell_session.h' | |||
906 | --- include/test/mir_test_doubles/stub_shell_session.h 2014-01-13 06:12:33 +0000 | |||
907 | +++ include/test/mir_test_doubles/stub_shell_session.h 2014-02-10 09:00:06 +0000 | |||
908 | @@ -1,5 +1,5 @@ | |||
909 | 1 | /* | 1 | /* |
911 | 2 | * Copyright © 2013 Canonical Ltd. | 2 | * Copyright © 2013-2014 Canonical Ltd. |
912 | 3 | * | 3 | * |
913 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
914 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
915 | @@ -45,6 +45,11 @@ | |||
916 | 45 | { | 45 | { |
917 | 46 | return std::string(); | 46 | return std::string(); |
918 | 47 | } | 47 | } |
919 | 48 | pid_t process_id() const override | ||
920 | 49 | { | ||
921 | 50 | return -1; | ||
922 | 51 | } | ||
923 | 52 | |||
924 | 48 | void force_requests_to_complete() override | 53 | void force_requests_to_complete() override |
925 | 49 | { | 54 | { |
926 | 50 | } | 55 | } |
927 | 51 | 56 | ||
928 | === modified file 'src/client/CMakeLists.txt' | |||
929 | --- src/client/CMakeLists.txt 2014-01-28 09:06:46 +0000 | |||
930 | +++ src/client/CMakeLists.txt 2014-02-10 09:00:06 +0000 | |||
931 | @@ -72,7 +72,7 @@ | |||
932 | 72 | ${CLIENT_SOURCES} | 72 | ${CLIENT_SOURCES} |
933 | 73 | ) | 73 | ) |
934 | 74 | 74 | ||
936 | 75 | set(MIRCLIENT_ABI 6) | 75 | set(MIRCLIENT_ABI 7) |
937 | 76 | 76 | ||
938 | 77 | set_target_properties( | 77 | set_target_properties( |
939 | 78 | mirclient | 78 | mirclient |
940 | @@ -117,7 +117,7 @@ | |||
941 | 117 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) | 117 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) |
942 | 118 | 118 | ||
943 | 119 | install( | 119 | install( |
945 | 120 | DIRECTORY ${CMAKE_SOURCE_DIR}/include/client/mir_toolkit | 120 | DIRECTORY ${CMAKE_SOURCE_DIR}/include/client/mir_toolkit ${CMAKE_SOURCE_DIR}/include/client/mir |
946 | 121 | DESTINATION "include/mirclient" | 121 | DESTINATION "include/mirclient" |
947 | 122 | ) | 122 | ) |
948 | 123 | 123 | ||
949 | 124 | 124 | ||
950 | === modified file 'src/client/mir_screencast.cpp' | |||
951 | --- src/client/mir_screencast.cpp 2014-01-24 18:11:19 +0000 | |||
952 | +++ src/client/mir_screencast.cpp 2014-02-10 09:00:06 +0000 | |||
953 | @@ -98,6 +98,8 @@ | |||
954 | 98 | egl_native_window_factory{egl_native_window_factory}, | 98 | egl_native_window_factory{egl_native_window_factory}, |
955 | 99 | buffer_depository{factory, mir::frontend::client_buffer_cache_size} | 99 | buffer_depository{factory, mir::frontend::client_buffer_cache_size} |
956 | 100 | { | 100 | { |
957 | 101 | protobuf_screencast.set_error("Not initialized"); | ||
958 | 102 | |||
959 | 101 | mir::protobuf::ScreencastParameters parameters; | 103 | mir::protobuf::ScreencastParameters parameters; |
960 | 102 | parameters.set_output_id(output_id); | 104 | parameters.set_output_id(output_id); |
961 | 103 | parameters.set_width(output_size.width.as_uint32_t()); | 105 | parameters.set_width(output_size.width.as_uint32_t()); |
962 | @@ -117,6 +119,11 @@ | |||
963 | 117 | return &create_screencast_wait_handle; | 119 | return &create_screencast_wait_handle; |
964 | 118 | } | 120 | } |
965 | 119 | 121 | ||
966 | 122 | bool MirScreencast::valid() | ||
967 | 123 | { | ||
968 | 124 | return !protobuf_screencast.has_error(); | ||
969 | 125 | } | ||
970 | 126 | |||
971 | 120 | MirSurfaceParameters MirScreencast::get_parameters() const | 127 | MirSurfaceParameters MirScreencast::get_parameters() const |
972 | 121 | { | 128 | { |
973 | 122 | return MirSurfaceParameters{ | 129 | return MirSurfaceParameters{ |
974 | @@ -188,7 +195,7 @@ | |||
975 | 188 | try | 195 | try |
976 | 189 | { | 196 | { |
977 | 190 | buffer_depository.deposit_package(buffer_package, | 197 | buffer_depository.deposit_package(buffer_package, |
979 | 191 | protobuf_buffer.buffer_id(), | 198 | buffer.buffer_id(), |
980 | 192 | output_size, output_format); | 199 | output_size, output_format); |
981 | 193 | } | 200 | } |
982 | 194 | catch (const std::runtime_error& err) | 201 | catch (const std::runtime_error& err) |
983 | @@ -200,8 +207,11 @@ | |||
984 | 200 | void MirScreencast::screencast_created( | 207 | void MirScreencast::screencast_created( |
985 | 201 | mir_screencast_callback callback, void* context) | 208 | mir_screencast_callback callback, void* context) |
986 | 202 | { | 209 | { |
989 | 203 | egl_native_window_ = egl_native_window_factory->create_egl_native_window(this); | 210 | if (!protobuf_screencast.has_error()) |
990 | 204 | process_buffer(protobuf_screencast.buffer()); | 211 | { |
991 | 212 | egl_native_window_ = egl_native_window_factory->create_egl_native_window(this); | ||
992 | 213 | process_buffer(protobuf_screencast.buffer()); | ||
993 | 214 | } | ||
994 | 205 | 215 | ||
995 | 206 | callback(this, context); | 216 | callback(this, context); |
996 | 207 | create_screencast_wait_handle.result_received(); | 217 | create_screencast_wait_handle.result_received(); |
997 | 208 | 218 | ||
998 | === modified file 'src/client/mir_screencast.h' | |||
999 | --- src/client/mir_screencast.h 2014-01-24 18:11:19 +0000 | |||
1000 | +++ src/client/mir_screencast.h 2014-02-10 09:00:06 +0000 | |||
1001 | @@ -49,6 +49,7 @@ | |||
1002 | 49 | mir_screencast_callback callback, void* context); | 49 | mir_screencast_callback callback, void* context); |
1003 | 50 | 50 | ||
1004 | 51 | MirWaitHandle* creation_wait_handle(); | 51 | MirWaitHandle* creation_wait_handle(); |
1005 | 52 | bool valid(); | ||
1006 | 52 | 53 | ||
1007 | 53 | MirWaitHandle* release( | 54 | MirWaitHandle* release( |
1008 | 54 | mir_screencast_callback callback, void* context); | 55 | mir_screencast_callback callback, void* context); |
1009 | 55 | 56 | ||
1010 | === modified file 'src/client/mir_screencast_api.cpp' | |||
1011 | --- src/client/mir_screencast_api.cpp 2014-01-29 09:16:50 +0000 | |||
1012 | +++ src/client/mir_screencast_api.cpp 2014-02-10 09:00:06 +0000 | |||
1013 | @@ -64,14 +64,21 @@ | |||
1014 | 64 | 64 | ||
1015 | 65 | auto const client_platform = connection->get_client_platform(); | 65 | auto const client_platform = connection->get_client_platform(); |
1016 | 66 | 66 | ||
1025 | 67 | screencast = new MirScreencast{ | 67 | std::unique_ptr<MirScreencast> screencast_uptr{ |
1026 | 68 | find_display_output(*config, parameters->output_id), | 68 | new MirScreencast{ |
1027 | 69 | connection->display_server(), | 69 | find_display_output(*config, parameters->output_id), |
1028 | 70 | client_platform, | 70 | connection->display_server(), |
1029 | 71 | client_platform->create_buffer_factory(), | 71 | client_platform, |
1030 | 72 | null_callback, nullptr}; | 72 | client_platform->create_buffer_factory(), |
1031 | 73 | 73 | null_callback, nullptr}}; | |
1032 | 74 | screencast->creation_wait_handle()->wait_for_all(); | 74 | |
1033 | 75 | screencast_uptr->creation_wait_handle()->wait_for_all(); | ||
1034 | 76 | |||
1035 | 77 | if (screencast_uptr->valid()) | ||
1036 | 78 | { | ||
1037 | 79 | screencast = screencast_uptr.get(); | ||
1038 | 80 | screencast_uptr.release(); | ||
1039 | 81 | } | ||
1040 | 75 | } | 82 | } |
1041 | 76 | catch (std::exception const&) | 83 | catch (std::exception const&) |
1042 | 77 | { | 84 | { |
1043 | 78 | 85 | ||
1044 | === modified file 'src/client/rpc/mir_socket_rpc_channel.cpp' | |||
1045 | --- src/client/rpc/mir_socket_rpc_channel.cpp 2014-01-13 06:12:33 +0000 | |||
1046 | +++ src/client/rpc/mir_socket_rpc_channel.cpp 2014-02-10 09:00:06 +0000 | |||
1047 | @@ -143,6 +143,7 @@ | |||
1048 | 143 | if (!disconnected.load()) | 143 | if (!disconnected.load()) |
1049 | 144 | { | 144 | { |
1050 | 145 | auto surface = dynamic_cast<mir::protobuf::Surface*>(response); | 145 | auto surface = dynamic_cast<mir::protobuf::Surface*>(response); |
1051 | 146 | mir::protobuf::Screencast* screencast{nullptr}; | ||
1052 | 146 | if (surface) | 147 | if (surface) |
1053 | 147 | { | 148 | { |
1054 | 148 | surface->clear_fd(); | 149 | surface->clear_fd(); |
1055 | @@ -157,12 +158,18 @@ | |||
1056 | 157 | rpc_report->file_descriptors_received(*response, fds); | 158 | rpc_report->file_descriptors_received(*response, fds); |
1057 | 158 | } | 159 | } |
1058 | 159 | } | 160 | } |
1059 | 161 | else | ||
1060 | 162 | { | ||
1061 | 163 | screencast = dynamic_cast<mir::protobuf::Screencast*>(response); | ||
1062 | 164 | } | ||
1063 | 160 | 165 | ||
1064 | 161 | auto buffer = dynamic_cast<mir::protobuf::Buffer*>(response); | 166 | auto buffer = dynamic_cast<mir::protobuf::Buffer*>(response); |
1065 | 162 | if (!buffer) | 167 | if (!buffer) |
1066 | 163 | { | 168 | { |
1067 | 164 | if (surface && surface->has_buffer()) | 169 | if (surface && surface->has_buffer()) |
1068 | 165 | buffer = surface->mutable_buffer(); | 170 | buffer = surface->mutable_buffer(); |
1069 | 171 | else if (screencast && screencast->has_buffer()) | ||
1070 | 172 | buffer = screencast->mutable_buffer(); | ||
1071 | 166 | } | 173 | } |
1072 | 167 | 174 | ||
1073 | 168 | if (buffer) | 175 | if (buffer) |
1074 | 169 | 176 | ||
1075 | === modified file 'src/platform/graphics/android/android_alloc_adaptor.cpp' | |||
1076 | --- src/platform/graphics/android/android_alloc_adaptor.cpp 2014-01-13 06:12:33 +0000 | |||
1077 | +++ src/platform/graphics/android/android_alloc_adaptor.cpp 2014-02-10 09:00:06 +0000 | |||
1078 | @@ -69,7 +69,7 @@ | |||
1079 | 69 | } | 69 | } |
1080 | 70 | 70 | ||
1081 | 71 | AndroidBufferHandleDeleter del1(alloc_dev); | 71 | AndroidBufferHandleDeleter del1(alloc_dev); |
1083 | 72 | std::shared_ptr<native_handle_t> handle(buf_handle, del1); | 72 | std::shared_ptr<native_handle_t const> handle(buf_handle, del1); |
1084 | 73 | 73 | ||
1085 | 74 | auto ops = std::make_shared<mga::RealSyncFileOps>(); | 74 | auto ops = std::make_shared<mga::RealSyncFileOps>(); |
1086 | 75 | auto fence = std::make_shared<mga::SyncFence>(ops, -1); | 75 | auto fence = std::make_shared<mga::SyncFence>(ops, -1); |
1087 | 76 | 76 | ||
1088 | === modified file 'src/platform/graphics/android/android_display.cpp' | |||
1089 | --- src/platform/graphics/android/android_display.cpp 2014-01-21 06:27:40 +0000 | |||
1090 | +++ src/platform/graphics/android/android_display.cpp 2014-02-10 09:00:06 +0000 | |||
1091 | @@ -52,9 +52,11 @@ | |||
1092 | 52 | f(*display_buffer); | 52 | f(*display_buffer); |
1093 | 53 | } | 53 | } |
1094 | 54 | 54 | ||
1096 | 55 | std::shared_ptr<mg::DisplayConfiguration> mga::AndroidDisplay::configuration() | 55 | std::unique_ptr<mg::DisplayConfiguration> mga::AndroidDisplay::configuration() const |
1097 | 56 | { | 56 | { |
1099 | 57 | return std::make_shared<mga::AndroidDisplayConfiguration>(current_configuration); | 57 | return std::unique_ptr<mg::DisplayConfiguration>( |
1100 | 58 | new mga::AndroidDisplayConfiguration(current_configuration) | ||
1101 | 59 | ); | ||
1102 | 58 | } | 60 | } |
1103 | 59 | 61 | ||
1104 | 60 | void mga::AndroidDisplay::configure(mg::DisplayConfiguration const& configuration) | 62 | void mga::AndroidDisplay::configure(mg::DisplayConfiguration const& configuration) |
1105 | 61 | 63 | ||
1106 | === modified file 'src/platform/graphics/android/android_display.h' | |||
1107 | --- src/platform/graphics/android/android_display.h 2014-01-13 06:12:33 +0000 | |||
1108 | +++ src/platform/graphics/android/android_display.h 2014-02-10 09:00:06 +0000 | |||
1109 | @@ -48,8 +48,8 @@ | |||
1110 | 48 | 48 | ||
1111 | 49 | void for_each_display_buffer(std::function<void(graphics::DisplayBuffer&)> const& f); | 49 | void for_each_display_buffer(std::function<void(graphics::DisplayBuffer&)> const& f); |
1112 | 50 | 50 | ||
1115 | 51 | std::shared_ptr<DisplayConfiguration> configuration(); | 51 | std::unique_ptr<DisplayConfiguration> configuration() const override; |
1116 | 52 | void configure(DisplayConfiguration const&); | 52 | void configure(DisplayConfiguration const&) override; |
1117 | 53 | 53 | ||
1118 | 54 | void register_configuration_change_handler( | 54 | void register_configuration_change_handler( |
1119 | 55 | EventHandlerRegister& handlers, | 55 | EventHandlerRegister& handlers, |
1120 | 56 | 56 | ||
1121 | === modified file 'src/platform/graphics/android/android_platform.cpp' | |||
1122 | --- src/platform/graphics/android/android_platform.cpp 2014-01-13 06:12:33 +0000 | |||
1123 | +++ src/platform/graphics/android/android_platform.cpp 2014-02-10 09:00:06 +0000 | |||
1124 | @@ -107,13 +107,11 @@ | |||
1125 | 107 | 107 | ||
1126 | 108 | extern "C" std::shared_ptr<mg::Platform> mg::create_platform(std::shared_ptr<mo::Option> const& /*options*/, std::shared_ptr<DisplayReport> const& display_report) | 108 | extern "C" std::shared_ptr<mg::Platform> mg::create_platform(std::shared_ptr<mo::Option> const& /*options*/, std::shared_ptr<DisplayReport> const& display_report) |
1127 | 109 | { | 109 | { |
1128 | 110 | //todo: could parse an option here | ||
1129 | 111 | auto should_use_fb_fallback = false; | ||
1130 | 112 | auto buffer_initializer = std::make_shared<mg::NullBufferInitializer>(); | 110 | auto buffer_initializer = std::make_shared<mg::NullBufferInitializer>(); |
1131 | 113 | auto display_resource_factory = std::make_shared<mga::ResourceFactory>(); | 111 | auto display_resource_factory = std::make_shared<mga::ResourceFactory>(); |
1132 | 114 | auto fb_allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(buffer_initializer); | 112 | auto fb_allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(buffer_initializer); |
1133 | 115 | auto display_builder = std::make_shared<mga::OutputBuilder>( | 113 | auto display_builder = std::make_shared<mga::OutputBuilder>( |
1135 | 116 | fb_allocator, display_resource_factory, display_report, should_use_fb_fallback); | 114 | fb_allocator, display_resource_factory, display_report); |
1136 | 117 | return std::make_shared<mga::AndroidPlatform>(display_builder, display_report); | 115 | return std::make_shared<mga::AndroidPlatform>(display_builder, display_report); |
1137 | 118 | } | 116 | } |
1138 | 119 | 117 | ||
1139 | 120 | 118 | ||
1140 | === modified file 'src/platform/graphics/android/display_buffer.h' | |||
1141 | --- src/platform/graphics/android/display_buffer.h 2014-01-23 17:26:51 +0000 | |||
1142 | +++ src/platform/graphics/android/display_buffer.h 2014-02-10 09:00:06 +0000 | |||
1143 | @@ -61,7 +61,6 @@ | |||
1144 | 61 | std::shared_ptr<DisplayDevice> const display_device; | 61 | std::shared_ptr<DisplayDevice> const display_device; |
1145 | 62 | std::shared_ptr<ANativeWindow> const native_window; | 62 | std::shared_ptr<ANativeWindow> const native_window; |
1146 | 63 | GLContext gl_context; | 63 | GLContext gl_context; |
1147 | 64 | bool prepared; | ||
1148 | 65 | MirOrientation rotation; | 64 | MirOrientation rotation; |
1149 | 66 | }; | 65 | }; |
1150 | 67 | 66 | ||
1151 | 68 | 67 | ||
1152 | === modified file 'src/platform/graphics/android/hwc_device.cpp' | |||
1153 | --- src/platform/graphics/android/hwc_device.cpp 2014-01-23 18:01:19 +0000 | |||
1154 | +++ src/platform/graphics/android/hwc_device.cpp 2014-02-10 09:00:06 +0000 | |||
1155 | @@ -35,10 +35,11 @@ | |||
1156 | 35 | namespace geom = mir::geometry; | 35 | namespace geom = mir::geometry; |
1157 | 36 | 36 | ||
1158 | 37 | mga::HwcDevice::HwcDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device, | 37 | mga::HwcDevice::HwcDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device, |
1160 | 38 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator) | 38 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator, |
1161 | 39 | std::shared_ptr<SyncFileOps> const& sync_ops) | ||
1162 | 39 | : HWCCommonDevice(hwc_device, coordinator), | 40 | : HWCCommonDevice(hwc_device, coordinator), |
1163 | 40 | layer_list({mga::ForceGLLayer{}, mga::FramebufferLayer{}}), | 41 | layer_list({mga::ForceGLLayer{}, mga::FramebufferLayer{}}), |
1165 | 41 | sync_ops(std::make_shared<mga::RealSyncFileOps>()) | 42 | sync_ops(sync_ops) |
1166 | 42 | { | 43 | { |
1167 | 43 | } | 44 | } |
1168 | 44 | 45 | ||
1169 | @@ -79,12 +80,8 @@ | |||
1170 | 79 | BOOST_THROW_EXCEPTION(std::runtime_error("error during hwc set()")); | 80 | BOOST_THROW_EXCEPTION(std::runtime_error("error during hwc set()")); |
1171 | 80 | } | 81 | } |
1172 | 81 | 82 | ||
1175 | 82 | if (last_display_fence) | 83 | mga::SyncFence retire_fence(sync_ops, displays[HWC_DISPLAY_PRIMARY]->retireFenceFd); |
1174 | 83 | last_display_fence->wait(); | ||
1176 | 84 | 84 | ||
1177 | 85 | int framebuffer_fence = layer_list.framebuffer_fence(); | 85 | int framebuffer_fence = layer_list.framebuffer_fence(); |
1178 | 86 | native_buffer->update_fence(framebuffer_fence); | 86 | native_buffer->update_fence(framebuffer_fence); |
1179 | 87 | |||
1180 | 88 | last_display_fence = std::make_shared<mga::SyncFence>( | ||
1181 | 89 | sync_ops, displays[HWC_DISPLAY_PRIMARY]->retireFenceFd); | ||
1182 | 90 | } | 87 | } |
1183 | 91 | 88 | ||
1184 | === modified file 'src/platform/graphics/android/hwc_device.h' | |||
1185 | --- src/platform/graphics/android/hwc_device.h 2014-01-23 18:01:19 +0000 | |||
1186 | +++ src/platform/graphics/android/hwc_device.h 2014-02-10 09:00:06 +0000 | |||
1187 | @@ -34,13 +34,13 @@ | |||
1188 | 34 | { | 34 | { |
1189 | 35 | class HWCVsyncCoordinator; | 35 | class HWCVsyncCoordinator; |
1190 | 36 | class SyncFileOps; | 36 | class SyncFileOps; |
1191 | 37 | class SyncFence; | ||
1192 | 38 | 37 | ||
1193 | 39 | class HwcDevice : public HWCCommonDevice | 38 | class HwcDevice : public HWCCommonDevice |
1194 | 40 | { | 39 | { |
1195 | 41 | public: | 40 | public: |
1196 | 42 | HwcDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device, | 41 | HwcDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device, |
1198 | 43 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator); | 42 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator, |
1199 | 43 | std::shared_ptr<SyncFileOps> const& sync_ops); | ||
1200 | 44 | 44 | ||
1201 | 45 | void prepare_gl(); | 45 | void prepare_gl(); |
1202 | 46 | void prepare_gl_and_overlays(std::list<std::shared_ptr<Renderable>> const& list); | 46 | void prepare_gl_and_overlays(std::list<std::shared_ptr<Renderable>> const& list); |
1203 | @@ -50,10 +50,7 @@ | |||
1204 | 50 | private: | 50 | private: |
1205 | 51 | LayerList layer_list; | 51 | LayerList layer_list; |
1206 | 52 | 52 | ||
1207 | 53 | std::shared_ptr<SyncFence> last_display_fence; | ||
1208 | 54 | std::shared_ptr<SyncFileOps> const sync_ops; | 53 | std::shared_ptr<SyncFileOps> const sync_ops; |
1209 | 55 | unsigned int primary_display_config; | ||
1210 | 56 | MirPixelFormat fb_format; | ||
1211 | 57 | static size_t const num_displays{3}; //primary, external, virtual | 54 | static size_t const num_displays{3}; //primary, external, virtual |
1212 | 58 | }; | 55 | }; |
1213 | 59 | 56 | ||
1214 | 60 | 57 | ||
1215 | === modified file 'src/platform/graphics/android/hwc_layers.cpp' | |||
1216 | --- src/platform/graphics/android/hwc_layers.cpp 2014-01-24 21:50:21 +0000 | |||
1217 | +++ src/platform/graphics/android/hwc_layers.cpp 2014-02-10 09:00:06 +0000 | |||
1218 | @@ -30,14 +30,18 @@ | |||
1219 | 30 | 30 | ||
1220 | 31 | mga::HWCLayer& mga::HWCLayer::operator=(HWCLayer const& layer) | 31 | mga::HWCLayer& mga::HWCLayer::operator=(HWCLayer const& layer) |
1221 | 32 | { | 32 | { |
1223 | 33 | memcpy(this, &layer, sizeof(HWCLayer)); | 33 | memcpy(static_cast<void*>(this), |
1224 | 34 | static_cast<void const*>(&layer), | ||
1225 | 35 | sizeof(HWCLayer)); | ||
1226 | 34 | this->visibleRegionScreen = {1, &this->visible_rect}; | 36 | this->visibleRegionScreen = {1, &this->visible_rect}; |
1227 | 35 | return *this; | 37 | return *this; |
1228 | 36 | } | 38 | } |
1229 | 37 | 39 | ||
1230 | 38 | mga::HWCLayer::HWCLayer(HWCLayer const& layer) | 40 | mga::HWCLayer::HWCLayer(HWCLayer const& layer) |
1231 | 39 | { | 41 | { |
1233 | 40 | memcpy(this, &layer, sizeof(HWCLayer)); | 42 | memcpy(static_cast<void*>(this), |
1234 | 43 | static_cast<void const*>(&layer), | ||
1235 | 44 | sizeof(HWCLayer)); | ||
1236 | 41 | this->visibleRegionScreen = {1, &this->visible_rect}; | 45 | this->visibleRegionScreen = {1, &this->visible_rect}; |
1237 | 42 | } | 46 | } |
1238 | 43 | 47 | ||
1239 | 44 | 48 | ||
1240 | === modified file 'src/platform/graphics/android/internal_client_window.cpp' | |||
1241 | --- src/platform/graphics/android/internal_client_window.cpp 2014-01-13 06:12:33 +0000 | |||
1242 | +++ src/platform/graphics/android/internal_client_window.cpp 2014-02-10 09:00:06 +0000 | |||
1243 | @@ -25,6 +25,7 @@ | |||
1244 | 25 | 25 | ||
1245 | 26 | #include <boost/throw_exception.hpp> | 26 | #include <boost/throw_exception.hpp> |
1246 | 27 | #include <stdexcept> | 27 | #include <stdexcept> |
1247 | 28 | #include <sstream> | ||
1248 | 28 | 29 | ||
1249 | 29 | namespace mg=mir::graphics; | 30 | namespace mg=mir::graphics; |
1250 | 30 | namespace mga=mg::android; | 31 | namespace mga=mg::android; |
1251 | @@ -93,7 +94,11 @@ | |||
1252 | 93 | case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS: | 94 | case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS: |
1253 | 94 | return 1; | 95 | return 1; |
1254 | 95 | default: | 96 | default: |
1256 | 96 | BOOST_THROW_EXCEPTION(std::runtime_error("driver requests info we dont provide. key: " + key)); | 97 | { |
1257 | 98 | std::stringstream sstream; | ||
1258 | 99 | sstream << "driver requests info we dont provide. key: " << key; | ||
1259 | 100 | BOOST_THROW_EXCEPTION(std::runtime_error(sstream.str())); | ||
1260 | 101 | } | ||
1261 | 97 | } | 102 | } |
1262 | 98 | } | 103 | } |
1263 | 99 | 104 | ||
1264 | 100 | 105 | ||
1265 | === modified file 'src/platform/graphics/android/output_builder.cpp' | |||
1266 | --- src/platform/graphics/android/output_builder.cpp 2014-01-21 18:09:35 +0000 | |||
1267 | +++ src/platform/graphics/android/output_builder.cpp 2014-02-10 09:00:06 +0000 | |||
1268 | @@ -33,22 +33,18 @@ | |||
1269 | 33 | mga::OutputBuilder::OutputBuilder( | 33 | mga::OutputBuilder::OutputBuilder( |
1270 | 34 | std::shared_ptr<mga::GraphicBufferAllocator> const& buffer_allocator, | 34 | std::shared_ptr<mga::GraphicBufferAllocator> const& buffer_allocator, |
1271 | 35 | std::shared_ptr<mga::DisplayResourceFactory> const& res_factory, | 35 | std::shared_ptr<mga::DisplayResourceFactory> const& res_factory, |
1274 | 36 | std::shared_ptr<mg::DisplayReport> const& display_report, | 36 | std::shared_ptr<mg::DisplayReport> const& display_report) |
1273 | 37 | bool should_use_fb_fallback) | ||
1275 | 38 | : buffer_allocator(buffer_allocator), | 37 | : buffer_allocator(buffer_allocator), |
1276 | 39 | res_factory(res_factory), | 38 | res_factory(res_factory), |
1277 | 40 | display_report(display_report), | 39 | display_report(display_report), |
1279 | 41 | force_backup_display(should_use_fb_fallback) | 40 | force_backup_display(false) |
1280 | 42 | { | 41 | { |
1290 | 43 | if (!force_backup_display) | 42 | try |
1291 | 44 | { | 43 | { |
1292 | 45 | try | 44 | hwc_native = res_factory->create_hwc_native_device(); |
1293 | 46 | { | 45 | } catch (...) |
1294 | 47 | hwc_native = res_factory->create_hwc_native_device(); | 46 | { |
1295 | 48 | } catch (...) | 47 | force_backup_display = true; |
1287 | 49 | { | ||
1288 | 50 | force_backup_display = true; | ||
1289 | 51 | } | ||
1296 | 52 | } | 48 | } |
1297 | 53 | 49 | ||
1298 | 54 | if (force_backup_display || hwc_native->common.version == HWC_DEVICE_API_VERSION_1_0) | 50 | if (force_backup_display || hwc_native->common.version == HWC_DEVICE_API_VERSION_1_0) |
1299 | 55 | 51 | ||
1300 | === modified file 'src/platform/graphics/android/output_builder.h' | |||
1301 | --- src/platform/graphics/android/output_builder.h 2014-01-13 06:12:33 +0000 | |||
1302 | +++ src/platform/graphics/android/output_builder.h 2014-02-10 09:00:06 +0000 | |||
1303 | @@ -40,8 +40,7 @@ | |||
1304 | 40 | OutputBuilder( | 40 | OutputBuilder( |
1305 | 41 | std::shared_ptr<GraphicBufferAllocator> const& buffer_allocator, | 41 | std::shared_ptr<GraphicBufferAllocator> const& buffer_allocator, |
1306 | 42 | std::shared_ptr<DisplayResourceFactory> const& res_factory, | 42 | std::shared_ptr<DisplayResourceFactory> const& res_factory, |
1309 | 43 | std::shared_ptr<DisplayReport> const& display_report, | 43 | std::shared_ptr<DisplayReport> const& display_report); |
1308 | 44 | bool should_use_fb_fallback); | ||
1310 | 45 | 44 | ||
1311 | 46 | MirPixelFormat display_format(); | 45 | MirPixelFormat display_format(); |
1312 | 47 | std::shared_ptr<DisplayDevice> create_display_device(); | 46 | std::shared_ptr<DisplayDevice> create_display_device(); |
1313 | 48 | 47 | ||
1314 | === modified file 'src/platform/graphics/android/resource_factory.cpp' | |||
1315 | --- src/platform/graphics/android/resource_factory.cpp 2014-01-21 18:09:35 +0000 | |||
1316 | +++ src/platform/graphics/android/resource_factory.cpp 2014-02-10 09:00:06 +0000 | |||
1317 | @@ -18,6 +18,7 @@ | |||
1318 | 18 | */ | 18 | */ |
1319 | 19 | 19 | ||
1320 | 20 | #include "mir/graphics/android/mir_native_window.h" | 20 | #include "mir/graphics/android/mir_native_window.h" |
1321 | 21 | #include "mir/graphics/android/sync_fence.h" | ||
1322 | 21 | #include "buffer.h" | 22 | #include "buffer.h" |
1323 | 22 | #include "resource_factory.h" | 23 | #include "resource_factory.h" |
1324 | 23 | #include "fb_device.h" | 24 | #include "fb_device.h" |
1325 | @@ -91,7 +92,8 @@ | |||
1326 | 91 | std::shared_ptr<hwc_composer_device_1> const& hwc_native_device) const | 92 | std::shared_ptr<hwc_composer_device_1> const& hwc_native_device) const |
1327 | 92 | { | 93 | { |
1328 | 93 | auto syncer = std::make_shared<mga::HWCVsync>(); | 94 | auto syncer = std::make_shared<mga::HWCVsync>(); |
1330 | 94 | return std::make_shared<mga::HwcDevice>(hwc_native_device, syncer); | 95 | auto file_ops = std::make_shared<mga::RealSyncFileOps>(); |
1331 | 96 | return std::make_shared<mga::HwcDevice>(hwc_native_device, syncer, file_ops); | ||
1332 | 95 | } | 97 | } |
1333 | 96 | 98 | ||
1334 | 97 | std::shared_ptr<mga::DisplayDevice> mga::ResourceFactory::create_hwc_fb_device( | 99 | std::shared_ptr<mga::DisplayDevice> mga::ResourceFactory::create_hwc_fb_device( |
1335 | 98 | 100 | ||
1336 | === modified file 'src/platform/graphics/android/server_render_window.cpp' | |||
1337 | --- src/platform/graphics/android/server_render_window.cpp 2014-01-13 06:12:33 +0000 | |||
1338 | +++ src/platform/graphics/android/server_render_window.cpp 2014-02-10 09:00:06 +0000 | |||
1339 | @@ -28,6 +28,7 @@ | |||
1340 | 28 | #include <system/window.h> | 28 | #include <system/window.h> |
1341 | 29 | #include <boost/throw_exception.hpp> | 29 | #include <boost/throw_exception.hpp> |
1342 | 30 | #include <stdexcept> | 30 | #include <stdexcept> |
1343 | 31 | #include <sstream> | ||
1344 | 31 | 32 | ||
1345 | 32 | namespace mg=mir::graphics; | 33 | namespace mg=mir::graphics; |
1346 | 33 | namespace mga=mir::graphics::android; | 34 | namespace mga=mir::graphics::android; |
1347 | @@ -81,7 +82,11 @@ | |||
1348 | 81 | case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS: | 82 | case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS: |
1349 | 82 | return 1; | 83 | return 1; |
1350 | 83 | default: | 84 | default: |
1352 | 84 | BOOST_THROW_EXCEPTION(std::runtime_error("driver requests info we dont provide. key: " + key)); | 85 | { |
1353 | 86 | std::stringstream sstream; | ||
1354 | 87 | sstream << "driver requests info we dont provide. key: " << key; | ||
1355 | 88 | BOOST_THROW_EXCEPTION(std::runtime_error(sstream.str())); | ||
1356 | 89 | } | ||
1357 | 85 | } | 90 | } |
1358 | 86 | } | 91 | } |
1359 | 87 | 92 | ||
1360 | 88 | 93 | ||
1361 | === modified file 'src/platform/graphics/mesa/display.cpp' | |||
1362 | --- src/platform/graphics/mesa/display.cpp 2014-01-22 08:32:55 +0000 | |||
1363 | +++ src/platform/graphics/mesa/display.cpp 2014-02-10 09:00:06 +0000 | |||
1364 | @@ -115,13 +115,15 @@ | |||
1365 | 115 | f(*db_ptr); | 115 | f(*db_ptr); |
1366 | 116 | } | 116 | } |
1367 | 117 | 117 | ||
1369 | 118 | std::shared_ptr<mg::DisplayConfiguration> mgm::Display::configuration() | 118 | std::unique_ptr<mg::DisplayConfiguration> mgm::Display::configuration() const |
1370 | 119 | { | 119 | { |
1371 | 120 | std::lock_guard<std::mutex> lg{configuration_mutex}; | 120 | std::lock_guard<std::mutex> lg{configuration_mutex}; |
1372 | 121 | 121 | ||
1373 | 122 | /* Give back a copy of the latest configuration information */ | 122 | /* Give back a copy of the latest configuration information */ |
1374 | 123 | current_display_configuration.update(); | 123 | current_display_configuration.update(); |
1376 | 124 | return std::make_shared<mgm::RealKMSDisplayConfiguration>(current_display_configuration); | 124 | return std::unique_ptr<mg::DisplayConfiguration>( |
1377 | 125 | new mgm::RealKMSDisplayConfiguration(current_display_configuration) | ||
1378 | 126 | ); | ||
1379 | 125 | } | 127 | } |
1380 | 126 | 128 | ||
1381 | 127 | void mgm::Display::configure(mg::DisplayConfiguration const& conf) | 129 | void mgm::Display::configure(mg::DisplayConfiguration const& conf) |
1382 | 128 | 130 | ||
1383 | === modified file 'src/platform/graphics/mesa/display.h' | |||
1384 | --- src/platform/graphics/mesa/display.h 2014-01-22 08:32:55 +0000 | |||
1385 | +++ src/platform/graphics/mesa/display.h 2014-02-10 09:00:06 +0000 | |||
1386 | @@ -62,8 +62,8 @@ | |||
1387 | 62 | void for_each_display_buffer( | 62 | void for_each_display_buffer( |
1388 | 63 | std::function<void(graphics::DisplayBuffer&)> const& f); | 63 | std::function<void(graphics::DisplayBuffer&)> const& f); |
1389 | 64 | 64 | ||
1392 | 65 | std::shared_ptr<DisplayConfiguration> configuration(); | 65 | std::unique_ptr<DisplayConfiguration> configuration() const override; |
1393 | 66 | void configure(DisplayConfiguration const& conf); | 66 | void configure(DisplayConfiguration const& conf) override; |
1394 | 67 | 67 | ||
1395 | 68 | void register_configuration_change_handler( | 68 | void register_configuration_change_handler( |
1396 | 69 | EventHandlerRegister& handlers, | 69 | EventHandlerRegister& handlers, |
1397 | @@ -83,14 +83,14 @@ | |||
1398 | 83 | private: | 83 | private: |
1399 | 84 | void clear_connected_unused_outputs(); | 84 | void clear_connected_unused_outputs(); |
1400 | 85 | 85 | ||
1402 | 86 | std::mutex configuration_mutex; | 86 | mutable std::mutex configuration_mutex; |
1403 | 87 | std::shared_ptr<Platform> const platform; | 87 | std::shared_ptr<Platform> const platform; |
1404 | 88 | std::shared_ptr<DisplayReport> const listener; | 88 | std::shared_ptr<DisplayReport> const listener; |
1405 | 89 | mir::udev::Monitor monitor; | 89 | mir::udev::Monitor monitor; |
1406 | 90 | helpers::EGLHelper shared_egl; | 90 | helpers::EGLHelper shared_egl; |
1407 | 91 | std::vector<std::unique_ptr<DisplayBuffer>> display_buffers; | 91 | std::vector<std::unique_ptr<DisplayBuffer>> display_buffers; |
1408 | 92 | RealKMSOutputContainer output_container; | 92 | RealKMSOutputContainer output_container; |
1410 | 93 | RealKMSDisplayConfiguration current_display_configuration; | 93 | mutable RealKMSDisplayConfiguration current_display_configuration; |
1411 | 94 | std::shared_ptr<Cursor> cursor; | 94 | std::shared_ptr<Cursor> cursor; |
1412 | 95 | }; | 95 | }; |
1413 | 96 | 96 | ||
1414 | 97 | 97 | ||
1415 | === modified file 'src/server/CMakeLists.txt' | |||
1416 | --- src/server/CMakeLists.txt 2014-01-22 08:32:55 +0000 | |||
1417 | +++ src/server/CMakeLists.txt 2014-02-10 09:00:06 +0000 | |||
1418 | @@ -94,7 +94,7 @@ | |||
1419 | 94 | ) | 94 | ) |
1420 | 95 | endif() | 95 | endif() |
1421 | 96 | 96 | ||
1423 | 97 | set(MIRSERVER_ABI 14) | 97 | set(MIRSERVER_ABI 15) |
1424 | 98 | 98 | ||
1425 | 99 | set_target_properties( | 99 | set_target_properties( |
1426 | 100 | mirserver | 100 | mirserver |
1427 | 101 | 101 | ||
1428 | === modified file 'src/server/compositor/buffer_bundle.h' | |||
1429 | --- src/server/compositor/buffer_bundle.h 2014-01-13 06:12:33 +0000 | |||
1430 | +++ src/server/compositor/buffer_bundle.h 2014-02-10 09:00:06 +0000 | |||
1431 | @@ -34,7 +34,7 @@ | |||
1432 | 34 | { | 34 | { |
1433 | 35 | public: | 35 | public: |
1434 | 36 | virtual ~BufferBundle() noexcept {} | 36 | virtual ~BufferBundle() noexcept {} |
1436 | 37 | virtual graphics::Buffer* client_acquire() = 0; | 37 | virtual void client_acquire(std::function<void(graphics::Buffer* buffer)> complete) = 0; |
1437 | 38 | virtual void client_release(graphics::Buffer*) = 0; | 38 | virtual void client_release(graphics::Buffer*) = 0; |
1438 | 39 | virtual std::shared_ptr<graphics::Buffer> | 39 | virtual std::shared_ptr<graphics::Buffer> |
1439 | 40 | compositor_acquire(unsigned long frameno) = 0; | 40 | compositor_acquire(unsigned long frameno) = 0; |
1440 | 41 | 41 | ||
1441 | === modified file 'src/server/compositor/buffer_stream_surfaces.cpp' | |||
1442 | --- src/server/compositor/buffer_stream_surfaces.cpp 2014-01-13 06:12:33 +0000 | |||
1443 | +++ src/server/compositor/buffer_stream_surfaces.cpp 2014-02-10 09:00:06 +0000 | |||
1444 | @@ -49,13 +49,14 @@ | |||
1445 | 49 | return std::make_shared<mc::TemporarySnapshotBuffer>(buffer_bundle); | 49 | return std::make_shared<mc::TemporarySnapshotBuffer>(buffer_bundle); |
1446 | 50 | } | 50 | } |
1447 | 51 | 51 | ||
1449 | 52 | void mc::BufferStreamSurfaces::swap_client_buffers(mg::Buffer*& buffer) | 52 | void mc::BufferStreamSurfaces::swap_client_buffers(graphics::Buffer* old_buffer, std::function<void(graphics::Buffer* new_buffer)> complete) |
1450 | 53 | { | 53 | { |
1452 | 54 | if (buffer) | 54 | if (old_buffer) |
1453 | 55 | { | 55 | { |
1455 | 56 | buffer_bundle->client_release(buffer); | 56 | buffer_bundle->client_release(old_buffer); |
1456 | 57 | } | 57 | } |
1458 | 58 | buffer = buffer_bundle->client_acquire(); | 58 | |
1459 | 59 | buffer_bundle->client_acquire(complete); | ||
1460 | 59 | } | 60 | } |
1461 | 60 | 61 | ||
1462 | 61 | MirPixelFormat mc::BufferStreamSurfaces::get_stream_pixel_format() | 62 | MirPixelFormat mc::BufferStreamSurfaces::get_stream_pixel_format() |
1463 | 62 | 63 | ||
1464 | === modified file 'src/server/compositor/buffer_stream_surfaces.h' | |||
1465 | --- src/server/compositor/buffer_stream_surfaces.h 2014-01-13 06:12:33 +0000 | |||
1466 | +++ src/server/compositor/buffer_stream_surfaces.h 2014-02-10 09:00:06 +0000 | |||
1467 | @@ -39,7 +39,7 @@ | |||
1468 | 39 | BufferStreamSurfaces(std::shared_ptr<BufferBundle> const& swapper); | 39 | BufferStreamSurfaces(std::shared_ptr<BufferBundle> const& swapper); |
1469 | 40 | ~BufferStreamSurfaces(); | 40 | ~BufferStreamSurfaces(); |
1470 | 41 | 41 | ||
1472 | 42 | void swap_client_buffers(graphics::Buffer*& buffer) override; | 42 | void swap_client_buffers(graphics::Buffer* old_buffer, std::function<void(graphics::Buffer* new_buffer)> complete) override; |
1473 | 43 | 43 | ||
1474 | 44 | std::shared_ptr<graphics::Buffer> | 44 | std::shared_ptr<graphics::Buffer> |
1475 | 45 | lock_compositor_buffer(unsigned long frameno) override; | 45 | lock_compositor_buffer(unsigned long frameno) override; |
1476 | 46 | 46 | ||
1477 | === modified file 'src/server/compositor/default_configuration.cpp' | |||
1478 | --- src/server/compositor/default_configuration.cpp 2014-01-13 06:12:33 +0000 | |||
1479 | +++ src/server/compositor/default_configuration.cpp 2014-02-10 09:00:06 +0000 | |||
1480 | @@ -17,13 +17,17 @@ | |||
1481 | 17 | */ | 17 | */ |
1482 | 18 | 18 | ||
1483 | 19 | #include "mir/default_server_configuration.h" | 19 | #include "mir/default_server_configuration.h" |
1484 | 20 | #include "mir/frontend/screencast.h" | ||
1485 | 20 | #include "buffer_stream_factory.h" | 21 | #include "buffer_stream_factory.h" |
1486 | 21 | #include "default_display_buffer_compositor_factory.h" | 22 | #include "default_display_buffer_compositor_factory.h" |
1487 | 22 | #include "multi_threaded_compositor.h" | 23 | #include "multi_threaded_compositor.h" |
1488 | 23 | #include "gl_renderer_factory.h" | 24 | #include "gl_renderer_factory.h" |
1489 | 24 | 25 | ||
1490 | 26 | #include <boost/throw_exception.hpp> | ||
1491 | 27 | |||
1492 | 25 | namespace mc = mir::compositor; | 28 | namespace mc = mir::compositor; |
1493 | 26 | namespace ms = mir::scene; | 29 | namespace ms = mir::scene; |
1494 | 30 | namespace mf = mir::frontend; | ||
1495 | 27 | 31 | ||
1496 | 28 | std::shared_ptr<ms::BufferStreamFactory> | 32 | std::shared_ptr<ms::BufferStreamFactory> |
1497 | 29 | mir::DefaultServerConfiguration::the_buffer_stream_factory() | 33 | mir::DefaultServerConfiguration::the_buffer_stream_factory() |
1498 | @@ -67,3 +71,31 @@ | |||
1499 | 67 | return std::make_shared<mc::GLRendererFactory>(); | 71 | return std::make_shared<mc::GLRendererFactory>(); |
1500 | 68 | }); | 72 | }); |
1501 | 69 | } | 73 | } |
1502 | 74 | |||
1503 | 75 | std::shared_ptr<mf::Screencast> mir::DefaultServerConfiguration::the_screencast() | ||
1504 | 76 | { | ||
1505 | 77 | struct NotImplementedScreencast : mf::Screencast | ||
1506 | 78 | { | ||
1507 | 79 | mf::ScreencastSessionId create_session( | ||
1508 | 80 | graphics::DisplayConfigurationOutputId) | ||
1509 | 81 | { | ||
1510 | 82 | BOOST_THROW_EXCEPTION(std::runtime_error("Screencast not implemented")); | ||
1511 | 83 | } | ||
1512 | 84 | |||
1513 | 85 | void destroy_session(mf::ScreencastSessionId) | ||
1514 | 86 | { | ||
1515 | 87 | BOOST_THROW_EXCEPTION(std::runtime_error("Screencast not implemented")); | ||
1516 | 88 | } | ||
1517 | 89 | |||
1518 | 90 | std::shared_ptr<graphics::Buffer> capture(mf::ScreencastSessionId) | ||
1519 | 91 | { | ||
1520 | 92 | BOOST_THROW_EXCEPTION(std::runtime_error("Screencast not implemented")); | ||
1521 | 93 | } | ||
1522 | 94 | }; | ||
1523 | 95 | |||
1524 | 96 | return screencast( | ||
1525 | 97 | [this]() | ||
1526 | 98 | { | ||
1527 | 99 | return std::make_shared<NotImplementedScreencast>(); | ||
1528 | 100 | }); | ||
1529 | 101 | } | ||
1530 | 70 | 102 | ||
1531 | === modified file 'src/server/compositor/switching_bundle.cpp' | |||
1532 | --- src/server/compositor/switching_bundle.cpp 2014-01-23 18:42:20 +0000 | |||
1533 | +++ src/server/compositor/switching_bundle.cpp 2014-02-10 09:00:06 +0000 | |||
1534 | @@ -177,7 +177,7 @@ | |||
1535 | 177 | return ring[slot].buf; | 177 | return ring[slot].buf; |
1536 | 178 | } | 178 | } |
1537 | 179 | 179 | ||
1539 | 180 | mg::Buffer* mc::SwitchingBundle::client_acquire() | 180 | void mc::SwitchingBundle::client_acquire(std::function<void(graphics::Buffer* buffer)> complete) |
1540 | 181 | { | 181 | { |
1541 | 182 | std::unique_lock<std::mutex> lock(guard); | 182 | std::unique_lock<std::mutex> lock(guard); |
1542 | 183 | 183 | ||
1543 | @@ -247,7 +247,7 @@ | |||
1544 | 247 | ring[client].buf = ret; | 247 | ring[client].buf = ret; |
1545 | 248 | } | 248 | } |
1546 | 249 | 249 | ||
1548 | 250 | return ret.get(); | 250 | complete(ret.get()); |
1549 | 251 | } | 251 | } |
1550 | 252 | 252 | ||
1551 | 253 | void mc::SwitchingBundle::client_release(graphics::Buffer* released_buffer) | 253 | void mc::SwitchingBundle::client_release(graphics::Buffer* released_buffer) |
1552 | 254 | 254 | ||
1553 | === modified file 'src/server/compositor/switching_bundle.h' | |||
1554 | --- src/server/compositor/switching_bundle.h 2014-01-23 18:42:20 +0000 | |||
1555 | +++ src/server/compositor/switching_bundle.h 2014-02-10 09:00:06 +0000 | |||
1556 | @@ -49,7 +49,7 @@ | |||
1557 | 49 | 49 | ||
1558 | 50 | graphics::BufferProperties properties() const; | 50 | graphics::BufferProperties properties() const; |
1559 | 51 | 51 | ||
1561 | 52 | graphics::Buffer* client_acquire(); | 52 | void client_acquire(std::function<void(graphics::Buffer* buffer)> complete) override; |
1562 | 53 | void client_release(graphics::Buffer* buffer); | 53 | void client_release(graphics::Buffer* buffer); |
1563 | 54 | std::shared_ptr<graphics::Buffer> | 54 | std::shared_ptr<graphics::Buffer> |
1564 | 55 | compositor_acquire(unsigned long frameno) override; | 55 | compositor_acquire(unsigned long frameno) override; |
1565 | 56 | 56 | ||
1566 | === modified file 'src/server/display_server.cpp' | |||
1567 | --- src/server/display_server.cpp 2013-10-16 07:34:22 +0000 | |||
1568 | +++ src/server/display_server.cpp 2014-02-10 09:00:06 +0000 | |||
1569 | @@ -27,6 +27,7 @@ | |||
1570 | 27 | #include "mir/compositor/compositor.h" | 27 | #include "mir/compositor/compositor.h" |
1571 | 28 | #include "mir/frontend/connector.h" | 28 | #include "mir/frontend/connector.h" |
1572 | 29 | #include "mir/graphics/display.h" | 29 | #include "mir/graphics/display.h" |
1573 | 30 | #include "mir/graphics/display_configuration.h" | ||
1574 | 30 | #include "mir/input/input_manager.h" | 31 | #include "mir/input/input_manager.h" |
1575 | 31 | 32 | ||
1576 | 32 | #include <stdexcept> | 33 | #include <stdexcept> |
1577 | @@ -134,7 +135,8 @@ | |||
1578 | 134 | 135 | ||
1579 | 135 | if (configure_display_on_resume) | 136 | if (configure_display_on_resume) |
1580 | 136 | { | 137 | { |
1582 | 137 | auto conf = display->configuration(); | 138 | std::shared_ptr<graphics::DisplayConfiguration> conf = |
1583 | 139 | display->configuration(); | ||
1584 | 138 | display_changer->configure_for_hardware_change( | 140 | display_changer->configure_for_hardware_change( |
1585 | 139 | conf, DisplayChanger::RetainSystemState); | 141 | conf, DisplayChanger::RetainSystemState); |
1586 | 140 | configure_display_on_resume = false; | 142 | configure_display_on_resume = false; |
1587 | @@ -162,7 +164,8 @@ | |||
1588 | 162 | { | 164 | { |
1589 | 163 | if (!paused) | 165 | if (!paused) |
1590 | 164 | { | 166 | { |
1592 | 165 | auto conf = display->configuration(); | 167 | std::shared_ptr<graphics::DisplayConfiguration> conf = |
1593 | 168 | display->configuration(); | ||
1594 | 166 | display_changer->configure_for_hardware_change( | 169 | display_changer->configure_for_hardware_change( |
1595 | 167 | conf, DisplayChanger::PauseResumeSystem); | 170 | conf, DisplayChanger::PauseResumeSystem); |
1596 | 168 | } | 171 | } |
1597 | 169 | 172 | ||
1598 | === modified file 'src/server/frontend/default_configuration.cpp' | |||
1599 | --- src/server/frontend/default_configuration.cpp 2014-01-29 12:51:30 +0000 | |||
1600 | +++ src/server/frontend/default_configuration.cpp 2014-02-10 09:00:06 +0000 | |||
1601 | @@ -1,5 +1,5 @@ | |||
1602 | 1 | /* | 1 | /* |
1604 | 2 | * Copyright © 2012 Canonical Ltd. | 2 | * Copyright © 2012-2014 Canonical Ltd. |
1605 | 3 | * | 3 | * |
1606 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
1607 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
1608 | @@ -42,13 +42,15 @@ | |||
1609 | 42 | std::shared_ptr<mf::SessionMediatorReport> const& sm_report, | 42 | std::shared_ptr<mf::SessionMediatorReport> const& sm_report, |
1610 | 43 | std::shared_ptr<mg::Platform> const& graphics_platform, | 43 | std::shared_ptr<mg::Platform> const& graphics_platform, |
1611 | 44 | std::shared_ptr<mf::DisplayChanger> const& display_changer, | 44 | std::shared_ptr<mf::DisplayChanger> const& display_changer, |
1613 | 45 | std::shared_ptr<mg::GraphicBufferAllocator> const& buffer_allocator) : | 45 | std::shared_ptr<mg::GraphicBufferAllocator> const& buffer_allocator, |
1614 | 46 | std::shared_ptr<mf::Screencast> const& screencast) : | ||
1615 | 46 | shell(shell), | 47 | shell(shell), |
1616 | 47 | sm_report(sm_report), | 48 | sm_report(sm_report), |
1617 | 48 | cache(std::make_shared<mf::ResourceCache>()), | 49 | cache(std::make_shared<mf::ResourceCache>()), |
1618 | 49 | graphics_platform(graphics_platform), | 50 | graphics_platform(graphics_platform), |
1619 | 50 | display_changer(display_changer), | 51 | display_changer(display_changer), |
1621 | 51 | buffer_allocator(buffer_allocator) | 52 | buffer_allocator(buffer_allocator), |
1622 | 53 | screencast(screencast) | ||
1623 | 52 | { | 54 | { |
1624 | 53 | } | 55 | } |
1625 | 54 | 56 | ||
1626 | @@ -59,9 +61,12 @@ | |||
1627 | 59 | std::shared_ptr<mg::Platform> const graphics_platform; | 61 | std::shared_ptr<mg::Platform> const graphics_platform; |
1628 | 60 | std::shared_ptr<mf::DisplayChanger> const display_changer; | 62 | std::shared_ptr<mf::DisplayChanger> const display_changer; |
1629 | 61 | std::shared_ptr<mg::GraphicBufferAllocator> const buffer_allocator; | 63 | std::shared_ptr<mg::GraphicBufferAllocator> const buffer_allocator; |
1630 | 64 | std::shared_ptr<mf::Screencast> const screencast; | ||
1631 | 62 | 65 | ||
1632 | 63 | virtual std::shared_ptr<mir::protobuf::DisplayServer> make_ipc_server( | 66 | virtual std::shared_ptr<mir::protobuf::DisplayServer> make_ipc_server( |
1634 | 64 | std::shared_ptr<mf::EventSink> const& sink, bool authorized_to_resize_display) | 67 | pid_t client_pid, |
1635 | 68 | std::shared_ptr<mf::EventSink> const& sink, | ||
1636 | 69 | bool authorized_to_resize_display) override | ||
1637 | 65 | { | 70 | { |
1638 | 66 | std::shared_ptr<mf::DisplayChanger> changer; | 71 | std::shared_ptr<mf::DisplayChanger> changer; |
1639 | 67 | if(authorized_to_resize_display) | 72 | if(authorized_to_resize_display) |
1640 | @@ -74,13 +79,15 @@ | |||
1641 | 74 | } | 79 | } |
1642 | 75 | 80 | ||
1643 | 76 | return std::make_shared<mf::SessionMediator>( | 81 | return std::make_shared<mf::SessionMediator>( |
1644 | 82 | client_pid, | ||
1645 | 77 | shell, | 83 | shell, |
1646 | 78 | graphics_platform, | 84 | graphics_platform, |
1647 | 79 | changer, | 85 | changer, |
1648 | 80 | buffer_allocator->supported_pixel_formats(), | 86 | buffer_allocator->supported_pixel_formats(), |
1649 | 81 | sm_report, | 87 | sm_report, |
1650 | 82 | sink, | 88 | sink, |
1652 | 83 | resource_cache()); | 89 | resource_cache(), |
1653 | 90 | screencast); | ||
1654 | 84 | } | 91 | } |
1655 | 85 | 92 | ||
1656 | 86 | virtual std::shared_ptr<mf::ResourceCache> resource_cache() | 93 | virtual std::shared_ptr<mf::ResourceCache> resource_cache() |
1657 | @@ -144,6 +151,8 @@ | |||
1658 | 144 | shell, | 151 | shell, |
1659 | 145 | the_session_mediator_report(), | 152 | the_session_mediator_report(), |
1660 | 146 | the_graphics_platform(), | 153 | the_graphics_platform(), |
1662 | 147 | the_frontend_display_changer(), allocator); | 154 | the_frontend_display_changer(), |
1663 | 155 | allocator, | ||
1664 | 156 | the_screencast()); | ||
1665 | 148 | }); | 157 | }); |
1666 | 149 | } | 158 | } |
1667 | 150 | 159 | ||
1668 | === modified file 'src/server/frontend/protobuf_ipc_factory.h' | |||
1669 | --- src/server/frontend/protobuf_ipc_factory.h 2014-01-21 06:27:40 +0000 | |||
1670 | +++ src/server/frontend/protobuf_ipc_factory.h 2014-02-10 09:00:06 +0000 | |||
1671 | @@ -1,5 +1,5 @@ | |||
1672 | 1 | /* | 1 | /* |
1674 | 2 | * Copyright © 2012 Canonical Ltd. | 2 | * Copyright © 2012-2014 Canonical Ltd. |
1675 | 3 | * | 3 | * |
1676 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
1677 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
1678 | @@ -19,6 +19,8 @@ | |||
1679 | 19 | #ifndef MIR_FRONTEND_PROTOBUF_IPC_FACTORY_H_ | 19 | #ifndef MIR_FRONTEND_PROTOBUF_IPC_FACTORY_H_ |
1680 | 20 | #define MIR_FRONTEND_PROTOBUF_IPC_FACTORY_H_ | 20 | #define MIR_FRONTEND_PROTOBUF_IPC_FACTORY_H_ |
1681 | 21 | 21 | ||
1682 | 22 | #include <sys/types.h> | ||
1683 | 23 | |||
1684 | 22 | #include <memory> | 24 | #include <memory> |
1685 | 23 | 25 | ||
1686 | 24 | namespace mir | 26 | namespace mir |
1687 | @@ -37,7 +39,10 @@ | |||
1688 | 37 | { | 39 | { |
1689 | 38 | public: | 40 | public: |
1690 | 39 | virtual std::shared_ptr<protobuf::DisplayServer> make_ipc_server( | 41 | virtual std::shared_ptr<protobuf::DisplayServer> make_ipc_server( |
1692 | 40 | std::shared_ptr<EventSink> const& sink, bool authorized_to_resize_display) = 0; | 42 | pid_t client_pid, |
1693 | 43 | std::shared_ptr<EventSink> const& sink, | ||
1694 | 44 | bool authorized_to_resize_display) = 0; | ||
1695 | 45 | |||
1696 | 41 | virtual std::shared_ptr<ResourceCache> resource_cache() = 0; | 46 | virtual std::shared_ptr<ResourceCache> resource_cache() = 0; |
1697 | 42 | 47 | ||
1698 | 43 | protected: | 48 | protected: |
1699 | 44 | 49 | ||
1700 | === modified file 'src/server/frontend/protobuf_message_processor.cpp' | |||
1701 | --- src/server/frontend/protobuf_message_processor.cpp 2014-01-28 09:06:46 +0000 | |||
1702 | +++ src/server/frontend/protobuf_message_processor.cpp 2014-02-10 09:00:06 +0000 | |||
1703 | @@ -21,6 +21,8 @@ | |||
1704 | 21 | #include "mir/frontend/protobuf_message_sender.h" | 21 | #include "mir/frontend/protobuf_message_sender.h" |
1705 | 22 | #include "mir/frontend/template_protobuf_message_processor.h" | 22 | #include "mir/frontend/template_protobuf_message_processor.h" |
1706 | 23 | 23 | ||
1707 | 24 | #include "mir_protobuf_wire.pb.h" | ||
1708 | 25 | |||
1709 | 24 | namespace mfd = mir::frontend::detail; | 26 | namespace mfd = mir::frontend::detail; |
1710 | 25 | 27 | ||
1711 | 26 | namespace | 28 | namespace |
1712 | @@ -54,11 +56,70 @@ | |||
1713 | 54 | template<> struct result_ptr_t<::mir::protobuf::Buffer> { typedef ::mir::protobuf::Buffer* type; }; | 56 | template<> struct result_ptr_t<::mir::protobuf::Buffer> { typedef ::mir::protobuf::Buffer* type; }; |
1714 | 55 | template<> struct result_ptr_t<::mir::protobuf::Connection> { typedef ::mir::protobuf::Connection* type; }; | 57 | template<> struct result_ptr_t<::mir::protobuf::Connection> { typedef ::mir::protobuf::Connection* type; }; |
1715 | 56 | template<> struct result_ptr_t<::mir::protobuf::Surface> { typedef ::mir::protobuf::Surface* type; }; | 58 | template<> struct result_ptr_t<::mir::protobuf::Surface> { typedef ::mir::protobuf::Surface* type; }; |
1721 | 57 | } | 59 | template<> struct result_ptr_t<::mir::protobuf::Screencast> { typedef ::mir::protobuf::Screencast* type; }; |
1722 | 58 | } | 60 | |
1723 | 59 | } | 61 | template<> |
1724 | 60 | 62 | void invoke( | |
1725 | 61 | bool mfd::ProtobufMessageProcessor::dispatch(mir::protobuf::wire::Invocation const& invocation) | 63 | ProtobufMessageProcessor* self, |
1726 | 64 | protobuf::DisplayServer* server, | ||
1727 | 65 | void (protobuf::DisplayServer::*function)( | ||
1728 | 66 | ::google::protobuf::RpcController* controller, | ||
1729 | 67 | const protobuf::SurfaceId* request, | ||
1730 | 68 | protobuf::Buffer* response, | ||
1731 | 69 | ::google::protobuf::Closure* done), | ||
1732 | 70 | Invocation const& invocation) | ||
1733 | 71 | { | ||
1734 | 72 | protobuf::SurfaceId parameter_message; | ||
1735 | 73 | parameter_message.ParseFromString(invocation.parameters()); | ||
1736 | 74 | auto const result_message = std::make_shared<protobuf::Buffer>(); | ||
1737 | 75 | |||
1738 | 76 | auto const callback = | ||
1739 | 77 | google::protobuf::NewCallback< | ||
1740 | 78 | ProtobufMessageProcessor, | ||
1741 | 79 | ::google::protobuf::uint32, | ||
1742 | 80 | std::shared_ptr<protobuf::Buffer>>( | ||
1743 | 81 | self, | ||
1744 | 82 | &ProtobufMessageProcessor::send_response, | ||
1745 | 83 | invocation.id(), | ||
1746 | 84 | result_message); | ||
1747 | 85 | |||
1748 | 86 | try | ||
1749 | 87 | { | ||
1750 | 88 | (server->*function)( | ||
1751 | 89 | 0, | ||
1752 | 90 | ¶meter_message, | ||
1753 | 91 | result_message.get(), | ||
1754 | 92 | callback); | ||
1755 | 93 | } | ||
1756 | 94 | catch (std::exception const& x) | ||
1757 | 95 | { | ||
1758 | 96 | delete callback; | ||
1759 | 97 | result_message->set_error(boost::diagnostic_information(x)); | ||
1760 | 98 | self->send_response(invocation.id(), result_message); | ||
1761 | 99 | } | ||
1762 | 100 | } | ||
1763 | 101 | } | ||
1764 | 102 | } | ||
1765 | 103 | } | ||
1766 | 104 | |||
1767 | 105 | |||
1768 | 106 | const std::string& mfd::Invocation::method_name() const | ||
1769 | 107 | { | ||
1770 | 108 | return invocation.method_name(); | ||
1771 | 109 | } | ||
1772 | 110 | |||
1773 | 111 | const std::string& mfd::Invocation::parameters() const | ||
1774 | 112 | { | ||
1775 | 113 | return invocation.parameters(); | ||
1776 | 114 | } | ||
1777 | 115 | |||
1778 | 116 | google::protobuf::uint32 mfd::Invocation::id() const | ||
1779 | 117 | { | ||
1780 | 118 | return invocation.id(); | ||
1781 | 119 | } | ||
1782 | 120 | |||
1783 | 121 | |||
1784 | 122 | bool mfd::ProtobufMessageProcessor::dispatch(Invocation const& invocation) | ||
1785 | 62 | { | 123 | { |
1786 | 63 | report->received_invocation(display_server.get(), invocation.id(), invocation.method_name()); | 124 | report->received_invocation(display_server.get(), invocation.id(), invocation.method_name()); |
1787 | 64 | 125 | ||
1788 | @@ -145,6 +206,11 @@ | |||
1789 | 145 | sender->send_response(id, response, {fd}); | 206 | sender->send_response(id, response, {fd}); |
1790 | 146 | } | 207 | } |
1791 | 147 | 208 | ||
1792 | 209 | void mfd::ProtobufMessageProcessor::send_response(::google::protobuf::uint32 id, std::shared_ptr<protobuf::Buffer> response) | ||
1793 | 210 | { | ||
1794 | 211 | send_response(id, response.get()); | ||
1795 | 212 | } | ||
1796 | 213 | |||
1797 | 148 | void mfd::ProtobufMessageProcessor::send_response(::google::protobuf::uint32 id, mir::protobuf::Connection* response) | 214 | void mfd::ProtobufMessageProcessor::send_response(::google::protobuf::uint32 id, mir::protobuf::Connection* response) |
1798 | 149 | { | 215 | { |
1799 | 150 | const auto& fd = response->has_platform() ? | 216 | const auto& fd = response->has_platform() ? |
1800 | @@ -163,3 +229,13 @@ | |||
1801 | 163 | 229 | ||
1802 | 164 | sender->send_response(id, response, {surface_fd, buffer_fd}); | 230 | sender->send_response(id, response, {surface_fd, buffer_fd}); |
1803 | 165 | } | 231 | } |
1804 | 232 | |||
1805 | 233 | void mfd::ProtobufMessageProcessor::send_response( | ||
1806 | 234 | ::google::protobuf::uint32 id, mir::protobuf::Screencast* response) | ||
1807 | 235 | { | ||
1808 | 236 | auto const& buffer_fd = response->has_buffer() ? | ||
1809 | 237 | extract_fds_from(response->mutable_buffer()) : | ||
1810 | 238 | std::vector<int32_t>(); | ||
1811 | 239 | |||
1812 | 240 | sender->send_response(id, response, {buffer_fd}); | ||
1813 | 241 | } | ||
1814 | 166 | 242 | ||
1815 | === modified file 'src/server/frontend/protobuf_message_processor.h' | |||
1816 | --- src/server/frontend/protobuf_message_processor.h 2014-01-22 15:54:11 +0000 | |||
1817 | +++ src/server/frontend/protobuf_message_processor.h 2014-02-10 09:00:06 +0000 | |||
1818 | @@ -52,9 +52,11 @@ | |||
1819 | 52 | void send_response(::google::protobuf::uint32 id, protobuf::Buffer* response); | 52 | void send_response(::google::protobuf::uint32 id, protobuf::Buffer* response); |
1820 | 53 | void send_response(::google::protobuf::uint32 id, protobuf::Connection* response); | 53 | void send_response(::google::protobuf::uint32 id, protobuf::Connection* response); |
1821 | 54 | void send_response(::google::protobuf::uint32 id, protobuf::Surface* response); | 54 | void send_response(::google::protobuf::uint32 id, protobuf::Surface* response); |
1822 | 55 | void send_response(::google::protobuf::uint32 id, std::shared_ptr<protobuf::Buffer> response); | ||
1823 | 56 | void send_response(::google::protobuf::uint32 id, mir::protobuf::Screencast* response); | ||
1824 | 55 | 57 | ||
1825 | 56 | private: | 58 | private: |
1827 | 57 | bool dispatch(mir::protobuf::wire::Invocation const& invocation); | 59 | bool dispatch(Invocation const& invocation); |
1828 | 58 | 60 | ||
1829 | 59 | std::shared_ptr<ProtobufMessageSender> const sender; | 61 | std::shared_ptr<ProtobufMessageSender> const sender; |
1830 | 60 | std::shared_ptr<protobuf::DisplayServer> const display_server; | 62 | std::shared_ptr<protobuf::DisplayServer> const display_server; |
1831 | 61 | 63 | ||
1832 | === modified file 'src/server/frontend/protobuf_session_creator.cpp' | |||
1833 | --- src/server/frontend/protobuf_session_creator.cpp 2014-01-22 15:54:11 +0000 | |||
1834 | +++ src/server/frontend/protobuf_session_creator.cpp 2014-02-10 09:00:06 +0000 | |||
1835 | @@ -1,5 +1,5 @@ | |||
1836 | 1 | /* | 1 | /* |
1838 | 2 | * Copyright © 2013 Canonical Ltd. | 2 | * Copyright © 2013-2014 Canonical Ltd. |
1839 | 3 | * | 3 | * |
1840 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
1841 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
1842 | @@ -69,7 +69,7 @@ | |||
1843 | 69 | auto const event_sink = std::make_shared<detail::EventSender>(messenger); | 69 | auto const event_sink = std::make_shared<detail::EventSender>(messenger); |
1844 | 70 | auto const msg_processor = create_processor( | 70 | auto const msg_processor = create_processor( |
1845 | 71 | message_sender, | 71 | message_sender, |
1847 | 72 | ipc_factory->make_ipc_server(event_sink, authorized_to_resize_display), | 72 | ipc_factory->make_ipc_server(client_pid, event_sink, authorized_to_resize_display), |
1848 | 73 | report); | 73 | report); |
1849 | 74 | 74 | ||
1850 | 75 | const auto& session = std::make_shared<mfd::SocketSession>(messenger, next_id(), connected_sessions, msg_processor); | 75 | const auto& session = std::make_shared<mfd::SocketSession>(messenger, next_id(), connected_sessions, msg_processor); |
1851 | 76 | 76 | ||
1852 | === modified file 'src/server/frontend/session_mediator.cpp' | |||
1853 | --- src/server/frontend/session_mediator.cpp 2014-01-13 06:12:33 +0000 | |||
1854 | +++ src/server/frontend/session_mediator.cpp 2014-02-10 09:00:06 +0000 | |||
1855 | @@ -1,5 +1,5 @@ | |||
1856 | 1 | /* | 1 | /* |
1858 | 2 | * Copyright © 2012 Canonical Ltd. | 2 | * Copyright © 2012-2014 Canonical Ltd. |
1859 | 3 | * | 3 | * |
1860 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
1861 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
1862 | @@ -38,6 +38,7 @@ | |||
1863 | 38 | #include "mir/graphics/platform_ipc_package.h" | 38 | #include "mir/graphics/platform_ipc_package.h" |
1864 | 39 | #include "mir/frontend/client_constants.h" | 39 | #include "mir/frontend/client_constants.h" |
1865 | 40 | #include "mir/frontend/event_sink.h" | 40 | #include "mir/frontend/event_sink.h" |
1866 | 41 | #include "mir/frontend/screencast.h" | ||
1867 | 41 | 42 | ||
1868 | 42 | #include "mir/geometry/rectangles.h" | 43 | #include "mir/geometry/rectangles.h" |
1869 | 43 | #include "client_buffer_tracker.h" | 44 | #include "client_buffer_tracker.h" |
1870 | @@ -55,20 +56,24 @@ | |||
1871 | 55 | namespace geom = mir::geometry; | 56 | namespace geom = mir::geometry; |
1872 | 56 | 57 | ||
1873 | 57 | mf::SessionMediator::SessionMediator( | 58 | mf::SessionMediator::SessionMediator( |
1874 | 59 | pid_t client_pid, | ||
1875 | 58 | std::shared_ptr<frontend::Shell> const& shell, | 60 | std::shared_ptr<frontend::Shell> const& shell, |
1876 | 59 | std::shared_ptr<graphics::Platform> const & graphics_platform, | 61 | std::shared_ptr<graphics::Platform> const & graphics_platform, |
1877 | 60 | std::shared_ptr<mf::DisplayChanger> const& display_changer, | 62 | std::shared_ptr<mf::DisplayChanger> const& display_changer, |
1878 | 61 | std::vector<MirPixelFormat> const& surface_pixel_formats, | 63 | std::vector<MirPixelFormat> const& surface_pixel_formats, |
1879 | 62 | std::shared_ptr<SessionMediatorReport> const& report, | 64 | std::shared_ptr<SessionMediatorReport> const& report, |
1880 | 63 | std::shared_ptr<EventSink> const& sender, | 65 | std::shared_ptr<EventSink> const& sender, |
1882 | 64 | std::shared_ptr<ResourceCache> const& resource_cache) : | 66 | std::shared_ptr<ResourceCache> const& resource_cache, |
1883 | 67 | std::shared_ptr<Screencast> const& screencast) : | ||
1884 | 68 | client_pid(client_pid), | ||
1885 | 65 | shell(shell), | 69 | shell(shell), |
1886 | 66 | graphics_platform(graphics_platform), | 70 | graphics_platform(graphics_platform), |
1887 | 67 | surface_pixel_formats(surface_pixel_formats), | 71 | surface_pixel_formats(surface_pixel_formats), |
1888 | 68 | display_changer(display_changer), | 72 | display_changer(display_changer), |
1889 | 69 | report(report), | 73 | report(report), |
1890 | 70 | event_sink(sender), | 74 | event_sink(sender), |
1892 | 71 | resource_cache(resource_cache) | 75 | resource_cache(resource_cache), |
1893 | 76 | screencast(screencast) | ||
1894 | 72 | { | 77 | { |
1895 | 73 | } | 78 | } |
1896 | 74 | 79 | ||
1897 | @@ -92,7 +97,7 @@ | |||
1898 | 92 | 97 | ||
1899 | 93 | { | 98 | { |
1900 | 94 | std::unique_lock<std::mutex> lock(session_mutex); | 99 | std::unique_lock<std::mutex> lock(session_mutex); |
1902 | 95 | weak_session = shell->open_session(request->application_name(), event_sink); | 100 | weak_session = shell->open_session(client_pid, request->application_name(), event_sink); |
1903 | 96 | } | 101 | } |
1904 | 97 | 102 | ||
1905 | 98 | auto ipc_package = graphics_platform->get_ipc_package(); | 103 | auto ipc_package = graphics_platform->get_ipc_package(); |
1906 | @@ -116,19 +121,25 @@ | |||
1907 | 116 | done->Run(); | 121 | done->Run(); |
1908 | 117 | } | 122 | } |
1909 | 118 | 123 | ||
1912 | 119 | std::tuple<mg::Buffer*, bool> | 124 | void mf::SessionMediator::advance_buffer( |
1913 | 120 | mf::SessionMediator::advance_buffer(SurfaceId surf_id, Surface& surface) | 125 | SurfaceId surf_id, |
1914 | 126 | Surface& surface, | ||
1915 | 127 | std::function<void(graphics::Buffer*, bool)> complete) | ||
1916 | 121 | { | 128 | { |
1917 | 122 | auto& tracker = client_buffer_tracker[surf_id]; | 129 | auto& tracker = client_buffer_tracker[surf_id]; |
1918 | 123 | if (!tracker) tracker = std::make_shared<ClientBufferTracker>(client_buffer_cache_size); | 130 | if (!tracker) tracker = std::make_shared<ClientBufferTracker>(client_buffer_cache_size); |
1919 | 124 | 131 | ||
1920 | 125 | auto& client_buffer = client_buffer_resource[surf_id]; | 132 | auto& client_buffer = client_buffer_resource[surf_id]; |
1925 | 126 | surface.swap_buffers(client_buffer); | 133 | surface.swap_buffers(client_buffer, |
1926 | 127 | auto id = client_buffer->id(); | 134 | [&tracker, &client_buffer, complete](mg::Buffer* new_buffer) |
1927 | 128 | auto need_full_ipc = !tracker->client_has(id); | 135 | { |
1928 | 129 | tracker->add(id); | 136 | client_buffer = new_buffer; |
1929 | 137 | auto id = client_buffer->id(); | ||
1930 | 138 | auto need_full_ipc = !tracker->client_has(id); | ||
1931 | 139 | tracker->add(id); | ||
1932 | 130 | 140 | ||
1934 | 131 | return std::tie(client_buffer, need_full_ipc); | 141 | complete(client_buffer, need_full_ipc); |
1935 | 142 | }); | ||
1936 | 132 | } | 143 | } |
1937 | 133 | 144 | ||
1938 | 134 | 145 | ||
1939 | @@ -138,49 +149,48 @@ | |||
1940 | 138 | mir::protobuf::Surface* response, | 149 | mir::protobuf::Surface* response, |
1941 | 139 | google::protobuf::Closure* done) | 150 | google::protobuf::Closure* done) |
1942 | 140 | { | 151 | { |
1986 | 141 | bool need_full_ipc; | 152 | |
1987 | 142 | graphics::Buffer* client_buffer{nullptr}; | 153 | auto const lock = std::make_shared<std::unique_lock<std::mutex>>(session_mutex); |
1988 | 143 | std::shared_ptr<Session> session; | 154 | |
1989 | 144 | 155 | auto const session = weak_session.lock(); | |
1990 | 145 | { | 156 | |
1991 | 146 | std::unique_lock<std::mutex> lock(session_mutex); | 157 | if (session.get() == nullptr) |
1992 | 147 | 158 | BOOST_THROW_EXCEPTION(std::logic_error("Invalid application session")); | |
1993 | 148 | session = weak_session.lock(); | 159 | |
1994 | 149 | 160 | report->session_create_surface_called(session->name()); | |
1995 | 150 | if (session.get() == nullptr) | 161 | |
1996 | 151 | BOOST_THROW_EXCEPTION(std::logic_error("Invalid application session")); | 162 | auto const surf_id = session->create_surface(msh::SurfaceCreationParameters() |
1997 | 152 | 163 | .of_name(request->surface_name()) | |
1998 | 153 | report->session_create_surface_called(session->name()); | 164 | .of_size(request->width(), request->height()) |
1999 | 154 | 165 | .of_buffer_usage(static_cast<graphics::BufferUsage>(request->buffer_usage())) | |
2000 | 155 | auto const surf_id = session->create_surface(msh::SurfaceCreationParameters() | 166 | .of_pixel_format(static_cast<MirPixelFormat>(request->pixel_format())) |
2001 | 156 | .of_name(request->surface_name()) | 167 | .with_output_id(graphics::DisplayConfigurationOutputId(request->output_id()))); |
2002 | 157 | .of_size(request->width(), request->height()) | 168 | |
2003 | 158 | .of_buffer_usage(static_cast<graphics::BufferUsage>(request->buffer_usage())) | 169 | auto surface = session->get_surface(surf_id); |
2004 | 159 | .of_pixel_format(static_cast<MirPixelFormat>(request->pixel_format())) | 170 | response->mutable_id()->set_value(surf_id.as_value()); |
2005 | 160 | .with_output_id(graphics::DisplayConfigurationOutputId(request->output_id()))); | 171 | response->set_width(surface->size().width.as_uint32_t()); |
2006 | 161 | 172 | response->set_height(surface->size().height.as_uint32_t()); | |
2007 | 162 | auto surface = session->get_surface(surf_id); | 173 | response->set_pixel_format((int)surface->pixel_format()); |
2008 | 163 | response->mutable_id()->set_value(surf_id.as_value()); | 174 | response->set_buffer_usage(request->buffer_usage()); |
2009 | 164 | response->set_width(surface->size().width.as_uint32_t()); | 175 | |
2010 | 165 | response->set_height(surface->size().height.as_uint32_t()); | 176 | if (surface->supports_input()) |
2011 | 166 | response->set_pixel_format((int)surface->pixel_format()); | 177 | response->add_fd(surface->client_input_fd()); |
2012 | 167 | response->set_buffer_usage(request->buffer_usage()); | 178 | |
2013 | 168 | 179 | advance_buffer(surf_id, *surface, | |
2014 | 169 | if (surface->supports_input()) | 180 | [lock, this, response, done, session](graphics::Buffer* client_buffer, bool need_full_ipc) |
2015 | 170 | response->add_fd(surface->client_input_fd()); | 181 | { |
2016 | 171 | 182 | lock->unlock(); | |
2017 | 172 | std::tie(client_buffer, need_full_ipc) = advance_buffer(surf_id, *surface); | 183 | |
2018 | 173 | } | 184 | auto buffer = response->mutable_buffer(); |
2019 | 174 | 185 | pack_protobuf_buffer(*buffer, client_buffer, need_full_ipc); | |
2020 | 175 | auto buffer = response->mutable_buffer(); | 186 | |
2021 | 176 | pack_protobuf_buffer(*buffer, client_buffer, need_full_ipc); | 187 | // TODO: NOTE: We use the ordering here to ensure the shell acts on the surface after the surface ID is sent over the wire. |
2022 | 177 | 188 | // This guarantees that notifications such as, gained focus, etc, can be correctly interpreted by the client. | |
2023 | 178 | // TODO: NOTE: We use the ordering here to ensure the shell acts on the surface after the surface ID is sent over the wire. | 189 | // To achieve this order we rely on done->Run() sending messages synchronously. As documented in mfd::SocketMessenger::send. |
2024 | 179 | // This guarantees that notifications such as, gained focus, etc, can be correctly interpreted by the client. | 190 | // this will require additional synchronization if mfd::SocketMessenger::send changes. |
2025 | 180 | // To achieve this order we rely on done->Run() sending messages synchronously. As documented in mfd::SocketMessenger::send. | 191 | done->Run(); |
2026 | 181 | // this will require additional synchronization if mfd::SocketMessenger::send changes. | 192 | shell->handle_surface_created(session); |
2027 | 182 | done->Run(); | 193 | }); |
1985 | 183 | shell->handle_surface_created(session); | ||
2028 | 184 | } | 194 | } |
2029 | 185 | 195 | ||
2030 | 186 | void mf::SessionMediator::next_buffer( | 196 | void mf::SessionMediator::next_buffer( |
2031 | @@ -189,34 +199,34 @@ | |||
2032 | 189 | ::mir::protobuf::Buffer* response, | 199 | ::mir::protobuf::Buffer* response, |
2033 | 190 | ::google::protobuf::Closure* done) | 200 | ::google::protobuf::Closure* done) |
2034 | 191 | { | 201 | { |
2035 | 192 | bool need_full_ipc; | ||
2036 | 193 | SurfaceId const surf_id{request->value()}; | 202 | SurfaceId const surf_id{request->value()}; |
2063 | 194 | graphics::Buffer* client_buffer{nullptr}; | 203 | |
2064 | 195 | 204 | auto const lock = std::make_shared<std::unique_lock<std::mutex>>(session_mutex); | |
2065 | 196 | { | 205 | |
2066 | 197 | std::unique_lock<std::mutex> lock(session_mutex); | 206 | auto const session = weak_session.lock(); |
2067 | 198 | 207 | ||
2068 | 199 | auto session = weak_session.lock(); | 208 | if (session.get() == nullptr) |
2069 | 200 | 209 | BOOST_THROW_EXCEPTION(std::logic_error("Invalid application session")); | |
2070 | 201 | if (session.get() == nullptr) | 210 | |
2071 | 202 | BOOST_THROW_EXCEPTION(std::logic_error("Invalid application session")); | 211 | report->session_next_buffer_called(session->name()); |
2072 | 203 | 212 | ||
2073 | 204 | report->session_next_buffer_called(session->name()); | 213 | // We ensure the client has not powered down the outputs, so that |
2074 | 205 | 214 | // swap_buffer will not block indefinitely, leaving the client | |
2075 | 206 | // We ensure the client has not powered down the outputs, so that | 215 | // in a position where it can not turn back on the |
2076 | 207 | // swap_buffer will not block indefinitely, leaving the client | 216 | // outputs. |
2077 | 208 | // in a position where it can not turn back on the | 217 | display_changer->ensure_display_powered(session); |
2078 | 209 | // outputs. | 218 | |
2079 | 210 | display_changer->ensure_display_powered(session); | 219 | auto surface = session->get_surface(surf_id); |
2080 | 211 | 220 | ||
2081 | 212 | auto surface = session->get_surface(surf_id); | 221 | advance_buffer(surf_id, *surface, |
2082 | 213 | 222 | [lock, this, response, done, session](graphics::Buffer* client_buffer, bool need_full_ipc) | |
2083 | 214 | std::tie(client_buffer, need_full_ipc) = advance_buffer(surf_id, *surface); | 223 | { |
2084 | 215 | } | 224 | lock->unlock(); |
2085 | 216 | 225 | ||
2086 | 217 | pack_protobuf_buffer(*response, client_buffer, need_full_ipc); | 226 | pack_protobuf_buffer(*response, client_buffer, need_full_ipc); |
2087 | 218 | 227 | ||
2088 | 219 | done->Run(); | 228 | done->Run(); |
2089 | 229 | }); | ||
2090 | 220 | } | 230 | } |
2091 | 221 | 231 | ||
2092 | 222 | void mf::SessionMediator::release_surface( | 232 | void mf::SessionMediator::release_surface( |
2093 | @@ -340,6 +350,59 @@ | |||
2094 | 340 | done->Run(); | 350 | done->Run(); |
2095 | 341 | } | 351 | } |
2096 | 342 | 352 | ||
2097 | 353 | void mf::SessionMediator::create_screencast( | ||
2098 | 354 | google::protobuf::RpcController*, | ||
2099 | 355 | const mir::protobuf::ScreencastParameters* parameters, | ||
2100 | 356 | mir::protobuf::Screencast* protobuf_screencast, | ||
2101 | 357 | google::protobuf::Closure* done) | ||
2102 | 358 | { | ||
2103 | 359 | static bool const need_full_ipc{true}; | ||
2104 | 360 | mg::DisplayConfigurationOutputId const output_id{ | ||
2105 | 361 | static_cast<int>(parameters->output_id())}; | ||
2106 | 362 | |||
2107 | 363 | auto screencast_session_id = screencast->create_session(output_id); | ||
2108 | 364 | auto buffer = screencast->capture(screencast_session_id); | ||
2109 | 365 | |||
2110 | 366 | protobuf_screencast->mutable_screencast_id()->set_value( | ||
2111 | 367 | screencast_session_id.as_value()); | ||
2112 | 368 | pack_protobuf_buffer(*protobuf_screencast->mutable_buffer(), | ||
2113 | 369 | buffer.get(), | ||
2114 | 370 | need_full_ipc); | ||
2115 | 371 | |||
2116 | 372 | done->Run(); | ||
2117 | 373 | } | ||
2118 | 374 | |||
2119 | 375 | void mf::SessionMediator::release_screencast( | ||
2120 | 376 | google::protobuf::RpcController*, | ||
2121 | 377 | const mir::protobuf::ScreencastId* protobuf_screencast_id, | ||
2122 | 378 | mir::protobuf::Void*, | ||
2123 | 379 | google::protobuf::Closure* done) | ||
2124 | 380 | { | ||
2125 | 381 | ScreencastSessionId const screencast_session_id{ | ||
2126 | 382 | protobuf_screencast_id->value()}; | ||
2127 | 383 | screencast->destroy_session(screencast_session_id); | ||
2128 | 384 | done->Run(); | ||
2129 | 385 | } | ||
2130 | 386 | |||
2131 | 387 | void mf::SessionMediator::screencast_buffer( | ||
2132 | 388 | google::protobuf::RpcController*, | ||
2133 | 389 | const mir::protobuf::ScreencastId* protobuf_screencast_id, | ||
2134 | 390 | mir::protobuf::Buffer* protobuf_buffer, | ||
2135 | 391 | google::protobuf::Closure* done) | ||
2136 | 392 | { | ||
2137 | 393 | static bool const does_not_need_full_ipc{false}; | ||
2138 | 394 | ScreencastSessionId const screencast_session_id{ | ||
2139 | 395 | protobuf_screencast_id->value()}; | ||
2140 | 396 | |||
2141 | 397 | auto buffer = screencast->capture(screencast_session_id); | ||
2142 | 398 | |||
2143 | 399 | pack_protobuf_buffer(*protobuf_buffer, | ||
2144 | 400 | buffer.get(), | ||
2145 | 401 | does_not_need_full_ipc); | ||
2146 | 402 | |||
2147 | 403 | done->Run(); | ||
2148 | 404 | } | ||
2149 | 405 | |||
2150 | 343 | void mf::SessionMediator::pack_protobuf_buffer( | 406 | void mf::SessionMediator::pack_protobuf_buffer( |
2151 | 344 | protobuf::Buffer& protobuf_buffer, | 407 | protobuf::Buffer& protobuf_buffer, |
2152 | 345 | graphics::Buffer* graphics_buffer, | 408 | graphics::Buffer* graphics_buffer, |
2153 | 346 | 409 | ||
2154 | === modified file 'src/server/frontend/session_mediator.h' | |||
2155 | --- src/server/frontend/session_mediator.h 2014-01-13 06:12:33 +0000 | |||
2156 | +++ src/server/frontend/session_mediator.h 2014-02-10 09:00:06 +0000 | |||
2157 | @@ -1,5 +1,5 @@ | |||
2158 | 1 | /* | 1 | /* |
2160 | 2 | * Copyright © 2012 Canonical Ltd. | 2 | * Copyright © 2012-2014 Canonical Ltd. |
2161 | 3 | * | 3 | * |
2162 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
2163 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
2164 | @@ -24,6 +24,7 @@ | |||
2165 | 24 | #include "mir/frontend/surface_id.h" | 24 | #include "mir/frontend/surface_id.h" |
2166 | 25 | #include "mir_toolkit/common.h" | 25 | #include "mir_toolkit/common.h" |
2167 | 26 | 26 | ||
2168 | 27 | #include <functional> | ||
2169 | 27 | #include <unordered_map> | 28 | #include <unordered_map> |
2170 | 28 | #include <memory> | 29 | #include <memory> |
2171 | 29 | #include <mutex> | 30 | #include <mutex> |
2172 | @@ -52,19 +53,22 @@ | |||
2173 | 52 | class SessionMediatorReport; | 53 | class SessionMediatorReport; |
2174 | 53 | class EventSink; | 54 | class EventSink; |
2175 | 54 | class DisplayChanger; | 55 | class DisplayChanger; |
2176 | 56 | class Screencast; | ||
2177 | 55 | 57 | ||
2178 | 56 | // SessionMediator relays requests from the client process into the server. | 58 | // SessionMediator relays requests from the client process into the server. |
2179 | 57 | class SessionMediator : public mir::protobuf::DisplayServer | 59 | class SessionMediator : public mir::protobuf::DisplayServer |
2180 | 58 | { | 60 | { |
2181 | 59 | public: | 61 | public: |
2182 | 60 | SessionMediator( | 62 | SessionMediator( |
2183 | 63 | pid_t client_pid, | ||
2184 | 61 | std::shared_ptr<Shell> const& shell, | 64 | std::shared_ptr<Shell> const& shell, |
2185 | 62 | std::shared_ptr<graphics::Platform> const& graphics_platform, | 65 | std::shared_ptr<graphics::Platform> const& graphics_platform, |
2186 | 63 | std::shared_ptr<frontend::DisplayChanger> const& display_changer, | 66 | std::shared_ptr<frontend::DisplayChanger> const& display_changer, |
2187 | 64 | std::vector<MirPixelFormat> const& surface_pixel_formats, | 67 | std::vector<MirPixelFormat> const& surface_pixel_formats, |
2188 | 65 | std::shared_ptr<SessionMediatorReport> const& report, | 68 | std::shared_ptr<SessionMediatorReport> const& report, |
2189 | 66 | std::shared_ptr<EventSink> const& event_sink, | 69 | std::shared_ptr<EventSink> const& event_sink, |
2191 | 67 | std::shared_ptr<ResourceCache> const& resource_cache); | 70 | std::shared_ptr<ResourceCache> const& resource_cache, |
2192 | 71 | std::shared_ptr<Screencast> const& screencast); | ||
2193 | 68 | 72 | ||
2194 | 69 | ~SessionMediator() noexcept; | 73 | ~SessionMediator() noexcept; |
2195 | 70 | 74 | ||
2196 | @@ -105,6 +109,21 @@ | |||
2197 | 105 | ::mir::protobuf::DisplayConfiguration* response, | 109 | ::mir::protobuf::DisplayConfiguration* response, |
2198 | 106 | ::google::protobuf::Closure* done) override; | 110 | ::google::protobuf::Closure* done) override; |
2199 | 107 | 111 | ||
2200 | 112 | void create_screencast(google::protobuf::RpcController*, | ||
2201 | 113 | const mir::protobuf::ScreencastParameters*, | ||
2202 | 114 | mir::protobuf::Screencast*, | ||
2203 | 115 | google::protobuf::Closure* done); | ||
2204 | 116 | |||
2205 | 117 | void release_screencast(google::protobuf::RpcController*, | ||
2206 | 118 | const mir::protobuf::ScreencastId*, | ||
2207 | 119 | mir::protobuf::Void*, | ||
2208 | 120 | google::protobuf::Closure* done); | ||
2209 | 121 | |||
2210 | 122 | void screencast_buffer(google::protobuf::RpcController*, | ||
2211 | 123 | const mir::protobuf::ScreencastId*, | ||
2212 | 124 | mir::protobuf::Buffer*, | ||
2213 | 125 | google::protobuf::Closure* done); | ||
2214 | 126 | |||
2215 | 108 | /* Platform specific requests */ | 127 | /* Platform specific requests */ |
2216 | 109 | void drm_auth_magic(google::protobuf::RpcController* controller, | 128 | void drm_auth_magic(google::protobuf::RpcController* controller, |
2217 | 110 | const mir::protobuf::DRMMagic* request, | 129 | const mir::protobuf::DRMMagic* request, |
2218 | @@ -116,7 +135,8 @@ | |||
2219 | 116 | graphics::Buffer* graphics_buffer, | 135 | graphics::Buffer* graphics_buffer, |
2220 | 117 | bool need_full_ipc); | 136 | bool need_full_ipc); |
2221 | 118 | 137 | ||
2223 | 119 | std::tuple<graphics::Buffer*, bool> advance_buffer(SurfaceId surf_id, Surface& surface); | 138 | void advance_buffer(SurfaceId surf_id, Surface& surface, std::function<void(graphics::Buffer*, bool)> complete); |
2224 | 139 | pid_t client_pid; | ||
2225 | 120 | std::shared_ptr<Shell> const shell; | 140 | std::shared_ptr<Shell> const shell; |
2226 | 121 | std::shared_ptr<graphics::Platform> const graphics_platform; | 141 | std::shared_ptr<graphics::Platform> const graphics_platform; |
2227 | 122 | 142 | ||
2228 | @@ -126,6 +146,7 @@ | |||
2229 | 126 | std::shared_ptr<SessionMediatorReport> const report; | 146 | std::shared_ptr<SessionMediatorReport> const report; |
2230 | 127 | std::shared_ptr<EventSink> const event_sink; | 147 | std::shared_ptr<EventSink> const event_sink; |
2231 | 128 | std::shared_ptr<ResourceCache> const resource_cache; | 148 | std::shared_ptr<ResourceCache> const resource_cache; |
2232 | 149 | std::shared_ptr<Screencast> const screencast; | ||
2233 | 129 | 150 | ||
2234 | 130 | std::unordered_map<SurfaceId,graphics::Buffer*> client_buffer_resource; | 151 | std::unordered_map<SurfaceId,graphics::Buffer*> client_buffer_resource; |
2235 | 131 | std::unordered_map<SurfaceId, std::shared_ptr<ClientBufferTracker>> client_buffer_tracker; | 152 | std::unordered_map<SurfaceId, std::shared_ptr<ClientBufferTracker>> client_buffer_tracker; |
2236 | 132 | 153 | ||
2237 | === modified file 'src/server/frontend/surface.cpp' | |||
2238 | --- src/server/frontend/surface.cpp 2014-01-13 06:12:33 +0000 | |||
2239 | +++ src/server/frontend/surface.cpp 2014-02-10 09:00:06 +0000 | |||
2240 | @@ -25,6 +25,10 @@ | |||
2241 | 25 | 25 | ||
2242 | 26 | #include "client_buffer_tracker.h" | 26 | #include "client_buffer_tracker.h" |
2243 | 27 | 27 | ||
2244 | 28 | #include <condition_variable> | ||
2245 | 29 | #include <mutex> | ||
2246 | 30 | #include <thread> | ||
2247 | 31 | |||
2248 | 28 | namespace mg = mir::graphics; | 32 | namespace mg = mir::graphics; |
2249 | 29 | namespace mf = mir::frontend; | 33 | namespace mf = mir::frontend; |
2250 | 30 | 34 | ||
2251 | @@ -39,7 +43,7 @@ | |||
2252 | 39 | private: | 43 | private: |
2253 | 40 | void swap_buffers(graphics::Buffer*& buffer) | 44 | void swap_buffers(graphics::Buffer*& buffer) |
2254 | 41 | { | 45 | { |
2256 | 42 | surface->swap_buffers(buffer); | 46 | surface->swap_buffers_blocking(buffer); |
2257 | 43 | } | 47 | } |
2258 | 44 | virtual mir::geometry::Size size() const { return surface->size(); } | 48 | virtual mir::geometry::Size size() const { return surface->size(); } |
2259 | 45 | virtual MirPixelFormat pixel_format() const { return surface->pixel_format(); } | 49 | virtual MirPixelFormat pixel_format() const { return surface->pixel_format(); } |
2260 | @@ -49,3 +53,23 @@ | |||
2261 | 49 | 53 | ||
2262 | 50 | return std::make_shared<ForwardingInternalSurface>(surface); | 54 | return std::make_shared<ForwardingInternalSurface>(surface); |
2263 | 51 | } | 55 | } |
2264 | 56 | |||
2265 | 57 | void mf::Surface::swap_buffers_blocking(graphics::Buffer*& buffer) | ||
2266 | 58 | { | ||
2267 | 59 | std::mutex mutex; | ||
2268 | 60 | std::condition_variable cv; | ||
2269 | 61 | bool done = false; | ||
2270 | 62 | |||
2271 | 63 | swap_buffers(buffer, | ||
2272 | 64 | [&](mg::Buffer* new_buffer) | ||
2273 | 65 | { | ||
2274 | 66 | std::unique_lock<decltype(mutex)> lock(mutex); | ||
2275 | 67 | buffer = new_buffer; | ||
2276 | 68 | done = true; | ||
2277 | 69 | cv.notify_one(); | ||
2278 | 70 | }); | ||
2279 | 71 | |||
2280 | 72 | std::unique_lock<decltype(mutex)> lock(mutex); | ||
2281 | 73 | |||
2282 | 74 | cv.wait(lock, [&]{ return done; }); | ||
2283 | 75 | } | ||
2284 | 52 | 76 | ||
2285 | === modified file 'src/server/graphics/nested/nested_display.cpp' | |||
2286 | --- src/server/graphics/nested/nested_display.cpp 2014-01-13 06:12:33 +0000 | |||
2287 | +++ src/server/graphics/nested/nested_display.cpp 2014-02-10 09:00:06 +0000 | |||
2288 | @@ -152,9 +152,13 @@ | |||
2289 | 152 | f(*i.second); | 152 | f(*i.second); |
2290 | 153 | } | 153 | } |
2291 | 154 | 154 | ||
2293 | 155 | std::shared_ptr<mg::DisplayConfiguration> mgn::NestedDisplay::configuration() | 155 | std::unique_ptr<mg::DisplayConfiguration> mgn::NestedDisplay::configuration() const |
2294 | 156 | { | 156 | { |
2296 | 157 | return std::make_shared<NestedDisplayConfiguration>(mir_connection_create_display_config(*connection)); | 157 | return std::unique_ptr<mg::DisplayConfiguration>( |
2297 | 158 | new NestedDisplayConfiguration( | ||
2298 | 159 | mir_connection_create_display_config(*connection) | ||
2299 | 160 | ) | ||
2300 | 161 | ); | ||
2301 | 158 | } | 162 | } |
2302 | 159 | 163 | ||
2303 | 160 | void mgn::NestedDisplay::complete_display_initialization(MirPixelFormat format) | 164 | void mgn::NestedDisplay::complete_display_initialization(MirPixelFormat format) |
2304 | 161 | 165 | ||
2305 | === modified file 'src/server/graphics/nested/nested_display.h' | |||
2306 | --- src/server/graphics/nested/nested_display.h 2014-01-13 06:12:33 +0000 | |||
2307 | +++ src/server/graphics/nested/nested_display.h 2014-02-10 09:00:06 +0000 | |||
2308 | @@ -102,7 +102,7 @@ | |||
2309 | 102 | 102 | ||
2310 | 103 | void for_each_display_buffer(std::function<void(DisplayBuffer&)>const& f) override; | 103 | void for_each_display_buffer(std::function<void(DisplayBuffer&)>const& f) override; |
2311 | 104 | 104 | ||
2313 | 105 | std::shared_ptr<DisplayConfiguration> configuration() override; | 105 | std::unique_ptr<DisplayConfiguration> configuration() const override; |
2314 | 106 | void configure(DisplayConfiguration const&) override; | 106 | void configure(DisplayConfiguration const&) override; |
2315 | 107 | 107 | ||
2316 | 108 | void register_configuration_change_handler( | 108 | void register_configuration_change_handler( |
2317 | 109 | 109 | ||
2318 | === modified file 'src/server/graphics/offscreen/display.cpp' | |||
2319 | --- src/server/graphics/offscreen/display.cpp 2014-01-10 08:51:30 +0000 | |||
2320 | +++ src/server/graphics/offscreen/display.cpp 2014-02-10 09:00:06 +0000 | |||
2321 | @@ -108,10 +108,12 @@ | |||
2322 | 108 | f(*db_ptr); | 108 | f(*db_ptr); |
2323 | 109 | } | 109 | } |
2324 | 110 | 110 | ||
2326 | 111 | std::shared_ptr<mg::DisplayConfiguration> mgo::Display::configuration() | 111 | std::unique_ptr<mg::DisplayConfiguration> mgo::Display::configuration() const |
2327 | 112 | { | 112 | { |
2328 | 113 | std::lock_guard<std::mutex> lock{configuration_mutex}; | 113 | std::lock_guard<std::mutex> lock{configuration_mutex}; |
2330 | 114 | return std::make_shared<mgo::DisplayConfiguration>(current_display_configuration); | 114 | return std::unique_ptr<mg::DisplayConfiguration>( |
2331 | 115 | new mgo::DisplayConfiguration(current_display_configuration) | ||
2332 | 116 | ); | ||
2333 | 115 | } | 117 | } |
2334 | 116 | 118 | ||
2335 | 117 | void mgo::Display::configure(mg::DisplayConfiguration const& conf) | 119 | void mgo::Display::configure(mg::DisplayConfiguration const& conf) |
2336 | 118 | 120 | ||
2337 | === modified file 'src/server/graphics/offscreen/display.h' | |||
2338 | --- src/server/graphics/offscreen/display.h 2013-12-13 05:24:22 +0000 | |||
2339 | +++ src/server/graphics/offscreen/display.h 2014-02-10 09:00:06 +0000 | |||
2340 | @@ -71,8 +71,8 @@ | |||
2341 | 71 | 71 | ||
2342 | 72 | void for_each_display_buffer(std::function<void(DisplayBuffer&)> const& f); | 72 | void for_each_display_buffer(std::function<void(DisplayBuffer&)> const& f); |
2343 | 73 | 73 | ||
2346 | 74 | std::shared_ptr<graphics::DisplayConfiguration> configuration(); | 74 | std::unique_ptr<graphics::DisplayConfiguration> configuration() const override; |
2347 | 75 | void configure(graphics::DisplayConfiguration const& conf); | 75 | void configure(graphics::DisplayConfiguration const& conf) override; |
2348 | 76 | 76 | ||
2349 | 77 | void register_configuration_change_handler( | 77 | void register_configuration_change_handler( |
2350 | 78 | EventHandlerRegister& handlers, | 78 | EventHandlerRegister& handlers, |
2351 | @@ -93,7 +93,7 @@ | |||
2352 | 93 | std::shared_ptr<BasicPlatform> const basic_platform; | 93 | std::shared_ptr<BasicPlatform> const basic_platform; |
2353 | 94 | detail::EGLDisplayHandle const egl_display; | 94 | detail::EGLDisplayHandle const egl_display; |
2354 | 95 | SurfacelessEGLContext const egl_context_shared; | 95 | SurfacelessEGLContext const egl_context_shared; |
2356 | 96 | std::mutex configuration_mutex; | 96 | mutable std::mutex configuration_mutex; |
2357 | 97 | DisplayConfiguration current_display_configuration; | 97 | DisplayConfiguration current_display_configuration; |
2358 | 98 | std::vector<std::unique_ptr<DisplayBuffer>> display_buffers; | 98 | std::vector<std::unique_ptr<DisplayBuffer>> display_buffers; |
2359 | 99 | }; | 99 | }; |
2360 | 100 | 100 | ||
2361 | === modified file 'src/server/scene/application_session.cpp' | |||
2362 | --- src/server/scene/application_session.cpp 2014-01-13 06:12:33 +0000 | |||
2363 | +++ src/server/scene/application_session.cpp 2014-02-10 09:00:06 +0000 | |||
2364 | @@ -1,5 +1,5 @@ | |||
2365 | 1 | /* | 1 | /* |
2367 | 2 | * Copyright © 2012 Canonical Ltd. | 2 | * Copyright © 2012-2014 Canonical Ltd. |
2368 | 3 | * | 3 | * |
2369 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
2370 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
2371 | @@ -37,11 +37,13 @@ | |||
2372 | 37 | 37 | ||
2373 | 38 | ms::ApplicationSession::ApplicationSession( | 38 | ms::ApplicationSession::ApplicationSession( |
2374 | 39 | std::shared_ptr<msh::SurfaceFactory> const& surface_factory, | 39 | std::shared_ptr<msh::SurfaceFactory> const& surface_factory, |
2375 | 40 | pid_t pid, | ||
2376 | 40 | std::string const& session_name, | 41 | std::string const& session_name, |
2377 | 41 | std::shared_ptr<SnapshotStrategy> const& snapshot_strategy, | 42 | std::shared_ptr<SnapshotStrategy> const& snapshot_strategy, |
2378 | 42 | std::shared_ptr<msh::SessionListener> const& session_listener, | 43 | std::shared_ptr<msh::SessionListener> const& session_listener, |
2379 | 43 | std::shared_ptr<mf::EventSink> const& sink) : | 44 | std::shared_ptr<mf::EventSink> const& sink) : |
2380 | 44 | surface_factory(surface_factory), | 45 | surface_factory(surface_factory), |
2381 | 46 | pid(pid), | ||
2382 | 45 | session_name(session_name), | 47 | session_name(session_name), |
2383 | 46 | snapshot_strategy(snapshot_strategy), | 48 | snapshot_strategy(snapshot_strategy), |
2384 | 47 | session_listener(session_listener), | 49 | session_listener(session_listener), |
2385 | @@ -125,6 +127,11 @@ | |||
2386 | 125 | return session_name; | 127 | return session_name; |
2387 | 126 | } | 128 | } |
2388 | 127 | 129 | ||
2389 | 130 | pid_t ms::ApplicationSession::process_id() const | ||
2390 | 131 | { | ||
2391 | 132 | return pid; | ||
2392 | 133 | } | ||
2393 | 134 | |||
2394 | 128 | void ms::ApplicationSession::force_requests_to_complete() | 135 | void ms::ApplicationSession::force_requests_to_complete() |
2395 | 129 | { | 136 | { |
2396 | 130 | std::unique_lock<std::mutex> lock(surfaces_mutex); | 137 | std::unique_lock<std::mutex> lock(surfaces_mutex); |
2397 | 131 | 138 | ||
2398 | === modified file 'src/server/scene/application_session.h' | |||
2399 | --- src/server/scene/application_session.h 2014-01-13 06:12:33 +0000 | |||
2400 | +++ src/server/scene/application_session.h 2014-02-10 09:00:06 +0000 | |||
2401 | @@ -1,5 +1,5 @@ | |||
2402 | 1 | /* | 1 | /* |
2404 | 2 | * Copyright © 2013 Canonical Ltd. | 2 | * Copyright © 2013-2014 Canonical Ltd. |
2405 | 3 | * | 3 | * |
2406 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
2407 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
2408 | @@ -45,6 +45,7 @@ | |||
2409 | 45 | public: | 45 | public: |
2410 | 46 | ApplicationSession( | 46 | ApplicationSession( |
2411 | 47 | std::shared_ptr<shell::SurfaceFactory> const& surface_factory, | 47 | std::shared_ptr<shell::SurfaceFactory> const& surface_factory, |
2412 | 48 | pid_t pid, | ||
2413 | 48 | std::string const& session_name, | 49 | std::string const& session_name, |
2414 | 49 | std::shared_ptr<SnapshotStrategy> const& snapshot_strategy, | 50 | std::shared_ptr<SnapshotStrategy> const& snapshot_strategy, |
2415 | 50 | std::shared_ptr<shell::SessionListener> const& session_listener, | 51 | std::shared_ptr<shell::SessionListener> const& session_listener, |
2416 | @@ -60,6 +61,7 @@ | |||
2417 | 60 | std::shared_ptr<shell::Surface> default_surface() const; | 61 | std::shared_ptr<shell::Surface> default_surface() const; |
2418 | 61 | 62 | ||
2419 | 62 | std::string name() const; | 63 | std::string name() const; |
2420 | 64 | pid_t process_id() const override; | ||
2421 | 63 | 65 | ||
2422 | 64 | void force_requests_to_complete(); | 66 | void force_requests_to_complete(); |
2423 | 65 | 67 | ||
2424 | @@ -77,6 +79,7 @@ | |||
2425 | 77 | 79 | ||
2426 | 78 | private: | 80 | private: |
2427 | 79 | std::shared_ptr<shell::SurfaceFactory> const surface_factory; | 81 | std::shared_ptr<shell::SurfaceFactory> const surface_factory; |
2428 | 82 | pid_t const pid; | ||
2429 | 80 | std::string const session_name; | 83 | std::string const session_name; |
2430 | 81 | std::shared_ptr<SnapshotStrategy> const snapshot_strategy; | 84 | std::shared_ptr<SnapshotStrategy> const snapshot_strategy; |
2431 | 82 | std::shared_ptr<shell::SessionListener> const session_listener; | 85 | std::shared_ptr<shell::SessionListener> const session_listener; |
2432 | 83 | 86 | ||
2433 | === modified file 'src/server/scene/basic_surface.cpp' | |||
2434 | --- src/server/scene/basic_surface.cpp 2014-01-24 08:29:36 +0000 | |||
2435 | +++ src/server/scene/basic_surface.cpp 2014-02-10 09:00:06 +0000 | |||
2436 | @@ -114,11 +114,11 @@ | |||
2437 | 114 | return surface_buffer_stream->get_stream_pixel_format(); | 114 | return surface_buffer_stream->get_stream_pixel_format(); |
2438 | 115 | } | 115 | } |
2439 | 116 | 116 | ||
2441 | 117 | void ms::BasicSurface::swap_buffers(graphics::Buffer*& buffer) | 117 | void ms::BasicSurface::swap_buffers(mg::Buffer* old_buffer, std::function<void(mg::Buffer* new_buffer)> complete) |
2442 | 118 | { | 118 | { |
2444 | 119 | bool const posting{!!buffer}; | 119 | bool const posting{!!old_buffer}; |
2445 | 120 | 120 | ||
2447 | 121 | surface_buffer_stream->swap_client_buffers(buffer); | 121 | surface_buffer_stream->swap_client_buffers(old_buffer, complete); |
2448 | 122 | 122 | ||
2449 | 123 | if (posting) | 123 | if (posting) |
2450 | 124 | { | 124 | { |
2451 | 125 | 125 | ||
2452 | === modified file 'src/server/scene/basic_surface.h' | |||
2453 | --- src/server/scene/basic_surface.h 2014-01-24 08:29:36 +0000 | |||
2454 | +++ src/server/scene/basic_surface.h 2014-02-10 09:00:06 +0000 | |||
2455 | @@ -73,7 +73,7 @@ | |||
2456 | 73 | virtual MirPixelFormat pixel_format() const; | 73 | virtual MirPixelFormat pixel_format() const; |
2457 | 74 | 74 | ||
2458 | 75 | virtual std::shared_ptr<graphics::Buffer> snapshot_buffer() const; | 75 | virtual std::shared_ptr<graphics::Buffer> snapshot_buffer() const; |
2460 | 76 | virtual void swap_buffers(graphics::Buffer*&); | 76 | virtual void swap_buffers(graphics::Buffer* old_buffer, std::function<void(graphics::Buffer* new_buffer)> complete); |
2461 | 77 | virtual void force_requests_to_complete(); | 77 | virtual void force_requests_to_complete(); |
2462 | 78 | 78 | ||
2463 | 79 | virtual bool supports_input() const; | 79 | virtual bool supports_input() const; |
2464 | 80 | 80 | ||
2465 | === modified file 'src/server/scene/session_manager.cpp' | |||
2466 | --- src/server/scene/session_manager.cpp 2014-01-13 06:12:33 +0000 | |||
2467 | +++ src/server/scene/session_manager.cpp 2014-02-10 09:00:06 +0000 | |||
2468 | @@ -1,5 +1,5 @@ | |||
2469 | 1 | /* | 1 | /* |
2471 | 2 | * Copyright © 2012 Canonical Ltd. | 2 | * Copyright © 2012-2014 Canonical Ltd. |
2472 | 3 | * | 3 | * |
2473 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
2474 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
2475 | @@ -73,12 +73,14 @@ | |||
2476 | 73 | close_session(session); | 73 | close_session(session); |
2477 | 74 | } | 74 | } |
2478 | 75 | 75 | ||
2481 | 76 | std::shared_ptr<mf::Session> ms::SessionManager::open_session(std::string const& name, | 76 | std::shared_ptr<mf::Session> ms::SessionManager::open_session( |
2482 | 77 | std::shared_ptr<mf::EventSink> const& sender) | 77 | pid_t client_pid, |
2483 | 78 | std::string const& name, | ||
2484 | 79 | std::shared_ptr<mf::EventSink> const& sender) | ||
2485 | 78 | { | 80 | { |
2486 | 79 | std::shared_ptr<msh::Session> new_session = | 81 | std::shared_ptr<msh::Session> new_session = |
2487 | 80 | std::make_shared<ApplicationSession>( | 82 | std::make_shared<ApplicationSession>( |
2489 | 81 | surface_factory, name, snapshot_strategy, session_listener, sender); | 83 | surface_factory, client_pid, name, snapshot_strategy, session_listener, sender); |
2490 | 82 | 84 | ||
2491 | 83 | app_container->insert_session(new_session); | 85 | app_container->insert_session(new_session); |
2492 | 84 | 86 | ||
2493 | 85 | 87 | ||
2494 | === modified file 'src/server/scene/session_manager.h' | |||
2495 | --- src/server/scene/session_manager.h 2014-01-13 06:12:33 +0000 | |||
2496 | +++ src/server/scene/session_manager.h 2014-02-10 09:00:06 +0000 | |||
2497 | @@ -1,5 +1,5 @@ | |||
2498 | 1 | /* | 1 | /* |
2500 | 2 | * Copyright © 2012 Canonical Ltd. | 2 | * Copyright © 2012-2014 Canonical Ltd. |
2501 | 3 | * | 3 | * |
2502 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
2503 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
2504 | @@ -55,7 +55,10 @@ | |||
2505 | 55 | virtual ~SessionManager(); | 55 | virtual ~SessionManager(); |
2506 | 56 | 56 | ||
2507 | 57 | virtual std::shared_ptr<frontend::Session> open_session( | 57 | virtual std::shared_ptr<frontend::Session> open_session( |
2509 | 58 | std::string const& name, std::shared_ptr<frontend::EventSink> const& sink); | 58 | pid_t client_pid, |
2510 | 59 | std::string const& name, | ||
2511 | 60 | std::shared_ptr<frontend::EventSink> const& sink); | ||
2512 | 61 | |||
2513 | 59 | virtual void close_session(std::shared_ptr<frontend::Session> const& session); | 62 | virtual void close_session(std::shared_ptr<frontend::Session> const& session); |
2514 | 60 | 63 | ||
2515 | 61 | frontend::SurfaceId create_surface_for(std::shared_ptr<frontend::Session> const& session, | 64 | frontend::SurfaceId create_surface_for(std::shared_ptr<frontend::Session> const& session, |
2516 | 62 | 65 | ||
2517 | === modified file 'src/server/scene/surface_impl.cpp' | |||
2518 | --- src/server/scene/surface_impl.cpp 2014-01-24 08:29:36 +0000 | |||
2519 | +++ src/server/scene/surface_impl.cpp 2014-02-10 09:00:06 +0000 | |||
2520 | @@ -103,9 +103,9 @@ | |||
2521 | 103 | return surface->pixel_format(); | 103 | return surface->pixel_format(); |
2522 | 104 | } | 104 | } |
2523 | 105 | 105 | ||
2525 | 106 | void ms::SurfaceImpl::swap_buffers(graphics::Buffer*& buffer) | 106 | void ms::SurfaceImpl::swap_buffers(mg::Buffer* old_buffer, std::function<void(mg::Buffer* new_buffer)> complete) |
2526 | 107 | { | 107 | { |
2528 | 108 | surface->swap_buffers(buffer); | 108 | surface->swap_buffers(old_buffer, complete); |
2529 | 109 | } | 109 | } |
2530 | 110 | 110 | ||
2531 | 111 | void ms::SurfaceImpl::allow_framedropping(bool allow) | 111 | void ms::SurfaceImpl::allow_framedropping(bool allow) |
2532 | 112 | 112 | ||
2533 | === modified file 'src/server/scene/surface_impl.h' | |||
2534 | --- src/server/scene/surface_impl.h 2014-01-13 06:12:33 +0000 | |||
2535 | +++ src/server/scene/surface_impl.h 2014-02-10 09:00:06 +0000 | |||
2536 | @@ -70,7 +70,7 @@ | |||
2537 | 70 | 70 | ||
2538 | 71 | virtual void with_most_recent_buffer_do( | 71 | virtual void with_most_recent_buffer_do( |
2539 | 72 | std::function<void(graphics::Buffer&)> const& exec); | 72 | std::function<void(graphics::Buffer&)> const& exec); |
2541 | 73 | virtual void swap_buffers(graphics::Buffer*& buffer); | 73 | virtual void swap_buffers(graphics::Buffer* old_buffer, std::function<void(graphics::Buffer* new_buffer)> complete) override; |
2542 | 74 | 74 | ||
2543 | 75 | virtual bool supports_input() const; | 75 | virtual bool supports_input() const; |
2544 | 76 | virtual int client_input_fd() const; | 76 | virtual int client_input_fd() const; |
2545 | 77 | 77 | ||
2546 | === modified file 'src/utils/CMakeLists.txt' | |||
2547 | --- src/utils/CMakeLists.txt 2014-01-10 05:48:41 +0000 | |||
2548 | +++ src/utils/CMakeLists.txt 2014-02-10 09:00:06 +0000 | |||
2549 | @@ -13,8 +13,17 @@ | |||
2550 | 13 | add_executable(mirout out.c) | 13 | add_executable(mirout out.c) |
2551 | 14 | target_link_libraries(mirout mirclient) | 14 | target_link_libraries(mirout mirclient) |
2552 | 15 | 15 | ||
2553 | 16 | add_executable(mirscreencast screencast.cpp) | ||
2554 | 17 | |||
2555 | 18 | target_link_libraries(mirscreencast | ||
2556 | 19 | mirclient | ||
2557 | 20 | ${EGL_LIBRARIES} | ||
2558 | 21 | ${GLESv2_LIBRARIES} | ||
2559 | 22 | ) | ||
2560 | 23 | |||
2561 | 16 | install(TARGETS | 24 | install(TARGETS |
2562 | 17 | mirping | 25 | mirping |
2563 | 18 | mirout | 26 | mirout |
2564 | 27 | mirscreencast | ||
2565 | 19 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | 28 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} |
2566 | 20 | ) | 29 | ) |
2567 | 21 | 30 | ||
2568 | === added file 'src/utils/screencast.cpp' | |||
2569 | --- src/utils/screencast.cpp 1970-01-01 00:00:00 +0000 | |||
2570 | +++ src/utils/screencast.cpp 2014-02-10 09:00:06 +0000 | |||
2571 | @@ -0,0 +1,313 @@ | |||
2572 | 1 | /* | ||
2573 | 2 | * Copyright © 2014 Canonical Ltd. | ||
2574 | 3 | * | ||
2575 | 4 | * This program is free software: you can redistribute it and/or modify | ||
2576 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
2577 | 6 | * published by the Free Software Foundation. | ||
2578 | 7 | * | ||
2579 | 8 | * This program is distributed in the hope that it will be useful, | ||
2580 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2581 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2582 | 11 | * GNU General Public License for more details. | ||
2583 | 12 | * | ||
2584 | 13 | * You should have received a copy of the GNU General Public License | ||
2585 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2586 | 15 | * | ||
2587 | 16 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> | ||
2588 | 17 | */ | ||
2589 | 18 | |||
2590 | 19 | #include "mir_toolkit/mir_client_library.h" | ||
2591 | 20 | #include "mir_toolkit/mir_screencast.h" | ||
2592 | 21 | #include "mir/geometry/size.h" | ||
2593 | 22 | |||
2594 | 23 | #include "mir/raii.h" | ||
2595 | 24 | |||
2596 | 25 | #include <getopt.h> | ||
2597 | 26 | #include <csignal> | ||
2598 | 27 | |||
2599 | 28 | #include <EGL/egl.h> | ||
2600 | 29 | #include <GLES2/gl2.h> | ||
2601 | 30 | #include <GLES2/gl2ext.h> | ||
2602 | 31 | |||
2603 | 32 | #include <fstream> | ||
2604 | 33 | #include <sstream> | ||
2605 | 34 | #include <thread> | ||
2606 | 35 | #include <iostream> | ||
2607 | 36 | #include <stdexcept> | ||
2608 | 37 | #include <future> | ||
2609 | 38 | #include <vector> | ||
2610 | 39 | |||
2611 | 40 | namespace | ||
2612 | 41 | { | ||
2613 | 42 | |||
2614 | 43 | volatile sig_atomic_t running = 1; | ||
2615 | 44 | |||
2616 | 45 | void shutdown(int) | ||
2617 | 46 | { | ||
2618 | 47 | running = 0; | ||
2619 | 48 | } | ||
2620 | 49 | |||
2621 | 50 | std::future<void> write_frame_to_file( | ||
2622 | 51 | std::vector<char> const& frame_data, int frame_number, GLenum format) | ||
2623 | 52 | { | ||
2624 | 53 | return std::async( | ||
2625 | 54 | std::launch::async, | ||
2626 | 55 | [&frame_data, frame_number, format] | ||
2627 | 56 | { | ||
2628 | 57 | std::stringstream ss; | ||
2629 | 58 | ss << "/tmp/mir_" ; | ||
2630 | 59 | ss.width(5); | ||
2631 | 60 | ss.fill('0'); | ||
2632 | 61 | ss << frame_number; | ||
2633 | 62 | ss << (format == GL_BGRA_EXT ? ".bgra" : ".rgba"); | ||
2634 | 63 | std::ofstream f(ss.str()); | ||
2635 | 64 | f.write(frame_data.data(), frame_data.size()); | ||
2636 | 65 | }); | ||
2637 | 66 | } | ||
2638 | 67 | |||
2639 | 68 | GLenum read_pixels(mir::geometry::Size const& size, void* buffer) | ||
2640 | 69 | { | ||
2641 | 70 | auto width = size.width.as_uint32_t(); | ||
2642 | 71 | auto height = size.height.as_uint32_t(); | ||
2643 | 72 | |||
2644 | 73 | GLenum format = GL_BGRA_EXT; | ||
2645 | 74 | |||
2646 | 75 | glReadPixels(0, 0, width, height, format, GL_UNSIGNED_BYTE, buffer); | ||
2647 | 76 | |||
2648 | 77 | if (glGetError() != GL_NO_ERROR) | ||
2649 | 78 | { | ||
2650 | 79 | format = GL_RGBA; | ||
2651 | 80 | glReadPixels(0, 0, width, height, format, GL_UNSIGNED_BYTE, buffer); | ||
2652 | 81 | } | ||
2653 | 82 | |||
2654 | 83 | return format; | ||
2655 | 84 | } | ||
2656 | 85 | |||
2657 | 86 | |||
2658 | 87 | uint32_t get_first_valid_output_id(MirConnection* connection) | ||
2659 | 88 | { | ||
2660 | 89 | auto const conf = mir::raii::deleter_for( | ||
2661 | 90 | mir_connection_create_display_config(connection), | ||
2662 | 91 | &mir_display_config_destroy); | ||
2663 | 92 | |||
2664 | 93 | if (conf == nullptr) | ||
2665 | 94 | throw std::runtime_error("Failed to get display configuration\n"); | ||
2666 | 95 | |||
2667 | 96 | for (unsigned i = 0; i < conf->num_outputs; ++i) | ||
2668 | 97 | { | ||
2669 | 98 | MirDisplayOutput const& output = conf->outputs[i]; | ||
2670 | 99 | |||
2671 | 100 | if (output.connected && output.used && | ||
2672 | 101 | output.current_mode < output.num_modes) | ||
2673 | 102 | { | ||
2674 | 103 | return output.output_id; | ||
2675 | 104 | } | ||
2676 | 105 | } | ||
2677 | 106 | |||
2678 | 107 | throw std::runtime_error("Couldn't find a valid output to screencast"); | ||
2679 | 108 | } | ||
2680 | 109 | |||
2681 | 110 | mir::geometry::Size get_output_size(MirConnection* connection, uint32_t output_id) | ||
2682 | 111 | { | ||
2683 | 112 | auto const conf = mir::raii::deleter_for( | ||
2684 | 113 | mir_connection_create_display_config(connection), | ||
2685 | 114 | &mir_display_config_destroy); | ||
2686 | 115 | |||
2687 | 116 | if (conf == nullptr) | ||
2688 | 117 | throw std::runtime_error("Failed to get display configuration\n"); | ||
2689 | 118 | |||
2690 | 119 | for (unsigned i = 0; i < conf->num_outputs; ++i) | ||
2691 | 120 | { | ||
2692 | 121 | MirDisplayOutput const& output = conf->outputs[i]; | ||
2693 | 122 | |||
2694 | 123 | if (output.output_id == output_id && | ||
2695 | 124 | output.current_mode < output.num_modes) | ||
2696 | 125 | { | ||
2697 | 126 | MirDisplayMode const& mode = output.modes[output.current_mode]; | ||
2698 | 127 | return mir::geometry::Size{mode.horizontal_resolution, mode.vertical_resolution}; | ||
2699 | 128 | } | ||
2700 | 129 | } | ||
2701 | 130 | |||
2702 | 131 | throw std::runtime_error("Couldn't get size of specified output"); | ||
2703 | 132 | } | ||
2704 | 133 | |||
2705 | 134 | void print_usage() | ||
2706 | 135 | { | ||
2707 | 136 | std::cout << "Usage " << std::endl | ||
2708 | 137 | << " -m <Mir server socket>" << std::endl | ||
2709 | 138 | << " -o <Output id>" << std::endl | ||
2710 | 139 | << " -h: this help text" << std::endl; | ||
2711 | 140 | } | ||
2712 | 141 | |||
2713 | 142 | struct EGLSetup | ||
2714 | 143 | { | ||
2715 | 144 | EGLSetup(MirConnection* connection, MirScreencast* screencast) | ||
2716 | 145 | { | ||
2717 | 146 | static EGLint const attribs[] = { | ||
2718 | 147 | EGL_SURFACE_TYPE, EGL_WINDOW_BIT, | ||
2719 | 148 | EGL_RED_SIZE, 8, | ||
2720 | 149 | EGL_GREEN_SIZE, 8, | ||
2721 | 150 | EGL_BLUE_SIZE, 8, | ||
2722 | 151 | EGL_ALPHA_SIZE, 8, | ||
2723 | 152 | EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, | ||
2724 | 153 | EGL_NONE}; | ||
2725 | 154 | |||
2726 | 155 | static EGLint const context_attribs[] = { | ||
2727 | 156 | EGL_CONTEXT_CLIENT_VERSION, 2, | ||
2728 | 157 | EGL_NONE }; | ||
2729 | 158 | |||
2730 | 159 | auto native_display = | ||
2731 | 160 | reinterpret_cast<EGLNativeDisplayType>( | ||
2732 | 161 | mir_connection_get_egl_native_display(connection)); | ||
2733 | 162 | |||
2734 | 163 | auto native_window = | ||
2735 | 164 | reinterpret_cast<EGLNativeWindowType>( | ||
2736 | 165 | mir_screencast_egl_native_window(screencast)); | ||
2737 | 166 | |||
2738 | 167 | egl_display = eglGetDisplay(native_display); | ||
2739 | 168 | |||
2740 | 169 | eglInitialize(egl_display, nullptr, nullptr); | ||
2741 | 170 | |||
2742 | 171 | int n; | ||
2743 | 172 | eglChooseConfig(egl_display, attribs, &egl_config, 1, &n); | ||
2744 | 173 | |||
2745 | 174 | egl_surface = eglCreateWindowSurface(egl_display, egl_config, native_window, NULL); | ||
2746 | 175 | if (egl_surface == EGL_NO_SURFACE) | ||
2747 | 176 | throw std::runtime_error("Failed to create EGL screencast surface"); | ||
2748 | 177 | |||
2749 | 178 | egl_context = eglCreateContext(egl_display, egl_config, EGL_NO_CONTEXT, context_attribs); | ||
2750 | 179 | if (egl_context == EGL_NO_CONTEXT) | ||
2751 | 180 | throw std::runtime_error("Failed to create EGL context for screencast"); | ||
2752 | 181 | |||
2753 | 182 | if (eglMakeCurrent(egl_display, egl_surface, | ||
2754 | 183 | egl_surface, egl_context) != EGL_TRUE) | ||
2755 | 184 | { | ||
2756 | 185 | throw std::runtime_error("Failed to make screencast surface current"); | ||
2757 | 186 | } | ||
2758 | 187 | } | ||
2759 | 188 | |||
2760 | 189 | ~EGLSetup() | ||
2761 | 190 | { | ||
2762 | 191 | eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); | ||
2763 | 192 | eglDestroySurface(egl_display, egl_surface); | ||
2764 | 193 | eglDestroyContext(egl_display, egl_context); | ||
2765 | 194 | eglTerminate(egl_display); | ||
2766 | 195 | } | ||
2767 | 196 | |||
2768 | 197 | void swap_buffers() | ||
2769 | 198 | { | ||
2770 | 199 | if (eglSwapBuffers(egl_display, egl_surface) != EGL_TRUE) | ||
2771 | 200 | throw std::runtime_error("Failed to swap screencast surface buffers"); | ||
2772 | 201 | } | ||
2773 | 202 | |||
2774 | 203 | EGLDisplay egl_display; | ||
2775 | 204 | EGLContext egl_context; | ||
2776 | 205 | EGLSurface egl_surface; | ||
2777 | 206 | EGLConfig egl_config; | ||
2778 | 207 | }; | ||
2779 | 208 | |||
2780 | 209 | void do_screencast(MirConnection* connection, MirScreencast* screencast, | ||
2781 | 210 | uint32_t output_id) | ||
2782 | 211 | { | ||
2783 | 212 | static int const rgba_pixel_size{4}; | ||
2784 | 213 | |||
2785 | 214 | auto const frame_size = get_output_size(connection, output_id); | ||
2786 | 215 | auto const frame_size_bytes = rgba_pixel_size * | ||
2787 | 216 | frame_size.width.as_uint32_t() * | ||
2788 | 217 | frame_size.height.as_uint32_t(); | ||
2789 | 218 | |||
2790 | 219 | int frame_number{0}; | ||
2791 | 220 | std::vector<char> frame_data(frame_size_bytes, 0); | ||
2792 | 221 | std::future<void> frame_written_future = | ||
2793 | 222 | std::async(std::launch::deferred, []{}); | ||
2794 | 223 | |||
2795 | 224 | EGLSetup egl_setup{connection, screencast}; | ||
2796 | 225 | |||
2797 | 226 | while (running) | ||
2798 | 227 | { | ||
2799 | 228 | frame_written_future.wait(); | ||
2800 | 229 | |||
2801 | 230 | auto format = read_pixels(frame_size, frame_data.data()); | ||
2802 | 231 | frame_written_future = write_frame_to_file(frame_data, frame_number, format); | ||
2803 | 232 | |||
2804 | 233 | egl_setup.swap_buffers(); | ||
2805 | 234 | ++frame_number; | ||
2806 | 235 | } | ||
2807 | 236 | } | ||
2808 | 237 | |||
2809 | 238 | } | ||
2810 | 239 | |||
2811 | 240 | int main(int argc, char* argv[]) | ||
2812 | 241 | try | ||
2813 | 242 | { | ||
2814 | 243 | int arg; | ||
2815 | 244 | opterr = 0; | ||
2816 | 245 | char const* socket_file = nullptr; | ||
2817 | 246 | uint32_t output_id = mir_display_output_id_invalid; | ||
2818 | 247 | |||
2819 | 248 | while ((arg = getopt (argc, argv, "hm:o:")) != -1) | ||
2820 | 249 | { | ||
2821 | 250 | switch (arg) | ||
2822 | 251 | { | ||
2823 | 252 | case 'm': | ||
2824 | 253 | socket_file = optarg; | ||
2825 | 254 | break; | ||
2826 | 255 | |||
2827 | 256 | case 'o': | ||
2828 | 257 | output_id = std::stoul(optarg); | ||
2829 | 258 | break; | ||
2830 | 259 | |||
2831 | 260 | case '?': | ||
2832 | 261 | case 'h': | ||
2833 | 262 | print_usage(); | ||
2834 | 263 | return EXIT_SUCCESS; | ||
2835 | 264 | |||
2836 | 265 | default: | ||
2837 | 266 | print_usage(); | ||
2838 | 267 | return EXIT_FAILURE; | ||
2839 | 268 | } | ||
2840 | 269 | } | ||
2841 | 270 | |||
2842 | 271 | signal(SIGINT, shutdown); | ||
2843 | 272 | signal(SIGTERM, shutdown); | ||
2844 | 273 | |||
2845 | 274 | auto const connection = mir::raii::deleter_for( | ||
2846 | 275 | mir_connect_sync(socket_file, "mirscreencast"), | ||
2847 | 276 | [](MirConnection* c) { if (c) mir_connection_release(c); }); | ||
2848 | 277 | |||
2849 | 278 | if (connection == nullptr || !mir_connection_is_valid(connection.get())) | ||
2850 | 279 | { | ||
2851 | 280 | std::string msg("Failed to connect to server."); | ||
2852 | 281 | if (connection) | ||
2853 | 282 | { | ||
2854 | 283 | msg += " Error was :"; | ||
2855 | 284 | msg += mir_connection_get_error_message(connection.get()); | ||
2856 | 285 | } | ||
2857 | 286 | throw std::runtime_error(std::string(msg)); | ||
2858 | 287 | } | ||
2859 | 288 | |||
2860 | 289 | if (output_id == mir_display_output_id_invalid) | ||
2861 | 290 | output_id = get_first_valid_output_id(connection.get()); | ||
2862 | 291 | |||
2863 | 292 | MirScreencastParameters params{ | ||
2864 | 293 | output_id, 0, 0, mir_pixel_format_invalid}; | ||
2865 | 294 | |||
2866 | 295 | std::cout << "Starting screencast for output id " << params.output_id << std::endl; | ||
2867 | 296 | |||
2868 | 297 | auto const screencast = mir::raii::deleter_for( | ||
2869 | 298 | mir_connection_create_screencast_sync(connection.get(), ¶ms), | ||
2870 | 299 | [](MirScreencast* s) { if (s) mir_screencast_release_sync(s); }); | ||
2871 | 300 | |||
2872 | 301 | if (screencast == nullptr) | ||
2873 | 302 | throw std::runtime_error("Failed to create screencast"); | ||
2874 | 303 | |||
2875 | 304 | do_screencast(connection.get(), screencast.get(), output_id); | ||
2876 | 305 | |||
2877 | 306 | return EXIT_SUCCESS; | ||
2878 | 307 | } | ||
2879 | 308 | catch(std::exception const& e) | ||
2880 | 309 | { | ||
2881 | 310 | std::cerr << e.what() << std::endl; | ||
2882 | 311 | |||
2883 | 312 | return EXIT_FAILURE; | ||
2884 | 313 | } | ||
2885 | 0 | 314 | ||
2886 | === modified file 'tests/acceptance-tests/test_client_screencast.cpp' | |||
2887 | --- tests/acceptance-tests/test_client_screencast.cpp 2014-01-29 17:20:51 +0000 | |||
2888 | +++ tests/acceptance-tests/test_client_screencast.cpp 2014-02-10 09:00:06 +0000 | |||
2889 | @@ -22,11 +22,11 @@ | |||
2890 | 22 | #include "mir_test_framework/stubbed_server_configuration.h" | 22 | #include "mir_test_framework/stubbed_server_configuration.h" |
2891 | 23 | #include "mir_test_framework/in_process_server.h" | 23 | #include "mir_test_framework/in_process_server.h" |
2892 | 24 | #include "mir_test_framework/using_stub_client_platform.h" | 24 | #include "mir_test_framework/using_stub_client_platform.h" |
2893 | 25 | #include "src/server/frontend/protobuf_ipc_factory.h" | ||
2894 | 26 | #include "mir_protobuf.pb.h" | ||
2895 | 27 | 25 | ||
2896 | 28 | #include "mir_test_doubles/null_display_changer.h" | 26 | #include "mir_test_doubles/null_display_changer.h" |
2897 | 29 | #include "mir_test_doubles/stub_display_configuration.h" | 27 | #include "mir_test_doubles/stub_display_configuration.h" |
2898 | 28 | #include "mir_test_doubles/stub_buffer.h" | ||
2899 | 29 | #include "mir_test_doubles/mock_screencast.h" | ||
2900 | 30 | #include "mir_test/fake_shared.h" | 30 | #include "mir_test/fake_shared.h" |
2901 | 31 | 31 | ||
2902 | 32 | #include <gtest/gtest.h> | 32 | #include <gtest/gtest.h> |
2903 | @@ -41,114 +41,6 @@ | |||
2904 | 41 | namespace | 41 | namespace |
2905 | 42 | { | 42 | { |
2906 | 43 | 43 | ||
2907 | 44 | ACTION(RunClosure) | ||
2908 | 45 | { | ||
2909 | 46 | arg3->Run(); | ||
2910 | 47 | } | ||
2911 | 48 | |||
2912 | 49 | MATCHER_P(WithOutputId, value, "") | ||
2913 | 50 | { | ||
2914 | 51 | return arg->output_id() == value; | ||
2915 | 52 | } | ||
2916 | 53 | |||
2917 | 54 | MATCHER_P(WithScreencastId, value, "") | ||
2918 | 55 | { | ||
2919 | 56 | return arg->value() == value; | ||
2920 | 57 | } | ||
2921 | 58 | |||
2922 | 59 | ACTION_P(SetCreateScreencastId, screencast_id) | ||
2923 | 60 | { | ||
2924 | 61 | arg2->mutable_screencast_id()->set_value(screencast_id); | ||
2925 | 62 | } | ||
2926 | 63 | |||
2927 | 64 | ACTION(FillCreateScreencastBuffer) | ||
2928 | 65 | { | ||
2929 | 66 | int fds[2]{-1,-1}; | ||
2930 | 67 | if (pipe(fds)) | ||
2931 | 68 | FAIL() << "Failed to create FillCreateScreencastBuffer fds"; | ||
2932 | 69 | close(fds[1]); | ||
2933 | 70 | arg2->mutable_buffer()->add_fd(fds[0]); | ||
2934 | 71 | } | ||
2935 | 72 | |||
2936 | 73 | /* | ||
2937 | 74 | * This setup is used temporarily to test MirScreencast, until | ||
2938 | 75 | * we have the server-side implementation of the feature in place. | ||
2939 | 76 | */ | ||
2940 | 77 | struct MockScreencastServer : mir::protobuf::DisplayServer | ||
2941 | 78 | { | ||
2942 | 79 | MockScreencastServer( | ||
2943 | 80 | std::shared_ptr<mir::protobuf::DisplayServer> const& ds) | ||
2944 | 81 | : wrapped_display_server{ds} | ||
2945 | 82 | { | ||
2946 | 83 | using namespace testing; | ||
2947 | 84 | ON_CALL(*this, create_screencast(_,_,_,_)) | ||
2948 | 85 | .WillByDefault(DoAll(FillCreateScreencastBuffer(),RunClosure())); | ||
2949 | 86 | ON_CALL(*this, release_screencast(_,_,_,_)) | ||
2950 | 87 | .WillByDefault(RunClosure()); | ||
2951 | 88 | } | ||
2952 | 89 | |||
2953 | 90 | void connect( | ||
2954 | 91 | ::google::protobuf::RpcController* rpc, | ||
2955 | 92 | const ::mir::protobuf::ConnectParameters* request, | ||
2956 | 93 | ::mir::protobuf::Connection* response, | ||
2957 | 94 | ::google::protobuf::Closure* done) override | ||
2958 | 95 | { | ||
2959 | 96 | wrapped_display_server->connect(rpc, request, response, done); | ||
2960 | 97 | } | ||
2961 | 98 | |||
2962 | 99 | void disconnect( | ||
2963 | 100 | google::protobuf::RpcController* rpc, | ||
2964 | 101 | const mir::protobuf::Void* request, | ||
2965 | 102 | mir::protobuf::Void* response, | ||
2966 | 103 | google::protobuf::Closure* done) override | ||
2967 | 104 | { | ||
2968 | 105 | wrapped_display_server->disconnect(rpc, request, response, done); | ||
2969 | 106 | } | ||
2970 | 107 | |||
2971 | 108 | MOCK_METHOD4(create_screencast, | ||
2972 | 109 | void(google::protobuf::RpcController*, | ||
2973 | 110 | const mir::protobuf::ScreencastParameters*, | ||
2974 | 111 | mir::protobuf::Screencast*, | ||
2975 | 112 | google::protobuf::Closure*)); | ||
2976 | 113 | |||
2977 | 114 | MOCK_METHOD4(release_screencast, | ||
2978 | 115 | void(google::protobuf::RpcController*, | ||
2979 | 116 | const mir::protobuf::ScreencastId*, | ||
2980 | 117 | mir::protobuf::Void*, | ||
2981 | 118 | google::protobuf::Closure*)); | ||
2982 | 119 | |||
2983 | 120 | std::shared_ptr<mir::protobuf::DisplayServer> const wrapped_display_server; | ||
2984 | 121 | }; | ||
2985 | 122 | |||
2986 | 123 | std::shared_ptr<MockScreencastServer> global_mock_screencast_server; | ||
2987 | 124 | |||
2988 | 125 | class WrappingIpcFactory : public mf::ProtobufIpcFactory | ||
2989 | 126 | { | ||
2990 | 127 | public: | ||
2991 | 128 | WrappingIpcFactory( | ||
2992 | 129 | std::shared_ptr<mf::ProtobufIpcFactory> const& ipc_factory) | ||
2993 | 130 | : wrapped_ipc_factory{ipc_factory} | ||
2994 | 131 | { | ||
2995 | 132 | } | ||
2996 | 133 | |||
2997 | 134 | std::shared_ptr<mir::protobuf::DisplayServer> make_ipc_server( | ||
2998 | 135 | std::shared_ptr<mf::EventSink> const& sink, bool auth) override | ||
2999 | 136 | { | ||
3000 | 137 | auto ipc_server = wrapped_ipc_factory->make_ipc_server(sink, auth); | ||
3001 | 138 | global_mock_screencast_server = | ||
3002 | 139 | std::make_shared<testing::NiceMock<MockScreencastServer>>(ipc_server); | ||
3003 | 140 | return global_mock_screencast_server; | ||
3004 | 141 | } | ||
3005 | 142 | |||
3006 | 143 | std::shared_ptr<mf::ResourceCache> resource_cache() override | ||
3007 | 144 | { | ||
3008 | 145 | return wrapped_ipc_factory->resource_cache(); | ||
3009 | 146 | } | ||
3010 | 147 | |||
3011 | 148 | private: | ||
3012 | 149 | std::shared_ptr<mf::ProtobufIpcFactory> const wrapped_ipc_factory; | ||
3013 | 150 | }; | ||
3014 | 151 | |||
3015 | 152 | class StubChanger : public mtd::NullDisplayChanger | 44 | class StubChanger : public mtd::NullDisplayChanger |
3016 | 153 | { | 45 | { |
3017 | 154 | public: | 46 | public: |
3018 | @@ -179,27 +71,22 @@ | |||
3019 | 179 | return mt::fake_shared(stub_changer); | 71 | return mt::fake_shared(stub_changer); |
3020 | 180 | } | 72 | } |
3021 | 181 | 73 | ||
3025 | 182 | std::shared_ptr<mf::ProtobufIpcFactory> the_ipc_factory( | 74 | std::shared_ptr<mf::Screencast> the_screencast() override |
3023 | 183 | std::shared_ptr<mf::Shell> const& shell, | ||
3024 | 184 | std::shared_ptr<mg::GraphicBufferAllocator> const& alloc) override | ||
3026 | 185 | { | 75 | { |
3029 | 186 | auto factory = mtf::StubbedServerConfiguration::the_ipc_factory(shell, alloc); | 76 | return mt::fake_shared(mock_screencast); |
3028 | 187 | return std::make_shared<WrappingIpcFactory>(factory); | ||
3030 | 188 | } | 77 | } |
3031 | 189 | 78 | ||
3032 | 190 | StubChanger stub_changer; | 79 | StubChanger stub_changer; |
3033 | 80 | mtd::MockScreencast mock_screencast; | ||
3034 | 191 | }; | 81 | }; |
3035 | 192 | 82 | ||
3036 | 193 | class MirScreencastTest : public mir_test_framework::InProcessServer | 83 | class MirScreencastTest : public mir_test_framework::InProcessServer |
3037 | 194 | { | 84 | { |
3038 | 195 | public: | 85 | public: |
3039 | 196 | ~MirScreencastTest() | ||
3040 | 197 | { | ||
3041 | 198 | global_mock_screencast_server.reset(); | ||
3042 | 199 | } | ||
3043 | 200 | |||
3044 | 201 | mir::DefaultServerConfiguration& server_config() override { return server_config_; } | 86 | mir::DefaultServerConfiguration& server_config() override { return server_config_; } |
3045 | 202 | 87 | ||
3046 | 88 | mtd::MockScreencast& mock_screencast() { return server_config_.mock_screencast; } | ||
3047 | 89 | |||
3048 | 203 | StubServerConfig server_config_; | 90 | StubServerConfig server_config_; |
3049 | 204 | mtf::UsingStubClientPlatform using_stub_client_platform; | 91 | mtf::UsingStubClientPlatform using_stub_client_platform; |
3050 | 205 | }; | 92 | }; |
3051 | @@ -227,8 +114,7 @@ | |||
3052 | 227 | uint32_t const invalid_output_id{33}; | 114 | uint32_t const invalid_output_id{33}; |
3053 | 228 | MirScreencastParameters params{invalid_output_id, 0, 0, mir_pixel_format_invalid}; | 115 | MirScreencastParameters params{invalid_output_id, 0, 0, mir_pixel_format_invalid}; |
3054 | 229 | 116 | ||
3057 | 230 | EXPECT_CALL(*global_mock_screencast_server, | 117 | EXPECT_CALL(mock_screencast(), create_session(_)) |
3056 | 231 | create_screencast(_,_,_,_)) | ||
3058 | 232 | .Times(0); | 118 | .Times(0); |
3059 | 233 | 119 | ||
3060 | 234 | auto screencast = | 120 | auto screencast = |
3061 | @@ -238,28 +124,27 @@ | |||
3062 | 238 | mir_connection_release(connection); | 124 | mir_connection_release(connection); |
3063 | 239 | } | 125 | } |
3064 | 240 | 126 | ||
3066 | 241 | TEST_F(MirScreencastTest, create_and_release_contact_server) | 127 | TEST_F(MirScreencastTest, contacts_server_screencast_for_create_and_release) |
3067 | 242 | { | 128 | { |
3068 | 243 | using namespace testing; | 129 | using namespace testing; |
3069 | 244 | 130 | ||
3070 | 245 | auto const connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__); | 131 | auto const connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__); |
3071 | 246 | ASSERT_TRUE(mir_connection_is_valid(connection)); | 132 | ASSERT_TRUE(mir_connection_is_valid(connection)); |
3072 | 247 | 133 | ||
3074 | 248 | uint32_t const screencast_id{99}; | 134 | mf::ScreencastSessionId const screencast_session_id{99}; |
3075 | 249 | uint32_t const output_id{2}; | 135 | uint32_t const output_id{2}; |
3076 | 250 | MirScreencastParameters params{output_id, 0, 0, mir_pixel_format_invalid}; | 136 | MirScreencastParameters params{output_id, 0, 0, mir_pixel_format_invalid}; |
3077 | 251 | 137 | ||
3078 | 252 | InSequence seq; | 138 | InSequence seq; |
3079 | 253 | 139 | ||
3089 | 254 | EXPECT_CALL(*global_mock_screencast_server, | 140 | EXPECT_CALL(mock_screencast(), |
3090 | 255 | create_screencast(_,WithOutputId(output_id),_,_)) | 141 | create_session(mg::DisplayConfigurationOutputId{output_id})) |
3091 | 256 | .WillOnce(DoAll(SetCreateScreencastId(screencast_id), | 142 | .WillOnce(Return(screencast_session_id)); |
3092 | 257 | FillCreateScreencastBuffer(), | 143 | |
3093 | 258 | RunClosure())); | 144 | EXPECT_CALL(mock_screencast(), capture(screencast_session_id)) |
3094 | 259 | 145 | .WillOnce(Return(std::make_shared<mtd::StubBuffer>())); | |
3095 | 260 | EXPECT_CALL(*global_mock_screencast_server, | 146 | |
3096 | 261 | release_screencast(_,WithScreencastId(screencast_id),_,_)) | 147 | EXPECT_CALL(mock_screencast(), destroy_session(screencast_session_id)); |
3088 | 262 | .WillOnce(RunClosure()); | ||
3097 | 263 | 148 | ||
3098 | 264 | auto screencast = mir_connection_create_screencast_sync(connection, ¶ms); | 149 | auto screencast = mir_connection_create_screencast_sync(connection, ¶ms); |
3099 | 265 | ASSERT_NE(nullptr, screencast); | 150 | ASSERT_NE(nullptr, screencast); |
3100 | @@ -275,9 +160,17 @@ | |||
3101 | 275 | auto const connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__); | 160 | auto const connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__); |
3102 | 276 | ASSERT_TRUE(mir_connection_is_valid(connection)); | 161 | ASSERT_TRUE(mir_connection_is_valid(connection)); |
3103 | 277 | 162 | ||
3104 | 163 | mf::ScreencastSessionId const screencast_session_id{99}; | ||
3105 | 278 | uint32_t const output_id{2}; | 164 | uint32_t const output_id{2}; |
3106 | 279 | MirScreencastParameters params{output_id, 0, 0, mir_pixel_format_invalid}; | 165 | MirScreencastParameters params{output_id, 0, 0, mir_pixel_format_invalid}; |
3107 | 280 | 166 | ||
3108 | 167 | InSequence seq; | ||
3109 | 168 | EXPECT_CALL(mock_screencast(), create_session(_)) | ||
3110 | 169 | .WillOnce(Return(screencast_session_id)); | ||
3111 | 170 | EXPECT_CALL(mock_screencast(), capture(_)) | ||
3112 | 171 | .WillOnce(Return(std::make_shared<mtd::StubBuffer>())); | ||
3113 | 172 | EXPECT_CALL(mock_screencast(), destroy_session(_)); | ||
3114 | 173 | |||
3115 | 281 | auto screencast = mir_connection_create_screencast_sync(connection, ¶ms); | 174 | auto screencast = mir_connection_create_screencast_sync(connection, ¶ms); |
3116 | 282 | ASSERT_NE(nullptr, screencast); | 175 | ASSERT_NE(nullptr, screencast); |
3117 | 283 | 176 | ||
3118 | @@ -288,3 +181,22 @@ | |||
3119 | 288 | 181 | ||
3120 | 289 | mir_connection_release(connection); | 182 | mir_connection_release(connection); |
3121 | 290 | } | 183 | } |
3122 | 184 | |||
3123 | 185 | TEST_F(MirScreencastTest, fails_on_client_when_server_request_fails) | ||
3124 | 186 | { | ||
3125 | 187 | using namespace testing; | ||
3126 | 188 | |||
3127 | 189 | auto const connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__); | ||
3128 | 190 | ASSERT_TRUE(mir_connection_is_valid(connection)); | ||
3129 | 191 | |||
3130 | 192 | uint32_t const output_id{2}; | ||
3131 | 193 | MirScreencastParameters params{output_id, 0, 0, mir_pixel_format_invalid}; | ||
3132 | 194 | |||
3133 | 195 | EXPECT_CALL(mock_screencast(), create_session(_)) | ||
3134 | 196 | .WillOnce(Throw(std::runtime_error(""))); | ||
3135 | 197 | |||
3136 | 198 | auto screencast = mir_connection_create_screencast_sync(connection, ¶ms); | ||
3137 | 199 | ASSERT_EQ(nullptr, screencast); | ||
3138 | 200 | |||
3139 | 201 | mir_connection_release(connection); | ||
3140 | 202 | } | ||
3141 | 291 | 203 | ||
3142 | === modified file 'tests/acceptance-tests/test_display_configuration.cpp' | |||
3143 | --- tests/acceptance-tests/test_display_configuration.cpp 2014-01-13 06:12:33 +0000 | |||
3144 | +++ tests/acceptance-tests/test_display_configuration.cpp 2014-02-10 09:00:06 +0000 | |||
3145 | @@ -87,9 +87,11 @@ | |||
3146 | 87 | f(display_buffer); | 87 | f(display_buffer); |
3147 | 88 | } | 88 | } |
3148 | 89 | 89 | ||
3150 | 90 | std::shared_ptr<mg::DisplayConfiguration> configuration() | 90 | std::unique_ptr<mg::DisplayConfiguration> configuration() const override |
3151 | 91 | { | 91 | { |
3153 | 92 | return config; | 92 | return std::unique_ptr<mg::DisplayConfiguration>( |
3154 | 93 | new mtd::StubDisplayConfig(*config) | ||
3155 | 94 | ); | ||
3156 | 93 | } | 95 | } |
3157 | 94 | 96 | ||
3158 | 95 | void register_configuration_change_handler( | 97 | void register_configuration_change_handler( |
3159 | @@ -112,7 +114,7 @@ | |||
3160 | 112 | MOCK_METHOD1(configure, void(mg::DisplayConfiguration const&)); | 114 | MOCK_METHOD1(configure, void(mg::DisplayConfiguration const&)); |
3161 | 113 | 115 | ||
3162 | 114 | void emit_configuration_change_event( | 116 | void emit_configuration_change_event( |
3164 | 115 | std::shared_ptr<mg::DisplayConfiguration> const& new_config) | 117 | std::shared_ptr<mtd::StubDisplayConfig> const& new_config) |
3165 | 116 | { | 118 | { |
3166 | 117 | config = new_config; | 119 | config = new_config; |
3167 | 118 | if (write(p.write_fd(), "a", 1)) {} | 120 | if (write(p.write_fd(), "a", 1)) {} |
3168 | @@ -125,7 +127,7 @@ | |||
3169 | 125 | } | 127 | } |
3170 | 126 | 128 | ||
3171 | 127 | private: | 129 | private: |
3173 | 128 | std::shared_ptr<mg::DisplayConfiguration> config; | 130 | std::shared_ptr<mtd::StubDisplayConfig> config; |
3174 | 129 | mtd::NullDisplayBuffer display_buffer; | 131 | mtd::NullDisplayBuffer display_buffer; |
3175 | 130 | mt::Pipe p; | 132 | mt::Pipe p; |
3176 | 131 | std::atomic<bool> handler_called; | 133 | std::atomic<bool> handler_called; |
3177 | 132 | 134 | ||
3178 | === modified file 'tests/acceptance-tests/test_protobuf.cpp' | |||
3179 | --- tests/acceptance-tests/test_protobuf.cpp 2014-01-21 12:49:00 +0000 | |||
3180 | +++ tests/acceptance-tests/test_protobuf.cpp 2014-02-10 09:00:06 +0000 | |||
3181 | @@ -75,7 +75,7 @@ | |||
3182 | 75 | sender(sender), | 75 | sender(sender), |
3183 | 76 | wrapped(wrapped) {} | 76 | wrapped(wrapped) {} |
3184 | 77 | 77 | ||
3186 | 78 | bool dispatch(mir::protobuf::wire::Invocation const& invocation) | 78 | bool dispatch(mfd::Invocation const& invocation) |
3187 | 79 | { | 79 | { |
3188 | 80 | if ("function" == invocation.method_name()) | 80 | if ("function" == invocation.method_name()) |
3189 | 81 | { | 81 | { |
3190 | 82 | 82 | ||
3191 | === modified file 'tests/acceptance-tests/test_surfaces_with_output_id.cpp' | |||
3192 | --- tests/acceptance-tests/test_surfaces_with_output_id.cpp 2014-01-13 06:12:33 +0000 | |||
3193 | +++ tests/acceptance-tests/test_surfaces_with_output_id.cpp 2014-02-10 09:00:06 +0000 | |||
3194 | @@ -66,9 +66,11 @@ | |||
3195 | 66 | f(*db); | 66 | f(*db); |
3196 | 67 | } | 67 | } |
3197 | 68 | 68 | ||
3199 | 69 | std::shared_ptr<mg::DisplayConfiguration> configuration() override | 69 | std::unique_ptr<mg::DisplayConfiguration> configuration() const override |
3200 | 70 | { | 70 | { |
3202 | 71 | return std::make_shared<mtd::StubDisplayConfig>(rects); | 71 | return std::unique_ptr<mg::DisplayConfiguration>( |
3203 | 72 | new mtd::StubDisplayConfig(rects) | ||
3204 | 73 | ); | ||
3205 | 72 | } | 74 | } |
3206 | 73 | 75 | ||
3207 | 74 | private: | 76 | private: |
3208 | 75 | 77 | ||
3209 | === modified file 'tests/draw/android_graphics.cpp' | |||
3210 | --- tests/draw/android_graphics.cpp 2014-01-13 06:12:33 +0000 | |||
3211 | +++ tests/draw/android_graphics.cpp 2014-02-10 09:00:06 +0000 | |||
3212 | @@ -48,28 +48,6 @@ | |||
3213 | 48 | gralloc_module_t *grmod; | 48 | gralloc_module_t *grmod; |
3214 | 49 | native_handle_t const* handle; | 49 | native_handle_t const* handle; |
3215 | 50 | }; | 50 | }; |
3216 | 51 | |||
3217 | 52 | static const char* proc_dir = "/proc"; | ||
3218 | 53 | static const char* surface_flinger_executable_name = "surfaceflinger"; | ||
3219 | 54 | int surface_flinger_filter(const struct dirent* d) | ||
3220 | 55 | { | ||
3221 | 56 | if (fnmatch("[1-9]*", d->d_name, 0)) | ||
3222 | 57 | return 0; | ||
3223 | 58 | |||
3224 | 59 | char path[256]; | ||
3225 | 60 | snprintf(path, sizeof(path), "%s/%s/cmdline", proc_dir, d->d_name); | ||
3226 | 61 | |||
3227 | 62 | std::ifstream in(path); | ||
3228 | 63 | std::string line; | ||
3229 | 64 | |||
3230 | 65 | while(std::getline(in, line)) | ||
3231 | 66 | { | ||
3232 | 67 | if (line.find(surface_flinger_executable_name) != std::string::npos) | ||
3233 | 68 | return 1; | ||
3234 | 69 | } | ||
3235 | 70 | |||
3236 | 71 | return 0; | ||
3237 | 72 | } | ||
3238 | 73 | } | 51 | } |
3239 | 74 | 52 | ||
3240 | 75 | mtd::TestGrallocMapper::TestGrallocMapper() | 53 | mtd::TestGrallocMapper::TestGrallocMapper() |
3241 | 76 | 54 | ||
3242 | === modified file 'tests/integration-tests/client/CMakeLists.txt' | |||
3243 | --- tests/integration-tests/client/CMakeLists.txt 2013-10-15 08:53:10 +0000 | |||
3244 | +++ tests/integration-tests/client/CMakeLists.txt 2014-02-10 09:00:06 +0000 | |||
3245 | @@ -4,9 +4,14 @@ | |||
3246 | 4 | APPEND INTEGRATION_TESTS_SRCS | 4 | APPEND INTEGRATION_TESTS_SRCS |
3247 | 5 | ${CMAKE_CURRENT_SOURCE_DIR}/test_client_render.cpp | 5 | ${CMAKE_CURRENT_SOURCE_DIR}/test_client_render.cpp |
3248 | 6 | ) | 6 | ) |
3249 | 7 | endif() | ||
3250 | 8 | |||
3251 | 9 | list( | ||
3252 | 10 | APPEND INTEGRATION_TESTS_SRCS | ||
3253 | 11 | ${CMAKE_CURRENT_SOURCE_DIR}/test_screencast.cpp | ||
3254 | 12 | ) | ||
3255 | 7 | 13 | ||
3256 | 8 | set( | 14 | set( |
3257 | 9 | INTEGRATION_TESTS_SRCS | 15 | INTEGRATION_TESTS_SRCS |
3258 | 10 | ${INTEGRATION_TESTS_SRCS} | 16 | ${INTEGRATION_TESTS_SRCS} |
3259 | 11 | PARENT_SCOPE) | 17 | PARENT_SCOPE) |
3260 | 12 | endif() | ||
3261 | 13 | 18 | ||
3262 | === added file 'tests/integration-tests/client/test_screencast.cpp' | |||
3263 | --- tests/integration-tests/client/test_screencast.cpp 1970-01-01 00:00:00 +0000 | |||
3264 | +++ tests/integration-tests/client/test_screencast.cpp 2014-02-10 09:00:06 +0000 | |||
3265 | @@ -0,0 +1,191 @@ | |||
3266 | 1 | /* | ||
3267 | 2 | * Copyright © 2014 Canonical Ltd. | ||
3268 | 3 | * | ||
3269 | 4 | * This program is free software: you can redistribute it and/or modify | ||
3270 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
3271 | 6 | * published by the Free Software Foundation. | ||
3272 | 7 | * | ||
3273 | 8 | * This program is distributed in the hope that it will be useful, | ||
3274 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3275 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3276 | 11 | * GNU General Public License for more details. | ||
3277 | 12 | * | ||
3278 | 13 | * You should have received a copy of the GNU General Public License | ||
3279 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3280 | 15 | * | ||
3281 | 16 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> | ||
3282 | 17 | */ | ||
3283 | 18 | |||
3284 | 19 | #include "mir_protobuf.pb.h" | ||
3285 | 20 | #include "src/client/default_connection_configuration.h" | ||
3286 | 21 | |||
3287 | 22 | #include "mir/frontend/connector.h" | ||
3288 | 23 | #include "mir_test/test_protobuf_server.h" | ||
3289 | 24 | #include "mir_test/stub_server_tool.h" | ||
3290 | 25 | #include "mir_test/pipe.h" | ||
3291 | 26 | |||
3292 | 27 | #include <gtest/gtest.h> | ||
3293 | 28 | |||
3294 | 29 | #include <thread> | ||
3295 | 30 | #include <mutex> | ||
3296 | 31 | #include <condition_variable> | ||
3297 | 32 | #include <boost/throw_exception.hpp> | ||
3298 | 33 | |||
3299 | 34 | namespace mcl = mir::client; | ||
3300 | 35 | namespace mt = mir::test; | ||
3301 | 36 | |||
3302 | 37 | namespace | ||
3303 | 38 | { | ||
3304 | 39 | |||
3305 | 40 | class WaitObject | ||
3306 | 41 | { | ||
3307 | 42 | public: | ||
3308 | 43 | void notify_ready() | ||
3309 | 44 | { | ||
3310 | 45 | std::unique_lock<std::mutex> lock{mutex}; | ||
3311 | 46 | ready = true; | ||
3312 | 47 | cv.notify_all(); | ||
3313 | 48 | } | ||
3314 | 49 | |||
3315 | 50 | void wait_until_ready() | ||
3316 | 51 | { | ||
3317 | 52 | std::unique_lock<std::mutex> lock{mutex}; | ||
3318 | 53 | if (!cv.wait_for(lock, std::chrono::seconds{10}, [this] { return ready; })) | ||
3319 | 54 | { | ||
3320 | 55 | BOOST_THROW_EXCEPTION(std::runtime_error("WaitObject timed out")); | ||
3321 | 56 | } | ||
3322 | 57 | } | ||
3323 | 58 | |||
3324 | 59 | private: | ||
3325 | 60 | std::mutex mutex; | ||
3326 | 61 | std::condition_variable cv; | ||
3327 | 62 | bool ready = false; | ||
3328 | 63 | }; | ||
3329 | 64 | |||
3330 | 65 | struct StubScreencastServerTool : mt::StubServerTool | ||
3331 | 66 | { | ||
3332 | 67 | void create_screencast( | ||
3333 | 68 | google::protobuf::RpcController*, | ||
3334 | 69 | const mir::protobuf::ScreencastParameters*, | ||
3335 | 70 | mir::protobuf::Screencast* response, | ||
3336 | 71 | google::protobuf::Closure* done) override | ||
3337 | 72 | { | ||
3338 | 73 | response->mutable_buffer()->add_fd(pipe.read_fd()); | ||
3339 | 74 | done->Run(); | ||
3340 | 75 | } | ||
3341 | 76 | |||
3342 | 77 | void screencast_buffer( | ||
3343 | 78 | ::google::protobuf::RpcController*, | ||
3344 | 79 | ::mir::protobuf::ScreencastId const*, | ||
3345 | 80 | ::mir::protobuf::Buffer* response, | ||
3346 | 81 | ::google::protobuf::Closure* done) override | ||
3347 | 82 | { | ||
3348 | 83 | response->add_fd(pipe.read_fd()); | ||
3349 | 84 | done->Run(); | ||
3350 | 85 | } | ||
3351 | 86 | |||
3352 | 87 | mt::Pipe pipe; | ||
3353 | 88 | }; | ||
3354 | 89 | |||
3355 | 90 | struct MirScreencastTest : public testing::Test | ||
3356 | 91 | { | ||
3357 | 92 | MirScreencastTest() | ||
3358 | 93 | : server_tool{std::make_shared<StubScreencastServerTool>()} | ||
3359 | 94 | { | ||
3360 | 95 | std::remove(test_socket); | ||
3361 | 96 | test_server = | ||
3362 | 97 | std::make_shared<mt::TestProtobufServer>(test_socket, server_tool); | ||
3363 | 98 | test_server->comm->start(); | ||
3364 | 99 | |||
3365 | 100 | rpc_channel = | ||
3366 | 101 | mcl::DefaultConnectionConfiguration{test_socket}.the_rpc_channel(); | ||
3367 | 102 | protobuf_server = | ||
3368 | 103 | std::make_shared<mir::protobuf::DisplayServer::Stub>(rpc_channel.get()); | ||
3369 | 104 | } | ||
3370 | 105 | |||
3371 | 106 | char const* const test_socket = "./test_socket_screencast"; | ||
3372 | 107 | std::shared_ptr<StubScreencastServerTool> const server_tool; | ||
3373 | 108 | std::shared_ptr<mt::TestProtobufServer> test_server; | ||
3374 | 109 | std::shared_ptr<google::protobuf::RpcChannel> rpc_channel; | ||
3375 | 110 | std::shared_ptr<mir::protobuf::DisplayServer> protobuf_server; | ||
3376 | 111 | }; | ||
3377 | 112 | |||
3378 | 113 | } | ||
3379 | 114 | |||
3380 | 115 | TEST_F(MirScreencastTest, gets_buffer_fd_when_creating_screencast) | ||
3381 | 116 | { | ||
3382 | 117 | std::vector<char> const cookie{'2','3','l','$'}; | ||
3383 | 118 | |||
3384 | 119 | ASSERT_EQ(static_cast<ssize_t>(cookie.size()), | ||
3385 | 120 | write(server_tool->pipe.write_fd(), cookie.data(), cookie.size())); | ||
3386 | 121 | |||
3387 | 122 | mir::protobuf::ScreencastParameters protobuf_parameters; | ||
3388 | 123 | protobuf_parameters.set_output_id(0); | ||
3389 | 124 | protobuf_parameters.set_width(0); | ||
3390 | 125 | protobuf_parameters.set_height(0); | ||
3391 | 126 | mir::protobuf::Screencast protobuf_screencast; | ||
3392 | 127 | |||
3393 | 128 | WaitObject wait_rpc; | ||
3394 | 129 | |||
3395 | 130 | protobuf_server->create_screencast( | ||
3396 | 131 | nullptr, | ||
3397 | 132 | &protobuf_parameters, | ||
3398 | 133 | &protobuf_screencast, | ||
3399 | 134 | google::protobuf::NewCallback(&wait_rpc, &WaitObject::notify_ready)); | ||
3400 | 135 | |||
3401 | 136 | wait_rpc.wait_until_ready(); | ||
3402 | 137 | |||
3403 | 138 | ASSERT_EQ(1, protobuf_screencast.buffer().fd_size()); | ||
3404 | 139 | auto const read_fd = protobuf_screencast.buffer().fd(0); | ||
3405 | 140 | |||
3406 | 141 | // The received FD should be different from the original pipe fd, | ||
3407 | 142 | // since we are sending it over our IPC mechanism, which for | ||
3408 | 143 | // the purposes of this test, lives in the same process. | ||
3409 | 144 | // TODO: Don't depend on IPC implementation details | ||
3410 | 145 | EXPECT_NE(read_fd, server_tool->pipe.read_fd()); | ||
3411 | 146 | |||
3412 | 147 | std::vector<char> received(cookie.size(), '\0'); | ||
3413 | 148 | EXPECT_EQ(static_cast<ssize_t>(cookie.size()), | ||
3414 | 149 | read(read_fd, received.data(), received.size())); | ||
3415 | 150 | EXPECT_EQ(cookie, received); | ||
3416 | 151 | |||
3417 | 152 | close(read_fd); | ||
3418 | 153 | } | ||
3419 | 154 | |||
3420 | 155 | TEST_F(MirScreencastTest, gets_buffer_fd_when_getting_screencast_buffer) | ||
3421 | 156 | { | ||
3422 | 157 | std::vector<char> const cookie{'X','%','q','S'}; | ||
3423 | 158 | |||
3424 | 159 | ASSERT_EQ(static_cast<ssize_t>(cookie.size()), | ||
3425 | 160 | write(server_tool->pipe.write_fd(), cookie.data(), cookie.size())); | ||
3426 | 161 | |||
3427 | 162 | mir::protobuf::ScreencastId protobuf_screencast_id; | ||
3428 | 163 | protobuf_screencast_id.set_value(0); | ||
3429 | 164 | mir::protobuf::Buffer protobuf_buffer; | ||
3430 | 165 | |||
3431 | 166 | WaitObject wait_rpc; | ||
3432 | 167 | |||
3433 | 168 | protobuf_server->screencast_buffer( | ||
3434 | 169 | nullptr, | ||
3435 | 170 | &protobuf_screencast_id, | ||
3436 | 171 | &protobuf_buffer, | ||
3437 | 172 | google::protobuf::NewCallback(&wait_rpc, &WaitObject::notify_ready)); | ||
3438 | 173 | |||
3439 | 174 | wait_rpc.wait_until_ready(); | ||
3440 | 175 | |||
3441 | 176 | ASSERT_EQ(1, protobuf_buffer.fd_size()); | ||
3442 | 177 | auto const read_fd = protobuf_buffer.fd(0); | ||
3443 | 178 | |||
3444 | 179 | // The received FD should be different from the original pipe fd, | ||
3445 | 180 | // since we are sending it over our IPC mechanism, which, for | ||
3446 | 181 | // the purposes of this test, lives in the same process. | ||
3447 | 182 | // TODO: Don't depend on IPC implementation details | ||
3448 | 183 | EXPECT_NE(read_fd, server_tool->pipe.read_fd()); | ||
3449 | 184 | |||
3450 | 185 | std::vector<char> received(cookie.size(), '\0'); | ||
3451 | 186 | EXPECT_EQ(static_cast<ssize_t>(cookie.size()), | ||
3452 | 187 | read(read_fd, received.data(), received.size())); | ||
3453 | 188 | EXPECT_EQ(cookie, received); | ||
3454 | 189 | |||
3455 | 190 | close(read_fd); | ||
3456 | 191 | } | ||
3457 | 0 | 192 | ||
3458 | === modified file 'tests/integration-tests/compositor/test_buffer_stream.cpp' | |||
3459 | --- tests/integration-tests/compositor/test_buffer_stream.cpp 2014-01-13 06:12:33 +0000 | |||
3460 | +++ tests/integration-tests/compositor/test_buffer_stream.cpp 2014-02-10 09:00:06 +0000 | |||
3461 | @@ -26,6 +26,7 @@ | |||
3462 | 26 | 26 | ||
3463 | 27 | #include <gmock/gmock.h> | 27 | #include <gmock/gmock.h> |
3464 | 28 | 28 | ||
3465 | 29 | #include <condition_variable> | ||
3466 | 29 | #include <thread> | 30 | #include <thread> |
3467 | 30 | #include <chrono> | 31 | #include <chrono> |
3468 | 31 | #include <atomic> | 32 | #include <atomic> |
3469 | @@ -38,6 +39,31 @@ | |||
3470 | 38 | 39 | ||
3471 | 39 | namespace | 40 | namespace |
3472 | 40 | { | 41 | { |
3473 | 42 | struct BufferStreamSurfaces : mc::BufferStreamSurfaces | ||
3474 | 43 | { | ||
3475 | 44 | using mc::BufferStreamSurfaces::BufferStreamSurfaces; | ||
3476 | 45 | |||
3477 | 46 | // Convenient function to allow tests to be written in linear style | ||
3478 | 47 | void swap_client_buffers_blocking(mg::Buffer*& buffer) | ||
3479 | 48 | { | ||
3480 | 49 | std::mutex mutex; | ||
3481 | 50 | std::condition_variable cv; | ||
3482 | 51 | bool done = false; | ||
3483 | 52 | |||
3484 | 53 | swap_client_buffers(buffer, | ||
3485 | 54 | [&](mg::Buffer* new_buffer) | ||
3486 | 55 | { | ||
3487 | 56 | std::unique_lock<decltype(mutex)> lock(mutex); | ||
3488 | 57 | buffer = new_buffer; | ||
3489 | 58 | done = true; | ||
3490 | 59 | cv.notify_one(); | ||
3491 | 60 | }); | ||
3492 | 61 | |||
3493 | 62 | std::unique_lock<decltype(mutex)> lock(mutex); | ||
3494 | 63 | |||
3495 | 64 | cv.wait(lock, [&]{ return done; }); | ||
3496 | 65 | } | ||
3497 | 66 | }; | ||
3498 | 41 | 67 | ||
3499 | 42 | struct BufferStreamTest : public ::testing::Test | 68 | struct BufferStreamTest : public ::testing::Test |
3500 | 43 | { | 69 | { |
3501 | @@ -60,7 +86,7 @@ | |||
3502 | 60 | } | 86 | } |
3503 | 61 | 87 | ||
3504 | 62 | const int nbuffers; | 88 | const int nbuffers; |
3506 | 63 | mc::BufferStreamSurfaces buffer_stream; | 89 | BufferStreamSurfaces buffer_stream; |
3507 | 64 | }; | 90 | }; |
3508 | 65 | 91 | ||
3509 | 66 | } | 92 | } |
3510 | @@ -68,9 +94,9 @@ | |||
3511 | 68 | TEST_F(BufferStreamTest, gives_same_back_buffer_until_more_available) | 94 | TEST_F(BufferStreamTest, gives_same_back_buffer_until_more_available) |
3512 | 69 | { | 95 | { |
3513 | 70 | mg::Buffer* client1{nullptr}; | 96 | mg::Buffer* client1{nullptr}; |
3515 | 71 | buffer_stream.swap_client_buffers(client1); | 97 | buffer_stream.swap_client_buffers_blocking(client1); |
3516 | 72 | auto client1_id = client1->id(); | 98 | auto client1_id = client1->id(); |
3518 | 73 | buffer_stream.swap_client_buffers(client1); | 99 | buffer_stream.swap_client_buffers_blocking(client1); |
3519 | 74 | 100 | ||
3520 | 75 | auto comp1 = buffer_stream.lock_compositor_buffer(1); | 101 | auto comp1 = buffer_stream.lock_compositor_buffer(1); |
3521 | 76 | auto comp2 = buffer_stream.lock_compositor_buffer(1); | 102 | auto comp2 = buffer_stream.lock_compositor_buffer(1); |
3522 | @@ -80,7 +106,7 @@ | |||
3523 | 80 | 106 | ||
3524 | 81 | comp1.reset(); | 107 | comp1.reset(); |
3525 | 82 | 108 | ||
3527 | 83 | buffer_stream.swap_client_buffers(client1); | 109 | buffer_stream.swap_client_buffers_blocking(client1); |
3528 | 84 | auto comp3 = buffer_stream.lock_compositor_buffer(2); | 110 | auto comp3 = buffer_stream.lock_compositor_buffer(2); |
3529 | 85 | 111 | ||
3530 | 86 | EXPECT_NE(client1_id, comp3->id()); | 112 | EXPECT_NE(client1_id, comp3->id()); |
3531 | @@ -97,7 +123,7 @@ | |||
3532 | 97 | { | 123 | { |
3533 | 98 | mg::Buffer* client_buffer{nullptr}; | 124 | mg::Buffer* client_buffer{nullptr}; |
3534 | 99 | for (int i = 0; i != nbuffers; i++) | 125 | for (int i = 0; i != nbuffers; i++) |
3536 | 100 | buffer_stream.swap_client_buffers(client_buffer); | 126 | buffer_stream.swap_client_buffers_blocking(client_buffer); |
3537 | 101 | 127 | ||
3538 | 102 | auto first_monitor = buffer_stream.lock_compositor_buffer(1); | 128 | auto first_monitor = buffer_stream.lock_compositor_buffer(1); |
3539 | 103 | auto first_compositor_id = first_monitor->id(); | 129 | auto first_compositor_id = first_monitor->id(); |
3540 | @@ -113,14 +139,14 @@ | |||
3541 | 113 | TEST_F(BufferStreamTest, gives_different_back_buffer_asap) | 139 | TEST_F(BufferStreamTest, gives_different_back_buffer_asap) |
3542 | 114 | { | 140 | { |
3543 | 115 | mg::Buffer* client_buffer{nullptr}; | 141 | mg::Buffer* client_buffer{nullptr}; |
3545 | 116 | buffer_stream.swap_client_buffers(client_buffer); | 142 | buffer_stream.swap_client_buffers_blocking(client_buffer); |
3546 | 117 | 143 | ||
3547 | 118 | if (nbuffers > 1) | 144 | if (nbuffers > 1) |
3548 | 119 | { | 145 | { |
3550 | 120 | buffer_stream.swap_client_buffers(client_buffer); | 146 | buffer_stream.swap_client_buffers_blocking(client_buffer); |
3551 | 121 | auto comp1 = buffer_stream.lock_compositor_buffer(1); | 147 | auto comp1 = buffer_stream.lock_compositor_buffer(1); |
3552 | 122 | 148 | ||
3554 | 123 | buffer_stream.swap_client_buffers(client_buffer); | 149 | buffer_stream.swap_client_buffers_blocking(client_buffer); |
3555 | 124 | auto comp2 = buffer_stream.lock_compositor_buffer(2); | 150 | auto comp2 = buffer_stream.lock_compositor_buffer(2); |
3556 | 125 | 151 | ||
3557 | 126 | EXPECT_NE(comp1->id(), comp2->id()); | 152 | EXPECT_NE(comp1->id(), comp2->id()); |
3558 | @@ -135,7 +161,7 @@ | |||
3559 | 135 | auto old_size = buffer_stream.stream_size(); | 161 | auto old_size = buffer_stream.stream_size(); |
3560 | 136 | 162 | ||
3561 | 137 | mg::Buffer* client{nullptr}; | 163 | mg::Buffer* client{nullptr}; |
3563 | 138 | buffer_stream.swap_client_buffers(client); | 164 | buffer_stream.swap_client_buffers_blocking(client); |
3564 | 139 | EXPECT_EQ(old_size, client->size()); | 165 | EXPECT_EQ(old_size, client->size()); |
3565 | 140 | 166 | ||
3566 | 141 | geom::Size const new_size | 167 | geom::Size const new_size |
3567 | @@ -146,13 +172,13 @@ | |||
3568 | 146 | buffer_stream.resize(new_size); | 172 | buffer_stream.resize(new_size); |
3569 | 147 | EXPECT_EQ(new_size, buffer_stream.stream_size()); | 173 | EXPECT_EQ(new_size, buffer_stream.stream_size()); |
3570 | 148 | 174 | ||
3572 | 149 | buffer_stream.swap_client_buffers(client); | 175 | buffer_stream.swap_client_buffers_blocking(client); |
3573 | 150 | EXPECT_EQ(new_size, client->size()); | 176 | EXPECT_EQ(new_size, client->size()); |
3574 | 151 | 177 | ||
3575 | 152 | buffer_stream.resize(old_size); | 178 | buffer_stream.resize(old_size); |
3576 | 153 | EXPECT_EQ(old_size, buffer_stream.stream_size()); | 179 | EXPECT_EQ(old_size, buffer_stream.stream_size()); |
3577 | 154 | 180 | ||
3579 | 155 | buffer_stream.swap_client_buffers(client); | 181 | buffer_stream.swap_client_buffers_blocking(client); |
3580 | 156 | EXPECT_EQ(old_size, client->size()); | 182 | EXPECT_EQ(old_size, client->size()); |
3581 | 157 | } | 183 | } |
3582 | 158 | 184 | ||
3583 | @@ -161,7 +187,7 @@ | |||
3584 | 161 | auto old_size = buffer_stream.stream_size(); | 187 | auto old_size = buffer_stream.stream_size(); |
3585 | 162 | 188 | ||
3586 | 163 | mg::Buffer* client{nullptr}; | 189 | mg::Buffer* client{nullptr}; |
3588 | 164 | buffer_stream.swap_client_buffers(client); | 190 | buffer_stream.swap_client_buffers_blocking(client); |
3589 | 165 | 191 | ||
3590 | 166 | geom::Size const new_size | 192 | geom::Size const new_size |
3591 | 167 | { | 193 | { |
3592 | @@ -171,8 +197,8 @@ | |||
3593 | 171 | buffer_stream.resize(new_size); | 197 | buffer_stream.resize(new_size); |
3594 | 172 | EXPECT_EQ(new_size, buffer_stream.stream_size()); | 198 | EXPECT_EQ(new_size, buffer_stream.stream_size()); |
3595 | 173 | 199 | ||
3598 | 174 | buffer_stream.swap_client_buffers(client); | 200 | buffer_stream.swap_client_buffers_blocking(client); |
3599 | 175 | buffer_stream.swap_client_buffers(client); | 201 | buffer_stream.swap_client_buffers_blocking(client); |
3600 | 176 | 202 | ||
3601 | 177 | auto comp1 = buffer_stream.lock_compositor_buffer(1); | 203 | auto comp1 = buffer_stream.lock_compositor_buffer(1); |
3602 | 178 | EXPECT_EQ(old_size, comp1->size()); | 204 | EXPECT_EQ(old_size, comp1->size()); |
3603 | @@ -182,7 +208,7 @@ | |||
3604 | 182 | EXPECT_EQ(new_size, comp2->size()); | 208 | EXPECT_EQ(new_size, comp2->size()); |
3605 | 183 | comp2.reset(); | 209 | comp2.reset(); |
3606 | 184 | 210 | ||
3608 | 185 | buffer_stream.swap_client_buffers(client); | 211 | buffer_stream.swap_client_buffers_blocking(client); |
3609 | 186 | 212 | ||
3610 | 187 | auto comp3 = buffer_stream.lock_compositor_buffer(3); | 213 | auto comp3 = buffer_stream.lock_compositor_buffer(3); |
3611 | 188 | EXPECT_EQ(new_size, comp3->size()); | 214 | EXPECT_EQ(new_size, comp3->size()); |
3612 | @@ -192,13 +218,13 @@ | |||
3613 | 192 | EXPECT_EQ(old_size, buffer_stream.stream_size()); | 218 | EXPECT_EQ(old_size, buffer_stream.stream_size()); |
3614 | 193 | 219 | ||
3615 | 194 | // No client frames "drawn" since resize(old_size), so compositor gets new_size | 220 | // No client frames "drawn" since resize(old_size), so compositor gets new_size |
3617 | 195 | buffer_stream.swap_client_buffers(client); | 221 | buffer_stream.swap_client_buffers_blocking(client); |
3618 | 196 | auto comp4 = buffer_stream.lock_compositor_buffer(4); | 222 | auto comp4 = buffer_stream.lock_compositor_buffer(4); |
3619 | 197 | EXPECT_EQ(new_size, comp4->size()); | 223 | EXPECT_EQ(new_size, comp4->size()); |
3620 | 198 | comp4.reset(); | 224 | comp4.reset(); |
3621 | 199 | 225 | ||
3622 | 200 | // Generate a new frame, which should be back to old_size now | 226 | // Generate a new frame, which should be back to old_size now |
3624 | 201 | buffer_stream.swap_client_buffers(client); | 227 | buffer_stream.swap_client_buffers_blocking(client); |
3625 | 202 | auto comp5 = buffer_stream.lock_compositor_buffer(5); | 228 | auto comp5 = buffer_stream.lock_compositor_buffer(5); |
3626 | 203 | EXPECT_EQ(old_size, comp5->size()); | 229 | EXPECT_EQ(old_size, comp5->size()); |
3627 | 204 | comp5.reset(); | 230 | comp5.reset(); |
3628 | @@ -207,8 +233,8 @@ | |||
3629 | 207 | TEST_F(BufferStreamTest, can_get_partly_released_back_buffer) | 233 | TEST_F(BufferStreamTest, can_get_partly_released_back_buffer) |
3630 | 208 | { | 234 | { |
3631 | 209 | mg::Buffer* client{nullptr}; | 235 | mg::Buffer* client{nullptr}; |
3634 | 210 | buffer_stream.swap_client_buffers(client); | 236 | buffer_stream.swap_client_buffers_blocking(client); |
3635 | 211 | buffer_stream.swap_client_buffers(client); | 237 | buffer_stream.swap_client_buffers_blocking(client); |
3636 | 212 | 238 | ||
3637 | 213 | auto comp1 = buffer_stream.lock_compositor_buffer(123); | 239 | auto comp1 = buffer_stream.lock_compositor_buffer(123); |
3638 | 214 | auto comp2 = buffer_stream.lock_compositor_buffer(123); | 240 | auto comp2 = buffer_stream.lock_compositor_buffer(123); |
3639 | @@ -225,12 +251,12 @@ | |||
3640 | 225 | namespace | 251 | namespace |
3641 | 226 | { | 252 | { |
3642 | 227 | 253 | ||
3644 | 228 | void client_loop(int nframes, mc::BufferStream& stream) | 254 | void client_loop(int nframes, BufferStreamSurfaces& stream) |
3645 | 229 | { | 255 | { |
3646 | 230 | mg::Buffer* out_buffer{nullptr}; | 256 | mg::Buffer* out_buffer{nullptr}; |
3647 | 231 | for (int f = 0; f < nframes; f++) | 257 | for (int f = 0; f < nframes; f++) |
3648 | 232 | { | 258 | { |
3650 | 233 | stream.swap_client_buffers(out_buffer); | 259 | stream.swap_client_buffers_blocking(out_buffer); |
3651 | 234 | ASSERT_NE(nullptr, out_buffer); | 260 | ASSERT_NE(nullptr, out_buffer); |
3652 | 235 | std::this_thread::yield(); | 261 | std::this_thread::yield(); |
3653 | 236 | } | 262 | } |
3654 | 237 | 263 | ||
3655 | === modified file 'tests/integration-tests/compositor/test_swapping_swappers.cpp' | |||
3656 | --- tests/integration-tests/compositor/test_swapping_swappers.cpp 2014-01-13 06:12:33 +0000 | |||
3657 | +++ tests/integration-tests/compositor/test_swapping_swappers.cpp 2014-02-10 09:00:06 +0000 | |||
3658 | @@ -51,6 +51,31 @@ | |||
3659 | 51 | std::shared_ptr<mc::SwitchingBundle> switching_bundle; | 51 | std::shared_ptr<mc::SwitchingBundle> switching_bundle; |
3660 | 52 | std::atomic<bool> client_thread_done; | 52 | std::atomic<bool> client_thread_done; |
3661 | 53 | }; | 53 | }; |
3662 | 54 | |||
3663 | 55 | auto client_acquire_blocking(std::shared_ptr<mc::SwitchingBundle> const& switching_bundle) | ||
3664 | 56 | -> mg::Buffer* | ||
3665 | 57 | { | ||
3666 | 58 | std::mutex mutex; | ||
3667 | 59 | std::condition_variable cv; | ||
3668 | 60 | bool done = false; | ||
3669 | 61 | |||
3670 | 62 | mg::Buffer* result; | ||
3671 | 63 | switching_bundle->client_acquire( | ||
3672 | 64 | [&](mg::Buffer* new_buffer) | ||
3673 | 65 | { | ||
3674 | 66 | std::unique_lock<decltype(mutex)> lock(mutex); | ||
3675 | 67 | |||
3676 | 68 | result = new_buffer; | ||
3677 | 69 | done = true; | ||
3678 | 70 | cv.notify_one(); | ||
3679 | 71 | }); | ||
3680 | 72 | |||
3681 | 73 | std::unique_lock<decltype(mutex)> lock(mutex); | ||
3682 | 74 | |||
3683 | 75 | cv.wait(lock, [&]{ return done; }); | ||
3684 | 76 | |||
3685 | 77 | return result; | ||
3686 | 78 | } | ||
3687 | 54 | } | 79 | } |
3688 | 55 | 80 | ||
3689 | 56 | TEST_F(SwapperSwappingStress, swapper) | 81 | TEST_F(SwapperSwappingStress, swapper) |
3690 | @@ -62,7 +87,7 @@ | |||
3691 | 62 | { | 87 | { |
3692 | 63 | for(auto i=0u; i < 400; i++) | 88 | for(auto i=0u; i < 400; i++) |
3693 | 64 | { | 89 | { |
3695 | 65 | auto b = switching_bundle->client_acquire(); | 90 | auto b = client_acquire_blocking(switching_bundle); |
3696 | 66 | std::this_thread::yield(); | 91 | std::this_thread::yield(); |
3697 | 67 | switching_bundle->client_release(b); | 92 | switching_bundle->client_release(b); |
3698 | 68 | } | 93 | } |
3699 | @@ -107,7 +132,7 @@ | |||
3700 | 107 | { | 132 | { |
3701 | 108 | for(auto i=0u; i < 400; i++) | 133 | for(auto i=0u; i < 400; i++) |
3702 | 109 | { | 134 | { |
3704 | 110 | auto b = switching_bundle->client_acquire(); | 135 | auto b = client_acquire_blocking(switching_bundle); |
3705 | 111 | std::this_thread::yield(); | 136 | std::this_thread::yield(); |
3706 | 112 | switching_bundle->client_release(b); | 137 | switching_bundle->client_release(b); |
3707 | 113 | } | 138 | } |
3708 | 114 | 139 | ||
3709 | === modified file 'tests/integration-tests/graphics/android/test_buffer_integration.cpp' | |||
3710 | --- tests/integration-tests/graphics/android/test_buffer_integration.cpp 2014-01-13 06:12:33 +0000 | |||
3711 | +++ tests/integration-tests/graphics/android/test_buffer_integration.cpp 2014-02-10 09:00:06 +0000 | |||
3712 | @@ -55,6 +55,30 @@ | |||
3713 | 55 | mtd::TestGrallocMapper sw_renderer; | 55 | mtd::TestGrallocMapper sw_renderer; |
3714 | 56 | }; | 56 | }; |
3715 | 57 | 57 | ||
3716 | 58 | auto client_acquire_blocking(mc::SwitchingBundle& switching_bundle) | ||
3717 | 59 | -> mg::Buffer* | ||
3718 | 60 | { | ||
3719 | 61 | std::mutex mutex; | ||
3720 | 62 | std::condition_variable cv; | ||
3721 | 63 | bool done = false; | ||
3722 | 64 | |||
3723 | 65 | mg::Buffer* result; | ||
3724 | 66 | switching_bundle.client_acquire( | ||
3725 | 67 | [&](mg::Buffer* new_buffer) | ||
3726 | 68 | { | ||
3727 | 69 | std::unique_lock<decltype(mutex)> lock(mutex); | ||
3728 | 70 | |||
3729 | 71 | result = new_buffer; | ||
3730 | 72 | done = true; | ||
3731 | 73 | cv.notify_one(); | ||
3732 | 74 | }); | ||
3733 | 75 | |||
3734 | 76 | std::unique_lock<decltype(mutex)> lock(mutex); | ||
3735 | 77 | |||
3736 | 78 | cv.wait(lock, [&]{ return done; }); | ||
3737 | 79 | |||
3738 | 80 | return result; | ||
3739 | 81 | } | ||
3740 | 58 | } | 82 | } |
3741 | 59 | 83 | ||
3742 | 60 | TEST_F(AndroidBufferIntegration, allocator_can_create_sw_buffer) | 84 | TEST_F(AndroidBufferIntegration, allocator_can_create_sw_buffer) |
3743 | @@ -92,7 +116,7 @@ | |||
3744 | 92 | 116 | ||
3745 | 93 | mc::SwitchingBundle swapper(2, allocator, buffer_properties); | 117 | mc::SwitchingBundle swapper(2, allocator, buffer_properties); |
3746 | 94 | 118 | ||
3748 | 95 | auto returned_buffer = swapper.client_acquire(); | 119 | auto returned_buffer = client_acquire_blocking(swapper); |
3749 | 96 | 120 | ||
3750 | 97 | EXPECT_NE(nullptr, returned_buffer); | 121 | EXPECT_NE(nullptr, returned_buffer); |
3751 | 98 | } | 122 | } |
3752 | 99 | 123 | ||
3753 | === modified file 'tests/integration-tests/graphics/android/test_display_integration.cpp' | |||
3754 | --- tests/integration-tests/graphics/android/test_display_integration.cpp 2014-01-21 06:27:40 +0000 | |||
3755 | +++ tests/integration-tests/graphics/android/test_display_integration.cpp 2014-02-10 09:00:06 +0000 | |||
3756 | @@ -38,7 +38,7 @@ | |||
3757 | 38 | 38 | ||
3758 | 39 | namespace | 39 | namespace |
3759 | 40 | { | 40 | { |
3761 | 41 | class AndroidGPUDisplay : public ::testing::Test | 41 | class AndroidDisplay : public ::testing::Test |
3762 | 42 | { | 42 | { |
3763 | 43 | protected: | 43 | protected: |
3764 | 44 | static void SetUpTestCase() | 44 | static void SetUpTestCase() |
3765 | @@ -65,42 +65,17 @@ | |||
3766 | 65 | static void (*original_sigterm_handler)(int); | 65 | static void (*original_sigterm_handler)(int); |
3767 | 66 | }; | 66 | }; |
3768 | 67 | 67 | ||
3805 | 68 | void (*AndroidGPUDisplay::original_sigterm_handler)(int); | 68 | void (*AndroidDisplay::original_sigterm_handler)(int); |
3806 | 69 | std::shared_ptr<mga::ResourceFactory> AndroidGPUDisplay::display_resource_factory; | 69 | std::shared_ptr<mga::ResourceFactory> AndroidDisplay::display_resource_factory; |
3807 | 70 | } | 70 | } |
3808 | 71 | 71 | ||
3809 | 72 | // disabled to unblock CI - see lp:1239955 | 72 | TEST_F(AndroidDisplay, display_can_post) |
3810 | 73 | TEST_F(AndroidGPUDisplay, DISABLED_gpu_display_ok_with_gles) | 73 | { |
3811 | 74 | { | 74 | auto mock_display_report = std::make_shared<testing::NiceMock<mtd::MockDisplayReport>>(); |
3812 | 75 | auto should_use_fb_fallback = true; | 75 | auto buffer_initializer = std::make_shared<mg::NullBufferInitializer>(); |
3813 | 76 | auto buffer_initializer = std::make_shared<mg::NullBufferInitializer>(); | 76 | auto fb_allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(buffer_initializer); |
3814 | 77 | auto fb_allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(buffer_initializer); | 77 | auto display_buffer_factory = std::make_shared<mga::OutputBuilder>( |
3815 | 78 | auto mock_display_report = std::make_shared<testing::NiceMock<mtd::MockDisplayReport>>(); | 78 | fb_allocator, display_resource_factory, mock_display_report); |
3780 | 79 | auto display_buffer_factory = std::make_shared<mga::OutputBuilder>( | ||
3781 | 80 | fb_allocator, display_resource_factory, mock_display_report, should_use_fb_fallback); | ||
3782 | 81 | |||
3783 | 82 | mga::AndroidDisplay display(display_buffer_factory, mock_display_report); | ||
3784 | 83 | display.for_each_display_buffer([this](mg::DisplayBuffer& buffer) | ||
3785 | 84 | { | ||
3786 | 85 | buffer.make_current(); | ||
3787 | 86 | gl_animation.init_gl(); | ||
3788 | 87 | |||
3789 | 88 | gl_animation.render_gl(); | ||
3790 | 89 | buffer.post_update(); | ||
3791 | 90 | |||
3792 | 91 | gl_animation.render_gl(); | ||
3793 | 92 | buffer.post_update(); | ||
3794 | 93 | }); | ||
3795 | 94 | } | ||
3796 | 95 | |||
3797 | 96 | TEST_F(AndroidGPUDisplay, hwc_display_ok_with_gles) | ||
3798 | 97 | { | ||
3799 | 98 | auto should_use_fb_fallback = false; | ||
3800 | 99 | auto mock_display_report = std::make_shared<testing::NiceMock<mtd::MockDisplayReport>>(); | ||
3801 | 100 | auto buffer_initializer = std::make_shared<mg::NullBufferInitializer>(); | ||
3802 | 101 | auto fb_allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(buffer_initializer); | ||
3803 | 102 | auto display_buffer_factory = std::make_shared<mga::OutputBuilder>( | ||
3804 | 103 | fb_allocator, display_resource_factory, mock_display_report, should_use_fb_fallback); | ||
3816 | 104 | 79 | ||
3817 | 105 | mga::AndroidDisplay display(display_buffer_factory, mock_display_report); | 80 | mga::AndroidDisplay display(display_buffer_factory, mock_display_report); |
3818 | 106 | display.for_each_display_buffer([this](mg::DisplayBuffer& buffer) | 81 | display.for_each_display_buffer([this](mg::DisplayBuffer& buffer) |
3819 | 107 | 82 | ||
3820 | === modified file 'tests/integration-tests/graphics/android/test_internal_client.cpp' | |||
3821 | --- tests/integration-tests/graphics/android/test_internal_client.cpp 2014-01-13 06:12:33 +0000 | |||
3822 | +++ tests/integration-tests/graphics/android/test_internal_client.cpp 2014-02-10 09:00:06 +0000 | |||
3823 | @@ -98,8 +98,9 @@ | |||
3824 | 98 | auto ss = std::make_shared<ms::SurfaceStack>(surface_allocator, stub_input_registrar, scene_report); | 98 | auto ss = std::make_shared<ms::SurfaceStack>(surface_allocator, stub_input_registrar, scene_report); |
3825 | 99 | auto surface_controller = std::make_shared<ms::SurfaceController>(ss); | 99 | auto surface_controller = std::make_shared<ms::SurfaceController>(ss); |
3826 | 100 | auto surface_source = std::make_shared<ms::SurfaceSource>(surface_controller, std::make_shared<mtd::NullSurfaceConfigurator>()); | 100 | auto surface_source = std::make_shared<ms::SurfaceSource>(surface_controller, std::make_shared<mtd::NullSurfaceConfigurator>()); |
3829 | 101 | auto mir_surface = as_internal_surface( | 101 | auto surface = surface_source->create_surface(nullptr, params, id, std::shared_ptr<mf::EventSink>()); |
3830 | 102 | surface_source->create_surface(nullptr, params, id, std::shared_ptr<mf::EventSink>())); | 102 | surface->allow_framedropping(true); |
3831 | 103 | auto mir_surface = as_internal_surface(surface); | ||
3832 | 103 | 104 | ||
3833 | 104 | auto options = std::shared_ptr<mo::ProgramOption>(); | 105 | auto options = std::shared_ptr<mo::ProgramOption>(); |
3834 | 105 | auto report = std::shared_ptr<mg::NullDisplayReport>(); | 106 | auto report = std::shared_ptr<mg::NullDisplayReport>(); |
3835 | 106 | 107 | ||
3836 | === modified file 'tests/integration-tests/test_display_server_main_loop_events.cpp' | |||
3837 | --- tests/integration-tests/test_display_server_main_loop_events.cpp 2014-01-13 06:12:33 +0000 | |||
3838 | +++ tests/integration-tests/test_display_server_main_loop_events.cpp 2014-02-10 09:00:06 +0000 | |||
3839 | @@ -94,9 +94,11 @@ | |||
3840 | 94 | display->for_each_display_buffer(f); | 94 | display->for_each_display_buffer(f); |
3841 | 95 | } | 95 | } |
3842 | 96 | 96 | ||
3844 | 97 | std::shared_ptr<mg::DisplayConfiguration> configuration() override | 97 | std::unique_ptr<mg::DisplayConfiguration> configuration() const override |
3845 | 98 | { | 98 | { |
3847 | 99 | return display->configuration(); | 99 | return std::unique_ptr<mg::DisplayConfiguration>( |
3848 | 100 | new mtd::NullDisplayConfiguration | ||
3849 | 101 | ); | ||
3850 | 100 | } | 102 | } |
3851 | 101 | 103 | ||
3852 | 102 | MOCK_METHOD1(configure, void(mg::DisplayConfiguration const&)); | 104 | MOCK_METHOD1(configure, void(mg::DisplayConfiguration const&)); |
3853 | 103 | 105 | ||
3854 | === modified file 'tests/integration-tests/test_session.cpp' | |||
3855 | --- tests/integration-tests/test_session.cpp 2014-01-14 07:02:27 +0000 | |||
3856 | +++ tests/integration-tests/test_session.cpp 2014-02-10 09:00:06 +0000 | |||
3857 | @@ -1,5 +1,5 @@ | |||
3858 | 1 | /* | 1 | /* |
3860 | 2 | * Copyright © 2013 Canonical Ltd. | 2 | * Copyright © 2013-2014 Canonical Ltd. |
3861 | 3 | * | 3 | * |
3862 | 4 | * This program is free software: you can redistribute it and/or modify | 4 | * This program is free software: you can redistribute it and/or modify |
3863 | 5 | * it under the terms of the GNU General Public License version 3 as | 5 | * it under the terms of the GNU General Public License version 3 as |
3864 | @@ -170,6 +170,7 @@ | |||
3865 | 170 | 170 | ||
3866 | 171 | ms::ApplicationSession session{ | 171 | ms::ApplicationSession session{ |
3867 | 172 | conf.the_shell_surface_factory(), | 172 | conf.the_shell_surface_factory(), |
3868 | 173 | __LINE__, | ||
3869 | 173 | "stress", | 174 | "stress", |
3870 | 174 | conf.the_snapshot_strategy(), | 175 | conf.the_snapshot_strategy(), |
3871 | 175 | std::make_shared<msh::NullSessionListener>(), | 176 | std::make_shared<msh::NullSessionListener>(), |
3872 | @@ -189,7 +190,7 @@ | |||
3873 | 189 | for (int i = 0; i < 500; ++i) | 190 | for (int i = 0; i < 500; ++i) |
3874 | 190 | { | 191 | { |
3875 | 191 | auto surface = session.default_surface(); | 192 | auto surface = session.default_surface(); |
3877 | 192 | surface->swap_buffers(buffer); | 193 | surface->swap_buffers_blocking(buffer); |
3878 | 193 | std::this_thread::sleep_for(std::chrono::microseconds{50}); | 194 | std::this_thread::sleep_for(std::chrono::microseconds{50}); |
3879 | 194 | } | 195 | } |
3880 | 195 | }}; | 196 | }}; |
3881 | 196 | 197 | ||
3882 | === modified file 'tests/integration-tests/test_session_manager.cpp' | |||
3883 | --- tests/integration-tests/test_session_manager.cpp 2014-01-13 06:12:33 +0000 | |||
3884 | +++ tests/integration-tests/test_session_manager.cpp 2014-02-10 09:00:06 +0000 | |||
3885 | @@ -76,9 +76,9 @@ | |||
3886 | 76 | 76 | ||
3887 | 77 | EXPECT_CALL(focus_setter, set_focus_to(_)).Times(3); | 77 | EXPECT_CALL(focus_setter, set_focus_to(_)).Times(3); |
3888 | 78 | 78 | ||
3892 | 79 | auto session1 = session_manager.open_session("Visual Basic Studio", std::make_shared<mtd::NullEventSink>()); | 79 | auto session1 = session_manager.open_session(__LINE__, "Visual Basic Studio", std::make_shared<mtd::NullEventSink>()); |
3893 | 80 | auto session2 = session_manager.open_session("Microsoft Access", std::make_shared<mtd::NullEventSink>()); | 80 | auto session2 = session_manager.open_session(__LINE__, "Microsoft Access", std::make_shared<mtd::NullEventSink>()); |
3894 | 81 | auto session3 = session_manager.open_session("WordPerfect", std::make_shared<mtd::NullEventSink>()); | 81 | auto session3 = session_manager.open_session(__LINE__, "WordPerfect", std::make_shared<mtd::NullEventSink>()); |
3895 | 82 | 82 | ||
3896 | 83 | Mock::VerifyAndClearExpectations(&focus_setter); | 83 | Mock::VerifyAndClearExpectations(&focus_setter); |
3897 | 84 | 84 | ||
3898 | @@ -105,9 +105,9 @@ | |||
3899 | 105 | 105 | ||
3900 | 106 | EXPECT_CALL(focus_setter, set_focus_to(_)).Times(3); | 106 | EXPECT_CALL(focus_setter, set_focus_to(_)).Times(3); |
3901 | 107 | 107 | ||
3905 | 108 | auto session1 = session_manager.open_session("Visual Basic Studio", std::make_shared<mtd::NullEventSink>()); | 108 | auto session1 = session_manager.open_session(__LINE__, "Visual Basic Studio", std::make_shared<mtd::NullEventSink>()); |
3906 | 109 | auto session2 = session_manager.open_session("Microsoft Access", std::make_shared<mtd::NullEventSink>()); | 109 | auto session2 = session_manager.open_session(__LINE__, "Microsoft Access", std::make_shared<mtd::NullEventSink>()); |
3907 | 110 | auto session3 = session_manager.open_session("WordPerfect", std::make_shared<mtd::NullEventSink>()); | 110 | auto session3 = session_manager.open_session(__LINE__, "WordPerfect", std::make_shared<mtd::NullEventSink>()); |
3908 | 111 | 111 | ||
3909 | 112 | Mock::VerifyAndClearExpectations(&focus_setter); | 112 | Mock::VerifyAndClearExpectations(&focus_setter); |
3910 | 113 | 113 | ||
3911 | 114 | 114 | ||
3912 | === modified file 'tests/integration-tests/test_swapinterval.cpp' | |||
3913 | --- tests/integration-tests/test_swapinterval.cpp 2014-01-13 06:12:33 +0000 | |||
3914 | +++ tests/integration-tests/test_swapinterval.cpp 2014-02-10 09:00:06 +0000 | |||
3915 | @@ -56,14 +56,22 @@ | |||
3916 | 56 | { | 56 | { |
3917 | 57 | } | 57 | } |
3918 | 58 | 58 | ||
3924 | 59 | void swap_client_buffers(mg::Buffer*& buffer) { buffer = &stub_buffer; } | 59 | void swap_client_buffers(mg::Buffer*, std::function<void(mg::Buffer* new_buffer)> complete) override |
3925 | 60 | std::shared_ptr<mg::Buffer> lock_compositor_buffer(unsigned long) { return std::make_shared<mtd::StubBuffer>(); } | 60 | { complete(&stub_buffer); } |
3926 | 61 | std::shared_ptr<mg::Buffer> lock_snapshot_buffer() { return std::make_shared<mtd::StubBuffer>(); } | 61 | |
3927 | 62 | MirPixelFormat get_stream_pixel_format() { return mir_pixel_format_abgr_8888; } | 62 | std::shared_ptr<mg::Buffer> lock_compositor_buffer(unsigned long) override |
3928 | 63 | geom::Size stream_size() { return geom::Size{}; } | 63 | { return std::make_shared<mtd::StubBuffer>(); } |
3929 | 64 | |||
3930 | 65 | std::shared_ptr<mg::Buffer> lock_snapshot_buffer() override | ||
3931 | 66 | { return std::make_shared<mtd::StubBuffer>(); } | ||
3932 | 67 | |||
3933 | 68 | MirPixelFormat get_stream_pixel_format() override | ||
3934 | 69 | { return mir_pixel_format_abgr_8888; } | ||
3935 | 70 | |||
3936 | 71 | geom::Size stream_size() override { return geom::Size{}; } | ||
3937 | 64 | void resize(geom::Size const&) override {} | 72 | void resize(geom::Size const&) override {} |
3940 | 65 | void force_requests_to_complete() {} | 73 | void force_requests_to_complete() override {} |
3941 | 66 | void allow_framedropping(bool) | 74 | void allow_framedropping(bool) override |
3942 | 67 | { | 75 | { |
3943 | 68 | while (write(render_operations_fd, "a", 1) != 1) continue; | 76 | while (write(render_operations_fd, "a", 1) != 1) continue; |
3944 | 69 | } | 77 | } |
3945 | 70 | 78 | ||
3946 | === modified file 'tests/mir_test_framework/stubbed_server_configuration.cpp' | |||
3947 | --- tests/mir_test_framework/stubbed_server_configuration.cpp 2014-01-29 12:51:30 +0000 | |||
3948 | +++ tests/mir_test_framework/stubbed_server_configuration.cpp 2014-02-10 09:00:06 +0000 | |||
3949 | @@ -120,7 +120,7 @@ | |||
3950 | 120 | class StubDisplayConfiguration : public mtd::NullDisplayConfiguration | 120 | class StubDisplayConfiguration : public mtd::NullDisplayConfiguration |
3951 | 121 | { | 121 | { |
3952 | 122 | public: | 122 | public: |
3954 | 123 | StubDisplayConfiguration(geom::Rectangle& rect) | 123 | StubDisplayConfiguration(geom::Rectangle const& rect) |
3955 | 124 | : modes{mg::DisplayConfigurationMode{rect.size, 1.0f}} | 124 | : modes{mg::DisplayConfigurationMode{rect.size, 1.0f}} |
3956 | 125 | { | 125 | { |
3957 | 126 | } | 126 | } |
3958 | @@ -156,9 +156,11 @@ | |||
3959 | 156 | f(display_buffer); | 156 | f(display_buffer); |
3960 | 157 | } | 157 | } |
3961 | 158 | 158 | ||
3963 | 159 | std::shared_ptr<mg::DisplayConfiguration> configuration() override | 159 | std::unique_ptr<mg::DisplayConfiguration> configuration() const override |
3964 | 160 | { | 160 | { |
3966 | 161 | return std::make_shared<StubDisplayConfiguration>(rect); | 161 | return std::unique_ptr<mg::DisplayConfiguration>( |
3967 | 162 | new StubDisplayConfiguration(rect) | ||
3968 | 163 | ); | ||
3969 | 162 | } | 164 | } |
3970 | 163 | 165 | ||
3971 | 164 | private: | 166 | private: |
3972 | 165 | 167 | ||
3973 | === modified file 'tests/unit-tests/client/test_mir_screencast.cpp' | |||
3974 | --- tests/unit-tests/client/test_mir_screencast.cpp 2014-01-24 18:11:19 +0000 | |||
3975 | +++ tests/unit-tests/client/test_mir_screencast.cpp 2014-02-10 09:00:06 +0000 | |||
3976 | @@ -67,12 +67,17 @@ | |||
3977 | 67 | void create_screencast( | 67 | void create_screencast( |
3978 | 68 | google::protobuf::RpcController* /*controller*/, | 68 | google::protobuf::RpcController* /*controller*/, |
3979 | 69 | mp::ScreencastParameters const* /*request*/, | 69 | mp::ScreencastParameters const* /*request*/, |
3981 | 70 | mp::Screencast* /*response*/, | 70 | mp::Screencast* response, |
3982 | 71 | google::protobuf::Closure* done) override | 71 | google::protobuf::Closure* done) override |
3983 | 72 | { | 72 | { |
3984 | 73 | if (server_thread.joinable()) | 73 | if (server_thread.joinable()) |
3985 | 74 | server_thread.join(); | 74 | server_thread.join(); |
3987 | 75 | server_thread = std::thread{[done, this] { done->Run(); }}; | 75 | server_thread = std::thread{ |
3988 | 76 | [response, done, this] | ||
3989 | 77 | { | ||
3990 | 78 | response->clear_error(); | ||
3991 | 79 | done->Run(); | ||
3992 | 80 | }}; | ||
3993 | 76 | } | 81 | } |
3994 | 77 | 82 | ||
3995 | 78 | void release_screencast( | 83 | void release_screencast( |
3996 | @@ -151,6 +156,7 @@ | |||
3997 | 151 | 156 | ||
3998 | 152 | ACTION_P(SetCreateScreencastId, screencast_id) | 157 | ACTION_P(SetCreateScreencastId, screencast_id) |
3999 | 153 | { | 158 | { |
4000 | 159 | arg2->clear_error(); | ||
4001 | 154 | arg2->mutable_screencast_id()->set_value(screencast_id); | 160 | arg2->mutable_screencast_id()->set_value(screencast_id); |
4002 | 155 | } | 161 | } |
4003 | 156 | 162 | ||
4004 | @@ -166,6 +172,7 @@ | |||
4005 | 166 | 172 | ||
4006 | 167 | ACTION_P(SetCreateBufferFromPackage, package) | 173 | ACTION_P(SetCreateBufferFromPackage, package) |
4007 | 168 | { | 174 | { |
4008 | 175 | arg2->clear_error(); | ||
4009 | 169 | auto buffer = arg2->mutable_buffer(); | 176 | auto buffer = arg2->mutable_buffer(); |
4010 | 170 | for (int i = 0; i != package.data_items; ++i) | 177 | for (int i = 0; i != package.data_items; ++i) |
4011 | 171 | { | 178 | { |
4012 | @@ -180,6 +187,11 @@ | |||
4013 | 180 | buffer->set_stride(package.stride); | 187 | buffer->set_stride(package.stride); |
4014 | 181 | } | 188 | } |
4015 | 182 | 189 | ||
4016 | 190 | ACTION(SetCreateError) | ||
4017 | 191 | { | ||
4018 | 192 | arg2->set_error("Test error"); | ||
4019 | 193 | } | ||
4020 | 194 | |||
4021 | 183 | ACTION(RunClosure) | 195 | ACTION(RunClosure) |
4022 | 184 | { | 196 | { |
4023 | 185 | arg3->Run(); | 197 | arg3->Run(); |
4024 | @@ -521,3 +533,41 @@ | |||
4025 | 521 | 533 | ||
4026 | 522 | EXPECT_EQ(StubEGLNativeWindowFactory::egl_native_window, egl_native_window); | 534 | EXPECT_EQ(StubEGLNativeWindowFactory::egl_native_window, egl_native_window); |
4027 | 523 | } | 535 | } |
4028 | 536 | |||
4029 | 537 | TEST_F(MirScreencastTest, is_invalid_if_server_create_screencast_fails) | ||
4030 | 538 | { | ||
4031 | 539 | using namespace testing; | ||
4032 | 540 | |||
4033 | 541 | EXPECT_CALL(mock_server, create_screencast(_,_,_,_)) | ||
4034 | 542 | .WillOnce(DoAll(SetCreateError(), RunClosure())); | ||
4035 | 543 | |||
4036 | 544 | MirScreencast screencast{ | ||
4037 | 545 | default_mir_output, mock_server, | ||
4038 | 546 | stub_egl_native_window_factory, | ||
4039 | 547 | stub_client_buffer_factory, | ||
4040 | 548 | null_callback_func, nullptr}; | ||
4041 | 549 | |||
4042 | 550 | screencast.creation_wait_handle()->wait_for_all(); | ||
4043 | 551 | |||
4044 | 552 | EXPECT_FALSE(screencast.valid()); | ||
4045 | 553 | } | ||
4046 | 554 | |||
4047 | 555 | TEST_F(MirScreencastTest, calls_callback_on_creation_failure) | ||
4048 | 556 | { | ||
4049 | 557 | using namespace testing; | ||
4050 | 558 | |||
4051 | 559 | MockCallback mock_cb; | ||
4052 | 560 | EXPECT_CALL(mock_server, create_screencast(_,_,_,_)) | ||
4053 | 561 | .WillOnce(DoAll(SetCreateError(), RunClosure())); | ||
4054 | 562 | EXPECT_CALL(mock_cb, call(_,&mock_cb)); | ||
4055 | 563 | |||
4056 | 564 | MirScreencast screencast{ | ||
4057 | 565 | default_mir_output, mock_server, | ||
4058 | 566 | stub_egl_native_window_factory, | ||
4059 | 567 | stub_client_buffer_factory, | ||
4060 | 568 | mock_callback_func, &mock_cb}; | ||
4061 | 569 | |||
4062 | 570 | screencast.creation_wait_handle()->wait_for_all(); | ||
4063 | 571 | |||
4064 | 572 | EXPECT_FALSE(screencast.valid()); | ||
4065 | 573 | } | ||
4066 | 524 | 574 | ||
4067 | === modified file 'tests/unit-tests/compositor/test_buffer_stream.cpp' | |||
4068 | --- tests/unit-tests/compositor/test_buffer_stream.cpp 2014-01-13 06:12:33 +0000 | |||
4069 | +++ tests/unit-tests/compositor/test_buffer_stream.cpp 2014-02-10 09:00:06 +0000 | |||
4070 | @@ -25,6 +25,8 @@ | |||
4071 | 25 | #include <gmock/gmock.h> | 25 | #include <gmock/gmock.h> |
4072 | 26 | #include <gtest/gtest.h> | 26 | #include <gtest/gtest.h> |
4073 | 27 | 27 | ||
4074 | 28 | #include <condition_variable> | ||
4075 | 29 | |||
4076 | 28 | namespace mc = mir::compositor; | 30 | namespace mc = mir::compositor; |
4077 | 29 | namespace mg = mir::graphics; | 31 | namespace mg = mir::graphics; |
4078 | 30 | namespace geom = mir::geometry; | 32 | namespace geom = mir::geometry; |
4079 | @@ -122,22 +124,50 @@ | |||
4080 | 122 | 124 | ||
4081 | 123 | TEST_F(BufferStreamTest, get_buffer_for_client_releases_resources) | 125 | TEST_F(BufferStreamTest, get_buffer_for_client_releases_resources) |
4082 | 124 | { | 126 | { |
4085 | 125 | using namespace testing; | 127 | std::mutex mutex; |
4086 | 126 | mc::BufferStreamSurfaces buffer_stream(mock_bundle); | 128 | std::condition_variable cv; |
4087 | 127 | mg::Buffer* buffer{nullptr}; | 129 | mg::Buffer* buffer{nullptr}; |
4088 | 130 | bool done = false; | ||
4089 | 131 | |||
4090 | 132 | auto const callback = | ||
4091 | 133 | [&](mg::Buffer* new_buffer) | ||
4092 | 134 | { | ||
4093 | 135 | std::unique_lock<decltype(mutex)> lock(mutex); | ||
4094 | 136 | buffer = new_buffer; | ||
4095 | 137 | done = true; | ||
4096 | 138 | cv.notify_one(); | ||
4097 | 139 | }; | ||
4098 | 140 | |||
4099 | 141 | using namespace testing; | ||
4100 | 142 | mc::BufferStreamSurfaces buffer_stream(mock_bundle); | ||
4101 | 128 | 143 | ||
4102 | 129 | InSequence seq; | 144 | InSequence seq; |
4104 | 130 | EXPECT_CALL(*mock_bundle, client_acquire()) | 145 | EXPECT_CALL(*mock_bundle, client_acquire(_)) |
4105 | 131 | .Times(1) | 146 | .Times(1) |
4107 | 132 | .WillOnce(Return(mock_buffer.get())); | 147 | .WillOnce(InvokeArgument<0>(mock_buffer.get())); |
4108 | 133 | EXPECT_CALL(*mock_bundle, client_release(_)) | 148 | EXPECT_CALL(*mock_bundle, client_release(_)) |
4109 | 134 | .Times(1); | 149 | .Times(1); |
4111 | 135 | EXPECT_CALL(*mock_bundle, client_acquire()) | 150 | EXPECT_CALL(*mock_bundle, client_acquire(_)) |
4112 | 136 | .Times(1) | 151 | .Times(1) |
4117 | 137 | .WillOnce(Return(mock_buffer.get())); | 152 | .WillOnce(InvokeArgument<0>(mock_buffer.get())); |
4118 | 138 | 153 | ||
4119 | 139 | buffer_stream.swap_client_buffers(buffer); | 154 | buffer_stream.swap_client_buffers(buffer, callback); |
4120 | 140 | buffer_stream.swap_client_buffers(buffer); | 155 | |
4121 | 156 | { | ||
4122 | 157 | std::unique_lock<decltype(mutex)> lock(mutex); | ||
4123 | 158 | |||
4124 | 159 | cv.wait(lock, [&]{ return done; }); | ||
4125 | 160 | } | ||
4126 | 161 | |||
4127 | 162 | done = false; | ||
4128 | 163 | |||
4129 | 164 | buffer_stream.swap_client_buffers(buffer, callback); | ||
4130 | 165 | |||
4131 | 166 | { | ||
4132 | 167 | std::unique_lock<decltype(mutex)> lock(mutex); | ||
4133 | 168 | |||
4134 | 169 | cv.wait(lock, [&]{ return done; }); | ||
4135 | 170 | } | ||
4136 | 141 | } | 171 | } |
4137 | 142 | 172 | ||
4138 | 143 | TEST_F(BufferStreamTest, allow_framedropping_device) | 173 | TEST_F(BufferStreamTest, allow_framedropping_device) |
4139 | 144 | 174 | ||
4140 | === modified file 'tests/unit-tests/compositor/test_switching_bundle.cpp' | |||
4141 | --- tests/unit-tests/compositor/test_switching_bundle.cpp 2014-01-22 14:15:29 +0000 | |||
4142 | +++ tests/unit-tests/compositor/test_switching_bundle.cpp 2014-02-10 09:00:06 +0000 | |||
4143 | @@ -34,6 +34,8 @@ | |||
4144 | 34 | 34 | ||
4145 | 35 | using namespace testing; | 35 | using namespace testing; |
4146 | 36 | 36 | ||
4147 | 37 | namespace | ||
4148 | 38 | { | ||
4149 | 37 | struct SwitchingBundleTest : public ::testing::Test | 39 | struct SwitchingBundleTest : public ::testing::Test |
4150 | 38 | { | 40 | { |
4151 | 39 | void SetUp() | 41 | void SetUp() |
4152 | @@ -52,6 +54,32 @@ | |||
4153 | 52 | mg::BufferProperties basic_properties; | 54 | mg::BufferProperties basic_properties; |
4154 | 53 | }; | 55 | }; |
4155 | 54 | 56 | ||
4156 | 57 | auto client_acquire_blocking(mc::SwitchingBundle& switching_bundle) | ||
4157 | 58 | -> mg::Buffer* | ||
4158 | 59 | { | ||
4159 | 60 | std::mutex mutex; | ||
4160 | 61 | std::condition_variable cv; | ||
4161 | 62 | bool done = false; | ||
4162 | 63 | |||
4163 | 64 | mg::Buffer* result; | ||
4164 | 65 | switching_bundle.client_acquire( | ||
4165 | 66 | [&](mg::Buffer* new_buffer) | ||
4166 | 67 | { | ||
4167 | 68 | std::unique_lock<decltype(mutex)> lock(mutex); | ||
4168 | 69 | |||
4169 | 70 | result = new_buffer; | ||
4170 | 71 | done = true; | ||
4171 | 72 | cv.notify_one(); | ||
4172 | 73 | }); | ||
4173 | 74 | |||
4174 | 75 | std::unique_lock<decltype(mutex)> lock(mutex); | ||
4175 | 76 | |||
4176 | 77 | cv.wait(lock, [&]{ return done; }); | ||
4177 | 78 | |||
4178 | 79 | return result; | ||
4179 | 80 | } | ||
4180 | 81 | } | ||
4181 | 82 | |||
4182 | 55 | TEST_F(SwitchingBundleTest, sync_swapper_by_default) | 83 | TEST_F(SwitchingBundleTest, sync_swapper_by_default) |
4183 | 56 | { | 84 | { |
4184 | 57 | mg::BufferProperties properties{geom::Size{7, 8}, | 85 | mg::BufferProperties properties{geom::Size{7, 8}, |
4185 | @@ -100,7 +128,7 @@ | |||
4186 | 100 | { | 128 | { |
4187 | 101 | mc::SwitchingBundle bundle(nbuffers, allocator, basic_properties); | 129 | mc::SwitchingBundle bundle(nbuffers, allocator, basic_properties); |
4188 | 102 | 130 | ||
4190 | 103 | auto buffer = bundle.client_acquire(); | 131 | auto buffer = client_acquire_blocking(bundle); |
4191 | 104 | bundle.client_release(buffer); | 132 | bundle.client_release(buffer); |
4192 | 105 | } | 133 | } |
4193 | 106 | } | 134 | } |
4194 | @@ -132,7 +160,7 @@ | |||
4195 | 132 | 160 | ||
4196 | 133 | for (int i = 0; i < 20; i++) | 161 | for (int i = 0; i < 20; i++) |
4197 | 134 | { | 162 | { |
4199 | 135 | auto client1 = bundle.client_acquire(); | 163 | auto client1 = client_acquire_blocking(bundle); |
4200 | 136 | mg::BufferID expect_id = client1->id(), composited_id; | 164 | mg::BufferID expect_id = client1->id(), composited_id; |
4201 | 137 | bundle.client_release(client1); | 165 | bundle.client_release(client1); |
4202 | 138 | 166 | ||
4203 | @@ -173,7 +201,7 @@ | |||
4204 | 173 | { | 201 | { |
4205 | 174 | for (int j = 0; j < 100; j++) | 202 | for (int j = 0; j < 100; j++) |
4206 | 175 | { | 203 | { |
4208 | 176 | auto client = bundle.client_acquire(); | 204 | auto client = client_acquire_blocking(bundle); |
4209 | 177 | last_client_id = client->id(); | 205 | last_client_id = client->id(); |
4210 | 178 | bundle.client_release(client); | 206 | bundle.client_release(client); |
4211 | 179 | } | 207 | } |
4212 | @@ -197,11 +225,11 @@ | |||
4213 | 197 | { // Regression test for LP: #1210042 | 225 | { // Regression test for LP: #1210042 |
4214 | 198 | mc::SwitchingBundle bundle(3, allocator, basic_properties); | 226 | mc::SwitchingBundle bundle(3, allocator, basic_properties); |
4215 | 199 | 227 | ||
4217 | 200 | auto client1 = bundle.client_acquire(); | 228 | auto client1 = client_acquire_blocking(bundle); |
4218 | 201 | auto client1_id = client1->id(); | 229 | auto client1_id = client1->id(); |
4219 | 202 | bundle.client_release(client1); | 230 | bundle.client_release(client1); |
4220 | 203 | 231 | ||
4222 | 204 | auto client2 = bundle.client_acquire(); | 232 | auto client2 = client_acquire_blocking(bundle); |
4223 | 205 | bundle.client_release(client2); | 233 | bundle.client_release(client2); |
4224 | 206 | 234 | ||
4225 | 207 | auto compositor = bundle.compositor_acquire(1); | 235 | auto compositor = bundle.compositor_acquire(1); |
4226 | @@ -217,8 +245,8 @@ | |||
4227 | 217 | { | 245 | { |
4228 | 218 | mc::SwitchingBundle bundle(nbuffers, allocator, basic_properties); | 246 | mc::SwitchingBundle bundle(nbuffers, allocator, basic_properties); |
4229 | 219 | 247 | ||
4232 | 220 | auto client1 = bundle.client_acquire(); | 248 | auto client1 = client_acquire_blocking(bundle); |
4233 | 221 | auto client2 = bundle.client_acquire(); | 249 | auto client2 = client_acquire_blocking(bundle); |
4234 | 222 | EXPECT_THROW( | 250 | EXPECT_THROW( |
4235 | 223 | bundle.client_release(client2), | 251 | bundle.client_release(client2), |
4236 | 224 | std::logic_error | 252 | std::logic_error |
4237 | @@ -241,7 +269,7 @@ | |||
4238 | 241 | mc::SwitchingBundle bundle(nbuffers, allocator, basic_properties); | 269 | mc::SwitchingBundle bundle(nbuffers, allocator, basic_properties); |
4239 | 242 | unsigned long frameno = 0; | 270 | unsigned long frameno = 0; |
4240 | 243 | 271 | ||
4242 | 244 | auto client = bundle.client_acquire(); | 272 | auto client = client_acquire_blocking(bundle); |
4243 | 245 | auto client_id = client->id(); | 273 | auto client_id = client->id(); |
4244 | 246 | bundle.client_release(client); | 274 | bundle.client_release(client); |
4245 | 247 | 275 | ||
4246 | @@ -291,7 +319,7 @@ | |||
4247 | 291 | { | 319 | { |
4248 | 292 | if (i % 10 == 0) | 320 | if (i % 10 == 0) |
4249 | 293 | { | 321 | { |
4251 | 294 | auto client = bundle.client_acquire(); | 322 | auto client = client_acquire_blocking(bundle); |
4252 | 295 | client_id = client->id(); | 323 | client_id = client->id(); |
4253 | 296 | bundle.client_release(client); | 324 | bundle.client_release(client); |
4254 | 297 | } | 325 | } |
4255 | @@ -317,7 +345,7 @@ | |||
4256 | 317 | mc::SwitchingBundle bundle(nbuffers, allocator, basic_properties); | 345 | mc::SwitchingBundle bundle(nbuffers, allocator, basic_properties); |
4257 | 318 | unsigned long frameno = 0; | 346 | unsigned long frameno = 0; |
4258 | 319 | 347 | ||
4260 | 320 | auto client = bundle.client_acquire(); | 348 | auto client = client_acquire_blocking(bundle); |
4261 | 321 | bundle.client_release(client); | 349 | bundle.client_release(client); |
4262 | 322 | 350 | ||
4263 | 323 | auto compositor1 = bundle.compositor_acquire(++frameno); | 351 | auto compositor1 = bundle.compositor_acquire(++frameno); |
4264 | @@ -342,11 +370,11 @@ | |||
4265 | 342 | mg::Buffer* client_buffer = nullptr; | 370 | mg::Buffer* client_buffer = nullptr; |
4266 | 343 | std::shared_ptr<mg::Buffer> compositor_buffer = nullptr; | 371 | std::shared_ptr<mg::Buffer> compositor_buffer = nullptr; |
4267 | 344 | 372 | ||
4269 | 345 | client_buffer = bundle.client_acquire(); | 373 | client_buffer = client_acquire_blocking(bundle); |
4270 | 346 | mg::BufferID first_ready_buffer_id = client_buffer->id(); | 374 | mg::BufferID first_ready_buffer_id = client_buffer->id(); |
4271 | 347 | bundle.client_release(client_buffer); | 375 | bundle.client_release(client_buffer); |
4272 | 348 | 376 | ||
4274 | 349 | client_buffer = bundle.client_acquire(); | 377 | client_buffer = client_acquire_blocking(bundle); |
4275 | 350 | 378 | ||
4276 | 351 | // in the original bug, compositor would be given the wrong buffer here | 379 | // in the original bug, compositor would be given the wrong buffer here |
4277 | 352 | compositor_buffer = bundle.compositor_acquire(0 /*frameno*/); | 380 | compositor_buffer = bundle.compositor_acquire(0 /*frameno*/); |
4278 | @@ -371,11 +399,11 @@ | |||
4279 | 371 | 399 | ||
4280 | 372 | std::shared_ptr<mg::Buffer> compositor[2]; | 400 | std::shared_ptr<mg::Buffer> compositor[2]; |
4281 | 373 | 401 | ||
4283 | 374 | bundle.client_release(bundle.client_acquire()); | 402 | bundle.client_release(client_acquire_blocking(bundle)); |
4284 | 375 | compositor[0] = bundle.compositor_acquire(frameno); | 403 | compositor[0] = bundle.compositor_acquire(frameno); |
4285 | 376 | 404 | ||
4286 | 377 | frameno++; | 405 | frameno++; |
4288 | 378 | bundle.client_release(bundle.client_acquire()); | 406 | bundle.client_release(client_acquire_blocking(bundle)); |
4289 | 379 | compositor[1] = bundle.compositor_acquire(frameno); | 407 | compositor[1] = bundle.compositor_acquire(frameno); |
4290 | 380 | 408 | ||
4291 | 381 | for (int i = 0; i < 20; i++) | 409 | for (int i = 0; i < 20; i++) |
4292 | @@ -386,7 +414,7 @@ | |||
4293 | 386 | // One of the compositors (the oldest one) gets a new buffer... | 414 | // One of the compositors (the oldest one) gets a new buffer... |
4294 | 387 | int oldest = i & 1; | 415 | int oldest = i & 1; |
4295 | 388 | bundle.compositor_release(compositor[oldest]); | 416 | bundle.compositor_release(compositor[oldest]); |
4297 | 389 | bundle.client_release(bundle.client_acquire()); | 417 | bundle.client_release(client_acquire_blocking(bundle)); |
4298 | 390 | frameno++; | 418 | frameno++; |
4299 | 391 | compositor[oldest] = bundle.compositor_acquire(frameno); | 419 | compositor[oldest] = bundle.compositor_acquire(frameno); |
4300 | 392 | } | 420 | } |
4301 | @@ -445,7 +473,7 @@ | |||
4302 | 445 | std::logic_error | 473 | std::logic_error |
4303 | 446 | ); | 474 | ); |
4304 | 447 | 475 | ||
4306 | 448 | auto client = bundle.client_acquire(); | 476 | auto client = client_acquire_blocking(bundle); |
4307 | 449 | auto snapshot = bundle.snapshot_acquire(); | 477 | auto snapshot = bundle.snapshot_acquire(); |
4308 | 450 | 478 | ||
4309 | 451 | EXPECT_EQ(compositor->id(), snapshot->id()); | 479 | EXPECT_EQ(compositor->id(), snapshot->id()); |
4310 | @@ -488,7 +516,7 @@ | |||
4311 | 488 | { | 516 | { |
4312 | 489 | for (int i = 0; i < nframes; i++) | 517 | for (int i = 0; i < nframes; i++) |
4313 | 490 | { | 518 | { |
4315 | 491 | bundle.client_release(bundle.client_acquire()); | 519 | bundle.client_release(client_acquire_blocking(bundle)); |
4316 | 492 | std::this_thread::yield(); | 520 | std::this_thread::yield(); |
4317 | 493 | } | 521 | } |
4318 | 494 | } | 522 | } |
4319 | @@ -499,12 +527,12 @@ | |||
4320 | 499 | { | 527 | { |
4321 | 500 | bundle.allow_framedropping(false); | 528 | bundle.allow_framedropping(false); |
4322 | 501 | for (int j = 0; j < 5; j++) | 529 | for (int j = 0; j < 5; j++) |
4324 | 502 | bundle.client_release(bundle.client_acquire()); | 530 | bundle.client_release(client_acquire_blocking(bundle)); |
4325 | 503 | std::this_thread::yield(); | 531 | std::this_thread::yield(); |
4326 | 504 | 532 | ||
4327 | 505 | bundle.allow_framedropping(true); | 533 | bundle.allow_framedropping(true); |
4328 | 506 | for (int j = 0; j < 5; j++) | 534 | for (int j = 0; j < 5; j++) |
4330 | 507 | bundle.client_release(bundle.client_acquire()); | 535 | bundle.client_release(client_acquire_blocking(bundle)); |
4331 | 508 | std::this_thread::yield(); | 536 | std::this_thread::yield(); |
4332 | 509 | } | 537 | } |
4333 | 510 | } | 538 | } |
4334 | @@ -602,11 +630,11 @@ | |||
4335 | 602 | 630 | ||
4336 | 603 | std::shared_ptr<mg::Buffer> compositor[2]; | 631 | std::shared_ptr<mg::Buffer> compositor[2]; |
4337 | 604 | 632 | ||
4339 | 605 | bundle.client_release(bundle.client_acquire()); | 633 | bundle.client_release(client_acquire_blocking(bundle)); |
4340 | 606 | compositor[0] = bundle.compositor_acquire(frameno); | 634 | compositor[0] = bundle.compositor_acquire(frameno); |
4341 | 607 | 635 | ||
4342 | 608 | frameno++; | 636 | frameno++; |
4344 | 609 | bundle.client_release(bundle.client_acquire()); | 637 | bundle.client_release(client_acquire_blocking(bundle)); |
4345 | 610 | compositor[1] = bundle.compositor_acquire(frameno); | 638 | compositor[1] = bundle.compositor_acquire(frameno); |
4346 | 611 | 639 | ||
4347 | 612 | for (int i = 0; i < 20; i++) | 640 | for (int i = 0; i < 20; i++) |
4348 | @@ -614,7 +642,7 @@ | |||
4349 | 614 | // Two compositors acquired, and they're always different... | 642 | // Two compositors acquired, and they're always different... |
4350 | 615 | ASSERT_NE(compositor[0]->id(), compositor[1]->id()); | 643 | ASSERT_NE(compositor[0]->id(), compositor[1]->id()); |
4351 | 616 | 644 | ||
4353 | 617 | auto client = bundle.client_acquire(); | 645 | auto client = client_acquire_blocking(bundle); |
4354 | 618 | ASSERT_NE(compositor[0]->id(), client->id()); | 646 | ASSERT_NE(compositor[0]->id(), client->id()); |
4355 | 619 | ASSERT_NE(compositor[1]->id(), client->id()); | 647 | ASSERT_NE(compositor[1]->id(), client->id()); |
4356 | 620 | bundle.client_release(client); | 648 | bundle.client_release(client); |
4357 | @@ -648,7 +676,7 @@ | |||
4358 | 648 | 676 | ||
4359 | 649 | for (int b = 0; b < nbuffers; b++) | 677 | for (int b = 0; b < nbuffers; b++) |
4360 | 650 | { | 678 | { |
4362 | 651 | buf[b] = bundle.client_acquire(); | 679 | buf[b] = client_acquire_blocking(bundle); |
4363 | 652 | expect[b] = buf[b]->id(); | 680 | expect[b] = buf[b]->id(); |
4364 | 653 | 681 | ||
4365 | 654 | for (int p = 0; p < b; p++) | 682 | for (int p = 0; p < b; p++) |
4366 | @@ -660,7 +688,7 @@ | |||
4367 | 660 | 688 | ||
4368 | 661 | for (int frame = 0; frame < nframes; frame++) | 689 | for (int frame = 0; frame < nframes; frame++) |
4369 | 662 | { | 690 | { |
4371 | 663 | auto client = bundle.client_acquire(); | 691 | auto client = client_acquire_blocking(bundle); |
4372 | 664 | ASSERT_EQ(expect[frame % nbuffers], client->id()); | 692 | ASSERT_EQ(expect[frame % nbuffers], client->id()); |
4373 | 665 | bundle.client_release(client); | 693 | bundle.client_release(client); |
4374 | 666 | } | 694 | } |
4375 | @@ -739,11 +767,11 @@ | |||
4376 | 739 | } | 767 | } |
4377 | 740 | }); | 768 | }); |
4378 | 741 | 769 | ||
4380 | 742 | bundle.client_release(bundle.client_acquire()); | 770 | bundle.client_release(client_acquire_blocking(bundle)); |
4381 | 743 | 771 | ||
4382 | 744 | while (!done.load()) | 772 | while (!done.load()) |
4383 | 745 | { | 773 | { |
4385 | 746 | bundle.client_release(bundle.client_acquire()); | 774 | bundle.client_release(client_acquire_blocking(bundle)); |
4386 | 747 | client_frames++; | 775 | client_frames++; |
4387 | 748 | } | 776 | } |
4388 | 749 | 777 | ||
4389 | @@ -789,13 +817,13 @@ | |||
4390 | 789 | } | 817 | } |
4391 | 790 | }); | 818 | }); |
4392 | 791 | 819 | ||
4394 | 792 | bundle.client_release(bundle.client_acquire()); | 820 | bundle.client_release(client_acquire_blocking(bundle)); |
4395 | 793 | 821 | ||
4396 | 794 | while (!done.load()) | 822 | while (!done.load()) |
4397 | 795 | { | 823 | { |
4398 | 796 | sync.lock(); | 824 | sync.lock(); |
4399 | 797 | sync.unlock(); | 825 | sync.unlock(); |
4401 | 798 | auto buf = bundle.client_acquire(); | 826 | auto buf = client_acquire_blocking(bundle); |
4402 | 799 | std::this_thread::sleep_for(frame_time); | 827 | std::this_thread::sleep_for(frame_time); |
4403 | 800 | bundle.client_release(buf); | 828 | bundle.client_release(buf); |
4404 | 801 | client_frames++; | 829 | client_frames++; |
4405 | @@ -825,7 +853,7 @@ | |||
4406 | 825 | for (int subframe = 0; subframe < 3; ++subframe) | 853 | for (int subframe = 0; subframe < 3; ++subframe) |
4407 | 826 | { | 854 | { |
4408 | 827 | bundle.resize(expect_size); | 855 | bundle.resize(expect_size); |
4410 | 828 | auto client = bundle.client_acquire(); | 856 | auto client = client_acquire_blocking(bundle); |
4411 | 829 | ASSERT_EQ(expect_size, client->size()); | 857 | ASSERT_EQ(expect_size, client->size()); |
4412 | 830 | bundle.client_release(client); | 858 | bundle.client_release(client); |
4413 | 831 | 859 | ||
4414 | @@ -861,7 +889,7 @@ | |||
4415 | 861 | height += dy; | 889 | height += dy; |
4416 | 862 | 890 | ||
4417 | 863 | bundle.resize(new_size); | 891 | bundle.resize(new_size); |
4419 | 864 | auto client = bundle.client_acquire(); | 892 | auto client = client_acquire_blocking(bundle); |
4420 | 865 | history[produce] = client->id(); | 893 | history[produce] = client->id(); |
4421 | 866 | ASSERT_EQ(new_size, client->size()); | 894 | ASSERT_EQ(new_size, client->size()); |
4422 | 867 | bundle.client_release(client); | 895 | bundle.client_release(client); |
4423 | 868 | 896 | ||
4424 | === modified file 'tests/unit-tests/compositor/test_temporary_buffers.cpp' | |||
4425 | --- tests/unit-tests/compositor/test_temporary_buffers.cpp 2014-01-13 06:12:33 +0000 | |||
4426 | +++ tests/unit-tests/compositor/test_temporary_buffers.cpp 2014-02-10 09:00:06 +0000 | |||
4427 | @@ -52,8 +52,8 @@ | |||
4428 | 52 | { | 52 | { |
4429 | 53 | using namespace testing; | 53 | using namespace testing; |
4430 | 54 | 54 | ||
4433 | 55 | ON_CALL(*mock_bundle, client_acquire()) | 55 | ON_CALL(*mock_bundle, client_acquire(_)) |
4434 | 56 | .WillByDefault(Return(mock_buffer.get())); | 56 | .WillByDefault(InvokeArgument<0>(mock_buffer.get())); |
4435 | 57 | ON_CALL(*mock_bundle, compositor_acquire(_)) | 57 | ON_CALL(*mock_bundle, compositor_acquire(_)) |
4436 | 58 | .WillByDefault(Return(mock_buffer)); | 58 | .WillByDefault(Return(mock_buffer)); |
4437 | 59 | } | 59 | } |
4438 | 60 | 60 | ||
4439 | === modified file 'tests/unit-tests/frontend/test_session_mediator.cpp' | |||
4440 | --- tests/unit-tests/frontend/test_session_mediator.cpp 2014-01-13 06:55:38 +0000 | |||
4441 | +++ tests/unit-tests/frontend/test_session_mediator.cpp 2014-02-10 09:00:06 +0000 | |||
4442 | @@ -1,5 +1,5 @@ | |||
4443 | 1 | /* | 1 | /* |
4445 | 2 | * Copyright © 2012 Canonical Ltd. | 2 | * Copyright © 2012-2014 Canonical Ltd. |
4446 | 3 | * | 3 | * |
4447 | 4 | * This program is free software: you can redistribute it and/or modify | 4 | * This program is free software: you can redistribute it and/or modify |
4448 | 5 | * it under the terms of the GNU General Public License version 3 as | 5 | * it under the terms of the GNU General Public License version 3 as |
4449 | @@ -39,6 +39,7 @@ | |||
4450 | 39 | #include "mir_test_doubles/stub_surface_builder.h" | 39 | #include "mir_test_doubles/stub_surface_builder.h" |
4451 | 40 | #include "mir_test_doubles/stub_display_configuration.h" | 40 | #include "mir_test_doubles/stub_display_configuration.h" |
4452 | 41 | #include "mir_test_doubles/stub_buffer_allocator.h" | 41 | #include "mir_test_doubles/stub_buffer_allocator.h" |
4453 | 42 | #include "mir_test_doubles/null_screencast.h" | ||
4454 | 42 | #include "mir_test/display_config_matchers.h" | 43 | #include "mir_test/display_config_matchers.h" |
4455 | 43 | #include "mir_test/fake_shared.h" | 44 | #include "mir_test/fake_shared.h" |
4456 | 44 | #include "mir/frontend/event_sink.h" | 45 | #include "mir/frontend/event_sink.h" |
4457 | @@ -103,7 +104,8 @@ | |||
4458 | 103 | 104 | ||
4459 | 104 | EXPECT_CALL(*mock_surface, size()).Times(AnyNumber()).WillRepeatedly(Return(geom::Size())); | 105 | EXPECT_CALL(*mock_surface, size()).Times(AnyNumber()).WillRepeatedly(Return(geom::Size())); |
4460 | 105 | EXPECT_CALL(*mock_surface, pixel_format()).Times(AnyNumber()).WillRepeatedly(Return(MirPixelFormat())); | 106 | EXPECT_CALL(*mock_surface, pixel_format()).Times(AnyNumber()).WillRepeatedly(Return(MirPixelFormat())); |
4462 | 106 | EXPECT_CALL(*mock_surface, swap_buffers(_)).Times(AnyNumber()).WillRepeatedly(SetArg<0>(mock_buffer.get())); | 107 | EXPECT_CALL(*mock_surface, swap_buffers(_, _)).Times(AnyNumber()) |
4463 | 108 | .WillRepeatedly(InvokeArgument<1>(mock_buffer.get())); | ||
4464 | 107 | 109 | ||
4465 | 108 | EXPECT_CALL(*mock_surface, supports_input()).Times(AnyNumber()).WillRepeatedly(Return(true)); | 110 | EXPECT_CALL(*mock_surface, supports_input()).Times(AnyNumber()).WillRepeatedly(Return(true)); |
4466 | 109 | EXPECT_CALL(*mock_surface, client_input_fd()).Times(AnyNumber()).WillRepeatedly(Return(testing_client_input_fd)); | 111 | EXPECT_CALL(*mock_surface, client_input_fd()).Times(AnyNumber()).WillRepeatedly(Return(testing_client_input_fd)); |
4467 | @@ -123,7 +125,8 @@ | |||
4468 | 123 | 125 | ||
4469 | 124 | EXPECT_CALL(*mock_surfaces[id], size()).Times(AnyNumber()).WillRepeatedly(Return(geom::Size())); | 126 | EXPECT_CALL(*mock_surfaces[id], size()).Times(AnyNumber()).WillRepeatedly(Return(geom::Size())); |
4470 | 125 | EXPECT_CALL(*mock_surfaces[id], pixel_format()).Times(AnyNumber()).WillRepeatedly(Return(MirPixelFormat())); | 127 | EXPECT_CALL(*mock_surfaces[id], pixel_format()).Times(AnyNumber()).WillRepeatedly(Return(MirPixelFormat())); |
4472 | 126 | EXPECT_CALL(*mock_surfaces[id], swap_buffers(_)).Times(AnyNumber()).WillRepeatedly(SetArg<0>(mock_buffer.get())); | 128 | EXPECT_CALL(*mock_surfaces[id], swap_buffers(_, _)).Times(AnyNumber()) |
4473 | 129 | .WillRepeatedly(InvokeArgument<1>(mock_buffer.get())); | ||
4474 | 127 | 130 | ||
4475 | 128 | EXPECT_CALL(*mock_surfaces[id], supports_input()).Times(AnyNumber()).WillRepeatedly(Return(true)); | 131 | EXPECT_CALL(*mock_surfaces[id], supports_input()).Times(AnyNumber()).WillRepeatedly(Return(true)); |
4476 | 129 | EXPECT_CALL(*mock_surfaces[id], client_input_fd()).Times(AnyNumber()).WillRepeatedly(Return(testing_client_input_fd)); | 132 | EXPECT_CALL(*mock_surfaces[id], client_input_fd()).Times(AnyNumber()).WillRepeatedly(Return(testing_client_input_fd)); |
4477 | @@ -183,6 +186,16 @@ | |||
4478 | 183 | MOCK_CONST_METHOD0(egl_native_display, EGLNativeDisplayType()); | 186 | MOCK_CONST_METHOD0(egl_native_display, EGLNativeDisplayType()); |
4479 | 184 | }; | 187 | }; |
4480 | 185 | 188 | ||
4481 | 189 | struct StubScreencast : mtd::NullScreencast | ||
4482 | 190 | { | ||
4483 | 191 | std::shared_ptr<mg::Buffer> capture(mf::ScreencastSessionId) | ||
4484 | 192 | { | ||
4485 | 193 | return mt::fake_shared(stub_buffer); | ||
4486 | 194 | } | ||
4487 | 195 | |||
4488 | 196 | mtd::StubBuffer stub_buffer; | ||
4489 | 197 | }; | ||
4490 | 198 | |||
4491 | 186 | struct SessionMediatorTest : public ::testing::Test | 199 | struct SessionMediatorTest : public ::testing::Test |
4492 | 187 | { | 200 | { |
4493 | 188 | SessionMediatorTest() | 201 | SessionMediatorTest() |
4494 | @@ -192,16 +205,17 @@ | |||
4495 | 192 | surface_pixel_formats{mir_pixel_format_argb_8888, mir_pixel_format_xrgb_8888}, | 205 | surface_pixel_formats{mir_pixel_format_argb_8888, mir_pixel_format_xrgb_8888}, |
4496 | 193 | report{std::make_shared<mf::NullSessionMediatorReport>()}, | 206 | report{std::make_shared<mf::NullSessionMediatorReport>()}, |
4497 | 194 | resource_cache{std::make_shared<mf::ResourceCache>()}, | 207 | resource_cache{std::make_shared<mf::ResourceCache>()}, |
4499 | 195 | mediator{shell, graphics_platform, graphics_changer, | 208 | stub_screencast{std::make_shared<StubScreencast>()}, |
4500 | 209 | mediator{__LINE__, shell, graphics_platform, graphics_changer, | ||
4501 | 196 | surface_pixel_formats, report, | 210 | surface_pixel_formats, report, |
4502 | 197 | std::make_shared<mtd::NullEventSink>(), | 211 | std::make_shared<mtd::NullEventSink>(), |
4504 | 198 | resource_cache}, | 212 | resource_cache, stub_screencast}, |
4505 | 199 | stubbed_session{std::make_shared<StubbedSession>()}, | 213 | stubbed_session{std::make_shared<StubbedSession>()}, |
4506 | 200 | null_callback{google::protobuf::NewPermanentCallback(google::protobuf::DoNothing)} | 214 | null_callback{google::protobuf::NewPermanentCallback(google::protobuf::DoNothing)} |
4507 | 201 | { | 215 | { |
4508 | 202 | using namespace ::testing; | 216 | using namespace ::testing; |
4509 | 203 | 217 | ||
4511 | 204 | ON_CALL(*shell, open_session(_, _)).WillByDefault(Return(stubbed_session)); | 218 | ON_CALL(*shell, open_session(_, _, _)).WillByDefault(Return(stubbed_session)); |
4512 | 205 | ON_CALL(*shell, create_surface_for(_, _)) | 219 | ON_CALL(*shell, create_surface_for(_, _)) |
4513 | 206 | .WillByDefault(WithArg<1>(Invoke(stubbed_session.get(), &StubbedSession::create_surface))); | 220 | .WillByDefault(WithArg<1>(Invoke(stubbed_session.get(), &StubbedSession::create_surface))); |
4514 | 207 | } | 221 | } |
4515 | @@ -212,6 +226,7 @@ | |||
4516 | 212 | std::vector<MirPixelFormat> const surface_pixel_formats; | 226 | std::vector<MirPixelFormat> const surface_pixel_formats; |
4517 | 213 | std::shared_ptr<mf::SessionMediatorReport> const report; | 227 | std::shared_ptr<mf::SessionMediatorReport> const report; |
4518 | 214 | std::shared_ptr<mf::ResourceCache> const resource_cache; | 228 | std::shared_ptr<mf::ResourceCache> const resource_cache; |
4519 | 229 | std::shared_ptr<StubScreencast> const stub_screencast; | ||
4520 | 215 | mf::SessionMediator mediator; | 230 | mf::SessionMediator mediator; |
4521 | 216 | std::shared_ptr<StubbedSession> const stubbed_session; | 231 | std::shared_ptr<StubbedSession> const stubbed_session; |
4522 | 217 | 232 | ||
4523 | @@ -355,10 +370,10 @@ | |||
4524 | 355 | .Times(1) | 370 | .Times(1) |
4525 | 356 | .WillOnce(Return(mt::fake_shared(config))); | 371 | .WillOnce(Return(mt::fake_shared(config))); |
4526 | 357 | mf::SessionMediator mediator( | 372 | mf::SessionMediator mediator( |
4528 | 358 | shell, graphics_platform, mock_display, | 373 | __LINE__, shell, graphics_platform, mock_display, |
4529 | 359 | surface_pixel_formats, report, | 374 | surface_pixel_formats, report, |
4530 | 360 | std::make_shared<mtd::NullEventSink>(), | 375 | std::make_shared<mtd::NullEventSink>(), |
4532 | 361 | resource_cache); | 376 | resource_cache, std::make_shared<mtd::NullScreencast>()); |
4533 | 362 | 377 | ||
4534 | 363 | mp::ConnectParameters connect_parameters; | 378 | mp::ConnectParameters connect_parameters; |
4535 | 364 | mp::Connection connection; | 379 | mp::Connection connection; |
4536 | @@ -461,6 +476,8 @@ | |||
4537 | 461 | mediator.connect(nullptr, &connect_parameters, &connection, null_callback.get()); | 476 | mediator.connect(nullptr, &connect_parameters, &connection, null_callback.get()); |
4538 | 462 | 477 | ||
4539 | 463 | { | 478 | { |
4540 | 479 | // AFAICS these values are stubs to set up the test condition, | ||
4541 | 480 | // the exact calls here are not a *requirement* on SessionMediator | ||
4542 | 464 | EXPECT_CALL(*stubbed_session->mock_buffer, id()) | 481 | EXPECT_CALL(*stubbed_session->mock_buffer, id()) |
4543 | 465 | .WillOnce(Return(mg::BufferID{4})) | 482 | .WillOnce(Return(mg::BufferID{4})) |
4544 | 466 | .WillOnce(Return(mg::BufferID{4})) | 483 | .WillOnce(Return(mg::BufferID{4})) |
4545 | @@ -519,8 +536,8 @@ | |||
4546 | 519 | * the pre-created stubbed_session->mock_surface. Further create_surface() | 536 | * the pre-created stubbed_session->mock_surface. Further create_surface() |
4547 | 520 | * invocations create new surfaces in stubbed_session->mock_surfaces[]. | 537 | * invocations create new surfaces in stubbed_session->mock_surfaces[]. |
4548 | 521 | */ | 538 | */ |
4551 | 522 | EXPECT_CALL(*stubbed_session->mock_surface, swap_buffers(_)) | 539 | EXPECT_CALL(*stubbed_session->mock_surface, swap_buffers(_, _)) |
4552 | 523 | .WillOnce(SetArg<0>(&buffer)); | 540 | .WillOnce(InvokeArgument<1>(&buffer)); |
4553 | 524 | 541 | ||
4554 | 525 | mediator.create_surface(nullptr, &surface_request, &surface_response, null_callback.get()); | 542 | mediator.create_surface(nullptr, &surface_request, &surface_response, null_callback.get()); |
4555 | 526 | mp::SurfaceId our_surface{surface_response.id()}; | 543 | mp::SurfaceId our_surface{surface_response.id()}; |
4556 | @@ -528,7 +545,7 @@ | |||
4557 | 528 | Mock::VerifyAndClearExpectations(stubbed_session->mock_surface.get()); | 545 | Mock::VerifyAndClearExpectations(stubbed_session->mock_surface.get()); |
4558 | 529 | 546 | ||
4559 | 530 | /* Creating a new surface should not affect our surfaces' buffers */ | 547 | /* Creating a new surface should not affect our surfaces' buffers */ |
4561 | 531 | EXPECT_CALL(*stubbed_session->mock_surface, swap_buffers(_)).Times(0); | 548 | EXPECT_CALL(*stubbed_session->mock_surface, swap_buffers(_, _)).Times(0); |
4562 | 532 | mediator.create_surface(nullptr, &surface_request, &surface_response, null_callback.get()); | 549 | mediator.create_surface(nullptr, &surface_request, &surface_response, null_callback.get()); |
4563 | 533 | 550 | ||
4564 | 534 | mp::SurfaceId new_surface{surface_response.id()}; | 551 | mp::SurfaceId new_surface{surface_response.id()}; |
4565 | @@ -540,7 +557,7 @@ | |||
4566 | 540 | Mock::VerifyAndClearExpectations(stubbed_session->mock_surface.get()); | 557 | Mock::VerifyAndClearExpectations(stubbed_session->mock_surface.get()); |
4567 | 541 | 558 | ||
4568 | 542 | /* Getting the next buffer of our surface should post the original */ | 559 | /* Getting the next buffer of our surface should post the original */ |
4570 | 543 | EXPECT_CALL(*stubbed_session->mock_surface, swap_buffers(Eq(&buffer))).Times(1); | 560 | EXPECT_CALL(*stubbed_session->mock_surface, swap_buffers(Eq(&buffer), _)).Times(1); |
4571 | 544 | 561 | ||
4572 | 545 | mediator.next_buffer(nullptr, &our_surface, &buffer_response, null_callback.get()); | 562 | mediator.next_buffer(nullptr, &our_surface, &buffer_response, null_callback.get()); |
4573 | 546 | mediator.disconnect(nullptr, nullptr, nullptr, null_callback.get()); | 563 | mediator.disconnect(nullptr, nullptr, nullptr, null_callback.get()); |
4574 | @@ -585,9 +602,10 @@ | |||
4575 | 585 | .WillOnce(Return(mt::fake_shared(stub_display_config))); | 602 | .WillOnce(Return(mt::fake_shared(stub_display_config))); |
4576 | 586 | 603 | ||
4577 | 587 | mf::SessionMediator session_mediator{ | 604 | mf::SessionMediator session_mediator{ |
4579 | 588 | shell, graphics_platform, mock_display_selector, | 605 | __LINE__, shell, graphics_platform, mock_display_selector, |
4580 | 589 | surface_pixel_formats, report, | 606 | surface_pixel_formats, report, |
4582 | 590 | std::make_shared<mtd::NullEventSink>(), resource_cache}; | 607 | std::make_shared<mtd::NullEventSink>(), resource_cache, |
4583 | 608 | std::make_shared<mtd::NullScreencast>()}; | ||
4584 | 591 | 609 | ||
4585 | 592 | session_mediator.connect(nullptr, &connect_parameters, &connection, null_callback.get()); | 610 | session_mediator.connect(nullptr, &connect_parameters, &connection, null_callback.get()); |
4586 | 593 | 611 | ||
4587 | @@ -620,3 +638,38 @@ | |||
4588 | 620 | 638 | ||
4589 | 621 | session_mediator.disconnect(nullptr, nullptr, nullptr, null_callback.get()); | 639 | session_mediator.disconnect(nullptr, nullptr, nullptr, null_callback.get()); |
4590 | 622 | } | 640 | } |
4591 | 641 | |||
4592 | 642 | TEST_F(SessionMediatorTest, fully_packs_buffer_for_create_screencast) | ||
4593 | 643 | { | ||
4594 | 644 | using namespace testing; | ||
4595 | 645 | |||
4596 | 646 | mp::ScreencastParameters screencast_parameters; | ||
4597 | 647 | mp::Screencast screencast; | ||
4598 | 648 | auto const& stub_buffer = stub_screencast->stub_buffer; | ||
4599 | 649 | |||
4600 | 650 | EXPECT_CALL(*graphics_platform, fill_ipc_package(_, &stub_buffer)); | ||
4601 | 651 | |||
4602 | 652 | mediator.create_screencast(nullptr, &screencast_parameters, | ||
4603 | 653 | &screencast, null_callback.get()); | ||
4604 | 654 | |||
4605 | 655 | EXPECT_EQ(stub_buffer.id().as_uint32_t(), | ||
4606 | 656 | screencast.buffer().buffer_id()); | ||
4607 | 657 | } | ||
4608 | 658 | |||
4609 | 659 | TEST_F(SessionMediatorTest, partially_packs_buffer_for_screencast_buffer) | ||
4610 | 660 | { | ||
4611 | 661 | using namespace testing; | ||
4612 | 662 | |||
4613 | 663 | mp::ScreencastId screencast_id; | ||
4614 | 664 | mp::Buffer protobuf_buffer; | ||
4615 | 665 | auto const& stub_buffer = stub_screencast->stub_buffer; | ||
4616 | 666 | |||
4617 | 667 | EXPECT_CALL(*graphics_platform, fill_ipc_package(_, &stub_buffer)) | ||
4618 | 668 | .Times(0); | ||
4619 | 669 | |||
4620 | 670 | mediator.screencast_buffer(nullptr, &screencast_id, | ||
4621 | 671 | &protobuf_buffer, null_callback.get()); | ||
4622 | 672 | |||
4623 | 673 | EXPECT_EQ(stub_buffer.id().as_uint32_t(), | ||
4624 | 674 | protobuf_buffer.buffer_id()); | ||
4625 | 675 | } | ||
4626 | 623 | 676 | ||
4627 | === modified file 'tests/unit-tests/frontend/test_session_mediator_android.cpp' | |||
4628 | --- tests/unit-tests/frontend/test_session_mediator_android.cpp 2014-01-13 06:12:33 +0000 | |||
4629 | +++ tests/unit-tests/frontend/test_session_mediator_android.cpp 2014-02-10 09:00:06 +0000 | |||
4630 | @@ -32,6 +32,7 @@ | |||
4631 | 32 | #include "mir_test_doubles/null_platform.h" | 32 | #include "mir_test_doubles/null_platform.h" |
4632 | 33 | #include "mir_test_doubles/null_event_sink.h" | 33 | #include "mir_test_doubles/null_event_sink.h" |
4633 | 34 | #include "mir_test_doubles/stub_buffer_allocator.h" | 34 | #include "mir_test_doubles/stub_buffer_allocator.h" |
4634 | 35 | #include "mir_test_doubles/null_screencast.h" | ||
4635 | 35 | 36 | ||
4636 | 36 | #include <gtest/gtest.h> | 37 | #include <gtest/gtest.h> |
4637 | 37 | 38 | ||
4638 | @@ -56,10 +57,10 @@ | |||
4639 | 56 | surface_pixel_formats{mir_pixel_format_argb_8888, mir_pixel_format_xrgb_8888}, | 57 | surface_pixel_formats{mir_pixel_format_argb_8888, mir_pixel_format_xrgb_8888}, |
4640 | 57 | report{std::make_shared<mf::NullSessionMediatorReport>()}, | 58 | report{std::make_shared<mf::NullSessionMediatorReport>()}, |
4641 | 58 | resource_cache{std::make_shared<mf::ResourceCache>()}, | 59 | resource_cache{std::make_shared<mf::ResourceCache>()}, |
4643 | 59 | mediator{shell, graphics_platform, display_changer, | 60 | mediator{__LINE__, shell, graphics_platform, display_changer, |
4644 | 60 | surface_pixel_formats, report, | 61 | surface_pixel_formats, report, |
4645 | 61 | std::make_shared<mtd::NullEventSink>(), | 62 | std::make_shared<mtd::NullEventSink>(), |
4647 | 62 | resource_cache}, | 63 | resource_cache, std::make_shared<mtd::NullScreencast>()}, |
4648 | 63 | null_callback{google::protobuf::NewPermanentCallback(google::protobuf::DoNothing)} | 64 | null_callback{google::protobuf::NewPermanentCallback(google::protobuf::DoNothing)} |
4649 | 64 | { | 65 | { |
4650 | 65 | } | 66 | } |
4651 | 66 | 67 | ||
4652 | === modified file 'tests/unit-tests/frontend/test_session_mediator_mesa.cpp' | |||
4653 | --- tests/unit-tests/frontend/test_session_mediator_mesa.cpp 2014-01-13 06:12:33 +0000 | |||
4654 | +++ tests/unit-tests/frontend/test_session_mediator_mesa.cpp 2014-02-10 09:00:06 +0000 | |||
4655 | @@ -1,5 +1,5 @@ | |||
4656 | 1 | /* | 1 | /* |
4658 | 2 | * Copyright © 2012 Canonical Ltd. | 2 | * Copyright © 2012-2014 Canonical Ltd. |
4659 | 3 | * | 3 | * |
4660 | 4 | * This program is free software: you can redistribute it and/or modify | 4 | * This program is free software: you can redistribute it and/or modify |
4661 | 5 | * it under the terms of the GNU General Public License version 3 as | 5 | * it under the terms of the GNU General Public License version 3 as |
4662 | @@ -34,6 +34,7 @@ | |||
4663 | 34 | #include "mir_test_doubles/null_platform.h" | 34 | #include "mir_test_doubles/null_platform.h" |
4664 | 35 | #include "mir_test_doubles/mock_session.h" | 35 | #include "mir_test_doubles/mock_session.h" |
4665 | 36 | #include "mir_test_doubles/stub_shell.h" | 36 | #include "mir_test_doubles/stub_shell.h" |
4666 | 37 | #include "mir_test_doubles/null_screencast.h" | ||
4667 | 37 | 38 | ||
4668 | 38 | #include <gtest/gtest.h> | 39 | #include <gtest/gtest.h> |
4669 | 39 | #include <gmock/gmock.h> | 40 | #include <gmock/gmock.h> |
4670 | @@ -69,10 +70,10 @@ | |||
4671 | 69 | surface_pixel_formats{mir_pixel_format_argb_8888, mir_pixel_format_xrgb_8888}, | 70 | surface_pixel_formats{mir_pixel_format_argb_8888, mir_pixel_format_xrgb_8888}, |
4672 | 70 | report{std::make_shared<mf::NullSessionMediatorReport>()}, | 71 | report{std::make_shared<mf::NullSessionMediatorReport>()}, |
4673 | 71 | resource_cache{std::make_shared<mf::ResourceCache>()}, | 72 | resource_cache{std::make_shared<mf::ResourceCache>()}, |
4675 | 72 | mediator{shell, mock_platform, display_changer, | 73 | mediator{__LINE__, shell, mock_platform, display_changer, |
4676 | 73 | surface_pixel_formats, report, | 74 | surface_pixel_formats, report, |
4677 | 74 | std::make_shared<mtd::NullEventSink>(), | 75 | std::make_shared<mtd::NullEventSink>(), |
4679 | 75 | resource_cache}, | 76 | resource_cache, std::make_shared<mtd::NullScreencast>()}, |
4680 | 76 | null_callback{google::protobuf::NewPermanentCallback(google::protobuf::DoNothing)} | 77 | null_callback{google::protobuf::NewPermanentCallback(google::protobuf::DoNothing)} |
4681 | 77 | { | 78 | { |
4682 | 78 | } | 79 | } |
4683 | 79 | 80 | ||
4684 | === modified file 'tests/unit-tests/frontend/test_socket_session.cpp' | |||
4685 | --- tests/unit-tests/frontend/test_socket_session.cpp 2014-01-22 15:54:11 +0000 | |||
4686 | +++ tests/unit-tests/frontend/test_socket_session.cpp 2014-02-10 09:00:06 +0000 | |||
4687 | @@ -70,7 +70,7 @@ | |||
4688 | 70 | 70 | ||
4689 | 71 | struct MockProcessor : public mfd::MessageProcessor | 71 | struct MockProcessor : public mfd::MessageProcessor |
4690 | 72 | { | 72 | { |
4692 | 73 | MOCK_METHOD1(dispatch, bool(mir::protobuf::wire::Invocation const& invocation)); | 73 | MOCK_METHOD1(dispatch, bool(mfd::Invocation const& invocation)); |
4693 | 74 | }; | 74 | }; |
4694 | 75 | } | 75 | } |
4695 | 76 | struct SocketSessionTest : public ::testing::Test | 76 | struct SocketSessionTest : public ::testing::Test |
4696 | 77 | 77 | ||
4697 | === modified file 'tests/unit-tests/graphics/android/test_android_alloc_adaptor.cpp' | |||
4698 | --- tests/unit-tests/graphics/android/test_android_alloc_adaptor.cpp 2014-01-13 06:12:33 +0000 | |||
4699 | +++ tests/unit-tests/graphics/android/test_android_alloc_adaptor.cpp 2014-02-10 09:00:06 +0000 | |||
4700 | @@ -236,7 +236,7 @@ | |||
4701 | 236 | 236 | ||
4702 | 237 | TEST_F(AdaptorICSTest, handle_has_version) | 237 | TEST_F(AdaptorICSTest, handle_has_version) |
4703 | 238 | { | 238 | { |
4705 | 239 | int version = 96; /* version value shared by JB and ICS */ | 239 | int version = sizeof(ANativeWindowBuffer); /* version value shared by JB and ICS */ |
4706 | 240 | auto native_handle = alloc_adaptor->alloc_buffer(size, pf, usage); | 240 | auto native_handle = alloc_adaptor->alloc_buffer(size, pf, usage); |
4707 | 241 | auto anwb = native_handle->anwb(); | 241 | auto anwb = native_handle->anwb(); |
4708 | 242 | EXPECT_EQ(version, anwb->common.version); | 242 | EXPECT_EQ(version, anwb->common.version); |
4709 | 243 | 243 | ||
4710 | === modified file 'tests/unit-tests/graphics/android/test_buffer_tex_bind.cpp' | |||
4711 | --- tests/unit-tests/graphics/android/test_buffer_tex_bind.cpp 2014-01-13 06:12:33 +0000 | |||
4712 | +++ tests/unit-tests/graphics/android/test_buffer_tex_bind.cpp 2014-02-10 09:00:06 +0000 | |||
4713 | @@ -101,7 +101,8 @@ | |||
4714 | 101 | TEST_F(AndroidBufferBinding, buffer_makes_new_image_with_new_display) | 101 | TEST_F(AndroidBufferBinding, buffer_makes_new_image_with_new_display) |
4715 | 102 | { | 102 | { |
4716 | 103 | using namespace testing; | 103 | using namespace testing; |
4718 | 104 | EGLDisplay second_fake_display = (EGLDisplay) ((int)mock_egl.fake_egl_display +1); | 104 | EGLDisplay second_fake_display = |
4719 | 105 | reinterpret_cast<EGLDisplay>(&second_fake_display); | ||
4720 | 105 | 106 | ||
4721 | 106 | /* return 1st fake display */ | 107 | /* return 1st fake display */ |
4722 | 107 | EXPECT_CALL(mock_egl, eglCreateImageKHR(_,_,_,_,_)) | 108 | EXPECT_CALL(mock_egl, eglCreateImageKHR(_,_,_,_,_)) |
4723 | @@ -121,7 +122,8 @@ | |||
4724 | 121 | TEST_F(AndroidBufferBinding, buffer_frees_images_it_makes) | 122 | TEST_F(AndroidBufferBinding, buffer_frees_images_it_makes) |
4725 | 122 | { | 123 | { |
4726 | 123 | using namespace testing; | 124 | using namespace testing; |
4728 | 124 | EGLDisplay second_fake_display = (EGLDisplay) ((int)mock_egl.fake_egl_display +1); | 125 | EGLDisplay second_fake_display = |
4729 | 126 | reinterpret_cast<EGLDisplay>(&second_fake_display); | ||
4730 | 125 | 127 | ||
4731 | 126 | EXPECT_CALL(mock_egl, eglDestroyImageKHR(_,_)) | 128 | EXPECT_CALL(mock_egl, eglDestroyImageKHR(_,_)) |
4732 | 127 | .Times(Exactly(2)); | 129 | .Times(Exactly(2)); |
4733 | @@ -141,9 +143,12 @@ | |||
4734 | 141 | using namespace testing; | 143 | using namespace testing; |
4735 | 142 | 144 | ||
4736 | 143 | EGLDisplay first_fake_display = mock_egl.fake_egl_display; | 145 | EGLDisplay first_fake_display = mock_egl.fake_egl_display; |
4740 | 144 | EGLImageKHR first_fake_egl_image = (EGLImageKHR) 0x84210; | 146 | EGLImageKHR first_fake_egl_image = |
4741 | 145 | EGLDisplay second_fake_display = (EGLDisplay) ((int)mock_egl.fake_egl_display +1); | 147 | reinterpret_cast<EGLImageKHR>(&first_fake_egl_image); |
4742 | 146 | EGLImageKHR second_fake_egl_image = (EGLImageKHR) 0x84211; | 148 | EGLDisplay second_fake_display = |
4743 | 149 | reinterpret_cast<EGLDisplay>(&second_fake_display); | ||
4744 | 150 | EGLImageKHR second_fake_egl_image = | ||
4745 | 151 | reinterpret_cast<EGLImageKHR>(&second_fake_egl_image); | ||
4746 | 147 | 152 | ||
4747 | 148 | /* actual expectations */ | 153 | /* actual expectations */ |
4748 | 149 | EXPECT_CALL(mock_egl, eglDestroyImageKHR(first_fake_display, first_fake_egl_image)) | 154 | EXPECT_CALL(mock_egl, eglDestroyImageKHR(first_fake_display, first_fake_egl_image)) |
4749 | @@ -321,8 +326,10 @@ | |||
4750 | 321 | TEST_F(AndroidBufferBinding, buffer_binding_uses_right_image_after_display_swap) | 326 | TEST_F(AndroidBufferBinding, buffer_binding_uses_right_image_after_display_swap) |
4751 | 322 | { | 327 | { |
4752 | 323 | using namespace testing; | 328 | using namespace testing; |
4755 | 324 | EGLDisplay second_fake_display = (EGLDisplay) ((int)mock_egl.fake_egl_display +1); | 329 | EGLDisplay second_fake_display = |
4756 | 325 | EGLImageKHR second_fake_egl_image = (EGLImageKHR) 0x84211; | 330 | reinterpret_cast<EGLDisplay>(&second_fake_display); |
4757 | 331 | EGLImageKHR second_fake_egl_image = | ||
4758 | 332 | reinterpret_cast<EGLImageKHR>(&second_fake_egl_image); | ||
4759 | 326 | 333 | ||
4760 | 327 | EXPECT_CALL(mock_egl, glEGLImageTargetTexture2DOES(_, _)) | 334 | EXPECT_CALL(mock_egl, glEGLImageTargetTexture2DOES(_, _)) |
4761 | 328 | .Times(Exactly(1)); | 335 | .Times(Exactly(1)); |
4762 | 329 | 336 | ||
4763 | === modified file 'tests/unit-tests/graphics/android/test_hwc_common_device.cpp' | |||
4764 | --- tests/unit-tests/graphics/android/test_hwc_common_device.cpp 2014-01-21 18:09:35 +0000 | |||
4765 | +++ tests/unit-tests/graphics/android/test_hwc_common_device.cpp 2014-02-10 09:00:06 +0000 | |||
4766 | @@ -16,6 +16,7 @@ | |||
4767 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
4768 | 17 | */ | 17 | */ |
4769 | 18 | 18 | ||
4770 | 19 | #include "mir/graphics/android/sync_fence.h" | ||
4771 | 19 | #include "src/platform/graphics/android/hwc_fb_device.h" | 20 | #include "src/platform/graphics/android/hwc_fb_device.h" |
4772 | 20 | #include "src/platform/graphics/android/hwc_device.h" | 21 | #include "src/platform/graphics/android/hwc_device.h" |
4773 | 21 | #include "src/platform/graphics/android/hwc_layerlist.h" | 22 | #include "src/platform/graphics/android/hwc_layerlist.h" |
4774 | @@ -58,7 +59,8 @@ | |||
4775 | 58 | std::shared_ptr<framebuffer_device_t> const&, | 59 | std::shared_ptr<framebuffer_device_t> const&, |
4776 | 59 | std::shared_ptr<mga::HWCVsyncCoordinator> const& coordinator) | 60 | std::shared_ptr<mga::HWCVsyncCoordinator> const& coordinator) |
4777 | 60 | { | 61 | { |
4779 | 61 | return std::make_shared<mga::HwcDevice>(hwc_device, coordinator); | 62 | auto file_ops = std::make_shared<mga::RealSyncFileOps>(); |
4780 | 63 | return std::make_shared<mga::HwcDevice>(hwc_device, coordinator, file_ops); | ||
4781 | 62 | } | 64 | } |
4782 | 63 | 65 | ||
4783 | 64 | template<typename T> | 66 | template<typename T> |
4784 | 65 | 67 | ||
4785 | === modified file 'tests/unit-tests/graphics/android/test_hwc_device.cpp' | |||
4786 | --- tests/unit-tests/graphics/android/test_hwc_device.cpp 2014-01-23 17:26:51 +0000 | |||
4787 | +++ tests/unit-tests/graphics/android/test_hwc_device.cpp 2014-02-10 09:00:06 +0000 | |||
4788 | @@ -16,6 +16,7 @@ | |||
4789 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
4790 | 17 | */ | 17 | */ |
4791 | 18 | 18 | ||
4792 | 19 | #include "mir/graphics/android/sync_fence.h" | ||
4793 | 19 | #include "src/platform/graphics/android/framebuffer_bundle.h" | 20 | #include "src/platform/graphics/android/framebuffer_bundle.h" |
4794 | 20 | #include "src/platform/graphics/android/hwc_device.h" | 21 | #include "src/platform/graphics/android/hwc_device.h" |
4795 | 21 | #include "src/platform/graphics/android/hwc_layerlist.h" | 22 | #include "src/platform/graphics/android/hwc_layerlist.h" |
4796 | @@ -35,6 +36,16 @@ | |||
4797 | 35 | namespace mtd=mir::test::doubles; | 36 | namespace mtd=mir::test::doubles; |
4798 | 36 | namespace geom=mir::geometry; | 37 | namespace geom=mir::geometry; |
4799 | 37 | 38 | ||
4800 | 39 | namespace | ||
4801 | 40 | { | ||
4802 | 41 | struct MockFileOps : public mga::SyncFileOps | ||
4803 | 42 | { | ||
4804 | 43 | MOCK_METHOD3(ioctl, int(int,int,void*)); | ||
4805 | 44 | MOCK_METHOD1(dup, int(int)); | ||
4806 | 45 | MOCK_METHOD1(close, int(int)); | ||
4807 | 46 | }; | ||
4808 | 47 | } | ||
4809 | 48 | |||
4810 | 38 | class HwcDevice : public ::testing::Test | 49 | class HwcDevice : public ::testing::Test |
4811 | 39 | { | 50 | { |
4812 | 40 | protected: | 51 | protected: |
4813 | @@ -48,10 +59,13 @@ | |||
4814 | 48 | mock_buffer = std::make_shared<testing::NiceMock<mtd::MockBuffer>>(); | 59 | mock_buffer = std::make_shared<testing::NiceMock<mtd::MockBuffer>>(); |
4815 | 49 | mock_device = std::make_shared<testing::NiceMock<mtd::MockHWCComposerDevice1>>(); | 60 | mock_device = std::make_shared<testing::NiceMock<mtd::MockHWCComposerDevice1>>(); |
4816 | 50 | mock_vsync = std::make_shared<testing::NiceMock<mtd::MockVsyncCoordinator>>(); | 61 | mock_vsync = std::make_shared<testing::NiceMock<mtd::MockVsyncCoordinator>>(); |
4817 | 62 | mock_file_ops = std::make_shared<MockFileOps>(); | ||
4818 | 51 | 63 | ||
4819 | 52 | ON_CALL(*mock_buffer, native_buffer_handle()) | 64 | ON_CALL(*mock_buffer, native_buffer_handle()) |
4820 | 53 | .WillByDefault(Return(mock_native_buffer)); | 65 | .WillByDefault(Return(mock_native_buffer)); |
4821 | 54 | } | 66 | } |
4822 | 67 | |||
4823 | 68 | std::shared_ptr<MockFileOps> mock_file_ops; | ||
4824 | 55 | std::shared_ptr<mtd::MockVsyncCoordinator> mock_vsync; | 69 | std::shared_ptr<mtd::MockVsyncCoordinator> mock_vsync; |
4825 | 56 | std::shared_ptr<mtd::MockHWCComposerDevice1> mock_device; | 70 | std::shared_ptr<mtd::MockHWCComposerDevice1> mock_device; |
4826 | 57 | std::shared_ptr<mtd::MockAndroidNativeBuffer> mock_native_buffer; | 71 | std::shared_ptr<mtd::MockAndroidNativeBuffer> mock_native_buffer; |
4827 | @@ -69,7 +83,7 @@ | |||
4828 | 69 | EXPECT_CALL(*mock_device, set_interface(mock_device.get(),_,_)) | 83 | EXPECT_CALL(*mock_device, set_interface(mock_device.get(),_,_)) |
4829 | 70 | .Times(1); | 84 | .Times(1); |
4830 | 71 | 85 | ||
4832 | 72 | mga::HwcDevice device(mock_device, mock_vsync); | 86 | mga::HwcDevice device(mock_device, mock_vsync, mock_file_ops); |
4833 | 73 | device.prepare_gl(); | 87 | device.prepare_gl(); |
4834 | 74 | device.post(*mock_buffer); | 88 | device.post(*mock_buffer); |
4835 | 75 | 89 | ||
4836 | @@ -90,7 +104,7 @@ | |||
4837 | 90 | EXPECT_CALL(*mock_device, prepare_interface(mock_device.get(), 1, _)) | 104 | EXPECT_CALL(*mock_device, prepare_interface(mock_device.get(), 1, _)) |
4838 | 91 | .Times(1); | 105 | .Times(1); |
4839 | 92 | 106 | ||
4841 | 93 | mga::HwcDevice device(mock_device, mock_vsync); | 107 | mga::HwcDevice device(mock_device, mock_vsync, mock_file_ops); |
4842 | 94 | device.prepare_gl(); | 108 | device.prepare_gl(); |
4843 | 95 | EXPECT_EQ(2, mock_device->display0_prepare_content.numHwLayers); | 109 | EXPECT_EQ(2, mock_device->display0_prepare_content.numHwLayers); |
4844 | 96 | EXPECT_EQ(-1, mock_device->display0_prepare_content.retireFenceFd); | 110 | EXPECT_EQ(-1, mock_device->display0_prepare_content.retireFenceFd); |
4845 | @@ -102,7 +116,7 @@ | |||
4846 | 102 | EXPECT_CALL(*mock_device, prepare_interface(mock_device.get(), 1, _)) | 116 | EXPECT_CALL(*mock_device, prepare_interface(mock_device.get(), 1, _)) |
4847 | 103 | .Times(1); | 117 | .Times(1); |
4848 | 104 | 118 | ||
4850 | 105 | mga::HwcDevice device(mock_device, mock_vsync); | 119 | mga::HwcDevice device(mock_device, mock_vsync, mock_file_ops); |
4851 | 106 | std::list<std::shared_ptr<mg::Renderable>> renderlist; | 120 | std::list<std::shared_ptr<mg::Renderable>> renderlist; |
4852 | 107 | device.prepare_gl_and_overlays(renderlist); | 121 | device.prepare_gl_and_overlays(renderlist); |
4853 | 108 | 122 | ||
4854 | @@ -114,7 +128,7 @@ | |||
4855 | 114 | { | 128 | { |
4856 | 115 | EXPECT_CALL(mock_egl, eglSwapBuffers(dpy,surf)) | 129 | EXPECT_CALL(mock_egl, eglSwapBuffers(dpy,surf)) |
4857 | 116 | .Times(1); | 130 | .Times(1); |
4859 | 117 | mga::HwcDevice device(mock_device, mock_vsync); | 131 | mga::HwcDevice device(mock_device, mock_vsync, mock_file_ops); |
4860 | 118 | device.gpu_render(dpy, surf); | 132 | device.gpu_render(dpy, surf); |
4861 | 119 | } | 133 | } |
4862 | 120 | 134 | ||
4863 | @@ -125,7 +139,7 @@ | |||
4864 | 125 | .Times(1) | 139 | .Times(1) |
4865 | 126 | .WillOnce(Return(EGL_FALSE)); | 140 | .WillOnce(Return(EGL_FALSE)); |
4866 | 127 | 141 | ||
4868 | 128 | mga::HwcDevice device(mock_device, mock_vsync); | 142 | mga::HwcDevice device(mock_device, mock_vsync, mock_file_ops); |
4869 | 129 | 143 | ||
4870 | 130 | EXPECT_THROW({ | 144 | EXPECT_THROW({ |
4871 | 131 | device.gpu_render(dpy, surf); | 145 | device.gpu_render(dpy, surf); |
4872 | @@ -136,15 +150,19 @@ | |||
4873 | 136 | { | 150 | { |
4874 | 137 | using namespace testing; | 151 | using namespace testing; |
4875 | 138 | int hwc_return_fence = 94; | 152 | int hwc_return_fence = 94; |
4876 | 153 | int hwc_retire_fence = 74; | ||
4877 | 139 | mock_device->hwc_set_return_fence(hwc_return_fence); | 154 | mock_device->hwc_set_return_fence(hwc_return_fence); |
4878 | 155 | mock_device->hwc_set_retire_fence(hwc_retire_fence); | ||
4879 | 140 | 156 | ||
4881 | 141 | mga::HwcDevice device(mock_device, mock_vsync); | 157 | mga::HwcDevice device(mock_device, mock_vsync, mock_file_ops); |
4882 | 142 | 158 | ||
4883 | 143 | InSequence seq; | 159 | InSequence seq; |
4884 | 144 | EXPECT_CALL(*mock_device, set_interface(mock_device.get(), 1, _)) | 160 | EXPECT_CALL(*mock_device, set_interface(mock_device.get(), 1, _)) |
4885 | 145 | .Times(1); | 161 | .Times(1); |
4886 | 146 | EXPECT_CALL(*mock_native_buffer, update_fence(hwc_return_fence)) | 162 | EXPECT_CALL(*mock_native_buffer, update_fence(hwc_return_fence)) |
4887 | 147 | .Times(1); | 163 | .Times(1); |
4888 | 164 | EXPECT_CALL(*mock_file_ops, close(hwc_retire_fence)) | ||
4889 | 165 | .Times(1); | ||
4890 | 148 | 166 | ||
4891 | 149 | device.post(*mock_buffer); | 167 | device.post(*mock_buffer); |
4892 | 150 | 168 | ||
4893 | @@ -161,7 +179,7 @@ | |||
4894 | 161 | { | 179 | { |
4895 | 162 | using namespace testing; | 180 | using namespace testing; |
4896 | 163 | 181 | ||
4898 | 164 | mga::HwcDevice device(mock_device, mock_vsync); | 182 | mga::HwcDevice device(mock_device, mock_vsync, mock_file_ops); |
4899 | 165 | 183 | ||
4900 | 166 | EXPECT_CALL(*mock_device, set_interface(mock_device.get(), _, _)) | 184 | EXPECT_CALL(*mock_device, set_interface(mock_device.get(), _, _)) |
4901 | 167 | .Times(1) | 185 | .Times(1) |
4902 | 168 | 186 | ||
4903 | === modified file 'tests/unit-tests/graphics/android/test_output_builder.cpp' | |||
4904 | --- tests/unit-tests/graphics/android/test_output_builder.cpp 2014-01-21 18:09:35 +0000 | |||
4905 | +++ tests/unit-tests/graphics/android/test_output_builder.cpp 2014-02-10 09:00:06 +0000 | |||
4906 | @@ -122,7 +122,7 @@ | |||
4907 | 122 | .Times(1); | 122 | .Times(1); |
4908 | 123 | 123 | ||
4909 | 124 | mga::OutputBuilder factory( | 124 | mga::OutputBuilder factory( |
4911 | 125 | mt::fake_shared(mock_buffer_allocator),mock_resource_factory, mock_display_report, false); | 125 | mt::fake_shared(mock_buffer_allocator),mock_resource_factory, mock_display_report); |
4912 | 126 | factory.create_display_device(); | 126 | factory.create_display_device(); |
4913 | 127 | } | 127 | } |
4914 | 128 | 128 | ||
4915 | @@ -143,7 +143,7 @@ | |||
4916 | 143 | .Times(1); | 143 | .Times(1); |
4917 | 144 | 144 | ||
4918 | 145 | mga::OutputBuilder factory( | 145 | mga::OutputBuilder factory( |
4920 | 146 | mt::fake_shared(mock_buffer_allocator),mock_resource_factory, mock_display_report, false); | 146 | mt::fake_shared(mock_buffer_allocator),mock_resource_factory, mock_display_report); |
4921 | 147 | factory.create_display_device(); | 147 | factory.create_display_device(); |
4922 | 148 | } | 148 | } |
4923 | 149 | 149 | ||
4924 | @@ -161,7 +161,7 @@ | |||
4925 | 161 | .Times(1); | 161 | .Times(1); |
4926 | 162 | 162 | ||
4927 | 163 | mga::OutputBuilder factory( | 163 | mga::OutputBuilder factory( |
4929 | 164 | mt::fake_shared(mock_buffer_allocator),mock_resource_factory, mock_display_report, false); | 164 | mt::fake_shared(mock_buffer_allocator),mock_resource_factory, mock_display_report); |
4930 | 165 | factory.create_display_device(); | 165 | factory.create_display_device(); |
4931 | 166 | } | 166 | } |
4932 | 167 | 167 | ||
4933 | @@ -182,7 +182,7 @@ | |||
4934 | 182 | .Times(1); | 182 | .Times(1); |
4935 | 183 | 183 | ||
4936 | 184 | mga::OutputBuilder factory( | 184 | mga::OutputBuilder factory( |
4938 | 185 | mt::fake_shared(mock_buffer_allocator),mock_resource_factory, mock_display_report, false); | 185 | mt::fake_shared(mock_buffer_allocator),mock_resource_factory, mock_display_report); |
4939 | 186 | factory.create_display_device(); | 186 | factory.create_display_device(); |
4940 | 187 | } | 187 | } |
4941 | 188 | 188 | ||
4942 | @@ -201,7 +201,7 @@ | |||
4943 | 201 | 201 | ||
4944 | 202 | EXPECT_THROW({ | 202 | EXPECT_THROW({ |
4945 | 203 | mga::OutputBuilder factory( | 203 | mga::OutputBuilder factory( |
4947 | 204 | mt::fake_shared(mock_buffer_allocator),mock_resource_factory, mock_display_report, false); | 204 | mt::fake_shared(mock_buffer_allocator),mock_resource_factory, mock_display_report); |
4948 | 205 | }, std::runtime_error); | 205 | }, std::runtime_error); |
4949 | 206 | } | 206 | } |
4950 | 207 | 207 | ||
4951 | @@ -219,7 +219,7 @@ | |||
4952 | 219 | .Times(1); | 219 | .Times(1); |
4953 | 220 | 220 | ||
4954 | 221 | mga::OutputBuilder factory( | 221 | mga::OutputBuilder factory( |
4956 | 222 | mt::fake_shared(mock_buffer_allocator),mock_resource_factory, mock_display_report, false); | 222 | mt::fake_shared(mock_buffer_allocator),mock_resource_factory, mock_display_report); |
4957 | 223 | factory.create_display_device(); | 223 | factory.create_display_device(); |
4958 | 224 | } | 224 | } |
4959 | 225 | 225 | ||
4960 | @@ -233,6 +233,6 @@ | |||
4961 | 233 | .Times(1); | 233 | .Times(1); |
4962 | 234 | 234 | ||
4963 | 235 | mga::OutputBuilder factory( | 235 | mga::OutputBuilder factory( |
4965 | 236 | mt::fake_shared(mock_buffer_allocator),mock_resource_factory, mock_display_report, false); | 236 | mt::fake_shared(mock_buffer_allocator),mock_resource_factory, mock_display_report); |
4966 | 237 | factory.create_display_buffer(mt::fake_shared(stub_device), gl_context); | 237 | factory.create_display_buffer(mt::fake_shared(stub_device), gl_context); |
4967 | 238 | } | 238 | } |
4968 | 239 | 239 | ||
4969 | === modified file 'tests/unit-tests/graphics/mesa/test_display_configuration.cpp' | |||
4970 | --- tests/unit-tests/graphics/mesa/test_display_configuration.cpp 2014-01-13 06:12:33 +0000 | |||
4971 | +++ tests/unit-tests/graphics/mesa/test_display_configuration.cpp 2014-02-10 09:00:06 +0000 | |||
4972 | @@ -289,7 +289,7 @@ | |||
4973 | 289 | /* Test body */ | 289 | /* Test body */ |
4974 | 290 | auto display = create_display(create_platform()); | 290 | auto display = create_display(create_platform()); |
4975 | 291 | 291 | ||
4977 | 292 | auto conf = display->configuration(); | 292 | std::shared_ptr<mg::DisplayConfiguration> conf = display->configuration(); |
4978 | 293 | auto const& kms_conf = std::static_pointer_cast<mgm::KMSDisplayConfiguration>(conf); | 293 | auto const& kms_conf = std::static_pointer_cast<mgm::KMSDisplayConfiguration>(conf); |
4979 | 294 | 294 | ||
4980 | 295 | size_t output_count{0}; | 295 | size_t output_count{0}; |
4981 | @@ -332,7 +332,7 @@ | |||
4982 | 332 | /* Test body */ | 332 | /* Test body */ |
4983 | 333 | auto display = create_display(create_platform()); | 333 | auto display = create_display(create_platform()); |
4984 | 334 | 334 | ||
4986 | 335 | auto conf = display->configuration(); | 335 | std::shared_ptr<mg::DisplayConfiguration> conf = display->configuration(); |
4987 | 336 | auto const& kms_conf = std::static_pointer_cast<mgm::KMSDisplayConfiguration>(conf); | 336 | auto const& kms_conf = std::static_pointer_cast<mgm::KMSDisplayConfiguration>(conf); |
4988 | 337 | 337 | ||
4989 | 338 | EXPECT_THROW({ | 338 | EXPECT_THROW({ |
4990 | 339 | 339 | ||
4991 | === modified file 'tests/unit-tests/scene/test_application_session.cpp' | |||
4992 | --- tests/unit-tests/scene/test_application_session.cpp 2014-01-13 06:12:33 +0000 | |||
4993 | +++ tests/unit-tests/scene/test_application_session.cpp 2014-02-10 09:00:06 +0000 | |||
4994 | @@ -1,5 +1,5 @@ | |||
4995 | 1 | /* | 1 | /* |
4997 | 2 | * Copyright © 2012 Canonical Ltd. | 2 | * Copyright © 2012-2014 Canonical Ltd. |
4998 | 3 | * | 3 | * |
4999 | 4 | * This program is free software: you can redistribute it and/or modify | 4 | * This program is free software: you can redistribute it and/or modify |
5000 | 5 | * it under the terms of the GNU General Public License version 3 as | 5 | * it under the terms of the GNU General Public License version 3 as |
PASSED: Continuous integration, rev:1177 jenkins. qa.ubuntu. com/job/ mir-ci/ 1635/ jenkins. qa.ubuntu. com/job/ mir-android- trusty- i386-build/ 848 jenkins. qa.ubuntu. com/job/ mir-clang- trusty- amd64-build/ 845 jenkins. qa.ubuntu. com/job/ mir-trusty- amd64-ci/ 33 jenkins. qa.ubuntu. com/job/ mir-trusty- amd64-ci/ 33/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-trusty- armhf-ci/ 33 jenkins. qa.ubuntu. com/job/ mir-trusty- armhf-ci/ 33/artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/mir- ci/1635/ rebuild
http://