Merge lp:~robertcarr/mir/socket-messenger-reporting into lp:~vanvugt/mir/fix-1226139
- socket-messenger-reporting
- Merge into fix-1226139
Proposed by
Robert Carr
Status: | Superseded |
---|---|
Proposed branch: | lp:~robertcarr/mir/socket-messenger-reporting |
Merge into: | lp:~vanvugt/mir/fix-1226139 |
Diff against target: |
12829 lines (+7770/-1040) 172 files modified
3rd_party/android-deps/android/input.h (+0/-21) 3rd_party/android-deps/std/PropertyMap.h (+14/-4) 3rd_party/android-deps/std/Vector.h (+1/-1) 3rd_party/android-input/README (+0/-19) 3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp (+2/-1) 3rd_party/android-input/android/frameworks/base/services/input/InputReader.h (+0/-4) CMakeLists.txt (+1/-1) debian/changelog (+109/-0) debian/control (+4/-4) debian/libmirclient3.install (+1/-1) debian/libmirserver4.install (+1/-1) debian/rules (+1/-2) doc/debug_for_xmir.md (+1/-1) examples/basic_server.cpp (+39/-4) examples/demo-shell/demo_shell.cpp (+2/-0) examples/demo-shell/window_manager.cpp (+51/-5) examples/demo-shell/window_manager.h (+13/-0) examples/demo_client_display_config.c (+90/-20) examples/render_surfaces.cpp (+5/-4) examples/server_configuration.cpp (+4/-4) include/platform/mir/graphics/display_buffer.h (+1/-0) include/platform/mir/graphics/display_configuration.h (+4/-1) include/server/mir/default_pause_resume_listener.h (+40/-0) include/server/mir/default_server_configuration.h (+15/-3) include/server/mir/frontend/connector.h (+14/-14) include/server/mir/frontend/connector_report.h (+9/-10) include/server/mir/frontend/display_changer.h (+1/-0) include/server/mir/frontend/messenger_report.h (+49/-0) include/server/mir/frontend/protobuf_ipc_factory.h (+3/-1) include/server/mir/frontend/session_creator.h (+44/-0) include/server/mir/frontend/session_mediator_report.h (+4/-0) include/server/mir/logging/messenger_report.h (+49/-0) include/server/mir/logging/session_mediator_report.h (+2/-0) include/server/mir/pause_resume_listener.h (+40/-0) include/server/mir/server_configuration.h (+4/-2) include/server/mir/shell/mediating_display_changer.h (+2/-0) include/server/mir/shell/unauthorized_display_changer.h (+2/-0) include/shared/mir/graphics/android/syncfence.h (+2/-19) include/shared/mir_toolkit/client_types.h (+4/-1) include/shared/mir_toolkit/common.h (+8/-0) include/test/mir_test/test_protobuf_server.h (+4/-4) include/test/mir_test_doubles/mock_display_changer.h (+1/-0) include/test/mir_test_doubles/mock_display_support_provider.h (+1/-0) include/test/mir_test_doubles/mock_hwc_interface.h (+1/-0) include/test/mir_test_doubles/mock_hwc_layerlist.h (+6/-6) include/test/mir_test_doubles/mock_pause_resume_listener.h (+44/-0) include/test/mir_test_doubles/null_display_changer.h (+3/-0) include/test/mir_test_doubles/null_display_config.h (+0/-51) include/test/mir_test_doubles/null_display_configuration.h (+1/-1) include/test/mir_test_doubles/stub_display_configuration.h (+4/-3) include/test/mir_test_doubles/stub_display_support_provider.h (+45/-0) include/test/mir_test_doubles/stub_ipc_factory.h (+6/-1) include/test/mir_test_framework/cross_process_sync.h (+5/-4) src/client/CMakeLists.txt (+1/-1) src/client/display_configuration.cpp (+1/-0) src/client/mir_connection.cpp (+1/-0) src/client/rpc/make_socket_rpc_channel.cpp (+24/-1) src/client/rpc/mir_socket_rpc_channel.cpp (+24/-4) src/client/rpc/mir_socket_rpc_channel.h (+8/-1) src/platform/graphics/default_display_configuration_policy.cpp (+4/-2) src/server/CMakeLists.txt (+1/-1) src/server/compositor/default_display_buffer_compositor.cpp (+2/-12) src/server/default_server_configuration.cpp (+44/-3) src/server/display_server.cpp (+16/-9) src/server/frontend/CMakeLists.txt (+7/-7) src/server/frontend/default_configuration.cpp (+49/-21) src/server/frontend/null_messenger_report.cpp (+25/-0) src/server/frontend/null_session_mediator_report.cpp (+4/-0) src/server/frontend/protobuf_buffer_packer.cpp (+1/-0) src/server/frontend/protobuf_session_creator.cpp (+73/-0) src/server/frontend/protobuf_session_creator.h (+60/-0) src/server/frontend/published_socket_connector.cpp (+79/-76) src/server/frontend/published_socket_connector.h (+37/-38) src/server/frontend/session_mediator.cpp (+9/-1) src/server/frontend/socket_messenger.cpp (+13/-10) src/server/frontend/socket_messenger.h (+6/-1) src/server/graphics/android/CMakeLists.txt (+1/-0) src/server/graphics/android/android_display.cpp (+16/-42) src/server/graphics/android/android_display.h (+6/-0) src/server/graphics/android/android_display_allocator.cpp (+5/-2) src/server/graphics/android/android_display_allocator.h (+1/-0) src/server/graphics/android/android_display_configuration.cpp (+68/-0) src/server/graphics/android/android_display_configuration.h (+51/-0) src/server/graphics/android/android_display_factory.cpp (+1/-1) src/server/graphics/android/android_hwc_factory.cpp (+1/-1) src/server/graphics/android/display_allocator.h (+3/-0) src/server/graphics/android/display_support_provider.h (+2/-0) src/server/graphics/android/fb_device.cpp (+6/-0) src/server/graphics/android/fb_device.h (+2/-0) src/server/graphics/android/gpu_hwc_android_display_buffer_factory.cpp (+5/-2) src/server/graphics/android/hwc10_device.cpp (+2/-0) src/server/graphics/android/hwc10_device.h (+0/-1) src/server/graphics/android/hwc11_device.cpp (+23/-38) src/server/graphics/android/hwc11_device.h (+3/-4) src/server/graphics/android/hwc_common_device.cpp (+28/-1) src/server/graphics/android/hwc_common_device.h (+12/-0) src/server/graphics/android/hwc_device.h (+2/-0) src/server/graphics/android/hwc_layerlist.cpp (+46/-23) src/server/graphics/android/hwc_layerlist.h (+18/-14) src/server/graphics/android/internal_client.cpp (+3/-4) src/server/graphics/android/internal_client.h (+2/-1) src/server/graphics/android/internal_client_window.cpp (+2/-1) src/server/graphics/android/server_render_window.cpp (+2/-1) src/server/graphics/gbm/gbm_buffer_allocator.cpp (+5/-1) src/server/graphics/gbm/gbm_buffer_allocator.h (+2/-0) src/server/graphics/gbm/gbm_display.cpp (+42/-6) src/server/graphics/gbm/gbm_display.h (+2/-0) src/server/graphics/gbm/gbm_display_buffer.h (+0/-1) src/server/graphics/gbm/kms_output.h (+5/-0) src/server/graphics/gbm/real_kms_display_configuration.cpp (+5/-3) src/server/graphics/gbm/real_kms_display_configuration.h (+1/-1) src/server/graphics/gbm/real_kms_output.cpp (+72/-7) src/server/graphics/gbm/real_kms_output.h (+9/-0) src/server/graphics/nested/nested_display_configuration.cpp (+8/-2) src/server/graphics/nested/nested_display_configuration.h (+2/-1) src/server/logging/CMakeLists.txt (+1/-0) src/server/logging/messenger_report.cpp (+46/-0) src/server/logging/session_mediator_report.cpp (+5/-0) src/server/options/program_option.cpp (+1/-1) src/server/shell/mediating_display_changer.cpp (+27/-0) src/server/shell/unauthorized_display_changer.cpp (+5/-0) src/shared/graphics/android/mir_native_window.cpp (+3/-19) src/shared/graphics/android/syncfence.cpp (+16/-6) src/shared/protobuf/mir_protobuf.proto (+1/-0) tests/acceptance-tests/test_client_input.cpp (+9/-6) tests/acceptance-tests/test_client_library.cpp (+1/-1) tests/acceptance-tests/test_server_shutdown.cpp (+3/-3) tests/acceptance-tests/test_test_framework.cpp (+1/-1) tests/integration-tests/client/test_client_render.cpp (+1/-1) tests/integration-tests/graphics/android/test_display_integration.cpp (+5/-7) tests/integration-tests/shell/test_session.cpp (+5/-4) tests/integration-tests/test_display_server_main_loop_events.cpp (+132/-32) tests/integration-tests/test_error_reporting.cpp (+1/-1) tests/mir_test/display_config_matchers.cpp (+5/-3) tests/mir_test_doubles/test_protobuf_socket_server.cpp (+10/-10) tests/mir_test_framework/cross_process_sync.cpp (+10/-0) tests/mir_test_framework/input_testing_server_options.cpp (+1/-1) tests/mir_test_framework/testing_process_manager.cpp (+1/-1) tests/mir_test_framework/testing_server_options.cpp (+1/-1) tests/unit-tests/android_input/CMakeLists.txt (+1/-0) tests/unit-tests/android_input/input_reader.cpp (+5135/-0) tests/unit-tests/client/android/CMakeLists.txt (+0/-1) tests/unit-tests/client/android/test_android_syncfence.cpp (+0/-91) tests/unit-tests/client/test_client_mir_surface.cpp (+1/-1) tests/unit-tests/frontend/CMakeLists.txt (+1/-1) tests/unit-tests/frontend/stress_protobuf_communicator.cpp (+1/-1) tests/unit-tests/frontend/test_protobuf_reports_errors.cpp (+1/-1) tests/unit-tests/frontend/test_protobuf_sends_fds.cpp (+1/-1) tests/unit-tests/frontend/test_protobuf_surface_apis.cpp (+1/-1) tests/unit-tests/frontend/test_published_socket_connector.cpp (+89/-32) tests/unit-tests/frontend/test_session_mediator.cpp (+5/-3) tests/unit-tests/frontend/test_socket_messenger.cpp (+5/-2) tests/unit-tests/graphics/android/test_android_display_factory.cpp (+6/-5) tests/unit-tests/graphics/android/test_android_fb.cpp (+5/-14) tests/unit-tests/graphics/android/test_gpu_display.cpp (+2/-1) tests/unit-tests/graphics/android/test_hwc10_device.cpp (+0/-1) tests/unit-tests/graphics/android/test_hwc11_device.cpp (+45/-120) tests/unit-tests/graphics/android/test_hwc_device.cpp (+36/-17) tests/unit-tests/graphics/android/test_hwc_display.cpp (+56/-3) tests/unit-tests/graphics/android/test_hwc_layerlist.cpp (+26/-24) tests/unit-tests/graphics/android/test_internal_client_interpreter.cpp (+12/-3) tests/unit-tests/graphics/android/test_server_interpreter.cpp (+1/-1) tests/unit-tests/graphics/gbm/test_gbm_buffer_allocator.cpp (+64/-0) tests/unit-tests/graphics/gbm/test_gbm_cursor.cpp (+8/-3) tests/unit-tests/graphics/gbm/test_gbm_display_configuration.cpp (+15/-7) tests/unit-tests/graphics/gbm/test_gbm_display_multi_monitor.cpp (+141/-23) tests/unit-tests/graphics/gbm/test_overlapping_output_grouping.cpp (+3/-2) tests/unit-tests/graphics/gbm/test_real_kms_output.cpp (+59/-0) tests/unit-tests/graphics/nested/test_nested_display_configuration.cpp (+15/-10) tests/unit-tests/graphics/test_default_display_configuration_policy.cpp (+30/-8) tests/unit-tests/graphics/test_display.cpp (+2/-0) tests/unit-tests/graphics/test_display_configuration.cpp (+2/-1) |
To merge this branch: | bzr merge lp:~robertcarr/mir/socket-messenger-reporting |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alan Griffiths (community) | Needs Fixing | ||
Daniel van Vugt | Pending | ||
Review via email: mp+187023@code.launchpad.net |
This proposal has been superseded by a proposal from 2013-09-26.
Commit message
Report exceptions in socket messenger.
Description of the change
Report socket messenger write errors so we can keep track of this.
To post a comment you must log in.
- 1074. By Robert Carr
-
Typo
- 1075. By Robert Carr
-
Merge trunk and update to new frontend interfaces
- 1076. By Robert Carr
-
Update tests
Revision history for this message
Robert Carr (robertcarr) wrote : | # |
Fixed to use the error code, updating to trunk with the reorganization of some frontend interfaces (notably communicator_
- 1077. By Robert Carr
-
Merge development branch
Unmerged revisions
- 1077. By Robert Carr
-
Merge development branch
- 1076. By Robert Carr
-
Update tests
- 1075. By Robert Carr
-
Merge trunk and update to new frontend interfaces
- 1074. By Robert Carr
-
Typo
- 1073. By Robert Carr
-
socket_messenger: Report exceptions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '3rd_party/android-deps/android/input.h' |
2 | --- 3rd_party/android-deps/android/input.h 2013-05-03 16:38:07 +0000 |
3 | +++ 3rd_party/android-deps/android/input.h 2013-09-26 15:36:41 +0000 |
4 | @@ -460,27 +460,6 @@ |
5 | AINPUT_KEYBOARD_TYPE_ALPHABETIC = 2 |
6 | }; |
7 | |
8 | -/* |
9 | - * Constants used to retrieve information about the range of motion for a particular |
10 | - * coordinate of a motion event. |
11 | - * |
12 | - * Refer to the documentation on android.view.InputDevice for more details about input sources |
13 | - * and their correct interpretation. |
14 | - * |
15 | - * DEPRECATION NOTICE: These constants are deprecated. Use AMOTION_EVENT_AXIS_* constants instead. |
16 | - */ |
17 | -enum { |
18 | - AINPUT_MOTION_RANGE_X = AMOTION_EVENT_AXIS_X, |
19 | - AINPUT_MOTION_RANGE_Y = AMOTION_EVENT_AXIS_Y, |
20 | - AINPUT_MOTION_RANGE_PRESSURE = AMOTION_EVENT_AXIS_PRESSURE, |
21 | - AINPUT_MOTION_RANGE_SIZE = AMOTION_EVENT_AXIS_SIZE, |
22 | - AINPUT_MOTION_RANGE_TOUCH_MAJOR = AMOTION_EVENT_AXIS_TOUCH_MAJOR, |
23 | - AINPUT_MOTION_RANGE_TOUCH_MINOR = AMOTION_EVENT_AXIS_TOUCH_MINOR, |
24 | - AINPUT_MOTION_RANGE_TOOL_MAJOR = AMOTION_EVENT_AXIS_TOOL_MAJOR, |
25 | - AINPUT_MOTION_RANGE_TOOL_MINOR = AMOTION_EVENT_AXIS_TOOL_MINOR, |
26 | - AINPUT_MOTION_RANGE_ORIENTATION = AMOTION_EVENT_AXIS_ORIENTATION |
27 | -} __attribute__ ((deprecated)); |
28 | - |
29 | #ifdef __cplusplus |
30 | } |
31 | #endif |
32 | |
33 | === modified file '3rd_party/android-deps/std/PropertyMap.h' |
34 | --- 3rd_party/android-deps/std/PropertyMap.h 2013-05-03 16:38:07 +0000 |
35 | +++ 3rd_party/android-deps/std/PropertyMap.h 2013-09-26 15:36:41 +0000 |
36 | @@ -62,10 +62,20 @@ |
37 | /* Clears the property map. */ |
38 | void clear() { options = boost::program_options::variables_map(); } |
39 | |
40 | -// /* Adds a property. |
41 | -// * Replaces the property with the same key if it is already present. |
42 | -// */ |
43 | -// void addProperty(const String8& key, const String8& value); |
44 | + /* Adds a property. |
45 | + * Replaces the property with the same key if it is already present. |
46 | + */ |
47 | + void addProperty(const String8& key, const String8& value) |
48 | + { |
49 | + namespace po = boost::program_options; |
50 | + options.insert(std::make_pair(key, po::variable_value(value, false))); |
51 | + } |
52 | + |
53 | + void addAll(const PropertyMap* other) |
54 | + { |
55 | + options.insert(other->options.begin(), other->options.end()); |
56 | + } |
57 | + |
58 | // |
59 | // /* Returns true if the property map contains the specified key. */ |
60 | // bool hasProperty(const String8& key) const; |
61 | |
62 | === modified file '3rd_party/android-deps/std/Vector.h' |
63 | --- 3rd_party/android-deps/std/Vector.h 2013-03-13 04:54:15 +0000 |
64 | +++ 3rd_party/android-deps/std/Vector.h 2013-09-26 15:36:41 +0000 |
65 | @@ -62,7 +62,7 @@ |
66 | |
67 | /*! copy operator */ |
68 | // const Vector<ValueType>& operator = (const Vector<ValueType>& rhs) const; |
69 | - Vector<ValueType>& operator=(const Vector<ValueType>& rhs) = default; |
70 | + Vector<ValueType>& operator=(const Vector<ValueType>& /* rhs */) = default; |
71 | |
72 | // const Vector<ValueType>& operator = (const SortedVector<ValueType>& rhs) const; |
73 | // Vector<ValueType>& operator = (const SortedVector<ValueType>& rhs); |
74 | |
75 | === modified file '3rd_party/android-input/README' |
76 | --- 3rd_party/android-input/README 2012-11-06 18:05:11 +0000 |
77 | +++ 3rd_party/android-input/README 2013-09-26 15:36:41 +0000 |
78 | @@ -3,25 +3,6 @@ |
79 | |
80 | All the needed base, helper and utility classes (e.g. String8) were also brought along. |
81 | |
82 | -Subdirectories: |
83 | - * android_pristine - The original, unmodified, android files, as they were |
84 | - fetched from android's source tree. Here just as a reference |
85 | - to track the local modifications made. Useful when you want to |
86 | - update the project to the latest android source tree. |
87 | - * android - The android files, but with some modifications to work on this |
88 | - project. They are the ones that actually get compiled. |
89 | - |
90 | -We strive to keep a minimal delta between android and android_pristine to make easier |
91 | -for us to get all updates made by them on the android project. That is, to avoid |
92 | -forking that code and therefore having to maintain it all ourselves. We just maintain |
93 | -the delta/modifications instead. |
94 | - |
95 | -Running |
96 | -======= |
97 | - |
98 | -Set the following environment variables to something or any path, otherwise applications |
99 | -seg fault: ANDROID_ROOT, ANDROID_DATA |
100 | - |
101 | Debugging |
102 | ========= |
103 | |
104 | |
105 | === modified file '3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp' |
106 | --- 3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp 2013-03-13 04:54:15 +0000 |
107 | +++ 3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp 2013-09-26 15:36:41 +0000 |
108 | @@ -2553,7 +2553,8 @@ |
109 | TouchInputMapper::TouchInputMapper(InputDevice* device) : |
110 | InputMapper(device), |
111 | mSource(0), mDeviceMode(DEVICE_MODE_DISABLED), |
112 | - mSurfaceOrientation(-1), mSurfaceWidth(-1), mSurfaceHeight(-1) { |
113 | + mSurfaceOrientation(-1), mSurfaceWidth(-1), mSurfaceHeight(-1), |
114 | + mPointerUsage(POINTER_USAGE_NONE) { |
115 | } |
116 | |
117 | TouchInputMapper::~TouchInputMapper() { |
118 | |
119 | === modified file '3rd_party/android-input/android/frameworks/base/services/input/InputReader.h' |
120 | --- 3rd_party/android-input/android/frameworks/base/services/input/InputReader.h 2013-05-03 16:38:07 +0000 |
121 | +++ 3rd_party/android-input/android/frameworks/base/services/input/InputReader.h 2013-09-26 15:36:41 +0000 |
122 | @@ -602,8 +602,6 @@ |
123 | inline bool haveRelativeVWheel() const { return mHaveRelWheel; } |
124 | inline bool haveRelativeHWheel() const { return mHaveRelHWheel; } |
125 | |
126 | - inline int32_t getRelativeX() const { return mRelX; } |
127 | - inline int32_t getRelativeY() const { return mRelY; } |
128 | inline int32_t getRelativeVWheel() const { return mRelWheel; } |
129 | inline int32_t getRelativeHWheel() const { return mRelHWheel; } |
130 | |
131 | @@ -611,8 +609,6 @@ |
132 | bool mHaveRelWheel; |
133 | bool mHaveRelHWheel; |
134 | |
135 | - int32_t mRelX; |
136 | - int32_t mRelY; |
137 | int32_t mRelWheel; |
138 | int32_t mRelHWheel; |
139 | |
140 | |
141 | === modified file 'CMakeLists.txt' |
142 | --- CMakeLists.txt 2013-08-28 03:41:48 +0000 |
143 | +++ CMakeLists.txt 2013-09-26 15:36:41 +0000 |
144 | @@ -28,7 +28,7 @@ |
145 | |
146 | set(MIR_VERSION_MAJOR 0) |
147 | set(MIR_VERSION_MINOR 0) |
148 | -set(MIR_VERSION_PATCH 10) |
149 | +set(MIR_VERSION_PATCH 12) |
150 | |
151 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
152 | |
153 | |
154 | === modified file 'debian/changelog' |
155 | --- debian/changelog 2013-09-04 06:04:48 +0000 |
156 | +++ debian/changelog 2013-09-26 15:36:41 +0000 |
157 | @@ -1,3 +1,112 @@ |
158 | +mir (0.0.12+13.10.20130926.1-0ubuntu1) saucy; urgency=low |
159 | + |
160 | + [ kg ] |
161 | + * bump version for ABI break (LP: #1229212) |
162 | + |
163 | + [ Robert Ancell ] |
164 | + * Bump version to 0.0.12 |
165 | + |
166 | + [ Alexandros Frantzis ] |
167 | + * tests: Fix compiler warning about maybe-uninitialized struct member |
168 | + |
169 | + [ Ubuntu daily release ] |
170 | + * Automatic snapshot from revision 1084 |
171 | + |
172 | + -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Thu, 26 Sep 2013 08:39:29 +0000 |
173 | + |
174 | +mir (0.0.11+13.10.20130924.1-0ubuntu1) saucy; urgency=low |
175 | + |
176 | + [ kg ] |
177 | + * bump version for ABI break (LP: #1229212) |
178 | + |
179 | + [ Robert Ancell ] |
180 | + * Allow an application to override the options being populated. |
181 | + * Pass the program options to parse_options(). |
182 | + * Add missing include for std::cerr. |
183 | + * Report when paused and resumed via configuration. (LP: #1192843) |
184 | + * Add missing directory separator when searching for a config file to |
185 | + parse. |
186 | + |
187 | + [ Kevin Gunn ] |
188 | + * change test timeouts and fix fence. |
189 | + |
190 | + [ Alexandros Frantzis ] |
191 | + * examples: Only check key information for key events This fixes a |
192 | + memory error reported by valgrind for examples that use eglapp. |
193 | + * shell: Apply the base configuration on a hardware change only if no |
194 | + per-session configuration is active. |
195 | + * graphics: consolidated fixed for nested code and examples on android |
196 | + stack. |
197 | + |
198 | + [ Eleni Maria Stea ] |
199 | + * graphics: Pull in Eleni's changes to get the DRM fd to init GBM from |
200 | + the host Mir instance. |
201 | + |
202 | + [ Didier Roche ] |
203 | + * remove (unused in the ppa as we have libmirserver3) hack to force |
204 | + depending and building against the exact same version. |
205 | + |
206 | + [ Robert Carr ] |
207 | + * Add DPMS configuration API. (LP: #1193222) |
208 | + * Deduplicate mtd::NullDisplayConfig and |
209 | + mtd::NullDisplayConfiguration. |
210 | + * Fix multiple internal client surfaces on android. (LP: #1228144) |
211 | + * change test timeouts and fix fence. |
212 | + * Add DPMS API and GBM/android impls. |
213 | + |
214 | + [ Kevin DuBois ] |
215 | + * platform, graphics: support nested (mir-on-mir) rendering on the |
216 | + Android platform. |
217 | + |
218 | + [ Michael Terry ] |
219 | + * Change how Mir chooses socket locations to make it simpler for a |
220 | + nested-Mir world, by using MIR_SOCKET as the host socket if no other |
221 | + host socket is provided and passing MIR_SOCKET on to any children. |
222 | + Also, change --nested-mode to --host-socket for clarity and add -- |
223 | + standalone to force standalone mode. |
224 | + |
225 | + [ Daniel d'Andrada ] |
226 | + * android-input housekeeping - Updated README - Removed some dead |
227 | + code. |
228 | + |
229 | + [ Daniel van Vugt ] |
230 | + * Add DPMS configuration API. (LP: #1193222) |
231 | + * Add a "flags" field to MirBufferPackage so that clients can find out |
232 | + if the buffer they've been given is scanout-capable. This is |
233 | + normally something a client should never need to know. However there |
234 | + are two specialized cases where it's required to fix bugs in the |
235 | + intel and radeon X drivers: LP: #1218735, LP: #1218815 The intel |
236 | + fix (already landed) contains a hack which will be updated after |
237 | + this branch lands. (LP: #1218815, #1218735) |
238 | + * GBM: Ensure that we don't create scanout buffers if bypass is |
239 | + explicitly disabled from the environment. (LP: #1227133) . (LP: |
240 | + #1227133) |
241 | + |
242 | + [ Alan Griffiths ] |
243 | + * graphics: Pull in Eleni's changes to get the DRM fd to init GBM from |
244 | + the host Mir instance. |
245 | + * input: Separate the code for dispatching input from that reading it. |
246 | + * graphics: Hook up nested surfaces events to input. |
247 | + * input: Connect nested input relay to input dispatch. |
248 | + * graphics: Simplify NativeAndroidPlatform out of existence. |
249 | + * tests: Fixes to get the tests "passing" on android/arm stack. (LP: |
250 | + #1226284) |
251 | + * graphics: consolidated fixed for nested code and examples on android |
252 | + stack. |
253 | + * examples: add command-line options to examples so the Mir server |
254 | + connection can be selected. |
255 | + * change test timeouts and fix fence. |
256 | + * client: Add client side support for connecting via an existing FD. |
257 | + |
258 | + [ Łukasz 'sil2100' Zemczak ] |
259 | + * Revert revision 1054 ABI-change (the libmirclient3 one), which seems |
260 | + to cause a lot of problems. |
261 | + |
262 | + [ Ubuntu daily release ] |
263 | + * Automatic snapshot from revision 1081 |
264 | + |
265 | + -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 24 Sep 2013 06:04:59 +0000 |
266 | + |
267 | mir (0.0.10+13.10.20130904-0ubuntu1) saucy; urgency=low |
268 | |
269 | [ Kevin DuBois ] |
270 | |
271 | === modified file 'debian/control' |
272 | --- debian/control 2013-09-18 13:59:53 +0000 |
273 | +++ debian/control 2013-09-26 15:36:41 +0000 |
274 | @@ -69,7 +69,7 @@ |
275 | . |
276 | Contains the protocol's definition files. |
277 | |
278 | -Package: libmirserver3 |
279 | +Package: libmirserver4 |
280 | Section: libs |
281 | Architecture: i386 amd64 armhf arm64 |
282 | Multi-Arch: same |
283 | @@ -115,7 +115,7 @@ |
284 | Architecture: i386 amd64 armhf arm64 |
285 | Multi-Arch: same |
286 | Pre-Depends: ${misc:Pre-Depends} |
287 | -Depends: libmirserver3 (= ${binary:Version}), |
288 | +Depends: libmirserver4 (= ${binary:Version}), |
289 | libmirprotobuf-dev (= ${binary:Version}), |
290 | mircommon-dev (= ${binary:Version}), |
291 | libglm-dev, |
292 | @@ -127,7 +127,7 @@ |
293 | . |
294 | Contains header files required to build Mir servers. |
295 | |
296 | -Package: libmirclient2 |
297 | +Package: libmirclient3 |
298 | Section: libs |
299 | Architecture: i386 amd64 armhf arm64 |
300 | Multi-Arch: same |
301 | @@ -145,7 +145,7 @@ |
302 | Architecture: i386 amd64 armhf arm64 |
303 | Multi-Arch: same |
304 | Pre-Depends: ${misc:Pre-Depends} |
305 | -Depends: libmirclient2 (= ${binary:Version}), |
306 | +Depends: libmirclient3 (= ${binary:Version}), |
307 | libmirprotobuf-dev (= ${binary:Version}), |
308 | mircommon-dev (= ${binary:Version}), |
309 | ${misc:Depends}, |
310 | |
311 | === renamed file 'debian/libmirclient2.install' => 'debian/libmirclient3.install' |
312 | --- debian/libmirclient2.install 2013-09-11 17:00:39 +0000 |
313 | +++ debian/libmirclient3.install 2013-09-26 15:36:41 +0000 |
314 | @@ -1,1 +1,1 @@ |
315 | -usr/lib/*/libmirclient.so.2 |
316 | +usr/lib/*/libmirclient.so.3 |
317 | |
318 | === renamed file 'debian/libmirserver3.install' => 'debian/libmirserver4.install' |
319 | --- debian/libmirserver3.install 2013-09-18 13:59:53 +0000 |
320 | +++ debian/libmirserver4.install 2013-09-26 15:36:41 +0000 |
321 | @@ -1,1 +1,1 @@ |
322 | -usr/lib/*/libmirserver.so.3 |
323 | +usr/lib/*/libmirserver.so.4 |
324 | |
325 | === modified file 'debian/rules' |
326 | --- debian/rules 2013-08-28 03:41:48 +0000 |
327 | +++ debian/rules 2013-09-26 15:36:41 +0000 |
328 | @@ -38,5 +38,4 @@ |
329 | |
330 | # TODO: we'll use a symbol file once mir is abi stable |
331 | override_dh_makeshlibs: |
332 | - dh_makeshlibs -p libmirserver1 -V 'libmirserver1 (= ${EXACT_PACKAGE_VERSION})' |
333 | - dh_makeshlibs --remaining-packages -V |
334 | + dh_makeshlibs -V |
335 | |
336 | === modified file 'doc/debug_for_xmir.md' |
337 | --- doc/debug_for_xmir.md 2013-09-11 17:00:39 +0000 |
338 | +++ doc/debug_for_xmir.md 2013-09-26 15:36:41 +0000 |
339 | @@ -78,7 +78,7 @@ |
340 | XMir component versions used and the use case steps. You may check the versions |
341 | of key XMir components by the following |
342 | |
343 | - dpkg -s libmirclient1 | grep Version |
344 | + dpkg -s libmirclient3 | grep Version |
345 | dpkg -s libmirserver0 | grep Version |
346 | dpkg -s lightdm | grep Version |
347 | dpkg -s unity-system-compositor | grep Version |
348 | |
349 | === modified file 'examples/basic_server.cpp' |
350 | --- examples/basic_server.cpp 2013-08-29 03:48:16 +0000 |
351 | +++ examples/basic_server.cpp 2013-09-26 15:36:41 +0000 |
352 | @@ -16,18 +16,53 @@ |
353 | * Authored by: Alan Griffiths <alan@octopull.co.uk> |
354 | */ |
355 | |
356 | +#include "server_configuration.h" |
357 | + |
358 | +#include "mir/abnormal_exit.h" |
359 | +#include "mir/frontend/connector.h" |
360 | +#include "mir/options/option.h" |
361 | +#include "mir/report_exception.h" |
362 | #include "mir/run_mir.h" |
363 | -#include "mir/report_exception.h" |
364 | -#include "server_configuration.h" |
365 | |
366 | #include <iostream> |
367 | |
368 | +namespace |
369 | +{ |
370 | +char const* const launch_child_opt = "launch-client"; |
371 | + |
372 | +struct ServerConfiguration : mir::examples::ServerConfiguration |
373 | +{ |
374 | + ServerConfiguration(int argc, char const** argv) : |
375 | + mir::examples::ServerConfiguration(argc, argv) |
376 | + { |
377 | + namespace po = boost::program_options; |
378 | + |
379 | + add_options() |
380 | + (launch_child_opt, po::value<std::string>(), "system() command to launch client"); |
381 | + } |
382 | + |
383 | + void launch_client() |
384 | + { |
385 | + if (the_options()->is_set(launch_child_opt)) |
386 | + { |
387 | + char buffer[128] = {0}; |
388 | + sprintf(buffer, "fd://%d", the_connector()->client_socket_fd()); |
389 | + setenv("MIR_SOCKET", buffer, 1); |
390 | + auto ignore = system((the_options()->get(launch_child_opt, "") + "&").c_str()); |
391 | + (void)ignore; |
392 | + } |
393 | + } |
394 | + |
395 | + using mir::examples::ServerConfiguration::the_options; |
396 | +}; |
397 | +} |
398 | + |
399 | int main(int argc, char const* argv[]) |
400 | try |
401 | { |
402 | - mir::examples::ServerConfiguration config(argc, argv); |
403 | + ServerConfiguration config(argc, argv); |
404 | |
405 | - run_mir(config, [](mir::DisplayServer&) {/* empty init */}); |
406 | + run_mir(config, [&](mir::DisplayServer&){ config.launch_client(); }); |
407 | return 0; |
408 | } |
409 | catch (...) |
410 | |
411 | === modified file 'examples/demo-shell/demo_shell.cpp' |
412 | --- examples/demo-shell/demo_shell.cpp 2013-08-28 03:41:48 +0000 |
413 | +++ examples/demo-shell/demo_shell.cpp 2013-09-26 15:36:41 +0000 |
414 | @@ -98,6 +98,8 @@ |
415 | // and the SessionStore |
416 | wm->set_focus_controller(config.the_focus_controller()); |
417 | wm->set_session_manager(config.the_session_manager()); |
418 | + wm->set_display(config.the_display()); |
419 | + wm->set_compositor(config.the_compositor()); |
420 | }); |
421 | return 0; |
422 | } |
423 | |
424 | === modified file 'examples/demo-shell/window_manager.cpp' |
425 | --- examples/demo-shell/window_manager.cpp 2013-08-28 03:41:48 +0000 |
426 | +++ examples/demo-shell/window_manager.cpp 2013-09-26 15:36:41 +0000 |
427 | @@ -22,6 +22,9 @@ |
428 | #include "mir/shell/session_manager.h" |
429 | #include "mir/shell/session.h" |
430 | #include "mir/shell/surface.h" |
431 | +#include "mir/graphics/display.h" |
432 | +#include "mir/graphics/display_configuration.h" |
433 | +#include "mir/compositor/compositor.h" |
434 | |
435 | #include <linux/input.h> |
436 | |
437 | @@ -30,6 +33,8 @@ |
438 | |
439 | namespace me = mir::examples; |
440 | namespace msh = mir::shell; |
441 | +namespace mg = mir::graphics; |
442 | +namespace mc = mir::compositor; |
443 | |
444 | namespace |
445 | { |
446 | @@ -52,6 +57,16 @@ |
447 | session_manager = sm; |
448 | } |
449 | |
450 | +void me::WindowManager::set_display(std::shared_ptr<mg::Display> const& dpy) |
451 | +{ |
452 | + display = dpy; |
453 | +} |
454 | + |
455 | +void me::WindowManager::set_compositor(std::shared_ptr<mc::Compositor> const& cptor) |
456 | +{ |
457 | + compositor = cptor; |
458 | +} |
459 | + |
460 | mir::geometry::Point average_pointer(MirMotionEvent const& motion) |
461 | { |
462 | using namespace mir; |
463 | @@ -73,15 +88,46 @@ |
464 | |
465 | bool me::WindowManager::handle(MirEvent const& event) |
466 | { |
467 | + // TODO: Fix android configuration and remove static hack ~racarr |
468 | + static bool display_off = false; |
469 | assert(focus_controller); |
470 | + assert(display); |
471 | + assert(compositor); |
472 | |
473 | if (event.key.type == mir_event_type_key && |
474 | - event.key.action == mir_key_action_down && |
475 | - event.key.modifiers & mir_key_modifier_alt && |
476 | - event.key.scan_code == KEY_TAB) // TODO: Use keycode once we support keymapping on the server side |
477 | + event.key.action == mir_key_action_down) |
478 | { |
479 | - focus_controller->focus_next(); |
480 | - return true; |
481 | + if (event.key.modifiers & mir_key_modifier_alt && |
482 | + event.key.scan_code == KEY_TAB) // TODO: Use keycode once we support keymapping on the server side |
483 | + { |
484 | + focus_controller->focus_next(); |
485 | + return true; |
486 | + } |
487 | + if (event.key.modifiers & mir_key_modifier_alt && event.key.scan_code == KEY_P) |
488 | + { |
489 | + compositor->stop(); |
490 | + auto conf = display->configuration(); |
491 | + conf->for_each_output([&](mg::DisplayConfigurationOutput const& output) -> void |
492 | + { |
493 | + MirPowerMode power_mode; |
494 | + if (!output.used) return; |
495 | + |
496 | + if (display_off == true) |
497 | + power_mode = mir_power_mode_on; |
498 | + else |
499 | + power_mode = mir_power_mode_off; |
500 | + |
501 | + conf->configure_output(output.id, output.used, |
502 | + output.top_left, |
503 | + output.current_mode_index, |
504 | + power_mode); |
505 | + }); |
506 | + display_off = !display_off; |
507 | + |
508 | + display->configure(*conf.get()); |
509 | + compositor->start(); |
510 | + return true; |
511 | + } |
512 | } |
513 | else if (event.type == mir_event_type_motion && |
514 | session_manager) |
515 | |
516 | === modified file 'examples/demo-shell/window_manager.h' |
517 | --- examples/demo-shell/window_manager.h 2013-08-28 03:41:48 +0000 |
518 | +++ examples/demo-shell/window_manager.h 2013-09-26 15:36:41 +0000 |
519 | @@ -31,6 +31,14 @@ |
520 | class FocusController; |
521 | class SessionManager; |
522 | } |
523 | +namespace graphics |
524 | +{ |
525 | +class Display; |
526 | +} |
527 | +namespace compositor |
528 | +{ |
529 | +class Compositor; |
530 | +} |
531 | namespace examples |
532 | { |
533 | |
534 | @@ -42,6 +50,8 @@ |
535 | |
536 | void set_focus_controller(std::shared_ptr<shell::FocusController> const& focus_controller); |
537 | void set_session_manager(std::shared_ptr<shell::SessionManager> const& sm); |
538 | + void set_display(std::shared_ptr<graphics::Display> const& display); |
539 | + void set_compositor(std::shared_ptr<compositor::Compositor> const& compositor); |
540 | |
541 | bool handle(MirEvent const& event) override; |
542 | |
543 | @@ -52,6 +62,9 @@ |
544 | private: |
545 | std::shared_ptr<shell::FocusController> focus_controller; |
546 | std::shared_ptr<shell::SessionManager> session_manager; |
547 | + std::shared_ptr<graphics::Display> display; |
548 | + std::shared_ptr<compositor::Compositor> compositor; |
549 | + |
550 | geometry::Displacement relative_click; // Click location in window space |
551 | geometry::Point click; // Click location in screen space |
552 | int max_fingers; // Maximum number of fingers touched during gesture |
553 | |
554 | === modified file 'examples/demo_client_display_config.c' |
555 | --- examples/demo_client_display_config.c 2013-09-11 17:00:39 +0000 |
556 | +++ examples/demo_client_display_config.c 2013-09-26 15:36:41 +0000 |
557 | @@ -35,17 +35,46 @@ |
558 | configuration_mode_unknown, |
559 | configuration_mode_clone, |
560 | configuration_mode_horizontal, |
561 | - configuration_mode_vertical |
562 | + configuration_mode_vertical, |
563 | + configuration_mode_single |
564 | } ConfigurationMode; |
565 | |
566 | struct ClientContext |
567 | { |
568 | MirConnection *connection; |
569 | ConfigurationMode mode; |
570 | + int mode_data; |
571 | volatile sig_atomic_t running; |
572 | volatile sig_atomic_t reconfigure; |
573 | }; |
574 | |
575 | +static void print_current_configuration(MirConnection *connection) |
576 | +{ |
577 | + MirDisplayConfiguration *conf = mir_connection_create_display_config(connection); |
578 | + |
579 | + for (uint32_t i = 0; i < conf->num_outputs; i++) |
580 | + { |
581 | + MirDisplayOutput *output = &conf->outputs[i]; |
582 | + printf("Output id: %d connected: %d used: %d position_x: %d position_y: %d", |
583 | + output->output_id, output->connected, |
584 | + output->used, output->position_x, output->position_y); |
585 | + if (output->current_mode < output->num_modes) |
586 | + { |
587 | + MirDisplayMode *mode = &output->modes[output->current_mode]; |
588 | + printf(" mode: %dx%d@%.2f\n", |
589 | + mode->horizontal_resolution, |
590 | + mode->vertical_resolution, |
591 | + mode->refresh_rate); |
592 | + } |
593 | + else |
594 | + { |
595 | + printf("\n"); |
596 | + } |
597 | + } |
598 | + |
599 | + mir_display_config_destroy(conf); |
600 | +} |
601 | + |
602 | static int apply_configuration(MirConnection *connection, MirDisplayConfiguration *conf) |
603 | { |
604 | MirWaitHandle* handle = mir_connection_apply_display_config(connection, conf); |
605 | @@ -120,7 +149,36 @@ |
606 | } |
607 | } |
608 | |
609 | -static void configure_display(struct ClientContext *context, ConfigurationMode mode) |
610 | +static void configure_display_single(struct MirDisplayConfiguration *conf, int output_num) |
611 | +{ |
612 | + uint32_t num_connected = 0; |
613 | + uint32_t output_to_enable = output_num; |
614 | + |
615 | + for (uint32_t i = 0; i < conf->num_outputs; i++) |
616 | + { |
617 | + MirDisplayOutput *output = &conf->outputs[i]; |
618 | + if (output->connected && output->num_modes > 0) |
619 | + ++num_connected; |
620 | + } |
621 | + |
622 | + if (output_to_enable > num_connected) |
623 | + output_to_enable = num_connected; |
624 | + |
625 | + for (uint32_t i = 0; i < conf->num_outputs; i++) |
626 | + { |
627 | + MirDisplayOutput *output = &conf->outputs[i]; |
628 | + if (output->connected && output->num_modes > 0) |
629 | + { |
630 | + output->used = (--output_to_enable == 0); |
631 | + output->current_mode = 0; |
632 | + output->position_x = 0; |
633 | + output->position_y = 0; |
634 | + } |
635 | + } |
636 | +} |
637 | + |
638 | +static void configure_display(struct ClientContext *context, ConfigurationMode mode, |
639 | + int mode_data) |
640 | { |
641 | MirDisplayConfiguration *conf = |
642 | mir_connection_create_display_config(context->connection); |
643 | @@ -140,9 +198,18 @@ |
644 | configure_display_horizontal(conf); |
645 | printf("Applying horizontal configuration: "); |
646 | } |
647 | + else if (mode == configuration_mode_single) |
648 | + { |
649 | + configure_display_single(conf, mode_data); |
650 | + printf("Applying single configuration for output %d: ", mode_data); |
651 | + } |
652 | |
653 | if (apply_configuration(context->connection, conf)) |
654 | + { |
655 | context->mode = mode; |
656 | + context->mode_data = mode_data; |
657 | + } |
658 | + |
659 | mir_display_config_destroy(conf); |
660 | } |
661 | |
662 | @@ -152,17 +219,7 @@ |
663 | |
664 | printf("=== Display configuration changed === \n"); |
665 | |
666 | - MirDisplayConfiguration *conf = mir_connection_create_display_config(connection); |
667 | - |
668 | - for (uint32_t i = 0; i < conf->num_outputs; i++) |
669 | - { |
670 | - MirDisplayOutput *output = &conf->outputs[i]; |
671 | - printf("Output id: %d connected: %d used: %d position_x: %d position_y: %d\n", |
672 | - output->output_id, output->connected, |
673 | - output->used, output->position_x, output->position_y); |
674 | - } |
675 | - |
676 | - mir_display_config_destroy(conf); |
677 | + print_current_configuration(connection); |
678 | |
679 | struct ClientContext *ctx = (struct ClientContext*) context; |
680 | ctx->reconfigure = 1; |
681 | @@ -183,15 +240,25 @@ |
682 | } |
683 | else if (event->key.key_code == XKB_KEY_c) |
684 | { |
685 | - configure_display(ctx, configuration_mode_clone); |
686 | + configure_display(ctx, configuration_mode_clone, 0); |
687 | } |
688 | else if (event->key.key_code == XKB_KEY_h) |
689 | { |
690 | - configure_display(ctx, configuration_mode_horizontal); |
691 | + configure_display(ctx, configuration_mode_horizontal, 0); |
692 | } |
693 | else if (event->key.key_code == XKB_KEY_v) |
694 | { |
695 | - configure_display(ctx, configuration_mode_vertical); |
696 | + configure_display(ctx, configuration_mode_vertical, 0); |
697 | + } |
698 | + else if (event->key.key_code >= XKB_KEY_1 && |
699 | + event->key.key_code <= XKB_KEY_9) |
700 | + { |
701 | + configure_display(ctx, configuration_mode_single, |
702 | + event->key.key_code - XKB_KEY_0); |
703 | + } |
704 | + else if (event->key.key_code == XKB_KEY_p) |
705 | + { |
706 | + print_current_configuration(ctx->connection); |
707 | } |
708 | } |
709 | } |
710 | @@ -203,10 +270,13 @@ |
711 | if (!mir_eglapp_init(argc, argv, &width, &height)) |
712 | { |
713 | printf("A demo client that allows changing the display configuration. While the client\n" |
714 | - "has the focus, use the following keys to change the display configuration:\n" |
715 | + "has the focus, use the following keys to change and get information about the\n" |
716 | + "display configuration:\n" |
717 | " c: clone outputs\n" |
718 | " h: arrange outputs horizontally in the virtual space\n" |
719 | - " v: arrange outputs vertically in the virtual space\n"); |
720 | + " v: arrange outputs vertically in the virtual space\n" |
721 | + " 1-9: enable only the Nth connected output (in the order returned by the hardware)\n" |
722 | + " p: print current display configuration\n"); |
723 | |
724 | return 1; |
725 | } |
726 | @@ -214,7 +284,7 @@ |
727 | MirConnection *connection = mir_eglapp_native_connection(); |
728 | MirSurface *surface = mir_eglapp_native_surface(); |
729 | |
730 | - struct ClientContext ctx = {connection, configuration_mode_unknown, 1, 0}; |
731 | + struct ClientContext ctx = {connection, configuration_mode_unknown, 0, 1, 0}; |
732 | mir_connection_set_display_config_change_callback( |
733 | connection, display_change_callback, &ctx); |
734 | |
735 | @@ -236,7 +306,7 @@ |
736 | |
737 | if (ctx.reconfigure) |
738 | { |
739 | - configure_display(&ctx, ctx.mode); |
740 | + configure_display(&ctx, ctx.mode, ctx.mode_data); |
741 | ctx.reconfigure = 0; |
742 | } |
743 | } |
744 | |
745 | === modified file 'examples/render_surfaces.cpp' |
746 | --- examples/render_surfaces.cpp 2013-09-16 18:27:02 +0000 |
747 | +++ examples/render_surfaces.cpp 2013-09-26 15:36:41 +0000 |
748 | @@ -19,7 +19,7 @@ |
749 | #include "mir/compositor/default_display_buffer_compositor_factory.h" |
750 | #include "mir/compositor/display_buffer_compositor.h" |
751 | #include "mir/graphics/graphic_buffer_allocator.h" |
752 | -#include "mir/frontend/communicator.h" |
753 | +#include "mir/frontend/connector.h" |
754 | #include "mir/shell/surface_creation_parameters.h" |
755 | #include "mir/geometry/size.h" |
756 | #include "mir/geometry/rectangles.h" |
757 | @@ -266,15 +266,16 @@ |
758 | |
759 | ///\internal [RenderSurfacesServerConfiguration_stubs_tag] |
760 | // Stub out server connectivity. |
761 | - std::shared_ptr<mf::Communicator> the_communicator() override |
762 | + std::shared_ptr<mf::Connector> the_connector() override |
763 | { |
764 | - struct NullCommunicator : public mf::Communicator |
765 | + struct NullConnector : public mf::Connector |
766 | { |
767 | void start() {} |
768 | void stop() {} |
769 | + int client_socket_fd() const override { return 0; } |
770 | }; |
771 | |
772 | - return std::make_shared<NullCommunicator>(); |
773 | + return std::make_shared<NullConnector>(); |
774 | } |
775 | ///\internal [RenderSurfacesServerConfiguration_stubs_tag] |
776 | |
777 | |
778 | === modified file 'examples/server_configuration.cpp' |
779 | --- examples/server_configuration.cpp 2013-09-11 17:00:39 +0000 |
780 | +++ examples/server_configuration.cpp 2013-09-26 15:36:41 +0000 |
781 | @@ -52,13 +52,13 @@ |
782 | if (conf_output.connected && conf_output.modes.size() > 0) |
783 | { |
784 | conf.configure_output(conf_output.id, true, geom::Point{max_x, 0}, |
785 | - preferred_mode_index); |
786 | + preferred_mode_index, mir_power_mode_on); |
787 | max_x += conf_output.modes[preferred_mode_index].size.width.as_int(); |
788 | } |
789 | else |
790 | { |
791 | conf.configure_output(conf_output.id, false, conf_output.top_left, |
792 | - conf_output.current_mode_index); |
793 | + conf_output.current_mode_index, mir_power_mode_on); |
794 | } |
795 | }); |
796 | } |
797 | @@ -78,13 +78,13 @@ |
798 | if (!done && conf_output.connected && conf_output.modes.size() > 0) |
799 | { |
800 | conf.configure_output(conf_output.id, true, geom::Point{0, 0}, |
801 | - preferred_mode_index); |
802 | + preferred_mode_index, mir_power_mode_on); |
803 | done = true; |
804 | } |
805 | else |
806 | { |
807 | conf.configure_output(conf_output.id, false, conf_output.top_left, |
808 | - conf_output.current_mode_index); |
809 | + conf_output.current_mode_index, mir_power_mode_on); |
810 | } |
811 | }); |
812 | } |
813 | |
814 | === modified file 'include/platform/mir/graphics/display_buffer.h' |
815 | --- include/platform/mir/graphics/display_buffer.h 2013-08-28 03:41:48 +0000 |
816 | +++ include/platform/mir/graphics/display_buffer.h 2013-09-26 15:36:41 +0000 |
817 | @@ -20,6 +20,7 @@ |
818 | #define MIR_GRAPHICS_DISPLAY_BUFFER_H_ |
819 | |
820 | #include <mir/geometry/rectangle.h> |
821 | + |
822 | #include <memory> |
823 | |
824 | namespace mir |
825 | |
826 | === modified file 'include/platform/mir/graphics/display_configuration.h' |
827 | --- include/platform/mir/graphics/display_configuration.h 2013-09-11 17:00:39 +0000 |
828 | +++ include/platform/mir/graphics/display_configuration.h 2013-09-26 15:36:41 +0000 |
829 | @@ -23,6 +23,7 @@ |
830 | #include "mir/geometry/size.h" |
831 | #include "mir/geometry/point.h" |
832 | #include "mir/geometry/pixel_format.h" |
833 | +#include "mir_toolkit/common.h" |
834 | |
835 | #include <functional> |
836 | #include <vector> |
837 | @@ -105,6 +106,8 @@ |
838 | size_t current_mode_index; |
839 | /** The index in the 'pixel_format' vector of the current output pixel format. */ |
840 | size_t current_format_index; |
841 | + /** Current power mode **/ |
842 | + MirPowerMode power_mode; |
843 | }; |
844 | |
845 | std::ostream& operator<<(std::ostream& out, DisplayConfigurationCard const& val); |
846 | @@ -134,7 +137,7 @@ |
847 | |
848 | /** Configures an output. */ |
849 | virtual void configure_output(DisplayConfigurationOutputId id, bool used, |
850 | - geometry::Point top_left, size_t mode_index) = 0; |
851 | + geometry::Point top_left, size_t mode_index, MirPowerMode power_mode) = 0; |
852 | |
853 | protected: |
854 | DisplayConfiguration() = default; |
855 | |
856 | === added file 'include/server/mir/default_pause_resume_listener.h' |
857 | --- include/server/mir/default_pause_resume_listener.h 1970-01-01 00:00:00 +0000 |
858 | +++ include/server/mir/default_pause_resume_listener.h 2013-09-26 15:36:41 +0000 |
859 | @@ -0,0 +1,40 @@ |
860 | +/* |
861 | + * Copyright © 2013 Canonical Ltd. |
862 | + * |
863 | + * This program is free software: you can redistribute it and/or modify it |
864 | + * under the terms of the GNU General Public License version 3, |
865 | + * as published by the Free Software Foundation. |
866 | + * |
867 | + * This program is distributed in the hope that it will be useful, |
868 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
869 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
870 | + * GNU General Public License for more details. |
871 | + * |
872 | + * You should have received a copy of the GNU General Public License |
873 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
874 | + * |
875 | + * Authored by: Robert Ancell <robert.ancell@canonical.com> |
876 | + */ |
877 | + |
878 | +#ifndef MIR_DEFAULT_PAUSE_RESUME_LISTENER_H_ |
879 | +#define MIR_DEFAULT_PAUSE_RESUME_LISTENER_H_ |
880 | + |
881 | +#include "mir/pause_resume_listener.h" |
882 | + |
883 | +namespace mir |
884 | +{ |
885 | +class DefaultPauseResumeListener : public virtual PauseResumeListener |
886 | +{ |
887 | +public: |
888 | + virtual void paused() |
889 | + { |
890 | + } |
891 | + |
892 | + virtual void resumed() |
893 | + { |
894 | + } |
895 | +}; |
896 | + |
897 | +} |
898 | + |
899 | +#endif /* MIR_DEFAULT_PAUSE_RESUME_LISTENER_H_ */ |
900 | |
901 | === modified file 'include/server/mir/default_server_configuration.h' |
902 | --- include/server/mir/default_server_configuration.h 2013-09-18 21:19:22 +0000 |
903 | +++ include/server/mir/default_server_configuration.h 2013-09-26 15:36:41 +0000 |
904 | @@ -41,10 +41,12 @@ |
905 | namespace frontend |
906 | { |
907 | class Shell; |
908 | -class Communicator; |
909 | +class Connector; |
910 | class ProtobufIpcFactory; |
911 | +class SessionCreator; |
912 | class SessionMediatorReport; |
913 | class MessageProcessorReport; |
914 | +class MessengerReport; |
915 | class SessionAuthorizer; |
916 | class EventSink; |
917 | class DisplayChanger; |
918 | @@ -118,11 +120,12 @@ |
919 | /** @name DisplayServer dependencies |
920 | * dependencies of DisplayServer on the rest of the Mir |
921 | * @{ */ |
922 | - virtual std::shared_ptr<frontend::Communicator> the_communicator(); |
923 | + virtual std::shared_ptr<frontend::Connector> the_connector(); |
924 | virtual std::shared_ptr<graphics::Display> the_display(); |
925 | virtual std::shared_ptr<compositor::Compositor> the_compositor(); |
926 | virtual std::shared_ptr<input::InputManager> the_input_manager(); |
927 | virtual std::shared_ptr<MainLoop> the_main_loop(); |
928 | + virtual std::shared_ptr<PauseResumeListener> the_pause_resume_listener(); |
929 | virtual std::shared_ptr<DisplayChanger> the_display_changer(); |
930 | virtual std::shared_ptr<graphics::Platform> the_graphics_platform(); |
931 | virtual std::shared_ptr<input::InputConfiguration> the_input_configuration(); |
932 | @@ -163,10 +166,16 @@ |
933 | * @{ */ |
934 | virtual std::shared_ptr<frontend::SessionMediatorReport> the_session_mediator_report(); |
935 | virtual std::shared_ptr<frontend::MessageProcessorReport> the_message_processor_report(); |
936 | + virtual std::shared_ptr<frontend::MessengerReport> the_messenger_report(); |
937 | virtual std::shared_ptr<frontend::SessionAuthorizer> the_session_authorizer(); |
938 | virtual std::shared_ptr<frontend::Shell> the_frontend_shell(); |
939 | virtual std::shared_ptr<frontend::EventSink> the_global_event_sink(); |
940 | virtual std::shared_ptr<frontend::DisplayChanger> the_frontend_display_changer(); |
941 | + /** @name frontend configuration - internal dependencies |
942 | + * internal dependencies of frontend |
943 | + * @{ */ |
944 | + virtual std::shared_ptr<frontend::SessionCreator> the_session_creator(); |
945 | + /** @} */ |
946 | /** @} */ |
947 | |
948 | virtual std::shared_ptr<shell::FocusController> the_focus_controller(); |
949 | @@ -242,7 +251,7 @@ |
950 | virtual std::shared_ptr<shell::MediatingDisplayChanger> the_mediating_display_changer(); |
951 | virtual std::shared_ptr<shell::BroadcastingSessionEventSink> the_broadcasting_session_event_sink(); |
952 | |
953 | - CachedPtr<frontend::Communicator> communicator; |
954 | + CachedPtr<frontend::Connector> connector; |
955 | CachedPtr<shell::SessionManager> session_manager; |
956 | |
957 | |
958 | @@ -263,8 +272,10 @@ |
959 | CachedPtr<frontend::ProtobufIpcFactory> ipc_factory; |
960 | CachedPtr<frontend::SessionMediatorReport> session_mediator_report; |
961 | CachedPtr<frontend::MessageProcessorReport> message_processor_report; |
962 | + CachedPtr<frontend::MessengerReport> messenger_report; |
963 | CachedPtr<frontend::SessionAuthorizer> session_authorizer; |
964 | CachedPtr<frontend::EventSink> global_event_sink; |
965 | + CachedPtr<frontend::SessionCreator> session_creator; |
966 | CachedPtr<compositor::RendererFactory> renderer_factory; |
967 | CachedPtr<compositor::BufferStreamFactory> buffer_stream_factory; |
968 | CachedPtr<surfaces::SurfaceStack> surface_stack; |
969 | @@ -286,6 +297,7 @@ |
970 | CachedPtr<surfaces::SurfaceController> surface_controller; |
971 | CachedPtr<time::TimeSource> time_source; |
972 | CachedPtr<MainLoop> main_loop; |
973 | + CachedPtr<PauseResumeListener> pause_resume_listener; |
974 | CachedPtr<graphics::DisplayConfigurationPolicy> display_configuration_policy; |
975 | CachedPtr<graphics::nested::HostConnection> host_connection; |
976 | CachedPtr<input::NestedInputRelay> nested_input_relay; |
977 | |
978 | === renamed file 'include/server/mir/frontend/communicator.h' => 'include/server/mir/frontend/connector.h' |
979 | --- include/server/mir/frontend/communicator.h 2013-04-25 09:48:54 +0000 |
980 | +++ include/server/mir/frontend/connector.h 2013-09-26 15:36:41 +0000 |
981 | @@ -16,29 +16,29 @@ |
982 | * Authored by: Thomas Voss <thomas.voss@canonical.com> |
983 | */ |
984 | |
985 | -#ifndef MIR_FRONTEND_COMMUNICATOR_H_ |
986 | -#define MIR_FRONTEND_COMMUNICATOR_H_ |
987 | +#ifndef MIR_FRONTEND_CONNECTOR_H_ |
988 | +#define MIR_FRONTEND_CONNECTOR_H_ |
989 | |
990 | namespace mir |
991 | { |
992 | namespace frontend |
993 | { |
994 | - |
995 | -class Communicator |
996 | +/// Handle client process connections |
997 | +class Connector |
998 | { |
999 | public: |
1000 | - virtual ~Communicator() {} |
1001 | - |
1002 | virtual void start() = 0; |
1003 | virtual void stop() = 0; |
1004 | |
1005 | + virtual int client_socket_fd() const = 0; |
1006 | + |
1007 | protected: |
1008 | - Communicator() = default; |
1009 | - Communicator(const Communicator&) = delete; |
1010 | - Communicator& operator=(const Communicator&) = delete; |
1011 | + Connector() = default; |
1012 | + virtual ~Connector() = default; |
1013 | + Connector(const Connector&) = delete; |
1014 | + Connector& operator=(const Connector&) = delete; |
1015 | }; |
1016 | - |
1017 | -} |
1018 | -} |
1019 | - |
1020 | -#endif // MIR_FRONTEND_COMMUNICATOR_H_ |
1021 | +} |
1022 | +} |
1023 | + |
1024 | +#endif // MIR_FRONTEND_CONNECTOR_H_ |
1025 | |
1026 | === renamed file 'include/server/mir/frontend/communicator_report.h' => 'include/server/mir/frontend/connector_report.h' |
1027 | --- include/server/mir/frontend/communicator_report.h 2013-06-19 16:14:40 +0000 |
1028 | +++ include/server/mir/frontend/connector_report.h 2013-09-26 15:36:41 +0000 |
1029 | @@ -16,8 +16,8 @@ |
1030 | * Authored by: Alan Griffiths <alan@octopull.co.uk |
1031 | */ |
1032 | |
1033 | -#ifndef MIR_FRONTEND_COMMUNICATOR_REPORT_H_ |
1034 | -#define MIR_FRONTEND_COMMUNICATOR_REPORT_H_ |
1035 | +#ifndef MIR_FRONTEND_CONNECTOR_REPORT_H_ |
1036 | +#define MIR_FRONTEND_CONNECTOR_REPORT_H_ |
1037 | |
1038 | #include <stdexcept> |
1039 | |
1040 | @@ -26,26 +26,25 @@ |
1041 | namespace frontend |
1042 | { |
1043 | |
1044 | -class CommunicatorReport |
1045 | +class ConnectorReport |
1046 | { |
1047 | public: |
1048 | |
1049 | virtual void error(std::exception const& error) = 0; |
1050 | |
1051 | protected: |
1052 | - virtual ~CommunicatorReport() = default; |
1053 | - CommunicatorReport() = default; |
1054 | - CommunicatorReport(const CommunicatorReport&) = delete; |
1055 | - CommunicatorReport& operator=(const CommunicatorReport&) = delete; |
1056 | + virtual ~ConnectorReport() = default; |
1057 | + ConnectorReport() = default; |
1058 | + ConnectorReport(const ConnectorReport&) = delete; |
1059 | + ConnectorReport& operator=(const ConnectorReport&) = delete; |
1060 | }; |
1061 | |
1062 | -class NullCommunicatorReport : public CommunicatorReport |
1063 | +class NullConnectorReport : public ConnectorReport |
1064 | { |
1065 | public: |
1066 | - |
1067 | void error(std::exception const& error); |
1068 | }; |
1069 | } |
1070 | } |
1071 | |
1072 | -#endif // MIR_FRONTEND_COMMUNICATOR_REPORT_H_ |
1073 | +#endif // MIR_FRONTEND_CONNECTOR_REPORT_H_ |
1074 | |
1075 | === modified file 'include/server/mir/frontend/display_changer.h' |
1076 | --- include/server/mir/frontend/display_changer.h 2013-08-28 03:41:48 +0000 |
1077 | +++ include/server/mir/frontend/display_changer.h 2013-09-26 15:36:41 +0000 |
1078 | @@ -38,6 +38,7 @@ |
1079 | |
1080 | virtual std::shared_ptr<graphics::DisplayConfiguration> active_configuration() = 0; |
1081 | virtual void configure(std::shared_ptr<Session> const&, std::shared_ptr<graphics::DisplayConfiguration> const&) = 0; |
1082 | + virtual void ensure_display_powered(std::shared_ptr<Session> const& session) = 0; |
1083 | |
1084 | protected: |
1085 | DisplayChanger() = default; |
1086 | |
1087 | === added file 'include/server/mir/frontend/messenger_report.h' |
1088 | --- include/server/mir/frontend/messenger_report.h 1970-01-01 00:00:00 +0000 |
1089 | +++ include/server/mir/frontend/messenger_report.h 2013-09-26 15:36:41 +0000 |
1090 | @@ -0,0 +1,49 @@ |
1091 | +/* |
1092 | + * Copyright © 2013 Canonical Ltd. |
1093 | + * |
1094 | + * This program is free software: you can redistribute it and/or modify it |
1095 | + * under the terms of the GNU General Public License version 3, |
1096 | + * as published by the Free Software Foundation. |
1097 | + * |
1098 | + * This program is distributed in the hope that it will be useful, |
1099 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1100 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1101 | + * GNU General Public License for more details. |
1102 | + * |
1103 | + * You should have received a copy of the GNU General Public License |
1104 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1105 | + * |
1106 | + * Authored by: Robert Carr <robert.carr@canonical.com> |
1107 | + */ |
1108 | + |
1109 | +#ifndef MIR_FRONTEND_MESSENGER_REPORT_H_ |
1110 | +#define MIR_FRONTEND_MESSENGER_REPORT_H_ |
1111 | + |
1112 | +#include <string> |
1113 | + |
1114 | +namespace mir |
1115 | +{ |
1116 | +namespace frontend |
1117 | +{ |
1118 | + |
1119 | +class MessengerReport |
1120 | +{ |
1121 | +public: |
1122 | + virtual void error(std::string const& error_message) = 0; |
1123 | + |
1124 | +protected: |
1125 | + virtual ~MessengerReport() = default; |
1126 | + MessengerReport() = default; |
1127 | + MessengerReport(const MessengerReport&) = delete; |
1128 | + MessengerReport& operator=(const MessengerReport&) = delete; |
1129 | +}; |
1130 | + |
1131 | +class NullMessengerReport : public MessengerReport |
1132 | +{ |
1133 | +public: |
1134 | + void error(std::string const& error_message); |
1135 | +}; |
1136 | +} |
1137 | +} |
1138 | + |
1139 | +#endif // MIR_FRONTEND_MESSENGER_REPORT_H_ |
1140 | |
1141 | === modified file 'include/server/mir/frontend/protobuf_ipc_factory.h' |
1142 | --- include/server/mir/frontend/protobuf_ipc_factory.h 2013-08-28 03:41:48 +0000 |
1143 | +++ include/server/mir/frontend/protobuf_ipc_factory.h 2013-09-26 15:36:41 +0000 |
1144 | @@ -32,6 +32,7 @@ |
1145 | class EventSink; |
1146 | class ResourceCache; |
1147 | class MessageProcessorReport; |
1148 | +class MessengerReport; |
1149 | |
1150 | class ProtobufIpcFactory |
1151 | { |
1152 | @@ -39,7 +40,8 @@ |
1153 | virtual std::shared_ptr<protobuf::DisplayServer> make_ipc_server( |
1154 | std::shared_ptr<EventSink> const& sink, bool authorized_to_resize_display) = 0; |
1155 | virtual std::shared_ptr<ResourceCache> resource_cache() = 0; |
1156 | - virtual std::shared_ptr<MessageProcessorReport> report() = 0; |
1157 | + virtual std::shared_ptr<MessageProcessorReport> message_processor_report() = 0; |
1158 | + virtual std::shared_ptr<MessengerReport> messenger_report() = 0; |
1159 | |
1160 | protected: |
1161 | ProtobufIpcFactory() {} |
1162 | |
1163 | === added file 'include/server/mir/frontend/session_creator.h' |
1164 | --- include/server/mir/frontend/session_creator.h 1970-01-01 00:00:00 +0000 |
1165 | +++ include/server/mir/frontend/session_creator.h 2013-09-26 15:36:41 +0000 |
1166 | @@ -0,0 +1,44 @@ |
1167 | +/* |
1168 | + * Copyright © 2013 Canonical Ltd. |
1169 | + * |
1170 | + * This program is free software: you can redistribute it and/or modify it |
1171 | + * under the terms of the GNU General Public License version 3, |
1172 | + * as published by the Free Software Foundation. |
1173 | + * |
1174 | + * This program is distributed in the hope that it will be useful, |
1175 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1176 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1177 | + * GNU General Public License for more details. |
1178 | + * |
1179 | + * You should have received a copy of the GNU General Public License |
1180 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1181 | + * |
1182 | + * Authored by: Alan Griffiths <alan@octopull.co.uk> |
1183 | + */ |
1184 | + |
1185 | +#ifndef MIR_FRONTEND_SESSION_CREATOR_H_ |
1186 | +#define MIR_FRONTEND_SESSION_CREATOR_H_ |
1187 | + |
1188 | +#include <boost/asio.hpp> |
1189 | + |
1190 | +#include <memory> |
1191 | + |
1192 | +namespace mir |
1193 | +{ |
1194 | +namespace frontend |
1195 | +{ |
1196 | +class SessionCreator |
1197 | +{ |
1198 | +public: |
1199 | + virtual void create_session_for(std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket) = 0; |
1200 | + |
1201 | +protected: |
1202 | + SessionCreator() = default; |
1203 | + virtual ~SessionCreator() noexcept = default; |
1204 | + SessionCreator(SessionCreator const&) = delete; |
1205 | + SessionCreator& operator=(SessionCreator const&) = delete; |
1206 | +}; |
1207 | +} |
1208 | +} |
1209 | + |
1210 | +#endif /* MIR_FRONTEND_SESSION_CREATOR_H_ */ |
1211 | |
1212 | === modified file 'include/server/mir/frontend/session_mediator_report.h' |
1213 | --- include/server/mir/frontend/session_mediator_report.h 2013-06-12 10:23:43 +0000 |
1214 | +++ include/server/mir/frontend/session_mediator_report.h 2013-09-26 15:36:41 +0000 |
1215 | @@ -46,6 +46,8 @@ |
1216 | |
1217 | virtual void session_configure_surface_called(std::string const& app_name) = 0; |
1218 | |
1219 | + virtual void session_configure_display_called(std::string const& app_name) = 0; |
1220 | + |
1221 | virtual void session_error( |
1222 | std::string const& app_name, |
1223 | char const* method, |
1224 | @@ -69,6 +71,8 @@ |
1225 | |
1226 | virtual void session_configure_surface_called(std::string const& app_name); |
1227 | |
1228 | + virtual void session_configure_display_called(std::string const& app_name); |
1229 | + |
1230 | virtual void session_error( |
1231 | std::string const& app_name, |
1232 | char const* method, |
1233 | |
1234 | === added file 'include/server/mir/logging/messenger_report.h' |
1235 | --- include/server/mir/logging/messenger_report.h 1970-01-01 00:00:00 +0000 |
1236 | +++ include/server/mir/logging/messenger_report.h 2013-09-26 15:36:41 +0000 |
1237 | @@ -0,0 +1,49 @@ |
1238 | +/* |
1239 | + * Copyright © 2013 Canonical Ltd. |
1240 | + * |
1241 | + * This program is free software: you can redistribute it and/or modify it |
1242 | + * under the terms of the GNU General Public License version 3, |
1243 | + * as published by the Free Software Foundation. |
1244 | + * |
1245 | + * This program is distributed in the hope that it will be useful, |
1246 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1247 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1248 | + * GNU General Public License for more details. |
1249 | + * |
1250 | + * You should have received a copy of the GNU General Public License |
1251 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1252 | + * |
1253 | + * Authored by: Alan Griffiths <alan@octopull.co.uk> |
1254 | + */ |
1255 | + |
1256 | +#ifndef MIR_LOGGING_MESSENGER_REPORT_H_ |
1257 | +#define MIR_LOGGING_MESSENGER_REPORT_H_ |
1258 | + |
1259 | +#include "mir/frontend/messenger_report.h" |
1260 | + |
1261 | +#include <memory> |
1262 | + |
1263 | +namespace mir |
1264 | +{ |
1265 | +namespace logging |
1266 | +{ |
1267 | +class Logger; |
1268 | + |
1269 | +class MessengerReport : public frontend::MessengerReport |
1270 | +{ |
1271 | +public: |
1272 | + MessengerReport(std::shared_ptr<Logger> const& logger); |
1273 | + virtual ~MessengerReport() noexcept(true) = default; |
1274 | + |
1275 | + void error(std::string const& error_message); |
1276 | + |
1277 | +private: |
1278 | + char const* component(); |
1279 | + std::shared_ptr<Logger> const logger; |
1280 | +}; |
1281 | + |
1282 | +} |
1283 | +} |
1284 | + |
1285 | + |
1286 | +#endif /* MIR_LOGGING_MESSENGER_REPORT_H_ */ |
1287 | |
1288 | === modified file 'include/server/mir/logging/session_mediator_report.h' |
1289 | --- include/server/mir/logging/session_mediator_report.h 2013-05-30 03:50:54 +0000 |
1290 | +++ include/server/mir/logging/session_mediator_report.h 2013-09-26 15:36:41 +0000 |
1291 | @@ -49,6 +49,8 @@ |
1292 | |
1293 | virtual void session_configure_surface_called(std::string const& app_name); |
1294 | |
1295 | + virtual void session_configure_display_called(std::string const& app_name); |
1296 | + |
1297 | virtual void session_error( |
1298 | std::string const& app_name, |
1299 | char const* method, |
1300 | |
1301 | === added file 'include/server/mir/pause_resume_listener.h' |
1302 | --- include/server/mir/pause_resume_listener.h 1970-01-01 00:00:00 +0000 |
1303 | +++ include/server/mir/pause_resume_listener.h 2013-09-26 15:36:41 +0000 |
1304 | @@ -0,0 +1,40 @@ |
1305 | +/* |
1306 | + * Copyright © 2013 Canonical Ltd. |
1307 | + * |
1308 | + * This program is free software: you can redistribute it and/or modify it |
1309 | + * under the terms of the GNU General Public License version 3, |
1310 | + * as published by the Free Software Foundation. |
1311 | + * |
1312 | + * This program is distributed in the hope that it will be useful, |
1313 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1314 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1315 | + * GNU General Public License for more details. |
1316 | + * |
1317 | + * You should have received a copy of the GNU General Public License |
1318 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1319 | + * |
1320 | + * Authored by: Robert Ancell <robert.ancell@canonical.com> |
1321 | + */ |
1322 | + |
1323 | +#ifndef MIR_PAUSE_RESUME_LISTENER_H_ |
1324 | +#define MIR_PAUSE_RESUME_LISTENER_H_ |
1325 | + |
1326 | +namespace mir |
1327 | +{ |
1328 | + |
1329 | +class PauseResumeListener |
1330 | +{ |
1331 | +public: |
1332 | + virtual void paused() = 0; |
1333 | + virtual void resumed() = 0; |
1334 | + |
1335 | +protected: |
1336 | + PauseResumeListener() = default; |
1337 | + virtual ~PauseResumeListener() = default; |
1338 | + PauseResumeListener(PauseResumeListener const&) = delete; |
1339 | + PauseResumeListener& operator=(PauseResumeListener const&) = delete; |
1340 | +}; |
1341 | + |
1342 | +} |
1343 | + |
1344 | +#endif /* MIR_PAUSE_RESUME_LISTENER_H_ */ |
1345 | |
1346 | === modified file 'include/server/mir/server_configuration.h' |
1347 | --- include/server/mir/server_configuration.h 2013-08-28 03:41:48 +0000 |
1348 | +++ include/server/mir/server_configuration.h 2013-09-26 15:36:41 +0000 |
1349 | @@ -28,7 +28,7 @@ |
1350 | } |
1351 | namespace frontend |
1352 | { |
1353 | -class Communicator; |
1354 | +class Connector; |
1355 | class Shell; |
1356 | } |
1357 | namespace shell |
1358 | @@ -49,6 +49,7 @@ |
1359 | } |
1360 | |
1361 | class MainLoop; |
1362 | +class PauseResumeListener; |
1363 | class DisplayChanger; |
1364 | |
1365 | class ServerConfiguration |
1366 | @@ -56,11 +57,12 @@ |
1367 | public: |
1368 | // TODO most of these interfaces are wider DisplayServer needs... |
1369 | // TODO ...some or all of them need narrowing |
1370 | - virtual std::shared_ptr<frontend::Communicator> the_communicator() = 0; |
1371 | + virtual std::shared_ptr<frontend::Connector> the_connector() = 0; |
1372 | virtual std::shared_ptr<graphics::Display> the_display() = 0; |
1373 | virtual std::shared_ptr<compositor::Compositor> the_compositor() = 0; |
1374 | virtual std::shared_ptr<input::InputManager> the_input_manager() = 0; |
1375 | virtual std::shared_ptr<MainLoop> the_main_loop() = 0; |
1376 | + virtual std::shared_ptr<PauseResumeListener> the_pause_resume_listener() = 0; |
1377 | virtual std::shared_ptr<DisplayChanger> the_display_changer() = 0; |
1378 | virtual std::shared_ptr<graphics::Platform> the_graphics_platform() = 0; |
1379 | virtual std::shared_ptr<input::InputConfiguration> the_input_configuration() = 0; |
1380 | |
1381 | === modified file 'include/server/mir/shell/mediating_display_changer.h' |
1382 | --- include/server/mir/shell/mediating_display_changer.h 2013-08-28 03:41:48 +0000 |
1383 | +++ include/server/mir/shell/mediating_display_changer.h 2013-09-26 15:36:41 +0000 |
1384 | @@ -57,6 +57,8 @@ |
1385 | void configure(std::shared_ptr<frontend::Session> const& session, |
1386 | std::shared_ptr<graphics::DisplayConfiguration> const& conf); |
1387 | |
1388 | + void ensure_display_powered(std::shared_ptr<frontend::Session> const& session); |
1389 | + |
1390 | /* From mir::DisplayChanger */ |
1391 | void configure_for_hardware_change( |
1392 | std::shared_ptr<graphics::DisplayConfiguration> const& conf, |
1393 | |
1394 | === modified file 'include/server/mir/shell/unauthorized_display_changer.h' |
1395 | --- include/server/mir/shell/unauthorized_display_changer.h 2013-08-28 03:41:48 +0000 |
1396 | +++ include/server/mir/shell/unauthorized_display_changer.h 2013-09-26 15:36:41 +0000 |
1397 | @@ -34,6 +34,8 @@ |
1398 | std::shared_ptr<graphics::DisplayConfiguration> active_configuration(); |
1399 | void configure(std::shared_ptr<frontend::Session> const&, std::shared_ptr<graphics::DisplayConfiguration> const&); |
1400 | |
1401 | + void ensure_display_powered(std::shared_ptr<frontend::Session> const& session); |
1402 | + |
1403 | private: |
1404 | std::shared_ptr<frontend::DisplayChanger> const changer; |
1405 | }; |
1406 | |
1407 | === renamed file 'src/shared/graphics/android/syncfence.h' => 'include/shared/mir/graphics/android/syncfence.h' |
1408 | --- src/shared/graphics/android/syncfence.h 2013-04-24 05:22:20 +0000 |
1409 | +++ include/shared/mir/graphics/android/syncfence.h 2013-09-26 15:36:41 +0000 |
1410 | @@ -20,9 +20,6 @@ |
1411 | |
1412 | #include "mir/graphics/android/sync_object.h" |
1413 | |
1414 | -#include <memory> |
1415 | -#define SYNC_IOC_WAIT 0x40043E00 |
1416 | - |
1417 | namespace mir |
1418 | { |
1419 | namespace graphics |
1420 | @@ -30,23 +27,11 @@ |
1421 | namespace android |
1422 | { |
1423 | |
1424 | -class IoctlWrapper |
1425 | -{ |
1426 | -public: |
1427 | - virtual ~IoctlWrapper() {} |
1428 | - virtual int ioctl(int fd, unsigned long int request, int* timeout) const = 0; |
1429 | - virtual int close(int fd) const = 0; |
1430 | - |
1431 | -protected: |
1432 | - IoctlWrapper() = default; |
1433 | - IoctlWrapper(IoctlWrapper const&) = delete; |
1434 | - IoctlWrapper& operator=(IoctlWrapper const&) = delete; |
1435 | -}; |
1436 | - |
1437 | class SyncFence : public SyncObject |
1438 | { |
1439 | public: |
1440 | - SyncFence(int fd, std::shared_ptr<IoctlWrapper> const& wrapper); |
1441 | + SyncFence(); |
1442 | + SyncFence(int fd); |
1443 | ~SyncFence() noexcept; |
1444 | |
1445 | void wait(); |
1446 | @@ -54,8 +39,6 @@ |
1447 | private: |
1448 | SyncFence(SyncFence const&) = delete; |
1449 | SyncFence& operator=(SyncFence const&) = delete; |
1450 | - |
1451 | - std::shared_ptr<IoctlWrapper> const ioctl_wrapper; |
1452 | int const fence_fd; |
1453 | }; |
1454 | |
1455 | |
1456 | === modified file 'include/shared/mir_toolkit/client_types.h' |
1457 | --- include/shared/mir_toolkit/client_types.h 2013-09-11 17:00:39 +0000 |
1458 | +++ include/shared/mir_toolkit/client_types.h 2013-09-26 15:36:41 +0000 |
1459 | @@ -22,6 +22,7 @@ |
1460 | #define MIR_TOOLKIT_CLIENT_TYPES_H_ |
1461 | |
1462 | #include <mir_toolkit/event.h> |
1463 | +#include <mir_toolkit/common.h> |
1464 | |
1465 | #include <stddef.h> |
1466 | |
1467 | @@ -229,7 +230,7 @@ |
1468 | uint32_t vertical_resolution; |
1469 | uint32_t horizontal_resolution; |
1470 | double refresh_rate; |
1471 | -}MirDisplayMode; |
1472 | +} MirDisplayMode; |
1473 | |
1474 | enum { mir_display_output_id_invalid = 0 }; |
1475 | |
1476 | @@ -255,6 +256,8 @@ |
1477 | |
1478 | uint32_t physical_width_mm; |
1479 | uint32_t physical_height_mm; |
1480 | + |
1481 | + MirPowerMode power_mode; |
1482 | } MirDisplayOutput; |
1483 | |
1484 | typedef struct MirDisplayConfiguration |
1485 | |
1486 | === modified file 'include/shared/mir_toolkit/common.h' |
1487 | --- include/shared/mir_toolkit/common.h 2013-09-11 17:00:39 +0000 |
1488 | +++ include/shared/mir_toolkit/common.h 2013-09-26 15:36:41 +0000 |
1489 | @@ -78,6 +78,14 @@ |
1490 | mir_lifecycle_state_will_suspend, |
1491 | mir_lifecycle_state_resumed |
1492 | } MirLifecycleState; |
1493 | + |
1494 | +typedef enum MirPowerMode |
1495 | +{ |
1496 | + mir_power_mode_on, /* Display in use. */ |
1497 | + mir_power_mode_standby, /* Blanked, low power. */ |
1498 | + mir_power_mode_suspend, /* Blanked, lowest power. */ |
1499 | + mir_power_mode_off /* Powered down. */ |
1500 | +} MirPowerMode; |
1501 | /**@}*/ |
1502 | |
1503 | #endif |
1504 | |
1505 | === modified file 'include/test/mir_test/test_protobuf_server.h' |
1506 | --- include/test/mir_test/test_protobuf_server.h 2013-06-19 16:14:40 +0000 |
1507 | +++ include/test/mir_test/test_protobuf_server.h 2013-09-26 15:36:41 +0000 |
1508 | @@ -25,8 +25,8 @@ |
1509 | { |
1510 | namespace frontend |
1511 | { |
1512 | -class Communicator; |
1513 | -class CommunicatorReport; |
1514 | +class Connector; |
1515 | +class ConnectorReport; |
1516 | } |
1517 | |
1518 | namespace protobuf |
1519 | @@ -45,10 +45,10 @@ |
1520 | TestProtobufServer( |
1521 | std::string const& socket_name, |
1522 | std::shared_ptr<protobuf::DisplayServer> const& tool, |
1523 | - std::shared_ptr<frontend::CommunicatorReport> const& report); |
1524 | + std::shared_ptr<frontend::ConnectorReport> const& report); |
1525 | |
1526 | // "Server" side |
1527 | - std::shared_ptr<frontend::Communicator> const comm; |
1528 | + std::shared_ptr<frontend::Connector> const comm; |
1529 | }; |
1530 | } |
1531 | } |
1532 | |
1533 | === modified file 'include/test/mir_test_doubles/mock_display_changer.h' |
1534 | --- include/test/mir_test_doubles/mock_display_changer.h 2013-08-28 03:41:48 +0000 |
1535 | +++ include/test/mir_test_doubles/mock_display_changer.h 2013-09-26 15:36:41 +0000 |
1536 | @@ -35,6 +35,7 @@ |
1537 | MOCK_METHOD0(active_configuration, std::shared_ptr<graphics::DisplayConfiguration>()); |
1538 | MOCK_METHOD2(configure, |
1539 | void(std::shared_ptr<frontend::Session> const&, std::shared_ptr<graphics::DisplayConfiguration> const&)); |
1540 | + MOCK_METHOD1(ensure_display_powered, void(std::shared_ptr<frontend::Session> const&)); |
1541 | }; |
1542 | |
1543 | } |
1544 | |
1545 | === modified file 'include/test/mir_test_doubles/mock_display_support_provider.h' |
1546 | --- include/test/mir_test_doubles/mock_display_support_provider.h 2013-08-28 03:41:48 +0000 |
1547 | +++ include/test/mir_test_doubles/mock_display_support_provider.h 2013-09-26 15:36:41 +0000 |
1548 | @@ -37,6 +37,7 @@ |
1549 | MOCK_CONST_METHOD0(number_of_framebuffers_available, unsigned int()); |
1550 | MOCK_METHOD1(set_next_frontbuffer, void(std::shared_ptr<mir::graphics::Buffer> const&)); |
1551 | MOCK_METHOD1(sync_to_display, void(bool)); |
1552 | + MOCK_METHOD1(blank_or_unblank_screen, void(bool)); |
1553 | }; |
1554 | } |
1555 | } |
1556 | |
1557 | === modified file 'include/test/mir_test_doubles/mock_hwc_interface.h' |
1558 | --- include/test/mir_test_doubles/mock_hwc_interface.h 2013-08-28 03:41:48 +0000 |
1559 | +++ include/test/mir_test_doubles/mock_hwc_interface.h 2013-09-26 15:36:41 +0000 |
1560 | @@ -41,6 +41,7 @@ |
1561 | MOCK_CONST_METHOD0(number_of_framebuffers_available, unsigned int()); |
1562 | MOCK_METHOD1(set_next_frontbuffer, void(std::shared_ptr<mir::graphics::Buffer> const&)); |
1563 | MOCK_METHOD1(sync_to_display, void(bool)); |
1564 | + MOCK_METHOD1(blank_or_unblank_screen, void(bool)); |
1565 | }; |
1566 | |
1567 | } |
1568 | |
1569 | === renamed file 'include/test/mir_test_doubles/mock_hwc_organizer.h' => 'include/test/mir_test_doubles/mock_hwc_layerlist.h' |
1570 | --- include/test/mir_test_doubles/mock_hwc_organizer.h 2013-08-28 03:41:48 +0000 |
1571 | +++ include/test/mir_test_doubles/mock_hwc_layerlist.h 2013-09-26 15:36:41 +0000 |
1572 | @@ -16,8 +16,8 @@ |
1573 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
1574 | */ |
1575 | |
1576 | -#ifndef MIR_TEST_DOUBLES_MOCK_HWC_ORGANIZER_H_ |
1577 | -#define MIR_TEST_DOUBLES_MOCK_HWC_ORGANIZER_H_ |
1578 | +#ifndef MIR_TEST_DOUBLES_MOCK_HWC_LAYERLIST_H_ |
1579 | +#define MIR_TEST_DOUBLES_MOCK_HWC_LAYERLIST_H_ |
1580 | |
1581 | #include "src/server/graphics/android/hwc_layerlist.h" |
1582 | |
1583 | @@ -30,14 +30,14 @@ |
1584 | namespace doubles |
1585 | { |
1586 | |
1587 | -struct MockHWCOrganizer : public graphics::android::HWCLayerOrganizer |
1588 | +struct MockHWCLayerList : public graphics::android::HWCLayerList |
1589 | { |
1590 | - ~MockHWCOrganizer() noexcept {} |
1591 | - MOCK_CONST_METHOD0(native_list, graphics::android::LayerList const&()); |
1592 | + ~MockHWCLayerList() noexcept {} |
1593 | + MOCK_CONST_METHOD0(native_list, hwc_display_contents_1_t*()); |
1594 | MOCK_METHOD1(set_fb_target, void(std::shared_ptr<graphics::Buffer> const&)); |
1595 | }; |
1596 | |
1597 | } |
1598 | } |
1599 | } |
1600 | -#endif /* MIR_TEST_DOUBLES_MOCK_HWC_ORGANIZER_H_ */ |
1601 | +#endif /* MIR_TEST_DOUBLES_MOCK_HWC_LAYERLIST_H_ */ |
1602 | |
1603 | === added file 'include/test/mir_test_doubles/mock_pause_resume_listener.h' |
1604 | --- include/test/mir_test_doubles/mock_pause_resume_listener.h 1970-01-01 00:00:00 +0000 |
1605 | +++ include/test/mir_test_doubles/mock_pause_resume_listener.h 2013-09-26 15:36:41 +0000 |
1606 | @@ -0,0 +1,44 @@ |
1607 | +/* |
1608 | + * Copyright © 2013 Canonical Ltd. |
1609 | + * |
1610 | + * This program is free software: you can redistribute it and/or modify it |
1611 | + * under the terms of the GNU General Public License version 3, |
1612 | + * as published by the Free Software Foundation. |
1613 | + * |
1614 | + * This program is distributed in the hope that it will be useful, |
1615 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1616 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1617 | + * GNU General Public License for more details. |
1618 | + * |
1619 | + * You should have received a copy of the GNU General Public License |
1620 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1621 | + * |
1622 | + * Authored by: Robert Ancell <robert.ancell@canonical.com> |
1623 | + */ |
1624 | + |
1625 | +#ifndef MIR_TEST_DOUBLES_MOCK_PAUSE_RESUME_LISTENER_H_ |
1626 | +#define MIR_TEST_DOUBLES_MOCK_PAUSE_RESUME_LISTENER_H_ |
1627 | + |
1628 | +#include "mir/pause_resume_listener.h" |
1629 | + |
1630 | +#include <gmock/gmock.h> |
1631 | + |
1632 | +namespace mir |
1633 | +{ |
1634 | +namespace test |
1635 | +{ |
1636 | +namespace doubles |
1637 | +{ |
1638 | + |
1639 | +class MockPauseResumeListener : public mir::PauseResumeListener |
1640 | +{ |
1641 | +public: |
1642 | + MOCK_METHOD0(paused, void()); |
1643 | + MOCK_METHOD0(resumed, void()); |
1644 | +}; |
1645 | + |
1646 | +} |
1647 | +} |
1648 | +} |
1649 | + |
1650 | +#endif /* MIR_TEST_DOUBLES_MOCK_PAUSE_RESUME_LISTENER_H_ */ |
1651 | |
1652 | === modified file 'include/test/mir_test_doubles/null_display_changer.h' |
1653 | --- include/test/mir_test_doubles/null_display_changer.h 2013-09-09 19:07:09 +0000 |
1654 | +++ include/test/mir_test_doubles/null_display_changer.h 2013-09-26 15:36:41 +0000 |
1655 | @@ -39,6 +39,9 @@ |
1656 | virtual void configure(std::shared_ptr<frontend::Session> const&, std::shared_ptr<graphics::DisplayConfiguration> const&) |
1657 | { |
1658 | } |
1659 | + virtual void ensure_display_powered(std::shared_ptr<frontend::Session> const&) |
1660 | + { |
1661 | + } |
1662 | }; |
1663 | } |
1664 | } |
1665 | |
1666 | === removed file 'include/test/mir_test_doubles/null_display_config.h' |
1667 | --- include/test/mir_test_doubles/null_display_config.h 2013-09-11 17:00:39 +0000 |
1668 | +++ include/test/mir_test_doubles/null_display_config.h 1970-01-01 00:00:00 +0000 |
1669 | @@ -1,51 +0,0 @@ |
1670 | -/* |
1671 | - * Copyright © 2013 Canonical Ltd. |
1672 | - * |
1673 | - * This program is free software: you can redistribute it and/or modify it |
1674 | - * under the terms of the GNU General Public License version 3, |
1675 | - * as published by the Free Software Foundation. |
1676 | - * |
1677 | - * This program is distributed in the hope that it will be useful, |
1678 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1679 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1680 | - * GNU General Public License for more details. |
1681 | - * |
1682 | - * You should have received a copy of the GNU General Public License |
1683 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1684 | - * |
1685 | - * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
1686 | - */ |
1687 | - |
1688 | -#ifndef MIR_TEST_DOUBLES_NULL_DISPLAY_CONFIG_H_ |
1689 | -#define MIR_TEST_DOUBLES_NULL_DISPLAY_CONFIG_H_ |
1690 | - |
1691 | -#include "mir/graphics/display_configuration.h" |
1692 | - |
1693 | -namespace mir |
1694 | -{ |
1695 | -namespace test |
1696 | -{ |
1697 | -namespace doubles |
1698 | -{ |
1699 | - |
1700 | -struct NullDisplayConfig : public graphics::DisplayConfiguration |
1701 | -{ |
1702 | - NullDisplayConfig() |
1703 | - { |
1704 | - } |
1705 | - virtual void for_each_card(std::function<void(graphics::DisplayConfigurationCard const&)>) const |
1706 | - { |
1707 | - } |
1708 | - virtual void for_each_output(std::function<void(graphics::DisplayConfigurationOutput const&)>) const |
1709 | - { |
1710 | - } |
1711 | - virtual void configure_output(graphics::DisplayConfigurationOutputId, bool, geometry::Point, size_t) |
1712 | - { |
1713 | - } |
1714 | -}; |
1715 | - |
1716 | -} |
1717 | -} |
1718 | -} |
1719 | - |
1720 | -#endif /*MIR_TEST_DOUBLES_NULL_DISPLAY_CONFIG_H_ */ |
1721 | |
1722 | === modified file 'include/test/mir_test_doubles/null_display_configuration.h' |
1723 | --- include/test/mir_test_doubles/null_display_configuration.h 2013-09-11 17:00:39 +0000 |
1724 | +++ include/test/mir_test_doubles/null_display_configuration.h 2013-09-26 15:36:41 +0000 |
1725 | @@ -35,7 +35,7 @@ |
1726 | void for_each_output(std::function<void(graphics::DisplayConfigurationOutput const&)>) const |
1727 | { |
1728 | } |
1729 | - void configure_output(graphics::DisplayConfigurationOutputId, bool, geometry::Point, size_t) |
1730 | + void configure_output(graphics::DisplayConfigurationOutputId, bool, geometry::Point, size_t, MirPowerMode) override |
1731 | { |
1732 | } |
1733 | }; |
1734 | |
1735 | === modified file 'include/test/mir_test_doubles/stub_display_configuration.h' |
1736 | --- include/test/mir_test_doubles/stub_display_configuration.h 2013-09-11 17:00:39 +0000 |
1737 | +++ include/test/mir_test_doubles/stub_display_configuration.h 2013-09-26 15:36:41 +0000 |
1738 | @@ -72,7 +72,8 @@ |
1739 | ((i % 2) == 0), |
1740 | ((i % 2) == 1), |
1741 | top_left, |
1742 | - mode_index, 1u |
1743 | + mode_index, 1u, |
1744 | + mir_power_mode_off |
1745 | }; |
1746 | |
1747 | outputs.push_back(output); |
1748 | @@ -99,7 +100,7 @@ |
1749 | graphics::DisplayConfigurationOutputType::vga, |
1750 | std::vector<geometry::PixelFormat>{geometry::PixelFormat::abgr_8888}, |
1751 | {{rect.size, 60.0}}, |
1752 | - 0, geometry::Size{}, true, true, rect.top_left, 0, 0 |
1753 | + 0, geometry::Size{}, true, true, rect.top_left, 0, 0, mir_power_mode_on |
1754 | }; |
1755 | |
1756 | outputs.push_back(output); |
1757 | @@ -128,7 +129,7 @@ |
1758 | } |
1759 | } |
1760 | |
1761 | - void configure_output(graphics::DisplayConfigurationOutputId, bool, geometry::Point, size_t) |
1762 | + void configure_output(graphics::DisplayConfigurationOutputId, bool, geometry::Point, size_t, MirPowerMode) |
1763 | { |
1764 | } |
1765 | |
1766 | |
1767 | === added file 'include/test/mir_test_doubles/stub_display_support_provider.h' |
1768 | --- include/test/mir_test_doubles/stub_display_support_provider.h 1970-01-01 00:00:00 +0000 |
1769 | +++ include/test/mir_test_doubles/stub_display_support_provider.h 2013-09-26 15:36:41 +0000 |
1770 | @@ -0,0 +1,45 @@ |
1771 | +/* |
1772 | + * Copyright © 2013 Canonical Ltd. |
1773 | + * |
1774 | + * This program is free software: you can redistribute it and/or modify it |
1775 | + * under the terms of the GNU General Public License version 3, |
1776 | + * as published by the Free Software Foundation. |
1777 | + * |
1778 | + * This program is distributed in the hope that it will be useful, |
1779 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1780 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1781 | + * GNU General Public License for more details. |
1782 | + * |
1783 | + * You should have received a copy of the GNU General Public License |
1784 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1785 | + * |
1786 | + */ |
1787 | + |
1788 | +#ifndef MIR_TEST_DOUBLES_STUB_DISPLAY_SUPPORT_PROVIDER_H_ |
1789 | +#define MIR_TEST_DOUBLES_STUB_DISPLAY_SUPPORT_PROVIDER_H_ |
1790 | + |
1791 | +#include "src/server/graphics/android/display_support_provider.h" |
1792 | + |
1793 | +namespace mir |
1794 | +{ |
1795 | +namespace test |
1796 | +{ |
1797 | +namespace doubles |
1798 | +{ |
1799 | + |
1800 | +struct StubDisplaySupportProvider : public graphics::android::DisplaySupportProvider |
1801 | +{ |
1802 | + ~StubDisplaySupportProvider() noexcept {} |
1803 | + |
1804 | + geometry::Size display_size() const { return geometry::Size(); } |
1805 | + geometry::PixelFormat display_format() const { return geometry::PixelFormat(); } |
1806 | + unsigned int number_of_framebuffers_available() const { return 0; } |
1807 | + void set_next_frontbuffer(std::shared_ptr<mir::graphics::Buffer> const&) {} |
1808 | + void sync_to_display(bool) {} |
1809 | + void blank_or_unblank_screen(bool) {} |
1810 | +}; |
1811 | + |
1812 | +} |
1813 | +} |
1814 | +} |
1815 | +#endif /* MIR_TEST_DOUBLES_STUB_DISPLAY_SUPPORT_PROVIDER_H_ */ |
1816 | |
1817 | === modified file 'include/test/mir_test_doubles/stub_ipc_factory.h' |
1818 | --- include/test/mir_test_doubles/stub_ipc_factory.h 2013-08-28 03:41:48 +0000 |
1819 | +++ include/test/mir_test_doubles/stub_ipc_factory.h 2013-09-26 15:36:41 +0000 |
1820 | @@ -24,6 +24,7 @@ |
1821 | #include "mir/frontend/protobuf_ipc_factory.h" |
1822 | #include "mir/frontend/resource_cache.h" |
1823 | #include "mir/frontend/null_message_processor_report.h" |
1824 | +#include "mir/frontend/messenger_report.h" |
1825 | |
1826 | namespace mir |
1827 | { |
1828 | @@ -53,10 +54,14 @@ |
1829 | return cache; |
1830 | } |
1831 | |
1832 | - virtual std::shared_ptr<frontend::MessageProcessorReport> report() |
1833 | + virtual std::shared_ptr<frontend::MessageProcessorReport> message_processor_report() |
1834 | { |
1835 | return std::make_shared<frontend::NullMessageProcessorReport>(); |
1836 | } |
1837 | + virtual std::shared_ptr<frontend::MessengerReport> messenger_report() |
1838 | + { |
1839 | + return std::make_shared<frontend::NullMessengerReport>(); |
1840 | + } |
1841 | |
1842 | std::shared_ptr<protobuf::DisplayServer> server; |
1843 | std::shared_ptr<frontend::ResourceCache> const cache; |
1844 | |
1845 | === modified file 'include/test/mir_test_framework/cross_process_sync.h' |
1846 | --- include/test/mir_test_framework/cross_process_sync.h 2013-08-28 03:41:48 +0000 |
1847 | +++ include/test/mir_test_framework/cross_process_sync.h 2013-09-26 15:36:41 +0000 |
1848 | @@ -36,14 +36,15 @@ |
1849 | |
1850 | // Try to signal the other side that we are ready for at most duration milliseconds. |
1851 | // Throws a std::runtime_error if not successful. |
1852 | - void try_signal_ready_for( |
1853 | - const std::chrono::milliseconds& duration = std::chrono::milliseconds(2000)); |
1854 | + void try_signal_ready_for(const std::chrono::milliseconds& duration); |
1855 | + |
1856 | + void try_signal_ready_for(); |
1857 | |
1858 | // Wait for the other sides to signal readiness for at most duration milliseconds. |
1859 | // Returns the number of ready signals that have been collected since creation. |
1860 | // Throws std::runtime_error if not successful. |
1861 | - unsigned int wait_for_signal_ready_for( |
1862 | - const std::chrono::milliseconds& duration = std::chrono::milliseconds(2000)); |
1863 | + unsigned int wait_for_signal_ready_for(const std::chrono::milliseconds& duration); |
1864 | + unsigned int wait_for_signal_ready_for(); |
1865 | |
1866 | void signal_ready(); |
1867 | unsigned int wait_for_signal_ready(); |
1868 | |
1869 | === modified file 'src/client/CMakeLists.txt' |
1870 | --- src/client/CMakeLists.txt 2013-09-11 17:00:39 +0000 |
1871 | +++ src/client/CMakeLists.txt 2013-09-26 15:36:41 +0000 |
1872 | @@ -68,7 +68,7 @@ |
1873 | ${CLIENT_SOURCES} |
1874 | ) |
1875 | |
1876 | -set(MIRCLIENT_ABI 2) |
1877 | +set(MIRCLIENT_ABI 3) |
1878 | |
1879 | set_target_properties( |
1880 | mirclient |
1881 | |
1882 | === modified file 'src/client/display_configuration.cpp' |
1883 | --- src/client/display_configuration.cpp 2013-08-28 03:41:48 +0000 |
1884 | +++ src/client/display_configuration.cpp 2013-09-26 15:36:41 +0000 |
1885 | @@ -96,6 +96,7 @@ |
1886 | output.used = msg.used(); |
1887 | output.physical_width_mm = msg.physical_width_mm(); |
1888 | output.physical_height_mm = msg.physical_height_mm(); |
1889 | + output.power_mode = static_cast<MirPowerMode>(msg.power_mode()); |
1890 | } |
1891 | |
1892 | } |
1893 | |
1894 | === modified file 'src/client/mir_connection.cpp' |
1895 | --- src/client/mir_connection.cpp 2013-09-12 08:32:02 +0000 |
1896 | +++ src/client/mir_connection.cpp 2013-09-26 15:36:41 +0000 |
1897 | @@ -434,6 +434,7 @@ |
1898 | display_request->set_current_mode(output.current_mode); |
1899 | display_request->set_position_x(output.position_x); |
1900 | display_request->set_position_y(output.position_y); |
1901 | + display_request->set_power_mode(output.power_mode); |
1902 | } |
1903 | |
1904 | server.configure_display(0, &request, &display_configuration_response, |
1905 | |
1906 | === modified file 'src/client/rpc/make_socket_rpc_channel.cpp' |
1907 | --- src/client/rpc/make_socket_rpc_channel.cpp 2013-08-28 03:41:48 +0000 |
1908 | +++ src/client/rpc/make_socket_rpc_channel.cpp 2013-09-26 15:36:41 +0000 |
1909 | @@ -19,15 +19,38 @@ |
1910 | #include "make_rpc_channel.h" |
1911 | #include "mir_socket_rpc_channel.h" |
1912 | |
1913 | +#include <cstring> |
1914 | + |
1915 | namespace mcl = mir::client; |
1916 | namespace mclr = mir::client::rpc; |
1917 | |
1918 | +namespace |
1919 | +{ |
1920 | +struct Prefix |
1921 | +{ |
1922 | + template<int Size> |
1923 | + Prefix(char const (&prefix)[Size]) : size(Size-1), prefix(prefix) {} |
1924 | + |
1925 | + bool is_start_of(std::string const& name) const |
1926 | + { return !strncmp(name.c_str(), prefix, size); } |
1927 | + |
1928 | + int const size; |
1929 | + char const* const prefix; |
1930 | +} const fd_prefix("fd://"); |
1931 | +} |
1932 | + |
1933 | std::shared_ptr<mclr::MirBasicRpcChannel> |
1934 | mclr::make_rpc_channel(std::string const& name, |
1935 | std::shared_ptr<mcl::SurfaceMap> const& map, |
1936 | std::shared_ptr<mcl::DisplayConfiguration> const& disp_conf, |
1937 | std::shared_ptr<RpcReport> const& rpc_report, |
1938 | std::shared_ptr<mcl::LifecycleControl> const& lifecycle_control) |
1939 | -{ |
1940 | +{ |
1941 | + if (fd_prefix.is_start_of(name)) |
1942 | + { |
1943 | + auto const fd = atoi(name.c_str()+fd_prefix.size); |
1944 | + return std::make_shared<MirSocketRpcChannel>(fd, map, disp_conf, rpc_report, lifecycle_control); |
1945 | + } |
1946 | + |
1947 | return std::make_shared<MirSocketRpcChannel>(name, map, disp_conf, rpc_report, lifecycle_control); |
1948 | } |
1949 | |
1950 | === modified file 'src/client/rpc/mir_socket_rpc_channel.cpp' |
1951 | --- src/client/rpc/mir_socket_rpc_channel.cpp 2013-08-28 03:41:48 +0000 |
1952 | +++ src/client/rpc/mir_socket_rpc_channel.cpp 2013-09-26 15:36:41 +0000 |
1953 | @@ -55,14 +55,35 @@ |
1954 | rpc_report(rpc_report), |
1955 | pending_calls(rpc_report), |
1956 | work(io_service), |
1957 | - endpoint(endpoint), |
1958 | socket(io_service), |
1959 | surface_map(surface_map), |
1960 | display_configuration(disp_config), |
1961 | lifecycle_control(lifecycle_control) |
1962 | { |
1963 | socket.connect(endpoint); |
1964 | - |
1965 | + init(); |
1966 | +} |
1967 | + |
1968 | +mclr::MirSocketRpcChannel::MirSocketRpcChannel( |
1969 | + int native_socket, |
1970 | + std::shared_ptr<mcl::SurfaceMap> const& surface_map, |
1971 | + std::shared_ptr<DisplayConfiguration> const& disp_config, |
1972 | + std::shared_ptr<RpcReport> const& rpc_report, |
1973 | + std::shared_ptr<LifecycleControl> const& lifecycle_control) : |
1974 | + rpc_report(rpc_report), |
1975 | + pending_calls(rpc_report), |
1976 | + work(io_service), |
1977 | + socket(io_service), |
1978 | + surface_map(surface_map), |
1979 | + display_configuration(disp_config), |
1980 | + lifecycle_control(lifecycle_control) |
1981 | +{ |
1982 | + socket.assign(boost::asio::local::stream_protocol(), native_socket); |
1983 | + init(); |
1984 | +} |
1985 | + |
1986 | +void mclr::MirSocketRpcChannel::init() |
1987 | +{ |
1988 | auto run_io_service = boost::bind(&boost::asio::io_service::run, &io_service); |
1989 | |
1990 | // Our IO threads must not recieve any signals |
1991 | @@ -74,9 +95,8 @@ |
1992 | BOOST_THROW_EXCEPTION( |
1993 | boost::enable_error_info( |
1994 | std::runtime_error("Failed to block signals on IO thread")) << boost::errinfo_errno(error)); |
1995 | - |
1996 | |
1997 | - io_service_thread = std::move(std::thread(run_io_service)); |
1998 | + io_service_thread = std::thread(run_io_service); |
1999 | |
2000 | // Restore previous signals. |
2001 | if ((error = pthread_sigmask(SIG_SETMASK, &old_mask, NULL))) |
2002 | |
2003 | === modified file 'src/client/rpc/mir_socket_rpc_channel.h' |
2004 | --- src/client/rpc/mir_socket_rpc_channel.h 2013-08-28 03:41:48 +0000 |
2005 | +++ src/client/rpc/mir_socket_rpc_channel.h 2013-09-26 15:36:41 +0000 |
2006 | @@ -57,9 +57,17 @@ |
2007 | std::shared_ptr<DisplayConfiguration> const& disp_config, |
2008 | std::shared_ptr<RpcReport> const& rpc_report, |
2009 | std::shared_ptr<LifecycleControl> const& lifecycle_control); |
2010 | + |
2011 | + MirSocketRpcChannel(int native_socket, |
2012 | + std::shared_ptr<SurfaceMap> const& surface_map, |
2013 | + std::shared_ptr<DisplayConfiguration> const& disp_config, |
2014 | + std::shared_ptr<RpcReport> const& rpc_report, |
2015 | + std::shared_ptr<LifecycleControl> const& lifecycle_control); |
2016 | ~MirSocketRpcChannel(); |
2017 | |
2018 | private: |
2019 | + void init(); |
2020 | + |
2021 | virtual void CallMethod(const google::protobuf::MethodDescriptor* method, google::protobuf::RpcController*, |
2022 | const google::protobuf::Message* parameters, google::protobuf::Message* response, |
2023 | google::protobuf::Closure* complete); |
2024 | @@ -68,7 +76,6 @@ |
2025 | std::thread io_service_thread; |
2026 | boost::asio::io_service io_service; |
2027 | boost::asio::io_service::work work; |
2028 | - boost::asio::local::stream_protocol::endpoint endpoint; |
2029 | boost::asio::local::stream_protocol::socket socket; |
2030 | |
2031 | static size_t const size_of_header = 2; |
2032 | |
2033 | === modified file 'src/platform/graphics/default_display_configuration_policy.cpp' |
2034 | --- src/platform/graphics/default_display_configuration_policy.cpp 2013-09-11 17:00:39 +0000 |
2035 | +++ src/platform/graphics/default_display_configuration_policy.cpp 2013-09-26 15:36:41 +0000 |
2036 | @@ -24,6 +24,8 @@ |
2037 | |
2038 | void mg::DefaultDisplayConfigurationPolicy::apply_to(DisplayConfiguration& conf) |
2039 | { |
2040 | + static MirPowerMode const default_power_state = mir_power_mode_on; |
2041 | + |
2042 | conf.for_each_output( |
2043 | [&conf](DisplayConfigurationOutput const& conf_output) |
2044 | { |
2045 | @@ -34,12 +36,12 @@ |
2046 | preferred_mode_index = 0; |
2047 | |
2048 | conf.configure_output(conf_output.id, true, geom::Point(), |
2049 | - preferred_mode_index); |
2050 | + preferred_mode_index, default_power_state); |
2051 | } |
2052 | else |
2053 | { |
2054 | conf.configure_output(conf_output.id, false, conf_output.top_left, |
2055 | - conf_output.current_mode_index); |
2056 | + conf_output.current_mode_index, default_power_state); |
2057 | } |
2058 | }); |
2059 | } |
2060 | |
2061 | === modified file 'src/server/CMakeLists.txt' |
2062 | --- src/server/CMakeLists.txt 2013-09-18 13:59:53 +0000 |
2063 | +++ src/server/CMakeLists.txt 2013-09-26 15:36:41 +0000 |
2064 | @@ -88,7 +88,7 @@ |
2065 | ) |
2066 | endif() |
2067 | |
2068 | -set(MIRSERVER_ABI 3) |
2069 | +set(MIRSERVER_ABI 4) |
2070 | |
2071 | set_target_properties( |
2072 | mirserver |
2073 | |
2074 | === modified file 'src/server/compositor/default_display_buffer_compositor.cpp' |
2075 | --- src/server/compositor/default_display_buffer_compositor.cpp 2013-08-29 09:00:55 +0000 |
2076 | +++ src/server/compositor/default_display_buffer_compositor.cpp 2013-09-26 15:36:41 +0000 |
2077 | @@ -75,10 +75,6 @@ |
2078 | |
2079 | void mc::DefaultDisplayBufferCompositor::composite() |
2080 | { |
2081 | - static bool got_bypass_env = false; |
2082 | - static bool bypass_env = true; |
2083 | - bool bypassed = false; |
2084 | - |
2085 | /* |
2086 | * Increment frame counts for each tick of the fastest instance of |
2087 | * DefaultDisplayBufferCompositor. This means for the fastest refresh |
2088 | @@ -93,14 +89,8 @@ |
2089 | local_frameno = global_frameno; |
2090 | } |
2091 | |
2092 | - if (!got_bypass_env) |
2093 | - { |
2094 | - const char *env = getenv("MIR_BYPASS"); |
2095 | - if (env != NULL) |
2096 | - bypass_env = env[0] != '0'; |
2097 | - |
2098 | - got_bypass_env = true; |
2099 | - } |
2100 | + static bool const bypass_env{[]{ auto const env = getenv("MIR_BYPASS"); return !env || env[0] != '0'; }()}; |
2101 | + bool bypassed = false; |
2102 | |
2103 | if (bypass_env && display_buffer.can_bypass()) |
2104 | { |
2105 | |
2106 | === modified file 'src/server/default_server_configuration.cpp' |
2107 | --- src/server/default_server_configuration.cpp 2013-09-19 12:26:41 +0000 |
2108 | +++ src/server/default_server_configuration.cpp 2013-09-26 15:36:41 +0000 |
2109 | @@ -19,6 +19,7 @@ |
2110 | #include "mir/default_server_configuration.h" |
2111 | #include "mir/abnormal_exit.h" |
2112 | #include "mir/asio_main_loop.h" |
2113 | +#include "mir/default_pause_resume_listener.h" |
2114 | #include "mir/shared_library.h" |
2115 | |
2116 | #include "mir/options/program_option.h" |
2117 | @@ -29,6 +30,7 @@ |
2118 | #include "mir/frontend/protobuf_ipc_factory.h" |
2119 | #include "mir/frontend/session_mediator_report.h" |
2120 | #include "mir/frontend/null_message_processor_report.h" |
2121 | +#include "mir/frontend/messenger_report.h" |
2122 | #include "mir/frontend/session_mediator.h" |
2123 | #include "mir/frontend/session_authorizer.h" |
2124 | #include "mir/frontend/global_event_sender.h" |
2125 | @@ -74,6 +76,7 @@ |
2126 | #include "mir/logging/session_mediator_report.h" |
2127 | #include "mir/logging/message_processor_report.h" |
2128 | #include "mir/logging/display_report.h" |
2129 | +#include "mir/logging/messenger_report.h" |
2130 | #include "mir/lttng/message_processor_report.h" |
2131 | #include "mir/lttng/input_report.h" |
2132 | #include "mir/shell/surface_source.h" |
2133 | @@ -112,13 +115,15 @@ |
2134 | explicit DefaultIpcFactory( |
2135 | std::shared_ptr<mf::Shell> const& shell, |
2136 | std::shared_ptr<mf::SessionMediatorReport> const& sm_report, |
2137 | - std::shared_ptr<mf::MessageProcessorReport> const& mr_report, |
2138 | + std::shared_ptr<mf::MessageProcessorReport> const& mp_report, |
2139 | + std::shared_ptr<mf::MessengerReport> const& messenger_report, |
2140 | std::shared_ptr<mg::Platform> const& graphics_platform, |
2141 | std::shared_ptr<mf::DisplayChanger> const& display_changer, |
2142 | std::shared_ptr<mg::GraphicBufferAllocator> const& buffer_allocator) : |
2143 | shell(shell), |
2144 | sm_report(sm_report), |
2145 | - mp_report(mr_report), |
2146 | + mp_report(mp_report), |
2147 | + msger_report(messenger_report), |
2148 | cache(std::make_shared<mf::ResourceCache>()), |
2149 | graphics_platform(graphics_platform), |
2150 | display_changer(display_changer), |
2151 | @@ -130,6 +135,7 @@ |
2152 | std::shared_ptr<mf::Shell> shell; |
2153 | std::shared_ptr<mf::SessionMediatorReport> const sm_report; |
2154 | std::shared_ptr<mf::MessageProcessorReport> const mp_report; |
2155 | + std::shared_ptr<mf::MessengerReport> const msger_report; |
2156 | std::shared_ptr<mf::ResourceCache> const cache; |
2157 | std::shared_ptr<mg::Platform> const graphics_platform; |
2158 | std::shared_ptr<mf::DisplayChanger> const display_changer; |
2159 | @@ -163,15 +169,21 @@ |
2160 | return cache; |
2161 | } |
2162 | |
2163 | - virtual std::shared_ptr<mf::MessageProcessorReport> report() |
2164 | + virtual std::shared_ptr<mf::MessageProcessorReport> message_processor_report() |
2165 | { |
2166 | return mp_report; |
2167 | } |
2168 | + virtual std::shared_ptr<mf::MessengerReport> messenger_report() |
2169 | + { |
2170 | + return msger_report; |
2171 | + } |
2172 | }; |
2173 | |
2174 | char const* const server_socket_opt = "file"; |
2175 | +char const* const no_server_socket_opt = "no-file"; |
2176 | char const* const session_mediator_report_opt = "session-mediator-report"; |
2177 | char const* const msg_processor_report_opt = "msg-processor-report"; |
2178 | +char const* const messenger_report_opt = "messenger-report"; |
2179 | char const* const display_report_opt = "display-report"; |
2180 | char const* const legacy_input_report_opt = "legacy-input-report"; |
2181 | char const* const input_report_opt = "input-report"; |
2182 | @@ -254,6 +266,7 @@ |
2183 | "Host socket filename. [string:default={$MIR_SOCKET,/tmp/mir_socket}]") |
2184 | ("file,f", po::value<std::string>(), |
2185 | "Socket filename. [string:default=/tmp/mir_socket]") |
2186 | + (no_server_socket_opt, "Do not provide a socket filename for client connections") |
2187 | (platform_graphics_lib, po::value<std::string>(), |
2188 | "Library to use for platform graphics support [default=libmirplatformgraphics.so]") |
2189 | ("enable-input,i", po::value<bool>(), |
2190 | @@ -821,6 +834,7 @@ |
2191 | shell, |
2192 | the_session_mediator_report(), |
2193 | the_message_processor_report(), |
2194 | + the_messenger_report(), |
2195 | the_graphics_platform(), |
2196 | the_frontend_display_changer(), allocator); |
2197 | }); |
2198 | @@ -887,6 +901,23 @@ |
2199 | }); |
2200 | } |
2201 | |
2202 | +std::shared_ptr<mf::MessengerReport> |
2203 | +mir::DefaultServerConfiguration::the_messenger_report() |
2204 | +{ |
2205 | + return messenger_report( |
2206 | + [this]() -> std::shared_ptr<mf::MessengerReport> |
2207 | + { |
2208 | + auto report_opt = the_options()->get(messenger_report_opt, off_opt_value); |
2209 | + if (report_opt == log_opt_value) |
2210 | + { |
2211 | + return std::make_shared<ml::MessengerReport>(the_logger()); |
2212 | + } |
2213 | + else |
2214 | + { |
2215 | + return std::make_shared<mf::NullMessengerReport>(); |
2216 | + } |
2217 | + }); |
2218 | +} |
2219 | |
2220 | std::shared_ptr<ml::Logger> mir::DefaultServerConfiguration::the_logger() |
2221 | { |
2222 | @@ -949,6 +980,16 @@ |
2223 | }); |
2224 | } |
2225 | |
2226 | + |
2227 | +std::shared_ptr<mir::PauseResumeListener> mir::DefaultServerConfiguration::the_pause_resume_listener() |
2228 | +{ |
2229 | + return pause_resume_listener( |
2230 | + []() |
2231 | + { |
2232 | + return std::make_shared<mir::DefaultPauseResumeListener>(); |
2233 | + }); |
2234 | +} |
2235 | + |
2236 | std::shared_ptr<mg::DisplayConfigurationPolicy> |
2237 | mir::DefaultServerConfiguration::the_display_configuration_policy() |
2238 | { |
2239 | |
2240 | === modified file 'src/server/display_server.cpp' |
2241 | --- src/server/display_server.cpp 2013-08-28 03:41:48 +0000 |
2242 | +++ src/server/display_server.cpp 2013-09-26 15:36:41 +0000 |
2243 | @@ -21,10 +21,11 @@ |
2244 | #include "mir/display_server.h" |
2245 | #include "mir/server_configuration.h" |
2246 | #include "mir/main_loop.h" |
2247 | +#include "mir/pause_resume_listener.h" |
2248 | #include "mir/display_changer.h" |
2249 | |
2250 | #include "mir/compositor/compositor.h" |
2251 | -#include "mir/frontend/communicator.h" |
2252 | +#include "mir/frontend/connector.h" |
2253 | #include "mir/graphics/display.h" |
2254 | #include "mir/input/input_manager.h" |
2255 | |
2256 | @@ -71,9 +72,10 @@ |
2257 | display{config.the_display()}, |
2258 | input_configuration{config.the_input_configuration()}, |
2259 | compositor{config.the_compositor()}, |
2260 | - communicator{config.the_communicator()}, |
2261 | + connector{config.the_connector()}, |
2262 | input_manager{config.the_input_manager()}, |
2263 | main_loop{config.the_main_loop()}, |
2264 | + pause_resume_listener{config.the_pause_resume_listener()}, |
2265 | display_changer{config.the_display_changer()}, |
2266 | paused{false}, |
2267 | configure_display_on_resume{false} |
2268 | @@ -101,8 +103,8 @@ |
2269 | [this] { compositor->start(); }}; |
2270 | |
2271 | TryButRevertIfUnwinding comm{ |
2272 | - [this] { communicator->stop(); }, |
2273 | - [this] { communicator->start(); }}; |
2274 | + [this] { connector->stop(); }, |
2275 | + [this] { connector->start(); }}; |
2276 | |
2277 | display->pause(); |
2278 | |
2279 | @@ -113,6 +115,8 @@ |
2280 | return false; |
2281 | } |
2282 | |
2283 | + pause_resume_listener->paused(); |
2284 | + |
2285 | return true; |
2286 | } |
2287 | |
2288 | @@ -125,8 +129,8 @@ |
2289 | [this] { display->pause(); }}; |
2290 | |
2291 | TryButRevertIfUnwinding comm{ |
2292 | - [this] { communicator->start(); }, |
2293 | - [this] { communicator->stop(); }}; |
2294 | + [this] { connector->start(); }, |
2295 | + [this] { connector->stop(); }}; |
2296 | |
2297 | if (configure_display_on_resume) |
2298 | { |
2299 | @@ -149,6 +153,8 @@ |
2300 | return false; |
2301 | } |
2302 | |
2303 | + pause_resume_listener->resumed(); |
2304 | + |
2305 | return true; |
2306 | } |
2307 | |
2308 | @@ -170,9 +176,10 @@ |
2309 | std::shared_ptr<mg::Display> const display; |
2310 | std::shared_ptr<input::InputConfiguration> const input_configuration; |
2311 | std::shared_ptr<mc::Compositor> const compositor; |
2312 | - std::shared_ptr<mf::Communicator> const communicator; |
2313 | + std::shared_ptr<mf::Connector> const connector; |
2314 | std::shared_ptr<mi::InputManager> const input_manager; |
2315 | std::shared_ptr<mir::MainLoop> const main_loop; |
2316 | + std::shared_ptr<mir::PauseResumeListener> const pause_resume_listener; |
2317 | std::shared_ptr<mir::DisplayChanger> const display_changer; |
2318 | bool paused; |
2319 | bool configure_display_on_resume; |
2320 | @@ -194,7 +201,7 @@ |
2321 | |
2322 | void mir::DisplayServer::run() |
2323 | { |
2324 | - p->communicator->start(); |
2325 | + p->connector->start(); |
2326 | p->compositor->start(); |
2327 | p->input_manager->start(); |
2328 | |
2329 | @@ -202,7 +209,7 @@ |
2330 | |
2331 | p->input_manager->stop(); |
2332 | p->compositor->stop(); |
2333 | - p->communicator->stop(); |
2334 | + p->connector->stop(); |
2335 | } |
2336 | |
2337 | void mir::DisplayServer::stop() |
2338 | |
2339 | === modified file 'src/server/frontend/CMakeLists.txt' |
2340 | --- src/server/frontend/CMakeLists.txt 2013-08-28 03:41:48 +0000 |
2341 | +++ src/server/frontend/CMakeLists.txt 2013-09-26 15:36:41 +0000 |
2342 | @@ -5,24 +5,24 @@ |
2343 | session_mediator.cpp |
2344 | null_session_mediator_report.cpp |
2345 | null_message_processor_report.cpp |
2346 | + null_messenger_report.cpp |
2347 | protobuf_message_processor.cpp |
2348 | protobuf_buffer_packer.cpp |
2349 | null_message_processor.cpp |
2350 | global_event_sender.cpp |
2351 | - |
2352 | + published_socket_connector.cpp |
2353 | + protobuf_session_creator.cpp |
2354 | + socket_session.cpp |
2355 | resource_cache.cpp |
2356 | socket_messenger.cpp |
2357 | event_sender.cpp |
2358 | surface.cpp |
2359 | + |
2360 | + default_configuration.cpp |
2361 | + |
2362 | ${PROTO_HDRS} |
2363 | ) |
2364 | |
2365 | -list(APPEND FRONTEND_SOURCES |
2366 | - protobuf_socket_communicator.cpp |
2367 | - make_protobuf_socket_communicator.cpp |
2368 | - socket_session.cpp |
2369 | -) |
2370 | - |
2371 | if (MIR_PLATFORM STREQUAL "android") |
2372 | list(APPEND FRONTEND_SOURCES session_mediator_android.cpp) |
2373 | elseif (MIR_PLATFORM STREQUAL "gbm") |
2374 | |
2375 | === renamed file 'src/server/frontend/make_protobuf_socket_communicator.cpp' => 'src/server/frontend/default_configuration.cpp' |
2376 | --- src/server/frontend/make_protobuf_socket_communicator.cpp 2013-08-28 03:41:48 +0000 |
2377 | +++ src/server/frontend/default_configuration.cpp 2013-09-26 15:36:41 +0000 |
2378 | @@ -17,39 +17,67 @@ |
2379 | */ |
2380 | |
2381 | #include "mir/default_server_configuration.h" |
2382 | +#include "protobuf_session_creator.h" |
2383 | + |
2384 | #include "mir/options/option.h" |
2385 | #include "mir/frontend/shell.h" |
2386 | #include "mir/shell/session_container.h" |
2387 | #include "mir/shell/session.h" |
2388 | -#include "protobuf_socket_communicator.h" |
2389 | -#include "mir/frontend/communicator_report.h" |
2390 | +#include "published_socket_connector.h" |
2391 | +#include "mir/frontend/connector_report.h" |
2392 | |
2393 | namespace mf = mir::frontend; |
2394 | -namespace mg = mir::graphics; |
2395 | -namespace mc = mir::compositor; |
2396 | namespace msh = mir::shell; |
2397 | |
2398 | -std::shared_ptr<mf::Communicator> |
2399 | -mir::DefaultServerConfiguration::the_communicator() |
2400 | -{ |
2401 | - return communicator( |
2402 | - [&,this]() -> std::shared_ptr<mf::Communicator> |
2403 | +namespace |
2404 | +{ |
2405 | +char const* const no_server_socket_opt = "no-file"; |
2406 | +} |
2407 | + |
2408 | +std::shared_ptr<mf::SessionCreator> |
2409 | +mir::DefaultServerConfiguration::the_session_creator() |
2410 | +{ |
2411 | + return session_creator([this] |
2412 | + { |
2413 | + return std::make_shared<mf::ProtobufSessionCreator>( |
2414 | + the_ipc_factory(the_frontend_shell(), the_buffer_allocator()), |
2415 | + the_session_authorizer()); |
2416 | + }); |
2417 | +} |
2418 | + |
2419 | +std::shared_ptr<mf::Connector> |
2420 | +mir::DefaultServerConfiguration::the_connector() |
2421 | +{ |
2422 | + return connector( |
2423 | + [&,this]() -> std::shared_ptr<mf::Connector> |
2424 | { |
2425 | auto const threads = the_options()->get("ipc-thread-pool", 10); |
2426 | auto shell_sessions = the_shell_session_container(); |
2427 | - return std::make_shared<mf::ProtobufSocketCommunicator>( |
2428 | - the_socket_file(), |
2429 | - the_ipc_factory(the_frontend_shell(), the_buffer_allocator()), |
2430 | - the_session_authorizer(), |
2431 | - threads, |
2432 | - [shell_sessions] |
2433 | + auto const& force_requests_to_complete = [shell_sessions] |
2434 | + { |
2435 | + shell_sessions->for_each([](std::shared_ptr<msh::Session> const& session) |
2436 | { |
2437 | - shell_sessions->for_each([](std::shared_ptr<msh::Session> const& session) |
2438 | - { |
2439 | - session->force_requests_to_complete(); |
2440 | - }); |
2441 | - }, |
2442 | - std::make_shared<mf::NullCommunicatorReport>()); |
2443 | + session->force_requests_to_complete(); |
2444 | + }); |
2445 | + }; |
2446 | + |
2447 | + if (the_options()->is_set(no_server_socket_opt)) |
2448 | + { |
2449 | + return std::make_shared<mf::BasicConnector>( |
2450 | + the_session_creator(), |
2451 | + threads, |
2452 | + force_requests_to_complete, |
2453 | + std::make_shared<mf::NullConnectorReport>()); |
2454 | + } |
2455 | + else |
2456 | + { |
2457 | + return std::make_shared<mf::PublishedSocketConnector>( |
2458 | + the_socket_file(), |
2459 | + the_session_creator(), |
2460 | + threads, |
2461 | + force_requests_to_complete, |
2462 | + std::make_shared<mf::NullConnectorReport>()); |
2463 | + } |
2464 | }); |
2465 | } |
2466 | |
2467 | |
2468 | === added file 'src/server/frontend/null_messenger_report.cpp' |
2469 | --- src/server/frontend/null_messenger_report.cpp 1970-01-01 00:00:00 +0000 |
2470 | +++ src/server/frontend/null_messenger_report.cpp 2013-09-26 15:36:41 +0000 |
2471 | @@ -0,0 +1,25 @@ |
2472 | +/* |
2473 | + * Copyright © 2013 Canonical Ltd. |
2474 | + * |
2475 | + * This program is free software: you can redistribute it and/or modify it |
2476 | + * under the terms of the GNU General Public License version 3, |
2477 | + * as published by the Free Software Foundation. |
2478 | + * |
2479 | + * This program is distributed in the hope that it will be useful, |
2480 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2481 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2482 | + * GNU General Public License for more details. |
2483 | + * |
2484 | + * You should have received a copy of the GNU General Public License |
2485 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2486 | + * |
2487 | + * Authored by: Robert Carr <robert.carr@canonical.com> |
2488 | + */ |
2489 | + |
2490 | +#include "mir/frontend/messenger_report.h" |
2491 | + |
2492 | +namespace mf = mir::frontend; |
2493 | + |
2494 | +void mf::NullMessengerReport::error(std::string const&) |
2495 | +{ |
2496 | +} |
2497 | |
2498 | === modified file 'src/server/frontend/null_session_mediator_report.cpp' |
2499 | --- src/server/frontend/null_session_mediator_report.cpp 2013-05-30 03:50:54 +0000 |
2500 | +++ src/server/frontend/null_session_mediator_report.cpp 2013-09-26 15:36:41 +0000 |
2501 | @@ -46,6 +46,10 @@ |
2502 | { |
2503 | } |
2504 | |
2505 | +void mir::frontend::NullSessionMediatorReport::session_configure_display_called(std::string const&) |
2506 | +{ |
2507 | +} |
2508 | + |
2509 | void mir::frontend::NullSessionMediatorReport::session_error( |
2510 | std::string const&, |
2511 | char const* , |
2512 | |
2513 | === modified file 'src/server/frontend/protobuf_buffer_packer.cpp' |
2514 | --- src/server/frontend/protobuf_buffer_packer.cpp 2013-09-12 08:05:56 +0000 |
2515 | +++ src/server/frontend/protobuf_buffer_packer.cpp 2013-09-26 15:36:41 +0000 |
2516 | @@ -65,6 +65,7 @@ |
2517 | protobuf_output.set_position_y(display_output.top_left.y.as_uint32_t()); |
2518 | protobuf_output.set_current_mode(display_output.current_mode_index); |
2519 | protobuf_output.set_current_format(display_output.current_format_index); |
2520 | + protobuf_output.set_power_mode(static_cast<uint32_t>(display_output.power_mode)); |
2521 | } |
2522 | |
2523 | } |
2524 | |
2525 | === added file 'src/server/frontend/protobuf_session_creator.cpp' |
2526 | --- src/server/frontend/protobuf_session_creator.cpp 1970-01-01 00:00:00 +0000 |
2527 | +++ src/server/frontend/protobuf_session_creator.cpp 2013-09-26 15:36:41 +0000 |
2528 | @@ -0,0 +1,73 @@ |
2529 | +/* |
2530 | + * Copyright © 2013 Canonical Ltd. |
2531 | + * |
2532 | + * This program is free software: you can redistribute it and/or modify it |
2533 | + * under the terms of the GNU General Public License version 3, |
2534 | + * as published by the Free Software Foundation. |
2535 | + * |
2536 | + * This program is distributed in the hope that it will be useful, |
2537 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2538 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2539 | + * GNU General Public License for more details. |
2540 | + * |
2541 | + * You should have received a copy of the GNU General Public License |
2542 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2543 | + * |
2544 | + * Authored by: Alan Griffiths <alan@octopull.co.uk> |
2545 | + */ |
2546 | + |
2547 | +#include "protobuf_session_creator.h" |
2548 | + |
2549 | +#include "event_sender.h" |
2550 | +#include "protobuf_message_processor.h" |
2551 | +#include "socket_messenger.h" |
2552 | +#include "socket_session.h" |
2553 | + |
2554 | +#include "mir/frontend/protobuf_ipc_factory.h" |
2555 | +#include "mir/frontend/session_authorizer.h" |
2556 | +#include "mir/protobuf/google_protobuf_guard.h" |
2557 | + |
2558 | +namespace mf = mir::frontend; |
2559 | +namespace mfd = mir::frontend::detail; |
2560 | +namespace ba = boost::asio; |
2561 | + |
2562 | +mf::ProtobufSessionCreator::ProtobufSessionCreator( |
2563 | + std::shared_ptr<ProtobufIpcFactory> const& ipc_factory, |
2564 | + std::shared_ptr<mf::SessionAuthorizer> const& session_authorizer) |
2565 | +: ipc_factory(ipc_factory), |
2566 | + session_authorizer(session_authorizer), |
2567 | + next_session_id(0), |
2568 | + connected_sessions(std::make_shared<mfd::ConnectedSessions<mfd::SocketSession>>()) |
2569 | +{ |
2570 | +} |
2571 | + |
2572 | +mf::ProtobufSessionCreator::~ProtobufSessionCreator() noexcept |
2573 | +{ |
2574 | + connected_sessions->clear(); |
2575 | +} |
2576 | + |
2577 | +int mf::ProtobufSessionCreator::next_id() |
2578 | +{ |
2579 | + return next_session_id.fetch_add(1); |
2580 | +} |
2581 | + |
2582 | +void mf::ProtobufSessionCreator::create_session_for(std::shared_ptr<ba::local::stream_protocol::socket> const& socket) |
2583 | +{ |
2584 | + auto const messenger = std::make_shared<detail::SocketMessenger>(socket, ipc_factory->messenger_report()); |
2585 | + auto const client_pid = messenger->client_pid(); |
2586 | + |
2587 | + if (session_authorizer->connection_is_allowed(client_pid)) |
2588 | + { |
2589 | + auto const authorized_to_resize_display = session_authorizer->configure_display_is_allowed(client_pid); |
2590 | + auto const event_sink = std::make_shared<detail::EventSender>(messenger); |
2591 | + auto const msg_processor = std::make_shared<detail::ProtobufMessageProcessor>( |
2592 | + messenger, |
2593 | + ipc_factory->make_ipc_server(event_sink, authorized_to_resize_display), |
2594 | + ipc_factory->resource_cache(), |
2595 | + ipc_factory->message_processor_report()); |
2596 | + |
2597 | + const auto& session = std::make_shared<mfd::SocketSession>(messenger, next_id(), connected_sessions, msg_processor); |
2598 | + connected_sessions->add(session); |
2599 | + session->read_next_message(); |
2600 | + } |
2601 | +} |
2602 | |
2603 | === added file 'src/server/frontend/protobuf_session_creator.h' |
2604 | --- src/server/frontend/protobuf_session_creator.h 1970-01-01 00:00:00 +0000 |
2605 | +++ src/server/frontend/protobuf_session_creator.h 2013-09-26 15:36:41 +0000 |
2606 | @@ -0,0 +1,60 @@ |
2607 | +/* |
2608 | + * Copyright © 2013 Canonical Ltd. |
2609 | + * |
2610 | + * This program is free software: you can redistribute it and/or modify it |
2611 | + * under the terms of the GNU General Public License version 3, |
2612 | + * as published by the Free Software Foundation. |
2613 | + * |
2614 | + * This program is distributed in the hope that it will be useful, |
2615 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2616 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2617 | + * GNU General Public License for more details. |
2618 | + * |
2619 | + * You should have received a copy of the GNU General Public License |
2620 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2621 | + * |
2622 | + * Authored by: Alan Griffiths <alan@octopull.co.uk> |
2623 | + */ |
2624 | + |
2625 | +#ifndef MIR_FRONTEND_PROTOBUF_SESSION_CREATOR_H_ |
2626 | +#define MIR_FRONTEND_PROTOBUF_SESSION_CREATOR_H_ |
2627 | + |
2628 | +#include "mir/frontend/session_creator.h" |
2629 | +#include "connected_sessions.h" |
2630 | + |
2631 | +#include <atomic> |
2632 | + |
2633 | +namespace mir |
2634 | +{ |
2635 | +namespace frontend |
2636 | +{ |
2637 | +class ProtobufIpcFactory; |
2638 | +class SessionAuthorizer; |
2639 | + |
2640 | +namespace detail |
2641 | +{ |
2642 | +struct SocketSession; |
2643 | +} |
2644 | + |
2645 | +class ProtobufSessionCreator : public SessionCreator |
2646 | +{ |
2647 | +public: |
2648 | + ProtobufSessionCreator( |
2649 | + std::shared_ptr<ProtobufIpcFactory> const& ipc_factory, |
2650 | + std::shared_ptr<SessionAuthorizer> const& session_authorizer); |
2651 | + ~ProtobufSessionCreator() noexcept; |
2652 | + |
2653 | + void create_session_for(std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket); |
2654 | + |
2655 | +private: |
2656 | + int next_id(); |
2657 | + |
2658 | + std::shared_ptr<ProtobufIpcFactory> const ipc_factory; |
2659 | + std::shared_ptr<SessionAuthorizer> const session_authorizer; |
2660 | + std::atomic<int> next_session_id; |
2661 | + std::shared_ptr<detail::ConnectedSessions<detail::SocketSession>> const connected_sessions; |
2662 | +}; |
2663 | +} |
2664 | +} |
2665 | + |
2666 | +#endif /* MIR_FRONTEND_PROTOBUF_SESSION_CREATOR_H_ */ |
2667 | |
2668 | === renamed file 'src/server/frontend/protobuf_socket_communicator.cpp' => 'src/server/frontend/published_socket_connector.cpp' |
2669 | --- src/server/frontend/protobuf_socket_communicator.cpp 2013-08-28 03:41:48 +0000 |
2670 | +++ src/server/frontend/published_socket_connector.cpp 2013-09-26 15:36:41 +0000 |
2671 | @@ -16,67 +16,78 @@ |
2672 | * Authored by: Thomas Guest <thomas.guest@canonical.com> |
2673 | */ |
2674 | |
2675 | -#include "protobuf_socket_communicator.h" |
2676 | -#include "protobuf_message_processor.h" |
2677 | -#include "socket_session.h" |
2678 | +#include "published_socket_connector.h" |
2679 | +#include "protobuf_session_creator.h" |
2680 | |
2681 | -#include "mir/frontend/communicator_report.h" |
2682 | -#include "mir/frontend/protobuf_ipc_factory.h" |
2683 | -#include "mir/frontend/session_authorizer.h" |
2684 | -#include "socket_messenger.h" |
2685 | -#include "event_sender.h" |
2686 | -#include "mir/protobuf/google_protobuf_guard.h" |
2687 | +#include "mir/frontend/connector_report.h" |
2688 | |
2689 | #include <boost/signals2.hpp> |
2690 | +#include <boost/exception/errinfo_errno.hpp> |
2691 | +#include <boost/throw_exception.hpp> |
2692 | + |
2693 | +#include <sys/socket.h> |
2694 | |
2695 | namespace mf = mir::frontend; |
2696 | namespace mfd = mir::frontend::detail; |
2697 | namespace ba = boost::asio; |
2698 | |
2699 | -mf::ProtobufSocketCommunicator::ProtobufSocketCommunicator( |
2700 | - std::string const& socket_file, |
2701 | - std::shared_ptr<ProtobufIpcFactory> const& ipc_factory, |
2702 | - std::shared_ptr<mf::SessionAuthorizer> const& session_authorizer, |
2703 | +mf::PublishedSocketConnector::PublishedSocketConnector( |
2704 | + const std::string& socket_file, |
2705 | + std::shared_ptr<SessionCreator> const& session_creator, |
2706 | int threads, |
2707 | std::function<void()> const& force_requests_to_complete, |
2708 | - std::shared_ptr<CommunicatorReport> const& report) |
2709 | -: socket_file((std::remove(socket_file.c_str()), socket_file)), |
2710 | - acceptor(io_service, socket_file), |
2711 | - io_service_threads(threads), |
2712 | - ipc_factory(ipc_factory), |
2713 | - session_authorizer(session_authorizer), |
2714 | - next_session_id(0), |
2715 | - connected_sessions(std::make_shared<mfd::ConnectedSessions<mfd::SocketSession>>()), |
2716 | - force_requests_to_complete(force_requests_to_complete), |
2717 | - report(report) |
2718 | + std::shared_ptr<ConnectorReport> const& report) |
2719 | +: BasicConnector(session_creator, threads, force_requests_to_complete, report), |
2720 | + socket_file(socket_file), |
2721 | + acceptor(io_service, socket_file) |
2722 | { |
2723 | start_accept(); |
2724 | } |
2725 | |
2726 | -void mf::ProtobufSocketCommunicator::start_accept() |
2727 | +mf::PublishedSocketConnector::~PublishedSocketConnector() noexcept |
2728 | +{ |
2729 | + std::remove(socket_file.c_str()); |
2730 | +} |
2731 | + |
2732 | +void mf::PublishedSocketConnector::start_accept() |
2733 | { |
2734 | auto socket = std::make_shared<boost::asio::local::stream_protocol::socket>(io_service); |
2735 | |
2736 | acceptor.async_accept( |
2737 | *socket, |
2738 | boost::bind( |
2739 | - &ProtobufSocketCommunicator::on_new_connection, |
2740 | + &PublishedSocketConnector::on_new_connection, |
2741 | this, |
2742 | socket, |
2743 | ba::placeholders::error)); |
2744 | } |
2745 | |
2746 | -int mf::ProtobufSocketCommunicator::next_id() |
2747 | -{ |
2748 | - int id = next_session_id.load(); |
2749 | - while (!next_session_id.compare_exchange_weak(id, id + 1)) std::this_thread::yield(); |
2750 | - return id; |
2751 | -} |
2752 | - |
2753 | - |
2754 | -void mf::ProtobufSocketCommunicator::start() |
2755 | -{ |
2756 | - auto run_io_service = [&] |
2757 | +void mf::PublishedSocketConnector::on_new_connection( |
2758 | + std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket, |
2759 | + boost::system::error_code const& ec) |
2760 | +{ |
2761 | + if (!ec) |
2762 | + { |
2763 | + create_session_for(socket); |
2764 | + } |
2765 | + start_accept(); |
2766 | +} |
2767 | + |
2768 | +mf::BasicConnector::BasicConnector( |
2769 | + std::shared_ptr<SessionCreator> const& session_creator, |
2770 | + int threads, |
2771 | + std::function<void()> const& force_requests_to_complete, |
2772 | + std::shared_ptr<ConnectorReport> const& report) |
2773 | +: io_service_threads(threads), |
2774 | + force_requests_to_complete(force_requests_to_complete), |
2775 | + report(report), |
2776 | + session_creator{session_creator} |
2777 | +{ |
2778 | +} |
2779 | + |
2780 | +void mf::BasicConnector::start() |
2781 | +{ |
2782 | + auto run_io_service = [this] |
2783 | { |
2784 | while (true) |
2785 | try |
2786 | @@ -92,16 +103,16 @@ |
2787 | |
2788 | for (auto& thread : io_service_threads) |
2789 | { |
2790 | - thread = std::move(std::thread(run_io_service)); |
2791 | + thread = std::thread(run_io_service); |
2792 | } |
2793 | } |
2794 | |
2795 | -void mf::ProtobufSocketCommunicator::stop() |
2796 | +void mf::BasicConnector::stop() |
2797 | { |
2798 | /* Stop processing new requests */ |
2799 | io_service.stop(); |
2800 | |
2801 | - /* |
2802 | + /* |
2803 | * Ensure that any pending requests will complete (i.e., that they |
2804 | * will not block indefinitely waiting for a resource from the server) |
2805 | */ |
2806 | @@ -120,44 +131,36 @@ |
2807 | io_service.reset(); |
2808 | } |
2809 | |
2810 | -mf::ProtobufSocketCommunicator::~ProtobufSocketCommunicator() |
2811 | +void mf::BasicConnector::create_session_for(std::shared_ptr<boost::asio::local::stream_protocol::socket> const& server_socket) const |
2812 | +{ |
2813 | + session_creator->create_session_for(server_socket); |
2814 | +} |
2815 | + |
2816 | +int mf::BasicConnector::client_socket_fd() const |
2817 | +{ |
2818 | + enum { server, client, size }; |
2819 | + int socket_fd[size]; |
2820 | + |
2821 | + if (socketpair(AF_LOCAL, SOCK_STREAM, 0, socket_fd)) |
2822 | + { |
2823 | + BOOST_THROW_EXCEPTION( |
2824 | + boost::enable_error_info( |
2825 | + std::runtime_error("Could not create socket pair")) << boost::errinfo_errno(errno)); |
2826 | + } |
2827 | + |
2828 | + auto const server_socket = std::make_shared<boost::asio::local::stream_protocol::socket>( |
2829 | + io_service, boost::asio::local::stream_protocol(), socket_fd[server]); |
2830 | + |
2831 | + create_session_for(server_socket); |
2832 | + |
2833 | + return socket_fd[client]; |
2834 | +} |
2835 | + |
2836 | +mf::BasicConnector::~BasicConnector() noexcept |
2837 | { |
2838 | stop(); |
2839 | - |
2840 | - connected_sessions->clear(); |
2841 | - |
2842 | - std::remove(socket_file.c_str()); |
2843 | -} |
2844 | - |
2845 | -void mf::ProtobufSocketCommunicator::on_new_connection( |
2846 | - std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket, |
2847 | - boost::system::error_code const& ec) |
2848 | -{ |
2849 | - if (!ec) |
2850 | - { |
2851 | - auto messenger = std::make_shared<detail::SocketMessenger>(socket); |
2852 | - auto client_pid = messenger->client_pid(); |
2853 | - if (session_authorizer->connection_is_allowed(client_pid)) |
2854 | - { |
2855 | - auto authorized_to_resize_display = session_authorizer->configure_display_is_allowed(client_pid); |
2856 | - auto event_sink = std::make_shared<detail::EventSender>(messenger); |
2857 | - auto msg_processor = std::make_shared<detail::ProtobufMessageProcessor>( |
2858 | - messenger, |
2859 | - ipc_factory->make_ipc_server(event_sink, authorized_to_resize_display), |
2860 | - ipc_factory->resource_cache(), |
2861 | - ipc_factory->report()); |
2862 | - auto const& session = std::make_shared<mfd::SocketSession>( |
2863 | - messenger, |
2864 | - next_id(), |
2865 | - connected_sessions, |
2866 | - msg_processor); |
2867 | - connected_sessions->add(session); |
2868 | - session->read_next_message(); |
2869 | - } |
2870 | - } |
2871 | - start_accept(); |
2872 | -} |
2873 | - |
2874 | -void mf::NullCommunicatorReport::error(std::exception const& /*error*/) |
2875 | +} |
2876 | + |
2877 | +void mf::NullConnectorReport::error(std::exception const& /*error*/) |
2878 | { |
2879 | } |
2880 | |
2881 | === renamed file 'src/server/frontend/protobuf_socket_communicator.h' => 'src/server/frontend/published_socket_connector.h' |
2882 | --- src/server/frontend/protobuf_socket_communicator.h 2013-08-28 03:41:48 +0000 |
2883 | +++ src/server/frontend/published_socket_connector.h 2013-09-26 15:36:41 +0000 |
2884 | @@ -19,13 +19,10 @@ |
2885 | #ifndef MIR_FRONTEND_PROTOBUF_ASIO_COMMUNICATOR_H_ |
2886 | #define MIR_FRONTEND_PROTOBUF_ASIO_COMMUNICATOR_H_ |
2887 | |
2888 | -#include "connected_sessions.h" |
2889 | - |
2890 | -#include "mir/frontend/communicator.h" |
2891 | +#include "mir/frontend/connector.h" |
2892 | |
2893 | #include <boost/asio.hpp> |
2894 | |
2895 | -#include <atomic> |
2896 | #include <thread> |
2897 | #include <string> |
2898 | #include <vector> |
2899 | @@ -43,52 +40,54 @@ |
2900 | { |
2901 | namespace frontend |
2902 | { |
2903 | -class ResourceCache; |
2904 | -class ProtobufIpcFactory; |
2905 | -class SessionAuthorizer; |
2906 | - |
2907 | -namespace detail |
2908 | -{ |
2909 | -struct SocketSession; |
2910 | -class MessageSender; |
2911 | -} |
2912 | - |
2913 | -class CommunicatorReport; |
2914 | - |
2915 | -class ProtobufSocketCommunicator : public Communicator |
2916 | -{ |
2917 | -public: |
2918 | - // Create communicator based on Boost asio and Google protobufs |
2919 | - // using the supplied socket. |
2920 | - explicit ProtobufSocketCommunicator( |
2921 | +class SessionCreator; |
2922 | +class ConnectorReport; |
2923 | + |
2924 | +/// provides a client-side socket fd for each connection |
2925 | +class BasicConnector : public Connector |
2926 | +{ |
2927 | +public: |
2928 | + explicit BasicConnector( |
2929 | + std::shared_ptr<SessionCreator> const& session_creator, |
2930 | + int threads, |
2931 | + std::function<void()> const& force_requests_to_complete, |
2932 | + std::shared_ptr<ConnectorReport> const& report); |
2933 | + ~BasicConnector() noexcept; |
2934 | + void start() override; |
2935 | + void stop() override; |
2936 | + int client_socket_fd() const override; |
2937 | + |
2938 | +protected: |
2939 | + void create_session_for(std::shared_ptr<boost::asio::local::stream_protocol::socket> const& server_socket) const; |
2940 | + boost::asio::io_service mutable io_service; |
2941 | + |
2942 | +private: |
2943 | + std::vector<std::thread> io_service_threads; |
2944 | + std::function<void()> const force_requests_to_complete; |
2945 | + std::shared_ptr<ConnectorReport> const report; |
2946 | + std::shared_ptr<SessionCreator> const session_creator; |
2947 | +}; |
2948 | + |
2949 | +/// Accept connections over a published socket |
2950 | +class PublishedSocketConnector : public BasicConnector |
2951 | +{ |
2952 | +public: |
2953 | + explicit PublishedSocketConnector( |
2954 | const std::string& socket_file, |
2955 | - std::shared_ptr<ProtobufIpcFactory> const& ipc_factory, |
2956 | - std::shared_ptr<SessionAuthorizer> const& session_authorizer, |
2957 | + std::shared_ptr<SessionCreator> const& session_creator, |
2958 | int threads, |
2959 | std::function<void()> const& force_requests_to_complete, |
2960 | - std::shared_ptr<CommunicatorReport> const& report); |
2961 | - ~ProtobufSocketCommunicator(); |
2962 | - void start(); |
2963 | - void stop(); |
2964 | + std::shared_ptr<ConnectorReport> const& report); |
2965 | + ~PublishedSocketConnector() noexcept; |
2966 | |
2967 | private: |
2968 | void start_accept(); |
2969 | void on_new_connection(std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket, |
2970 | boost::system::error_code const& ec); |
2971 | - int next_id(); |
2972 | |
2973 | const std::string socket_file; |
2974 | - boost::asio::io_service io_service; |
2975 | boost::asio::local::stream_protocol::acceptor acceptor; |
2976 | - std::vector<std::thread> io_service_threads; |
2977 | - std::shared_ptr<ProtobufIpcFactory> const ipc_factory; |
2978 | - std::shared_ptr<SessionAuthorizer> const session_authorizer; |
2979 | - std::atomic<int> next_session_id; |
2980 | - std::shared_ptr<detail::ConnectedSessions<detail::SocketSession>> const connected_sessions; |
2981 | - std::function<void()> const force_requests_to_complete; |
2982 | - std::shared_ptr<CommunicatorReport> const report; |
2983 | }; |
2984 | - |
2985 | } |
2986 | } |
2987 | |
2988 | |
2989 | === modified file 'src/server/frontend/session_mediator.cpp' |
2990 | --- src/server/frontend/session_mediator.cpp 2013-09-11 17:00:39 +0000 |
2991 | +++ src/server/frontend/session_mediator.cpp 2013-09-26 15:36:41 +0000 |
2992 | @@ -181,6 +181,12 @@ |
2993 | BOOST_THROW_EXCEPTION(std::logic_error("Invalid application session")); |
2994 | |
2995 | report->session_next_buffer_called(session->name()); |
2996 | + |
2997 | + // We ensure the client has not powered down the outputs, so that |
2998 | + // swap_buffer will not block indefinitely, leaving the client |
2999 | + // in a position where it can not turn back on the |
3000 | + // outputs. |
3001 | + display_changer->ensure_display_powered(session); |
3002 | |
3003 | auto surface = session->get_surface(SurfaceId(request->value())); |
3004 | |
3005 | @@ -292,6 +298,8 @@ |
3006 | if (session.get() == nullptr) |
3007 | BOOST_THROW_EXCEPTION(std::logic_error("Invalid application session")); |
3008 | |
3009 | + report->session_configure_display_called(session->name()); |
3010 | + |
3011 | auto config = display_changer->active_configuration(); |
3012 | for (auto i=0; i < request->display_output_size(); i++) |
3013 | { |
3014 | @@ -299,7 +307,7 @@ |
3015 | mg::DisplayConfigurationOutputId output_id{static_cast<int>(output.output_id())}; |
3016 | config->configure_output(output_id, output.used(), |
3017 | geom::Point{output.position_x(), output.position_y()}, |
3018 | - output.current_mode()); |
3019 | + output.current_mode(), static_cast<MirPowerMode>(output.power_mode())); |
3020 | } |
3021 | |
3022 | display_changer->configure(session, config); |
3023 | |
3024 | === modified file 'src/server/frontend/socket_messenger.cpp' |
3025 | --- src/server/frontend/socket_messenger.cpp 2013-09-20 14:17:55 +0000 |
3026 | +++ src/server/frontend/socket_messenger.cpp 2013-09-26 15:36:41 +0000 |
3027 | @@ -18,13 +18,16 @@ |
3028 | |
3029 | #include "socket_messenger.h" |
3030 | #include "mir/frontend/client_constants.h" |
3031 | +#include "mir/frontend/messenger_report.h" |
3032 | |
3033 | namespace mfd = mir::frontend::detail; |
3034 | namespace bs = boost::system; |
3035 | namespace ba = boost::asio; |
3036 | |
3037 | -mfd::SocketMessenger::SocketMessenger(std::shared_ptr<ba::local::stream_protocol::socket> const& socket) |
3038 | - : socket(socket) |
3039 | +mfd::SocketMessenger::SocketMessenger(std::shared_ptr<ba::local::stream_protocol::socket> const& socket, |
3040 | + std::shared_ptr<MessengerReport> const& report) |
3041 | + : socket(socket), |
3042 | + report(report) |
3043 | { |
3044 | whole_message.reserve(serialization_buffer_size); |
3045 | } |
3046 | @@ -59,14 +62,14 @@ |
3047 | // function has completed (if it would be executed asynchronously. |
3048 | // NOTE: we rely on this synchronous behavior as per the comment in |
3049 | // mf::SessionMediator::create_surface |
3050 | - try |
3051 | - { |
3052 | - ba::write(*socket, ba::buffer(whole_message)); |
3053 | - } |
3054 | - catch (std::exception &) |
3055 | - { |
3056 | - // Don't care |
3057 | - } |
3058 | + |
3059 | + boost::system::error_code err; |
3060 | + ba::write(*socket, ba::buffer(whole_message), err); |
3061 | + if (!err) |
3062 | + { |
3063 | + report->error(err.message()); |
3064 | + } |
3065 | + |
3066 | } |
3067 | |
3068 | void mfd::SocketMessenger::send_fds(std::vector<int32_t> const& fds) |
3069 | |
3070 | === modified file 'src/server/frontend/socket_messenger.h' |
3071 | --- src/server/frontend/socket_messenger.h 2013-08-28 03:41:48 +0000 |
3072 | +++ src/server/frontend/socket_messenger.h 2013-09-26 15:36:41 +0000 |
3073 | @@ -26,13 +26,16 @@ |
3074 | { |
3075 | namespace frontend |
3076 | { |
3077 | +class MessengerReport; |
3078 | + |
3079 | namespace detail |
3080 | { |
3081 | class SocketMessenger : public MessageSender, |
3082 | public MessageReceiver |
3083 | { |
3084 | public: |
3085 | - SocketMessenger(std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket); |
3086 | + SocketMessenger(std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket, |
3087 | + std::shared_ptr<frontend::MessengerReport> const& report); |
3088 | |
3089 | void send(std::string const& body); |
3090 | void send_fds(std::vector<int32_t> const& fds); |
3091 | @@ -42,6 +45,8 @@ |
3092 | |
3093 | private: |
3094 | std::shared_ptr<boost::asio::local::stream_protocol::socket> socket; |
3095 | + std::shared_ptr<MessengerReport> const report; |
3096 | + |
3097 | std::vector<char> whole_message; |
3098 | }; |
3099 | } |
3100 | |
3101 | === modified file 'src/server/graphics/android/CMakeLists.txt' |
3102 | --- src/server/graphics/android/CMakeLists.txt 2013-08-28 03:41:48 +0000 |
3103 | +++ src/server/graphics/android/CMakeLists.txt 2013-09-26 15:36:41 +0000 |
3104 | @@ -11,6 +11,7 @@ |
3105 | android_buffer_allocator.cpp |
3106 | buffer.cpp |
3107 | android_display.cpp |
3108 | + android_display_configuration.cpp |
3109 | gpu_hwc_android_display_buffer_factory.cpp |
3110 | hwc_layerlist.cpp |
3111 | hwc10_device.cpp |
3112 | |
3113 | === modified file 'src/server/graphics/android/android_display.cpp' |
3114 | --- src/server/graphics/android/android_display.cpp 2013-09-11 17:00:39 +0000 |
3115 | +++ src/server/graphics/android/android_display.cpp 2013-09-26 15:36:41 +0000 |
3116 | @@ -24,6 +24,7 @@ |
3117 | #include "mir/graphics/egl_resources.h" |
3118 | #include "android_display.h" |
3119 | #include "android_display_buffer_factory.h" |
3120 | +#include "display_support_provider.h" |
3121 | #include "mir/geometry/rectangle.h" |
3122 | |
3123 | #include <boost/throw_exception.hpp> |
3124 | @@ -50,45 +51,6 @@ |
3125 | EGL_NONE |
3126 | }; |
3127 | |
3128 | -class AndroidDisplayConfiguration : public mg::DisplayConfiguration |
3129 | -{ |
3130 | -public: |
3131 | - AndroidDisplayConfiguration(geom::Size const& display_size) |
3132 | - : configuration{mg::DisplayConfigurationOutputId{1}, |
3133 | - mg::DisplayConfigurationCardId{0}, |
3134 | - mg::DisplayConfigurationOutputType::lvds, |
3135 | - {geom::PixelFormat::abgr_8888}, |
3136 | - {mg::DisplayConfigurationMode{display_size,0.0f}}, |
3137 | - 0, |
3138 | - geom::Size{0,0}, |
3139 | - true, |
3140 | - true, |
3141 | - geom::Point{0,0}, |
3142 | - 0, 0}, |
3143 | - card{mg::DisplayConfigurationCardId{0}, 1} |
3144 | - { |
3145 | - } |
3146 | - |
3147 | - void for_each_card(std::function<void(mg::DisplayConfigurationCard const&)> f) const |
3148 | - { |
3149 | - f(card); |
3150 | - } |
3151 | - |
3152 | - void for_each_output(std::function<void(mg::DisplayConfigurationOutput const&)> f) const |
3153 | - { |
3154 | - f(configuration); |
3155 | - } |
3156 | - |
3157 | - void configure_output(mg::DisplayConfigurationOutputId, bool, geom::Point, size_t) |
3158 | - { |
3159 | - BOOST_THROW_EXCEPTION(std::runtime_error("cannot configure output\n")); |
3160 | - } |
3161 | - |
3162 | -private: |
3163 | - mg::DisplayConfigurationOutput const configuration; |
3164 | - mg::DisplayConfigurationCard const card; |
3165 | -}; |
3166 | - |
3167 | EGLDisplay create_and_initialize_display() |
3168 | { |
3169 | EGLint major, minor; |
3170 | @@ -149,6 +111,7 @@ |
3171 | |
3172 | mga::AndroidDisplay::AndroidDisplay(const std::shared_ptr<AndroidFramebufferWindowQuery>& native_win, |
3173 | std::shared_ptr<AndroidDisplayBufferFactory> const& db_factory, |
3174 | + std::shared_ptr<DisplaySupportProvider> const& display_provider, |
3175 | std::shared_ptr<DisplayReport> const& display_report) |
3176 | : native_window{native_win}, |
3177 | egl_display{create_and_initialize_display()}, |
3178 | @@ -160,7 +123,9 @@ |
3179 | eglCreatePbufferSurface(egl_display, egl_config, |
3180 | dummy_pbuffer_attribs)}, |
3181 | display_buffer{db_factory->create_display_buffer( |
3182 | - native_window, egl_display, egl_context_shared)} |
3183 | + native_window, egl_display, egl_context_shared)}, |
3184 | + display_provider(display_provider), |
3185 | + current_configuration{display_buffer->view_area().size} |
3186 | { |
3187 | display_report->report_successful_setup_of_native_resources(); |
3188 | |
3189 | @@ -186,11 +151,20 @@ |
3190 | |
3191 | std::shared_ptr<mg::DisplayConfiguration> mga::AndroidDisplay::configuration() |
3192 | { |
3193 | - return std::make_shared<AndroidDisplayConfiguration>(display_buffer->view_area().size); |
3194 | + return std::make_shared<mga::AndroidDisplayConfiguration>(current_configuration); |
3195 | } |
3196 | |
3197 | -void mga::AndroidDisplay::configure(mg::DisplayConfiguration const&) |
3198 | +void mga::AndroidDisplay::configure(mg::DisplayConfiguration const& configuration) |
3199 | { |
3200 | + configuration.for_each_output([&](mg::DisplayConfigurationOutput const& output) -> void |
3201 | + { |
3202 | + // TODO: Properly support multiple outputs |
3203 | + if (output.power_mode == mir_power_mode_on) |
3204 | + display_provider->blank_or_unblank_screen(false); |
3205 | + else |
3206 | + display_provider->blank_or_unblank_screen(true); |
3207 | + }); |
3208 | + current_configuration = dynamic_cast<mga::AndroidDisplayConfiguration const&>(configuration); |
3209 | } |
3210 | |
3211 | void mga::AndroidDisplay::register_configuration_change_handler( |
3212 | |
3213 | === modified file 'src/server/graphics/android/android_display.h' |
3214 | --- src/server/graphics/android/android_display.h 2013-08-28 03:41:48 +0000 |
3215 | +++ src/server/graphics/android/android_display.h 2013-09-26 15:36:41 +0000 |
3216 | @@ -22,6 +22,7 @@ |
3217 | #include "mir/graphics/display.h" |
3218 | #include "mir/graphics/egl_resources.h" |
3219 | #include "android_framebuffer_window.h" |
3220 | +#include "android_display_configuration.h" |
3221 | |
3222 | #include <EGL/egl.h> |
3223 | #include <memory> |
3224 | @@ -38,12 +39,14 @@ |
3225 | { |
3226 | |
3227 | class AndroidDisplayBufferFactory; |
3228 | +class DisplaySupportProvider; |
3229 | |
3230 | class AndroidDisplay : public Display |
3231 | { |
3232 | public: |
3233 | explicit AndroidDisplay(std::shared_ptr<AndroidFramebufferWindowQuery> const&, |
3234 | std::shared_ptr<AndroidDisplayBufferFactory> const&, |
3235 | + std::shared_ptr<DisplaySupportProvider> const&, |
3236 | std::shared_ptr<DisplayReport> const&); |
3237 | ~AndroidDisplay(); |
3238 | |
3239 | @@ -74,6 +77,9 @@ |
3240 | EGLContextStore const egl_context_shared; |
3241 | EGLSurfaceStore const egl_surface_dummy; |
3242 | std::unique_ptr<DisplayBuffer> display_buffer; |
3243 | + std::shared_ptr<DisplaySupportProvider> display_provider; |
3244 | + |
3245 | + AndroidDisplayConfiguration current_configuration; |
3246 | }; |
3247 | |
3248 | } |
3249 | |
3250 | === modified file 'src/server/graphics/android/android_display_allocator.cpp' |
3251 | --- src/server/graphics/android/android_display_allocator.cpp 2013-08-28 03:41:48 +0000 |
3252 | +++ src/server/graphics/android/android_display_allocator.cpp 2013-09-26 15:36:41 +0000 |
3253 | @@ -21,17 +21,20 @@ |
3254 | #include "android_framebuffer_window.h" |
3255 | #include "gpu_android_display_buffer_factory.h" |
3256 | #include "hwc_android_display_buffer_factory.h" |
3257 | +#include "hwc_device.h" |
3258 | +#include "fb_device.h" |
3259 | |
3260 | namespace mg=mir::graphics; |
3261 | namespace mga=mir::graphics::android; |
3262 | |
3263 | std::shared_ptr<mga::AndroidDisplay> mga::AndroidDisplayAllocator::create_gpu_display( |
3264 | std::shared_ptr<ANativeWindow> const& native_window, |
3265 | + std::shared_ptr<DisplaySupportProvider> const& display_provider, |
3266 | std::shared_ptr<DisplayReport> const& display_report) const |
3267 | { |
3268 | auto window = std::make_shared<mga::AndroidFramebufferWindow>(native_window); |
3269 | auto db_factory = std::make_shared<mga::GPUAndroidDisplayBufferFactory>(); |
3270 | - return std::make_shared<AndroidDisplay>(window, db_factory, display_report); |
3271 | + return std::make_shared<AndroidDisplay>(window, db_factory, display_provider, display_report); |
3272 | } |
3273 | |
3274 | std::shared_ptr<mga::AndroidDisplay> mga::AndroidDisplayAllocator::create_hwc_display( |
3275 | @@ -41,5 +44,5 @@ |
3276 | { |
3277 | auto window = std::make_shared<mga::AndroidFramebufferWindow>(anw); |
3278 | auto db_factory = std::make_shared<mga::HWCAndroidDisplayBufferFactory>(hwc_device); |
3279 | - return std::make_shared<AndroidDisplay>(window, db_factory, display_report); |
3280 | + return std::make_shared<AndroidDisplay>(window, db_factory, hwc_device, display_report); |
3281 | } |
3282 | |
3283 | === modified file 'src/server/graphics/android/android_display_allocator.h' |
3284 | --- src/server/graphics/android/android_display_allocator.h 2013-08-28 03:41:48 +0000 |
3285 | +++ src/server/graphics/android/android_display_allocator.h 2013-09-26 15:36:41 +0000 |
3286 | @@ -33,6 +33,7 @@ |
3287 | public: |
3288 | std::shared_ptr<AndroidDisplay> create_gpu_display( |
3289 | std::shared_ptr<ANativeWindow> const&, |
3290 | + std::shared_ptr<DisplaySupportProvider> const&, |
3291 | std::shared_ptr<DisplayReport> const&) const; |
3292 | |
3293 | std::shared_ptr<AndroidDisplay> create_hwc_display( |
3294 | |
3295 | === added file 'src/server/graphics/android/android_display_configuration.cpp' |
3296 | --- src/server/graphics/android/android_display_configuration.cpp 1970-01-01 00:00:00 +0000 |
3297 | +++ src/server/graphics/android/android_display_configuration.cpp 2013-09-26 15:36:41 +0000 |
3298 | @@ -0,0 +1,68 @@ |
3299 | +/* |
3300 | + * Copyright © 2013 Canonical Ltd. |
3301 | + * |
3302 | + * This program is free software: you can redistribute it and/or modify it |
3303 | + * under the terms of the GNU General Public License version 3, |
3304 | + * as published by the Free Software Foundation. |
3305 | + * |
3306 | + * This program is distributed in the hope that it will be useful, |
3307 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3308 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3309 | + * GNU General Public License for more details. |
3310 | + * |
3311 | + * You should have received a copy of the GNU General Public License |
3312 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3313 | + */ |
3314 | + |
3315 | +#include "android_display_configuration.h" |
3316 | + |
3317 | +namespace mg = mir::graphics; |
3318 | +namespace mga = mg::android; |
3319 | +namespace geom = mir::geometry; |
3320 | + |
3321 | +mga::AndroidDisplayConfiguration::AndroidDisplayConfiguration(geom::Size const& display_size) |
3322 | + : configuration{mg::DisplayConfigurationOutputId{1}, |
3323 | + mg::DisplayConfigurationCardId{0}, |
3324 | + mg::DisplayConfigurationOutputType::lvds, |
3325 | + {geom::PixelFormat::abgr_8888}, |
3326 | + {mg::DisplayConfigurationMode{display_size,0.0f}}, |
3327 | + 0, |
3328 | + geom::Size{0,0}, |
3329 | + true, |
3330 | + true, |
3331 | + geom::Point{0,0}, |
3332 | + 0, 0, mir_power_mode_on}, |
3333 | + card{mg::DisplayConfigurationCardId{0}, 1} |
3334 | +{ |
3335 | +} |
3336 | + |
3337 | +mga::AndroidDisplayConfiguration::AndroidDisplayConfiguration(AndroidDisplayConfiguration const& other) |
3338 | + : DisplayConfiguration(), configuration(other.configuration), |
3339 | + card(other.card) |
3340 | +{ |
3341 | +} |
3342 | + |
3343 | +mga::AndroidDisplayConfiguration& mga::AndroidDisplayConfiguration::operator=(AndroidDisplayConfiguration const& other) |
3344 | +{ |
3345 | + if (&other != this) |
3346 | + { |
3347 | + configuration = other.configuration; |
3348 | + card = other.card; |
3349 | + } |
3350 | + return *this; |
3351 | +} |
3352 | + |
3353 | +void mga::AndroidDisplayConfiguration::for_each_card(std::function<void(mg::DisplayConfigurationCard const&)> f) const |
3354 | +{ |
3355 | + f(card); |
3356 | +} |
3357 | + |
3358 | +void mga::AndroidDisplayConfiguration::for_each_output(std::function<void(mg::DisplayConfigurationOutput const&)> f) const |
3359 | +{ |
3360 | + f(configuration); |
3361 | +} |
3362 | + |
3363 | +void mga::AndroidDisplayConfiguration::configure_output(mg::DisplayConfigurationOutputId, bool, geom::Point, size_t, MirPowerMode power_mode) |
3364 | +{ |
3365 | + configuration.power_mode = power_mode; |
3366 | +} |
3367 | |
3368 | === added file 'src/server/graphics/android/android_display_configuration.h' |
3369 | --- src/server/graphics/android/android_display_configuration.h 1970-01-01 00:00:00 +0000 |
3370 | +++ src/server/graphics/android/android_display_configuration.h 2013-09-26 15:36:41 +0000 |
3371 | @@ -0,0 +1,51 @@ |
3372 | +/* |
3373 | + * Copyright © 2013 Canonical Ltd. |
3374 | + * |
3375 | + * This program is free software: you can redistribute it and/or modify it |
3376 | + * under the terms of the GNU General Public License version 3, |
3377 | + * as published by the Free Software Foundation. |
3378 | + * |
3379 | + * This program is distributed in the hope that it will be useful, |
3380 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3381 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3382 | + * GNU General Public License for more details. |
3383 | + * |
3384 | + * You should have received a copy of the GNU General Public License |
3385 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3386 | + */ |
3387 | + |
3388 | +#ifndef MIR_GRAPHICS_ANDROID_ANDROID_DISPLAY_CONFIGURATION_H_ |
3389 | +#define MIR_GRAPHICS_ANDROID_ANDROID_DISPLAY_CONFIGURATION_H_ |
3390 | + |
3391 | +#include "mir/graphics/display_configuration.h" |
3392 | + |
3393 | +namespace mir |
3394 | +{ |
3395 | +namespace graphics |
3396 | +{ |
3397 | +namespace android |
3398 | +{ |
3399 | + |
3400 | +class AndroidDisplayConfiguration : public graphics::DisplayConfiguration |
3401 | +{ |
3402 | +public: |
3403 | + AndroidDisplayConfiguration(geometry::Size const& display_size); |
3404 | + AndroidDisplayConfiguration(AndroidDisplayConfiguration const& other); |
3405 | + AndroidDisplayConfiguration& operator=(AndroidDisplayConfiguration const& other); |
3406 | + |
3407 | + virtual ~AndroidDisplayConfiguration() = default; |
3408 | + |
3409 | + void for_each_card(std::function<void(DisplayConfigurationCard const&)> f) const; |
3410 | + void for_each_output(std::function<void(DisplayConfigurationOutput const&)> f) const; |
3411 | + void configure_output(DisplayConfigurationOutputId, bool, geometry::Point, size_t, MirPowerMode power_mode); |
3412 | + |
3413 | +private: |
3414 | + DisplayConfigurationOutput configuration; |
3415 | + DisplayConfigurationCard card; |
3416 | +}; |
3417 | + |
3418 | + |
3419 | +} |
3420 | +} |
3421 | +} |
3422 | +#endif /* MIR_GRAPHICS_ANDROID_ANDROID_DISPLAY_CONFIGURATION_H_ */ |
3423 | |
3424 | === modified file 'src/server/graphics/android/android_display_factory.cpp' |
3425 | --- src/server/graphics/android/android_display_factory.cpp 2013-08-28 03:41:48 +0000 |
3426 | +++ src/server/graphics/android/android_display_factory.cpp 2013-09-26 15:36:41 +0000 |
3427 | @@ -100,7 +100,7 @@ |
3428 | else |
3429 | { |
3430 | auto fb_native_win = fb_factory->create_fb_native_window(fb_dev); |
3431 | - display = display_factory->create_gpu_display(fb_native_win, display_report); |
3432 | + display = display_factory->create_gpu_display(fb_native_win, fb_dev, display_report); |
3433 | display_report->report_gpu_composition_in_use(); |
3434 | } |
3435 | |
3436 | |
3437 | === modified file 'src/server/graphics/android/android_hwc_factory.cpp' |
3438 | --- src/server/graphics/android/android_hwc_factory.cpp 2013-05-16 18:56:32 +0000 |
3439 | +++ src/server/graphics/android/android_hwc_factory.cpp 2013-09-26 15:36:41 +0000 |
3440 | @@ -28,7 +28,7 @@ |
3441 | std::shared_ptr<hwc_composer_device_1> const& hwc_device, |
3442 | std::shared_ptr<mga::DisplaySupportProvider> const& fb_device) const |
3443 | { |
3444 | - auto layer_list = std::make_shared<mga::HWCLayerList>(); |
3445 | + auto layer_list = std::make_shared<mga::LayerList>(); |
3446 | auto syncer = std::make_shared<mga::HWCVsync>(); |
3447 | return std::make_shared<mga::HWC11Device>(hwc_device, layer_list, fb_device, syncer); |
3448 | } |
3449 | |
3450 | === modified file 'src/server/graphics/android/display_allocator.h' |
3451 | --- src/server/graphics/android/display_allocator.h 2013-08-28 03:41:48 +0000 |
3452 | +++ src/server/graphics/android/display_allocator.h 2013-09-26 15:36:41 +0000 |
3453 | @@ -33,6 +33,8 @@ |
3454 | class AndroidDisplay; |
3455 | class HWCDevice; |
3456 | class HWCDisplay; |
3457 | +class DisplaySupportProvider; |
3458 | + |
3459 | class DisplayAllocator |
3460 | { |
3461 | public: |
3462 | @@ -41,6 +43,7 @@ |
3463 | |
3464 | virtual std::shared_ptr<AndroidDisplay> create_gpu_display( |
3465 | std::shared_ptr<ANativeWindow> const&, |
3466 | + std::shared_ptr<DisplaySupportProvider> const&, |
3467 | std::shared_ptr<DisplayReport> const&) const = 0; |
3468 | |
3469 | virtual std::shared_ptr<AndroidDisplay> create_hwc_display( |
3470 | |
3471 | === modified file 'src/server/graphics/android/display_support_provider.h' |
3472 | --- src/server/graphics/android/display_support_provider.h 2013-08-28 03:41:48 +0000 |
3473 | +++ src/server/graphics/android/display_support_provider.h 2013-09-26 15:36:41 +0000 |
3474 | @@ -44,6 +44,8 @@ |
3475 | //post immediately, or be deferred. |
3476 | virtual void set_next_frontbuffer(std::shared_ptr<graphics::Buffer> const& buffer) = 0; |
3477 | virtual void sync_to_display(bool sync) = 0; |
3478 | + |
3479 | + virtual void blank_or_unblank_screen(bool blank) = 0; |
3480 | protected: |
3481 | DisplaySupportProvider() = default; |
3482 | DisplaySupportProvider& operator=(DisplaySupportProvider const&) = delete; |
3483 | |
3484 | === modified file 'src/server/graphics/android/fb_device.cpp' |
3485 | --- src/server/graphics/android/fb_device.cpp 2013-08-28 03:41:48 +0000 |
3486 | +++ src/server/graphics/android/fb_device.cpp 2013-09-26 15:36:41 +0000 |
3487 | @@ -78,3 +78,9 @@ |
3488 | fb_device->setSwapInterval(fb_device.get(), 0); |
3489 | } |
3490 | } |
3491 | + |
3492 | +void mga::FBDevice::blank_or_unblank_screen(bool blank) |
3493 | +{ |
3494 | + // TODO: Implement |
3495 | + (void) blank; |
3496 | +} |
3497 | |
3498 | === modified file 'src/server/graphics/android/fb_device.h' |
3499 | --- src/server/graphics/android/fb_device.h 2013-08-28 03:41:48 +0000 |
3500 | +++ src/server/graphics/android/fb_device.h 2013-09-26 15:36:41 +0000 |
3501 | @@ -41,6 +41,8 @@ |
3502 | |
3503 | void set_next_frontbuffer(std::shared_ptr<graphics::Buffer> const& buffer); |
3504 | void sync_to_display(bool sync); |
3505 | + |
3506 | + void blank_or_unblank_screen(bool blank); |
3507 | private: |
3508 | std::shared_ptr<framebuffer_device_t> const fb_device; |
3509 | }; |
3510 | |
3511 | === modified file 'src/server/graphics/android/gpu_hwc_android_display_buffer_factory.cpp' |
3512 | --- src/server/graphics/android/gpu_hwc_android_display_buffer_factory.cpp 2013-08-28 03:41:48 +0000 |
3513 | +++ src/server/graphics/android/gpu_hwc_android_display_buffer_factory.cpp 2013-09-26 15:36:41 +0000 |
3514 | @@ -110,7 +110,7 @@ |
3515 | { |
3516 | return false; |
3517 | } |
3518 | - |
3519 | + |
3520 | protected: |
3521 | std::shared_ptr<mga::AndroidFramebufferWindowQuery> const native_window; |
3522 | EGLDisplay const egl_display; |
3523 | @@ -126,7 +126,8 @@ |
3524 | EGLContext egl_context_shared, |
3525 | std::shared_ptr<mga::HWCDevice> const& hwc_device) |
3526 | : GPUDisplayBuffer{native_win, egl_display, egl_context_shared}, |
3527 | - hwc_device{hwc_device} |
3528 | + hwc_device{hwc_device}, |
3529 | + blanked(false) |
3530 | { |
3531 | } |
3532 | |
3533 | @@ -144,6 +145,8 @@ |
3534 | |
3535 | private: |
3536 | std::shared_ptr<mga::HWCDevice> const hwc_device; |
3537 | + |
3538 | + bool blanked; |
3539 | }; |
3540 | |
3541 | } |
3542 | |
3543 | === modified file 'src/server/graphics/android/hwc10_device.cpp' |
3544 | --- src/server/graphics/android/hwc10_device.cpp 2013-08-28 03:41:48 +0000 |
3545 | +++ src/server/graphics/android/hwc10_device.cpp 2013-09-26 15:36:41 +0000 |
3546 | @@ -62,6 +62,8 @@ |
3547 | |
3548 | void mga::HWC10Device::commit_frame(EGLDisplay dpy, EGLSurface sur) |
3549 | { |
3550 | + auto lg = lock_unblanked(); |
3551 | + |
3552 | hwc_display_contents_1 display_contents; |
3553 | display_contents.dpy = dpy; |
3554 | display_contents.sur = sur; |
3555 | |
3556 | === modified file 'src/server/graphics/android/hwc10_device.h' |
3557 | --- src/server/graphics/android/hwc10_device.h 2013-08-28 03:41:48 +0000 |
3558 | +++ src/server/graphics/android/hwc10_device.h 2013-09-26 15:36:41 +0000 |
3559 | @@ -26,7 +26,6 @@ |
3560 | { |
3561 | namespace android |
3562 | { |
3563 | -class HWCLayerOrganizer; |
3564 | class DisplaySupportProvider; |
3565 | |
3566 | class HWC10Device : public HWCCommonDevice |
3567 | |
3568 | === modified file 'src/server/graphics/android/hwc11_device.cpp' |
3569 | --- src/server/graphics/android/hwc11_device.cpp 2013-08-28 03:41:48 +0000 |
3570 | +++ src/server/graphics/android/hwc11_device.cpp 2013-09-26 15:36:41 +0000 |
3571 | @@ -20,6 +20,7 @@ |
3572 | #include "hwc11_device.h" |
3573 | #include "hwc_layerlist.h" |
3574 | #include "hwc_vsync_coordinator.h" |
3575 | +#include "mir/graphics/android/syncfence.h" |
3576 | #include <boost/throw_exception.hpp> |
3577 | #include <stdexcept> |
3578 | |
3579 | @@ -28,13 +29,12 @@ |
3580 | namespace geom=mir::geometry; |
3581 | |
3582 | mga::HWC11Device::HWC11Device(std::shared_ptr<hwc_composer_device_1> const& hwc_device, |
3583 | - std::shared_ptr<HWCLayerOrganizer> const& organizer, |
3584 | + std::shared_ptr<HWCLayerList> const& layer_list, |
3585 | std::shared_ptr<DisplaySupportProvider> const& fbdev, |
3586 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator) |
3587 | : HWCCommonDevice(hwc_device, coordinator), |
3588 | - layer_organizer(organizer), |
3589 | - fb_device(fbdev), |
3590 | - wait_for_vsync(true) |
3591 | + layer_list(layer_list), |
3592 | + fb_device(fbdev) |
3593 | { |
3594 | size_t num_configs = 1; |
3595 | auto rc = hwc_device->getDisplayConfigs(hwc_device.get(), HWC_DISPLAY_PRIMARY, &primary_display_config, &num_configs); |
3596 | @@ -55,8 +55,6 @@ |
3597 | HWC_DISPLAY_NO_ATTRIBUTE}; |
3598 | |
3599 | int size_values[2]; |
3600 | - /* note: some hwc modules (adreno320) do not accept any request list other than what surfaceflinger's requests, |
3601 | - * despite what the hwc header says. from what I've seen so far, this is harmless, other than a logcat msg */ |
3602 | hwc_device->getDisplayAttributes(hwc_device.get(), HWC_DISPLAY_PRIMARY, primary_display_config, |
3603 | size_request, size_values); |
3604 | |
3605 | @@ -77,52 +75,39 @@ |
3606 | |
3607 | void mga::HWC11Device::set_next_frontbuffer(std::shared_ptr<mg::Buffer> const& buffer) |
3608 | { |
3609 | - layer_organizer->set_fb_target(buffer); |
3610 | - |
3611 | - if (wait_for_vsync) |
3612 | - { |
3613 | - fb_device->set_next_frontbuffer(buffer); |
3614 | - } |
3615 | + layer_list->set_fb_target(buffer); |
3616 | } |
3617 | |
3618 | void mga::HWC11Device::commit_frame(EGLDisplay dpy, EGLSurface sur) |
3619 | { |
3620 | - /* note, swapbuffers will go around through the driver and call set_next_frontbuffer */ |
3621 | + auto lg = lock_unblanked(); |
3622 | + |
3623 | + //note, although we only have a primary display right now, |
3624 | + // set the second display to nullptr, as exynos hwc always derefs displays[1] |
3625 | + hwc_display_contents_1_t* displays[HWC_NUM_DISPLAY_TYPES] {layer_list->native_list(), nullptr}; |
3626 | + |
3627 | + if (hwc_device->prepare(hwc_device.get(), 1, displays)) |
3628 | + { |
3629 | + BOOST_THROW_EXCEPTION(std::runtime_error("error during hwc prepare()")); |
3630 | + } |
3631 | + |
3632 | + /* note, swapbuffers will go around through the driver and call |
3633 | + set_next_frontbuffer, updating the fb target before committing */ |
3634 | if (eglSwapBuffers(dpy, sur) == EGL_FALSE) |
3635 | { |
3636 | BOOST_THROW_EXCEPTION(std::runtime_error("error during eglSwapBuffers")); |
3637 | } |
3638 | |
3639 | - auto& list = layer_organizer->native_list(); |
3640 | - |
3641 | - auto struct_size = sizeof(hwc_display_contents_1_t) + sizeof(hwc_layer_1_t)*(list.size()); |
3642 | - auto hwc_display_raw = static_cast<hwc_display_contents_1_t*>( ::operator new( struct_size)); |
3643 | - auto hwc_display = std::unique_ptr<hwc_display_contents_1_t>(hwc_display_raw); |
3644 | - |
3645 | - auto i = 0u; |
3646 | - for( auto& layer : list) |
3647 | - { |
3648 | - hwc_display->hwLayers[i++] = *layer; |
3649 | - } |
3650 | - hwc_display->numHwLayers = list.size(); |
3651 | - hwc_display->retireFenceFd = -1; |
3652 | - |
3653 | - auto rc = hwc_device->set(hwc_device.get(), HWC_NUM_DISPLAY_TYPES, &hwc_display_raw); |
3654 | - if (rc != 0) |
3655 | + if (hwc_device->set(hwc_device.get(), 1, displays)) |
3656 | { |
3657 | BOOST_THROW_EXCEPTION(std::runtime_error("error during hwc set()")); |
3658 | } |
3659 | |
3660 | - if (hwc_display->retireFenceFd > 0) |
3661 | - close(hwc_display->retireFenceFd); |
3662 | - |
3663 | - if (wait_for_vsync) |
3664 | - { |
3665 | - coordinator->wait_for_vsync(); |
3666 | - } |
3667 | + mga::SyncFence fence(displays[HWC_DISPLAY_PRIMARY]->retireFenceFd); |
3668 | + fence.wait(); |
3669 | } |
3670 | |
3671 | -void mga::HWC11Device::sync_to_display(bool sync) |
3672 | +void mga::HWC11Device::sync_to_display(bool) |
3673 | { |
3674 | - wait_for_vsync = sync; |
3675 | + //TODO return error code, running not synced to vsync is not supported |
3676 | } |
3677 | |
3678 | === modified file 'src/server/graphics/android/hwc11_device.h' |
3679 | --- src/server/graphics/android/hwc11_device.h 2013-08-28 03:41:48 +0000 |
3680 | +++ src/server/graphics/android/hwc11_device.h 2013-09-26 15:36:41 +0000 |
3681 | @@ -29,14 +29,14 @@ |
3682 | |
3683 | namespace android |
3684 | { |
3685 | -class HWCLayerOrganizer; |
3686 | +class HWCLayerList; |
3687 | class HWCVsyncCoordinator; |
3688 | |
3689 | class HWC11Device : public HWCCommonDevice |
3690 | { |
3691 | public: |
3692 | HWC11Device(std::shared_ptr<hwc_composer_device_1> const& hwc_device, |
3693 | - std::shared_ptr<HWCLayerOrganizer> const& organizer, |
3694 | + std::shared_ptr<HWCLayerList> const& layer_list, |
3695 | std::shared_ptr<DisplaySupportProvider> const& fbdev, |
3696 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator); |
3697 | ~HWC11Device() noexcept; |
3698 | @@ -50,10 +50,9 @@ |
3699 | void commit_frame(EGLDisplay dpy, EGLSurface sur); |
3700 | |
3701 | private: |
3702 | - std::shared_ptr<HWCLayerOrganizer> const layer_organizer; |
3703 | + std::shared_ptr<HWCLayerList> const layer_list; |
3704 | std::shared_ptr<DisplaySupportProvider> const fb_device; |
3705 | unsigned int primary_display_config; |
3706 | - bool wait_for_vsync; |
3707 | }; |
3708 | |
3709 | } |
3710 | |
3711 | === modified file 'src/server/graphics/android/hwc_common_device.cpp' |
3712 | --- src/server/graphics/android/hwc_common_device.cpp 2013-06-11 10:00:48 +0000 |
3713 | +++ src/server/graphics/android/hwc_common_device.cpp 2013-09-26 15:36:41 +0000 |
3714 | @@ -46,7 +46,8 @@ |
3715 | mga::HWCCommonDevice::HWCCommonDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device, |
3716 | std::shared_ptr<mga::HWCVsyncCoordinator> const& coordinator) |
3717 | : hwc_device(hwc_device), |
3718 | - coordinator(coordinator) |
3719 | + coordinator(coordinator), |
3720 | + blanked(false) |
3721 | { |
3722 | callbacks.hooks.invalidate = invalidate_hook; |
3723 | callbacks.hooks.vsync = vsync_hook; |
3724 | @@ -95,3 +96,29 @@ |
3725 | { |
3726 | coordinator->notify_vsync(); |
3727 | } |
3728 | + |
3729 | +void mga::HWCCommonDevice::blank_or_unblank_screen(bool blank) |
3730 | +{ |
3731 | + std::unique_lock<std::mutex> lg(blanked_mutex); |
3732 | + |
3733 | + int err = hwc_device->blank(hwc_device.get(), HWC_DISPLAY_PRIMARY, blank); |
3734 | + if (err) |
3735 | + { |
3736 | + std::string blanking_status_msg = "Could not " + |
3737 | + (blank ? std::string("blank") : std::string("unblank")) + " display"; |
3738 | + BOOST_THROW_EXCEPTION( |
3739 | + boost::enable_error_info( |
3740 | + std::runtime_error(blanking_status_msg)) << |
3741 | + boost::errinfo_errno(-err)); |
3742 | + } |
3743 | + blanked = blank; |
3744 | + blanked_cond.notify_all(); |
3745 | +} |
3746 | + |
3747 | +std::unique_lock<std::mutex> mga::HWCCommonDevice::lock_unblanked() |
3748 | +{ |
3749 | + std::unique_lock<std::mutex> lg(blanked_mutex); |
3750 | + while(blanked) |
3751 | + blanked_cond.wait(lg); |
3752 | + return std::move(lg); |
3753 | +} |
3754 | |
3755 | === modified file 'src/server/graphics/android/hwc_common_device.h' |
3756 | --- src/server/graphics/android/hwc_common_device.h 2013-08-28 03:41:48 +0000 |
3757 | +++ src/server/graphics/android/hwc_common_device.h 2013-09-26 15:36:41 +0000 |
3758 | @@ -22,6 +22,9 @@ |
3759 | |
3760 | #include <hardware/hwcomposer.h> |
3761 | |
3762 | +#include <mutex> |
3763 | +#include <condition_variable> |
3764 | + |
3765 | namespace mir |
3766 | { |
3767 | namespace graphics |
3768 | @@ -49,6 +52,8 @@ |
3769 | virtual geometry::Size display_size() const = 0; |
3770 | virtual void set_next_frontbuffer(std::shared_ptr<Buffer> const& buffer) = 0; |
3771 | virtual void commit_frame(EGLDisplay dpy, EGLSurface sur) = 0; |
3772 | + |
3773 | + void blank_or_unblank_screen(bool blank); |
3774 | |
3775 | void notify_vsync(); |
3776 | protected: |
3777 | @@ -57,8 +62,15 @@ |
3778 | |
3779 | std::shared_ptr<hwc_composer_device_1> const hwc_device; |
3780 | std::shared_ptr<HWCVsyncCoordinator> const coordinator; |
3781 | +protected: |
3782 | + std::unique_lock<std::mutex> lock_unblanked(); |
3783 | + |
3784 | private: |
3785 | HWCCallbacks callbacks; |
3786 | + |
3787 | + std::mutex blanked_mutex; |
3788 | + std::condition_variable blanked_cond; |
3789 | + bool blanked; |
3790 | }; |
3791 | |
3792 | } |
3793 | |
3794 | === modified file 'src/server/graphics/android/hwc_device.h' |
3795 | --- src/server/graphics/android/hwc_device.h 2013-08-28 03:41:48 +0000 |
3796 | +++ src/server/graphics/android/hwc_device.h 2013-09-26 15:36:41 +0000 |
3797 | @@ -42,6 +42,8 @@ |
3798 | virtual void set_next_frontbuffer(std::shared_ptr<Buffer> const& buffer) = 0; |
3799 | |
3800 | virtual void commit_frame(EGLDisplay dpy, EGLSurface sur) = 0; |
3801 | + |
3802 | + virtual void blank_or_unblank_screen(bool blank) = 0; |
3803 | private: |
3804 | HWCDevice(HWCDevice const&) = delete; |
3805 | HWCDevice& operator=(HWCDevice const&) = delete; |
3806 | |
3807 | === modified file 'src/server/graphics/android/hwc_layerlist.cpp' |
3808 | --- src/server/graphics/android/hwc_layerlist.cpp 2013-08-28 03:41:48 +0000 |
3809 | +++ src/server/graphics/android/hwc_layerlist.cpp 2013-09-26 15:36:41 +0000 |
3810 | @@ -41,7 +41,7 @@ |
3811 | mga::HWCDefaultLayer::HWCDefaultLayer(std::initializer_list<mga::HWCRect> list) |
3812 | { |
3813 | /* default values.*/ |
3814 | - self.compositionType = HWC_FRAMEBUFFER; |
3815 | + self.compositionType = HWC_FRAMEBUFFER_TARGET; |
3816 | self.hints = 0; |
3817 | self.flags = 0; |
3818 | self.transform = 0; |
3819 | @@ -75,27 +75,31 @@ |
3820 | } |
3821 | |
3822 | mga::HWCFBLayer::HWCFBLayer( |
3823 | - std::shared_ptr<ANativeWindowBuffer> const& native_buf, |
3824 | - HWCRect& display_frame_rect) |
3825 | + buffer_handle_t native_handle, |
3826 | + HWCRect display_frame_rect) |
3827 | : HWCDefaultLayer{display_frame_rect} |
3828 | { |
3829 | self.compositionType = HWC_FRAMEBUFFER_TARGET; |
3830 | - self.handle = native_buf->handle; |
3831 | |
3832 | + self.handle = native_handle; |
3833 | self.sourceCrop = display_frame_rect; |
3834 | self.displayFrame = display_frame_rect; |
3835 | } |
3836 | |
3837 | -mga::HWCLayerList::HWCLayerList() |
3838 | -{ |
3839 | -} |
3840 | - |
3841 | -const mga::LayerList& mga::HWCLayerList::native_list() const |
3842 | -{ |
3843 | - return layer_list; |
3844 | -} |
3845 | - |
3846 | -void mga::HWCLayerList::set_fb_target(std::shared_ptr<mg::Buffer> const& buffer) |
3847 | +mga::HWCFBLayer::HWCFBLayer() |
3848 | + : HWCFBLayer{nullptr, mga::HWCRect{}} |
3849 | +{ |
3850 | +} |
3851 | + |
3852 | +mga::LayerList::LayerList() |
3853 | + : layer_list{std::make_shared<HWCFBLayer>()}, |
3854 | + hwc_representation{std::make_shared<hwc_display_contents_1_t>()} |
3855 | +{ |
3856 | + memset(hwc_representation.get(), 0, sizeof(hwc_display_contents_1_t)); |
3857 | + update_list(); |
3858 | +} |
3859 | + |
3860 | +void mga::LayerList::set_fb_target(std::shared_ptr<mg::Buffer> const& buffer) |
3861 | { |
3862 | auto handle = buffer->native_buffer_handle(); |
3863 | |
3864 | @@ -103,13 +107,32 @@ |
3865 | geom::Rectangle rect{pt, buffer->size()}; |
3866 | HWCRect display_rect(rect); |
3867 | |
3868 | - auto fb_layer = std::make_shared<HWCFBLayer>(handle, display_rect); |
3869 | - if (layer_list.empty()) |
3870 | - { |
3871 | - layer_list.push_back(fb_layer); |
3872 | - } |
3873 | - else |
3874 | - { |
3875 | - layer_list[0] = fb_layer; |
3876 | - } |
3877 | + auto fb_layer = std::make_shared<HWCFBLayer>(handle->handle, display_rect); |
3878 | + layer_list[fb_position] = fb_layer; |
3879 | + |
3880 | + update_list(); |
3881 | } |
3882 | + |
3883 | +void mga::LayerList::update_list() |
3884 | +{ |
3885 | + if (layer_list.size() != hwc_representation->numHwLayers) |
3886 | + { |
3887 | + auto struct_size = sizeof(hwc_display_contents_1_t) + sizeof(hwc_layer_1_t)*(layer_list.size()); |
3888 | + hwc_representation = std::shared_ptr<hwc_display_contents_1_t>( |
3889 | + static_cast<hwc_display_contents_1_t*>( ::operator new(struct_size))); |
3890 | + |
3891 | + hwc_representation->numHwLayers = layer_list.size(); |
3892 | + } |
3893 | + |
3894 | + auto i = 0u; |
3895 | + for( auto& layer : layer_list) |
3896 | + { |
3897 | + hwc_representation->hwLayers[i++] = *layer; |
3898 | + } |
3899 | + hwc_representation->retireFenceFd = -1; |
3900 | +} |
3901 | + |
3902 | +hwc_display_contents_1_t* mga::LayerList::native_list() const |
3903 | +{ |
3904 | + return hwc_representation.get(); |
3905 | +} |
3906 | |
3907 | === modified file 'src/server/graphics/android/hwc_layerlist.h' |
3908 | --- src/server/graphics/android/hwc_layerlist.h 2013-08-28 03:41:48 +0000 |
3909 | +++ src/server/graphics/android/hwc_layerlist.h 2013-09-26 15:36:41 +0000 |
3910 | @@ -32,8 +32,6 @@ |
3911 | |
3912 | namespace android |
3913 | { |
3914 | -class HWCDefaultLayer; |
3915 | -typedef struct std::vector<std::shared_ptr<HWCDefaultLayer>> LayerList; |
3916 | |
3917 | struct HWCRect |
3918 | { |
3919 | @@ -63,34 +61,40 @@ |
3920 | |
3921 | struct HWCFBLayer : public HWCDefaultLayer |
3922 | { |
3923 | - HWCFBLayer(std::shared_ptr<ANativeWindowBuffer> const& native_buf, |
3924 | - HWCRect& display_frame_rect); |
3925 | + HWCFBLayer(); |
3926 | + HWCFBLayer(buffer_handle_t native_buf, |
3927 | + HWCRect display_frame_rect); |
3928 | }; |
3929 | |
3930 | -class HWCLayerOrganizer |
3931 | +class HWCLayerList |
3932 | { |
3933 | public: |
3934 | - virtual ~HWCLayerOrganizer() = default; |
3935 | - virtual const LayerList& native_list() const = 0; |
3936 | + virtual ~HWCLayerList() = default; |
3937 | + |
3938 | + virtual hwc_display_contents_1_t* native_list() const = 0; |
3939 | virtual void set_fb_target(std::shared_ptr<Buffer> const&) = 0; |
3940 | |
3941 | protected: |
3942 | - HWCLayerOrganizer() = default; |
3943 | - HWCLayerOrganizer& operator=(HWCLayerOrganizer const&) = delete; |
3944 | - HWCLayerOrganizer(HWCLayerOrganizer const&) = delete; |
3945 | + HWCLayerList() = default; |
3946 | + HWCLayerList& operator=(HWCLayerList const&) = delete; |
3947 | + HWCLayerList(HWCLayerList const&) = delete; |
3948 | |
3949 | }; |
3950 | |
3951 | -class HWCLayerList : public HWCLayerOrganizer |
3952 | +class LayerList : public HWCLayerList |
3953 | { |
3954 | public: |
3955 | - HWCLayerList(); |
3956 | - const LayerList& native_list() const; |
3957 | + LayerList(); |
3958 | |
3959 | void set_fb_target(std::shared_ptr<Buffer> const&); |
3960 | + hwc_display_contents_1_t* native_list() const; |
3961 | |
3962 | private: |
3963 | - LayerList layer_list; |
3964 | + std::vector<std::shared_ptr<HWCDefaultLayer>> layer_list; |
3965 | + void update_list(); |
3966 | + |
3967 | + static size_t const fb_position = 0u; |
3968 | + std::shared_ptr<hwc_display_contents_1_t> hwc_representation; |
3969 | }; |
3970 | |
3971 | } |
3972 | |
3973 | === modified file 'src/server/graphics/android/internal_client.cpp' |
3974 | --- src/server/graphics/android/internal_client.cpp 2013-08-28 03:41:48 +0000 |
3975 | +++ src/server/graphics/android/internal_client.cpp 2013-09-26 15:36:41 +0000 |
3976 | @@ -24,7 +24,6 @@ |
3977 | namespace mga=mir::graphics::android; |
3978 | |
3979 | mga::InternalClient::InternalClient() |
3980 | - : client_window(0) |
3981 | { |
3982 | } |
3983 | |
3984 | @@ -35,12 +34,12 @@ |
3985 | |
3986 | EGLNativeWindowType mga::InternalClient::egl_native_window(std::shared_ptr<InternalSurface> const& surface) |
3987 | { |
3988 | - if (!client_window) |
3989 | + if (!client_windows[surface]) |
3990 | { |
3991 | auto cache = std::make_shared<mga::InterpreterCache>(); |
3992 | auto interpreter = std::make_shared<mga::InternalClientWindow>(surface, cache); |
3993 | - client_window = std::make_shared<mga::MirNativeWindow>(interpreter); |
3994 | + client_windows[surface] = std::make_shared<mga::MirNativeWindow>(interpreter); |
3995 | } |
3996 | |
3997 | - return client_window.get(); |
3998 | + return client_windows[surface].get(); |
3999 | } |
4000 | |
4001 | === modified file 'src/server/graphics/android/internal_client.h' |
4002 | --- src/server/graphics/android/internal_client.h 2013-08-28 03:41:48 +0000 |
4003 | +++ src/server/graphics/android/internal_client.h 2013-09-26 15:36:41 +0000 |
4004 | @@ -21,6 +21,7 @@ |
4005 | |
4006 | #include "mir/graphics/internal_client.h" |
4007 | #include <memory> |
4008 | +#include <map> |
4009 | |
4010 | namespace mir |
4011 | { |
4012 | @@ -37,7 +38,7 @@ |
4013 | EGLNativeWindowType egl_native_window(std::shared_ptr<InternalSurface> const&); |
4014 | |
4015 | private: |
4016 | - std::shared_ptr<MirNativeWindow> client_window; |
4017 | + std::map<std::shared_ptr<InternalSurface>, std::shared_ptr<MirNativeWindow>> client_windows; |
4018 | }; |
4019 | } |
4020 | } |
4021 | |
4022 | === modified file 'src/server/graphics/android/internal_client_window.cpp' |
4023 | --- src/server/graphics/android/internal_client_window.cpp 2013-08-28 03:41:48 +0000 |
4024 | +++ src/server/graphics/android/internal_client_window.cpp 2013-09-26 15:36:41 +0000 |
4025 | @@ -44,8 +44,9 @@ |
4026 | } |
4027 | |
4028 | void mga::InternalClientWindow::driver_returns_buffer(ANativeWindowBuffer* handle, |
4029 | - std::shared_ptr<SyncObject> const&) |
4030 | + std::shared_ptr<SyncObject> const& fence) |
4031 | { |
4032 | + fence->wait(); |
4033 | resource_cache->retrieve_buffer(handle); |
4034 | /* here, the mc::TemporaryBuffer will destruct, triggering buffer advance */ |
4035 | } |
4036 | |
4037 | === modified file 'src/server/graphics/android/server_render_window.cpp' |
4038 | --- src/server/graphics/android/server_render_window.cpp 2013-08-28 03:41:48 +0000 |
4039 | +++ src/server/graphics/android/server_render_window.cpp 2013-09-26 15:36:41 +0000 |
4040 | @@ -53,8 +53,9 @@ |
4041 | } |
4042 | |
4043 | //sync object could be passed to hwc. we don't need to that yet though |
4044 | -void mga::ServerRenderWindow::driver_returns_buffer(ANativeWindowBuffer* returned_handle, std::shared_ptr<SyncObject> const&) |
4045 | +void mga::ServerRenderWindow::driver_returns_buffer(ANativeWindowBuffer* returned_handle, std::shared_ptr<SyncObject> const& fence) |
4046 | { |
4047 | + fence->wait(); |
4048 | auto buffer = resource_cache->retrieve_buffer(returned_handle); |
4049 | poster->set_next_frontbuffer(buffer); |
4050 | swapper->compositor_release(buffer); |
4051 | |
4052 | === modified file 'src/server/graphics/gbm/gbm_buffer_allocator.cpp' |
4053 | --- src/server/graphics/gbm/gbm_buffer_allocator.cpp 2013-09-11 13:50:10 +0000 |
4054 | +++ src/server/graphics/gbm/gbm_buffer_allocator.cpp 2013-09-26 15:36:41 +0000 |
4055 | @@ -114,6 +114,9 @@ |
4056 | egl_extensions(std::make_shared<mg::EGLExtensions>()) |
4057 | { |
4058 | assert(buffer_initializer.get() != 0); |
4059 | + |
4060 | + const char *env = getenv("MIR_BYPASS"); |
4061 | + bypass_env = env ? env[0] != '0' : true; |
4062 | } |
4063 | |
4064 | std::shared_ptr<mg::Buffer> mgg::GBMBufferAllocator::alloc_buffer(BufferProperties const& buffer_properties) |
4065 | @@ -145,7 +148,8 @@ |
4066 | * resizing). We may also want to check for |
4067 | * mir_surface_state_fullscreen later when it's fully wired up. |
4068 | */ |
4069 | - if (buffer_properties.usage == BufferUsage::hardware && |
4070 | + if (bypass_env && |
4071 | + buffer_properties.usage == BufferUsage::hardware && |
4072 | buffer_properties.size.width.as_uint32_t() >= 800 && |
4073 | buffer_properties.size.height.as_uint32_t() >= 600) |
4074 | { |
4075 | |
4076 | === modified file 'src/server/graphics/gbm/gbm_buffer_allocator.h' |
4077 | --- src/server/graphics/gbm/gbm_buffer_allocator.h 2013-08-29 03:48:16 +0000 |
4078 | +++ src/server/graphics/gbm/gbm_buffer_allocator.h 2013-09-26 15:36:41 +0000 |
4079 | @@ -55,6 +55,8 @@ |
4080 | gbm_device* const device; |
4081 | std::shared_ptr<graphics::BufferInitializer> buffer_initializer; |
4082 | std::shared_ptr<EGLExtensions> const egl_extensions; |
4083 | + |
4084 | + bool bypass_env; |
4085 | }; |
4086 | |
4087 | } |
4088 | |
4089 | === modified file 'src/server/graphics/gbm/gbm_display.cpp' |
4090 | --- src/server/graphics/gbm/gbm_display.cpp 2013-09-11 17:00:39 +0000 |
4091 | +++ src/server/graphics/gbm/gbm_display.cpp 2013-09-26 15:36:41 +0000 |
4092 | @@ -129,6 +129,16 @@ |
4093 | auto const& kms_conf = dynamic_cast<RealKMSDisplayConfiguration const&>(conf); |
4094 | std::vector<std::unique_ptr<GBMDisplayBuffer>> display_buffers_new; |
4095 | |
4096 | + /* Reset the state of all outputs */ |
4097 | + kms_conf.for_each_output([&](DisplayConfigurationOutput const& conf_output) |
4098 | + { |
4099 | + uint32_t const connector_id = current_display_configuration.get_kms_connector_id(conf_output.id); |
4100 | + auto kms_output = output_container.get_kms_output_for(connector_id); |
4101 | + kms_output->clear_cursor(); |
4102 | + kms_output->reset(); |
4103 | + }); |
4104 | + |
4105 | + /* Set up used outputs */ |
4106 | OverlappingOutputGrouping grouping{conf}; |
4107 | |
4108 | grouping.for_each_group([&](OverlappingOutputGroup const& group) |
4109 | @@ -143,8 +153,8 @@ |
4110 | |
4111 | auto const mode_index = kms_conf.get_kms_mode_index(conf_output.id, |
4112 | conf_output.current_mode_index); |
4113 | - kms_output->reset(); |
4114 | kms_output->configure(conf_output.top_left - bounding_rect.top_left, mode_index); |
4115 | + kms_output->set_power_mode(conf_output.power_mode); |
4116 | kms_outputs.push_back(kms_output); |
4117 | }); |
4118 | |
4119 | @@ -164,6 +174,9 @@ |
4120 | |
4121 | /* Store applied configuration */ |
4122 | current_display_configuration = kms_conf; |
4123 | + |
4124 | + /* Clear connected but unused outputs */ |
4125 | + clear_connected_unused_outputs(); |
4126 | } |
4127 | |
4128 | if (cursor) cursor->show_at_last_known_position(); |
4129 | @@ -205,7 +218,6 @@ |
4130 | try |
4131 | { |
4132 | platform->drm.set_master(); |
4133 | - if (cursor) cursor->show_at_last_known_position(); |
4134 | } |
4135 | catch(std::runtime_error const& e) |
4136 | { |
4137 | @@ -213,10 +225,21 @@ |
4138 | throw; |
4139 | } |
4140 | |
4141 | - std::lock_guard<std::mutex> lg{configuration_mutex}; |
4142 | - |
4143 | - for (auto& db_ptr : display_buffers) |
4144 | - db_ptr->schedule_set_crtc(); |
4145 | + { |
4146 | + std::lock_guard<std::mutex> lg{configuration_mutex}; |
4147 | + |
4148 | + /* |
4149 | + * After resuming (e.g. because we switched back to the display server VT) |
4150 | + * we need to reset the CRTCs. For active displays we schedule a CRTC reset |
4151 | + * on the next swap. For connected but unused outputs we clear the CRTC. |
4152 | + */ |
4153 | + for (auto& db_ptr : display_buffers) |
4154 | + db_ptr->schedule_set_crtc(); |
4155 | + |
4156 | + clear_connected_unused_outputs(); |
4157 | + } |
4158 | + |
4159 | + if (cursor) cursor->show_at_last_known_position(); |
4160 | } |
4161 | |
4162 | auto mgg::GBMDisplay::the_cursor() -> std::weak_ptr<Cursor> |
4163 | @@ -254,3 +277,16 @@ |
4164 | return std::unique_ptr<GBMGLContext>{ |
4165 | new GBMGLContext{platform->gbm, shared_egl.context()}}; |
4166 | } |
4167 | + |
4168 | +void mgg::GBMDisplay::clear_connected_unused_outputs() |
4169 | +{ |
4170 | + current_display_configuration.for_each_output([&](DisplayConfigurationOutput const& conf_output) |
4171 | + { |
4172 | + if (conf_output.connected && !conf_output.used) |
4173 | + { |
4174 | + uint32_t const connector_id = current_display_configuration.get_kms_connector_id(conf_output.id); |
4175 | + auto kms_output = output_container.get_kms_output_for(connector_id); |
4176 | + kms_output->clear_crtc(); |
4177 | + } |
4178 | + }); |
4179 | +} |
4180 | |
4181 | === modified file 'src/server/graphics/gbm/gbm_display.h' |
4182 | --- src/server/graphics/gbm/gbm_display.h 2013-08-28 03:41:48 +0000 |
4183 | +++ src/server/graphics/gbm/gbm_display.h 2013-09-26 15:36:41 +0000 |
4184 | @@ -82,6 +82,8 @@ |
4185 | std::unique_ptr<GLContext> create_gl_context(); |
4186 | |
4187 | private: |
4188 | + void clear_connected_unused_outputs(); |
4189 | + |
4190 | std::mutex configuration_mutex; |
4191 | std::shared_ptr<GBMPlatform> const platform; |
4192 | std::shared_ptr<VideoDevices> const video_devices; |
4193 | |
4194 | === modified file 'src/server/graphics/gbm/gbm_display_buffer.h' |
4195 | --- src/server/graphics/gbm/gbm_display_buffer.h 2013-08-28 03:41:48 +0000 |
4196 | +++ src/server/graphics/gbm/gbm_display_buffer.h 2013-09-26 15:36:41 +0000 |
4197 | @@ -58,7 +58,6 @@ |
4198 | |
4199 | bool can_bypass() const override; |
4200 | void post_update(std::shared_ptr<graphics::Buffer> bypass_buf) override; |
4201 | - |
4202 | void schedule_set_crtc(); |
4203 | |
4204 | private: |
4205 | |
4206 | === modified file 'src/server/graphics/gbm/kms_output.h' |
4207 | --- src/server/graphics/gbm/kms_output.h 2013-09-11 17:00:39 +0000 |
4208 | +++ src/server/graphics/gbm/kms_output.h 2013-09-26 15:36:41 +0000 |
4209 | @@ -22,6 +22,8 @@ |
4210 | #include "mir/geometry/size.h" |
4211 | #include "mir/geometry/point.h" |
4212 | #include "mir/geometry/displacement.h" |
4213 | +#include "mir/graphics/display_configuration.h" |
4214 | +#include "mir_toolkit/common.h" |
4215 | |
4216 | #include <gbm.h> |
4217 | |
4218 | @@ -42,6 +44,7 @@ |
4219 | virtual geometry::Size size() const = 0; |
4220 | |
4221 | virtual bool set_crtc(uint32_t fb_id) = 0; |
4222 | + virtual void clear_crtc() = 0; |
4223 | virtual bool schedule_page_flip(uint32_t fb_id) = 0; |
4224 | virtual void wait_for_page_flip() = 0; |
4225 | |
4226 | @@ -49,6 +52,8 @@ |
4227 | virtual void move_cursor(geometry::Point destination) = 0; |
4228 | virtual void clear_cursor() = 0; |
4229 | virtual bool has_cursor() const = 0; |
4230 | + |
4231 | + virtual void set_power_mode(MirPowerMode mode) = 0; |
4232 | |
4233 | protected: |
4234 | KMSOutput() = default; |
4235 | |
4236 | === modified file 'src/server/graphics/gbm/real_kms_display_configuration.cpp' |
4237 | --- src/server/graphics/gbm/real_kms_display_configuration.cpp 2013-09-11 17:00:39 +0000 |
4238 | +++ src/server/graphics/gbm/real_kms_display_configuration.cpp 2013-09-26 15:36:41 +0000 |
4239 | @@ -108,7 +108,8 @@ |
4240 | |
4241 | void mgg::RealKMSDisplayConfiguration::configure_output( |
4242 | DisplayConfigurationOutputId id, bool used, |
4243 | - geometry::Point top_left, size_t mode_index) |
4244 | + geometry::Point top_left, size_t mode_index, |
4245 | + MirPowerMode power_mode) |
4246 | { |
4247 | auto iter = find_output_with_id(id); |
4248 | |
4249 | @@ -122,6 +123,7 @@ |
4250 | output.used = used; |
4251 | output.top_left = top_left; |
4252 | output.current_mode_index = mode_index; |
4253 | + output.power_mode = power_mode; |
4254 | } |
4255 | else |
4256 | { |
4257 | @@ -222,12 +224,12 @@ |
4258 | { |
4259 | outputs.push_back({id, card_id, type, formats, modes, preferred_mode_index, |
4260 | physical_size, connected, false, geom::Point(), |
4261 | - current_mode_index, 0u}); |
4262 | + current_mode_index, 0u, mir_power_mode_on}); |
4263 | } |
4264 | else |
4265 | { |
4266 | auto& output = *iter; |
4267 | - |
4268 | + |
4269 | output.modes = modes; |
4270 | output.preferred_mode_index = preferred_mode_index; |
4271 | output.physical_size_mm = physical_size; |
4272 | |
4273 | === modified file 'src/server/graphics/gbm/real_kms_display_configuration.h' |
4274 | --- src/server/graphics/gbm/real_kms_display_configuration.h 2013-09-11 17:00:39 +0000 |
4275 | +++ src/server/graphics/gbm/real_kms_display_configuration.h 2013-09-26 15:36:41 +0000 |
4276 | @@ -40,7 +40,7 @@ |
4277 | void for_each_card(std::function<void(DisplayConfigurationCard const&)> f) const; |
4278 | void for_each_output(std::function<void(DisplayConfigurationOutput const&)> f) const; |
4279 | void configure_output(DisplayConfigurationOutputId id, bool used, |
4280 | - geometry::Point top_left, size_t mode_index); |
4281 | + geometry::Point top_left, size_t mode_index, MirPowerMode power_mode); |
4282 | |
4283 | uint32_t get_kms_connector_id(DisplayConfigurationOutputId id) const; |
4284 | size_t get_kms_mode_index(DisplayConfigurationOutputId id, size_t conf_mode_index) const; |
4285 | |
4286 | === modified file 'src/server/graphics/gbm/real_kms_output.cpp' |
4287 | --- src/server/graphics/gbm/real_kms_output.cpp 2013-09-11 17:00:39 +0000 |
4288 | +++ src/server/graphics/gbm/real_kms_output.cpp 2013-09-26 15:36:41 +0000 |
4289 | @@ -25,7 +25,8 @@ |
4290 | #include <stdexcept> |
4291 | #include <vector> |
4292 | |
4293 | -namespace mgg = mir::graphics::gbm; |
4294 | +namespace mg = mir::graphics; |
4295 | +namespace mgg = mg::gbm; |
4296 | namespace geom = mir::geometry; |
4297 | |
4298 | namespace |
4299 | @@ -37,7 +38,8 @@ |
4300 | |
4301 | resources.for_each_connector([&](mgg::DRMModeConnectorUPtr connector) |
4302 | { |
4303 | - if (connector->encoder_id == encoder_id) |
4304 | + if (connector->encoder_id == encoder_id && |
4305 | + connector->connection == DRM_MODE_CONNECTED) |
4306 | { |
4307 | auto encoder = resources.encoder(connector->encoder_id); |
4308 | if (encoder) |
4309 | @@ -58,11 +60,14 @@ |
4310 | |
4311 | resources.for_each_connector([&](mgg::DRMModeConnectorUPtr connector) |
4312 | { |
4313 | - auto encoder = resources.encoder(connector->encoder_id); |
4314 | - if (encoder) |
4315 | + if (connector->connection == DRM_MODE_CONNECTED) |
4316 | { |
4317 | - if (encoder->crtc_id == crtc_id) |
4318 | - crtc_used = true; |
4319 | + auto encoder = resources.encoder(connector->encoder_id); |
4320 | + if (encoder) |
4321 | + { |
4322 | + if (encoder->crtc_id == crtc_id) |
4323 | + crtc_used = true; |
4324 | + } |
4325 | } |
4326 | }); |
4327 | |
4328 | @@ -131,7 +136,8 @@ |
4329 | std::shared_ptr<PageFlipper> const& page_flipper) |
4330 | : drm_fd{drm_fd}, connector_id{connector_id}, page_flipper{page_flipper}, |
4331 | connector(), mode_index{0}, current_crtc(), saved_crtc(), |
4332 | - using_saved_crtc{true}, has_cursor_{false} |
4333 | + using_saved_crtc{true}, has_cursor_{false}, |
4334 | + power_mode(mir_power_mode_on) |
4335 | { |
4336 | reset(); |
4337 | |
4338 | @@ -161,6 +167,21 @@ |
4339 | if (!connector) |
4340 | BOOST_THROW_EXCEPTION(std::runtime_error("No DRM connector found\n")); |
4341 | |
4342 | + // TODO: What if we can't locate the DPMS property? |
4343 | + for (int i = 0; i < connector->count_props; i++) |
4344 | + { |
4345 | + auto prop = drmModeGetProperty(drm_fd, connector->props[i]); |
4346 | + if (prop && (prop->flags & DRM_MODE_PROP_ENUM)) { |
4347 | + if (!strcmp(prop->name, "DPMS")) |
4348 | + { |
4349 | + dpms_enum_id = connector->props[i]; |
4350 | + drmModeFreeProperty(prop); |
4351 | + break; |
4352 | + } |
4353 | + drmModeFreeProperty(prop); |
4354 | + } |
4355 | + } |
4356 | + |
4357 | /* Discard previously current crtc */ |
4358 | current_crtc = nullptr; |
4359 | } |
4360 | @@ -198,8 +219,37 @@ |
4361 | return true; |
4362 | } |
4363 | |
4364 | +void mgg::RealKMSOutput::clear_crtc() |
4365 | +{ |
4366 | + /* |
4367 | + * In order to actually clear the output, we need to have a crtc |
4368 | + * connected to the output/connector so that we can disconnect |
4369 | + * it. However, not being able to get a crtc is OK, since it means |
4370 | + * that the output cannot be displaying anything anyway. |
4371 | + */ |
4372 | + if (!ensure_crtc()) |
4373 | + return; |
4374 | + |
4375 | + auto result = drmModeSetCrtc(drm_fd, current_crtc->crtc_id, |
4376 | + 0, 0, 0, nullptr, 0, nullptr); |
4377 | + if (result) |
4378 | + { |
4379 | + std::string const msg = |
4380 | + "Couldn't clear output " + connector_name(connector.get()); |
4381 | + |
4382 | + BOOST_THROW_EXCEPTION( |
4383 | + ::boost::enable_error_info(std::runtime_error(msg)) |
4384 | + << (boost::error_info<KMSOutput, decltype(result)>(result))); |
4385 | + } |
4386 | + |
4387 | + current_crtc = nullptr; |
4388 | +} |
4389 | + |
4390 | bool mgg::RealKMSOutput::schedule_page_flip(uint32_t fb_id) |
4391 | { |
4392 | + std::unique_lock<std::mutex> lg(power_mutex); |
4393 | + if (power_mode != mir_power_mode_on) |
4394 | + return true; |
4395 | if (!current_crtc) |
4396 | BOOST_THROW_EXCEPTION(std::runtime_error("Output " + |
4397 | connector_name(connector.get()) + |
4398 | @@ -210,6 +260,9 @@ |
4399 | |
4400 | void mgg::RealKMSOutput::wait_for_page_flip() |
4401 | { |
4402 | + std::unique_lock<std::mutex> lg(power_mutex); |
4403 | + if (power_mode != mir_power_mode_on) |
4404 | + return; |
4405 | if (!current_crtc) |
4406 | BOOST_THROW_EXCEPTION(std::runtime_error("Output " + |
4407 | connector_name(connector.get()) + |
4408 | @@ -323,3 +376,15 @@ |
4409 | using_saved_crtc = true; |
4410 | } |
4411 | } |
4412 | + |
4413 | +void mgg::RealKMSOutput::set_power_mode(MirPowerMode mode) |
4414 | +{ |
4415 | + std::lock_guard<std::mutex> lg(power_mutex); |
4416 | + |
4417 | + if (power_mode != mode) |
4418 | + { |
4419 | + power_mode = mode; |
4420 | + drmModeConnectorSetProperty(drm_fd, connector_id, |
4421 | + dpms_enum_id, mode); |
4422 | + } |
4423 | +} |
4424 | |
4425 | === modified file 'src/server/graphics/gbm/real_kms_output.h' |
4426 | --- src/server/graphics/gbm/real_kms_output.h 2013-09-11 17:00:39 +0000 |
4427 | +++ src/server/graphics/gbm/real_kms_output.h 2013-09-26 15:36:41 +0000 |
4428 | @@ -23,6 +23,7 @@ |
4429 | #include "drm_mode_resources.h" |
4430 | |
4431 | #include <memory> |
4432 | +#include <mutex> |
4433 | |
4434 | namespace mir |
4435 | { |
4436 | @@ -45,6 +46,7 @@ |
4437 | geometry::Size size() const; |
4438 | |
4439 | bool set_crtc(uint32_t fb_id); |
4440 | + void clear_crtc(); |
4441 | bool schedule_page_flip(uint32_t fb_id); |
4442 | void wait_for_page_flip(); |
4443 | |
4444 | @@ -52,6 +54,8 @@ |
4445 | void move_cursor(geometry::Point destination); |
4446 | void clear_cursor(); |
4447 | bool has_cursor() const; |
4448 | + |
4449 | + void set_power_mode(MirPowerMode mode); |
4450 | |
4451 | private: |
4452 | bool ensure_crtc(); |
4453 | @@ -68,6 +72,11 @@ |
4454 | drmModeCrtc saved_crtc; |
4455 | bool using_saved_crtc; |
4456 | bool has_cursor_; |
4457 | + |
4458 | + MirPowerMode power_mode; |
4459 | + int dpms_enum_id; |
4460 | + |
4461 | + std::mutex power_mutex; |
4462 | }; |
4463 | |
4464 | } |
4465 | |
4466 | === modified file 'src/server/graphics/nested/nested_display_configuration.cpp' |
4467 | --- src/server/graphics/nested/nested_display_configuration.cpp 2013-09-11 17:00:39 +0000 |
4468 | +++ src/server/graphics/nested/nested_display_configuration.cpp 2013-09-26 15:36:41 +0000 |
4469 | @@ -18,6 +18,9 @@ |
4470 | |
4471 | #include "nested_display_configuration.h" |
4472 | |
4473 | +namespace mg = mir::graphics; |
4474 | +namespace mgn = mg::nested; |
4475 | + |
4476 | #include <boost/throw_exception.hpp> |
4477 | |
4478 | #include <stdexcept> |
4479 | @@ -74,14 +77,16 @@ |
4480 | !!mir_output.used, |
4481 | geometry::Point{mir_output.position_x, mir_output.position_y}, |
4482 | mir_output.current_mode, |
4483 | - mir_output.current_output_format |
4484 | + mir_output.current_output_format, |
4485 | + mir_output.power_mode |
4486 | }; |
4487 | |
4488 | f(output); |
4489 | }); |
4490 | } |
4491 | |
4492 | -void mgn::NestedDisplayConfiguration::configure_output(DisplayConfigurationOutputId id, bool used, geometry::Point top_left, size_t mode_index) |
4493 | +void mgn::NestedDisplayConfiguration::configure_output(DisplayConfigurationOutputId id, bool used, |
4494 | + geometry::Point top_left, size_t mode_index, MirPowerMode power_mode) |
4495 | { |
4496 | for (auto mir_output = display_config->outputs; |
4497 | mir_output != display_config->outputs+display_config->num_outputs; |
4498 | @@ -96,6 +101,7 @@ |
4499 | mir_output->position_x = top_left.x.as_uint32_t(); |
4500 | mir_output->position_y = top_left.y.as_uint32_t(); |
4501 | mir_output->current_mode = mode_index; |
4502 | + mir_output->power_mode = static_cast<MirPowerMode>(power_mode); |
4503 | return; |
4504 | } |
4505 | } |
4506 | |
4507 | === modified file 'src/server/graphics/nested/nested_display_configuration.h' |
4508 | --- src/server/graphics/nested/nested_display_configuration.h 2013-09-11 17:00:39 +0000 |
4509 | +++ src/server/graphics/nested/nested_display_configuration.h 2013-09-26 15:36:41 +0000 |
4510 | @@ -37,7 +37,8 @@ |
4511 | void for_each_card(std::function<void(DisplayConfigurationCard const&)>) const; |
4512 | void for_each_output(std::function<void(DisplayConfigurationOutput const&)>) const; |
4513 | |
4514 | - void configure_output(DisplayConfigurationOutputId id, bool used, geometry::Point top_left, size_t mode_index); |
4515 | + void configure_output(DisplayConfigurationOutputId id, bool used, geometry::Point top_left, size_t mode_index, |
4516 | + MirPowerMode power_mode); |
4517 | |
4518 | operator MirDisplayConfiguration*() const { return display_config; } |
4519 | private: |
4520 | |
4521 | === modified file 'src/server/logging/CMakeLists.txt' |
4522 | --- src/server/logging/CMakeLists.txt 2013-08-28 03:41:48 +0000 |
4523 | +++ src/server/logging/CMakeLists.txt 2013-09-26 15:36:41 +0000 |
4524 | @@ -6,6 +6,7 @@ |
4525 | message_processor_report.cpp |
4526 | display_report.cpp |
4527 | input_report.cpp |
4528 | + messenger_report.cpp |
4529 | ) |
4530 | |
4531 | add_library( |
4532 | |
4533 | === added file 'src/server/logging/messenger_report.cpp' |
4534 | --- src/server/logging/messenger_report.cpp 1970-01-01 00:00:00 +0000 |
4535 | +++ src/server/logging/messenger_report.cpp 2013-09-26 15:36:41 +0000 |
4536 | @@ -0,0 +1,46 @@ |
4537 | +/* |
4538 | + * Copyright © 2013 Canonical Ltd. |
4539 | + * |
4540 | + * This program is free software: you can redistribute it and/or modify it |
4541 | + * under the terms of the GNU General Public License version 3, |
4542 | + * as published by the Free Software Foundation. |
4543 | + * |
4544 | + * This program is distributed in the hope that it will be useful, |
4545 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4546 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4547 | + * GNU General Public License for more details. |
4548 | + * |
4549 | + * You should have received a copy of the GNU General Public License |
4550 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4551 | + * |
4552 | + * Authored by: Alan Griffiths <alan@octopull.co.uk> |
4553 | + */ |
4554 | + |
4555 | +#include "mir/logging/messenger_report.h" |
4556 | +#include "mir/logging/logger.h" |
4557 | + |
4558 | +#include "std/MirLog.h" |
4559 | +#include <std/Log.h> |
4560 | + |
4561 | + |
4562 | +#include <sstream> |
4563 | +#include <cstring> |
4564 | +#include <mutex> |
4565 | + |
4566 | +namespace ml = mir::logging; |
4567 | + |
4568 | +ml::MessengerReport::MessengerReport(const std::shared_ptr<Logger>& logger) |
4569 | + : logger(logger) |
4570 | +{ |
4571 | +} |
4572 | + |
4573 | +const char* ml::MessengerReport::component() |
4574 | +{ |
4575 | + static const char* s = "messenger"; |
4576 | + return s; |
4577 | +} |
4578 | + |
4579 | +void ml::MessengerReport::error(std::string const& error_message) |
4580 | +{ |
4581 | + logger->log<Logger::informational>(error_message, component()); |
4582 | +} |
4583 | |
4584 | === modified file 'src/server/logging/session_mediator_report.cpp' |
4585 | --- src/server/logging/session_mediator_report.cpp 2013-05-30 03:50:54 +0000 |
4586 | +++ src/server/logging/session_mediator_report.cpp 2013-09-26 15:36:41 +0000 |
4587 | @@ -68,6 +68,11 @@ |
4588 | log->log<Logger::informational>("session_configure_surface_called(\"" + app_name + "\")", component); |
4589 | } |
4590 | |
4591 | +void ml::SessionMediatorReport::session_configure_display_called(std::string const& app_name) |
4592 | +{ |
4593 | + log->log<Logger::informational>("session_configure_display_called(\"" + app_name + "\")", component); |
4594 | +} |
4595 | + |
4596 | void ml::SessionMediatorReport::session_error( |
4597 | std::string const& app_name, |
4598 | char const* method, |
4599 | |
4600 | === modified file 'src/server/options/program_option.cpp' |
4601 | --- src/server/options/program_option.cpp 2013-06-13 06:00:21 +0000 |
4602 | +++ src/server/options/program_option.cpp 2013-09-26 15:36:41 +0000 |
4603 | @@ -87,7 +87,7 @@ |
4604 | /* Read options from config files */ |
4605 | for (std::string config_root; getline(config_stream, config_root, ':');) |
4606 | { |
4607 | - auto const& filename = config_root + name; |
4608 | + auto const& filename = config_root + "/" + name; |
4609 | |
4610 | try |
4611 | { |
4612 | |
4613 | === modified file 'src/server/shell/mediating_display_changer.cpp' |
4614 | --- src/server/shell/mediating_display_changer.cpp 2013-09-16 21:37:49 +0000 |
4615 | +++ src/server/shell/mediating_display_changer.cpp 2013-09-26 15:36:41 +0000 |
4616 | @@ -23,6 +23,7 @@ |
4617 | #include "mir/graphics/display.h" |
4618 | #include "mir/compositor/compositor.h" |
4619 | #include "mir/graphics/display_configuration_policy.h" |
4620 | +#include "mir/graphics/display_configuration.h" |
4621 | |
4622 | namespace mf = mir::frontend; |
4623 | namespace msh = mir::shell; |
4624 | @@ -115,6 +116,32 @@ |
4625 | |
4626 | } |
4627 | |
4628 | +void msh::MediatingDisplayChanger::ensure_display_powered(std::shared_ptr<mf::Session> const& session) |
4629 | +{ |
4630 | + std::lock_guard<std::mutex> lg{configuration_mutex}; |
4631 | + bool switched = false; |
4632 | + |
4633 | + auto it = config_map.find(session); |
4634 | + if (it == config_map.end()) |
4635 | + return; |
4636 | + auto conf = it->second; |
4637 | + conf->for_each_output([&](mg::DisplayConfigurationOutput const& output) -> void |
4638 | + { |
4639 | + if (!output.used) return; |
4640 | + |
4641 | + if (output.power_mode != mir_power_mode_on) |
4642 | + { |
4643 | + switched = true; |
4644 | + conf->configure_output(output.id, output.used, |
4645 | + output.top_left, |
4646 | + output.current_mode_index, |
4647 | + mir_power_mode_on); |
4648 | + } |
4649 | + }); |
4650 | + if (switched) |
4651 | + configure(session, conf); |
4652 | +} |
4653 | + |
4654 | void msh::MediatingDisplayChanger::configure( |
4655 | std::shared_ptr<mf::Session> const& session, |
4656 | std::shared_ptr<mg::DisplayConfiguration> const& conf) |
4657 | |
4658 | === modified file 'src/server/shell/unauthorized_display_changer.cpp' |
4659 | --- src/server/shell/unauthorized_display_changer.cpp 2013-08-28 03:41:48 +0000 |
4660 | +++ src/server/shell/unauthorized_display_changer.cpp 2013-09-26 15:36:41 +0000 |
4661 | @@ -38,3 +38,8 @@ |
4662 | { |
4663 | BOOST_THROW_EXCEPTION(std::runtime_error("not authorized to apply display configurations")); |
4664 | } |
4665 | + |
4666 | +void msh::UnauthorizedDisplayChanger::ensure_display_powered(std::shared_ptr<mf::Session> const&) |
4667 | +{ |
4668 | + BOOST_THROW_EXCEPTION(std::runtime_error("not authorized to apply display configurations")); |
4669 | +} |
4670 | |
4671 | === modified file 'src/shared/graphics/android/mir_native_window.cpp' |
4672 | --- src/shared/graphics/android/mir_native_window.cpp 2013-05-20 15:29:28 +0000 |
4673 | +++ src/shared/graphics/android/mir_native_window.cpp 2013-09-26 15:36:41 +0000 |
4674 | @@ -18,28 +18,14 @@ |
4675 | |
4676 | #include "mir/graphics/android/mir_native_window.h" |
4677 | #include "mir/graphics/android/android_driver_interpreter.h" |
4678 | -#include "syncfence.h" |
4679 | +#include "mir/graphics/android/syncfence.h" |
4680 | |
4681 | -#include <unistd.h> |
4682 | -#include <sys/ioctl.h> |
4683 | |
4684 | namespace mga=mir::graphics::android; |
4685 | |
4686 | namespace |
4687 | { |
4688 | |
4689 | -class IoctlControl : public mga::IoctlWrapper |
4690 | -{ |
4691 | -public: |
4692 | - int ioctl(int fd, unsigned long int request, int* timeout) const |
4693 | - { |
4694 | - return ::ioctl(fd, request, timeout); |
4695 | - } |
4696 | - int close(int fd) const |
4697 | - { |
4698 | - return ::close(fd); |
4699 | - } |
4700 | -}; |
4701 | |
4702 | static int query_static(const ANativeWindow* anw, int key, int* value); |
4703 | static int perform_static(ANativeWindow* anw, int key, ...); |
4704 | @@ -99,8 +85,7 @@ |
4705 | struct ANativeWindowBuffer* buffer) |
4706 | { |
4707 | auto self = static_cast<mga::MirNativeWindow*>(window); |
4708 | - auto ioctl_control = std::make_shared<IoctlControl>(); |
4709 | - auto fence = std::make_shared<mga::SyncFence>(-1, ioctl_control); |
4710 | + auto fence = std::make_shared<mga::SyncFence>(); |
4711 | return self->queueBuffer(buffer, fence); |
4712 | } |
4713 | |
4714 | @@ -108,8 +93,7 @@ |
4715 | struct ANativeWindowBuffer* buffer, int fence_fd) |
4716 | { |
4717 | auto self = static_cast<mga::MirNativeWindow*>(window); |
4718 | - auto ioctl_control = std::make_shared<IoctlControl>(); |
4719 | - auto fence = std::make_shared<mga::SyncFence>(fence_fd, ioctl_control); |
4720 | + auto fence = std::make_shared<mga::SyncFence>(fence_fd); |
4721 | return self->queueBuffer(buffer, fence); |
4722 | |
4723 | } |
4724 | |
4725 | === modified file 'src/shared/graphics/android/syncfence.cpp' |
4726 | --- src/shared/graphics/android/syncfence.cpp 2013-04-24 05:22:20 +0000 |
4727 | +++ src/shared/graphics/android/syncfence.cpp 2013-09-26 15:36:41 +0000 |
4728 | @@ -16,13 +16,23 @@ |
4729 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
4730 | */ |
4731 | |
4732 | -#include "syncfence.h" |
4733 | +#include "mir/graphics/android/syncfence.h" |
4734 | + |
4735 | +#include <unistd.h> |
4736 | +#include <sys/ioctl.h> |
4737 | + |
4738 | +//FIXME: (lp-1229884) this ioctl code should be taken from kernel headers |
4739 | +#define SYNC_IOC_WAIT 0x40043E00 |
4740 | |
4741 | namespace mga = mir::graphics::android; |
4742 | |
4743 | -mga::SyncFence::SyncFence(int fd, std::shared_ptr<IoctlWrapper> const& wrapper) |
4744 | - : ioctl_wrapper(wrapper), |
4745 | - fence_fd(fd) |
4746 | +mga::SyncFence::SyncFence() |
4747 | + : fence_fd(-1) |
4748 | +{ |
4749 | +} |
4750 | + |
4751 | +mga::SyncFence::SyncFence(int fd) |
4752 | + : fence_fd(fd) |
4753 | { |
4754 | } |
4755 | |
4756 | @@ -30,7 +40,7 @@ |
4757 | { |
4758 | if (fence_fd > 0) |
4759 | { |
4760 | - ioctl_wrapper->close(fence_fd); |
4761 | + ::close(fence_fd); |
4762 | } |
4763 | } |
4764 | |
4765 | @@ -39,6 +49,6 @@ |
4766 | if (fence_fd > 0) |
4767 | { |
4768 | int timeout = -1; |
4769 | - ioctl_wrapper->ioctl(fence_fd, SYNC_IOC_WAIT, &timeout); |
4770 | + ::ioctl(fence_fd, SYNC_IOC_WAIT, &timeout); |
4771 | } |
4772 | } |
4773 | |
4774 | === modified file 'src/shared/protobuf/mir_protobuf.proto' |
4775 | --- src/shared/protobuf/mir_protobuf.proto 2013-09-12 08:05:56 +0000 |
4776 | +++ src/shared/protobuf/mir_protobuf.proto 2013-09-26 15:36:41 +0000 |
4777 | @@ -73,6 +73,7 @@ |
4778 | optional uint32 physical_height_mm = 12; |
4779 | optional uint32 type = 13; |
4780 | optional uint32 preferred_mode = 14; |
4781 | + optional uint32 power_mode = 15; |
4782 | } |
4783 | |
4784 | // DEPRECATED |
4785 | |
4786 | === modified file 'tests/acceptance-tests/test_client_input.cpp' |
4787 | --- tests/acceptance-tests/test_client_input.cpp 2013-09-17 14:31:42 +0000 |
4788 | +++ tests/acceptance-tests/test_client_input.cpp 2013-09-26 15:36:41 +0000 |
4789 | @@ -151,7 +151,7 @@ |
4790 | |
4791 | try |
4792 | { |
4793 | - input_cb_setup_fence.try_signal_ready_for(std::chrono::milliseconds(1000)); |
4794 | + input_cb_setup_fence.try_signal_ready_for(); |
4795 | } catch (const std::runtime_error& e) |
4796 | { |
4797 | std::cout << e.what() << std::endl; |
4798 | @@ -859,7 +859,7 @@ |
4799 | |
4800 | static std::string const test_client_name = "1"; |
4801 | static std::string const test_client_2_name = "2"; |
4802 | - mtf::CrossProcessSync fence, second_client_done_fence; |
4803 | + mtf::CrossProcessSync fence, first_client_ready_fence, second_client_done_fence; |
4804 | |
4805 | struct ServerConfiguration : public mtf::InputTestingServerConfiguration |
4806 | { |
4807 | @@ -916,20 +916,23 @@ |
4808 | EXPECT_CALL(*handler, handle_input(MotionEventWithPosition(2, 2))).Times(1) |
4809 | .WillOnce(mt::WakeUp(&events_received)); |
4810 | } |
4811 | - } client_1{fence}; |
4812 | + } client_1{first_client_ready_fence}; |
4813 | struct ButtonClientTwo : InputClient |
4814 | { |
4815 | + mtf::CrossProcessSync first_client_ready; |
4816 | mtf::CrossProcessSync done_fence; |
4817 | |
4818 | - ButtonClientTwo(mtf::CrossProcessSync const& fence, mtf::CrossProcessSync const& done_fence) |
4819 | + ButtonClientTwo(mtf::CrossProcessSync const& fence, mtf::CrossProcessSync const& first_client_ready, |
4820 | + mtf::CrossProcessSync const& done_fence) |
4821 | : InputClient(fence, test_client_2_name), |
4822 | + first_client_ready(first_client_ready), |
4823 | done_fence(done_fence) |
4824 | { |
4825 | } |
4826 | void exec() |
4827 | { |
4828 | // Ensure we stack on top of the first client |
4829 | - input_cb_setup_fence.wait_for_signal_ready_for(std::chrono::milliseconds(4000)); |
4830 | + first_client_ready.wait_for_signal_ready_for(); |
4831 | InputClient::exec(); |
4832 | } |
4833 | |
4834 | @@ -940,7 +943,7 @@ |
4835 | EXPECT_CALL(*handler, handle_input(MotionEventWithPosition(1, 1))).Times(1) |
4836 | .WillOnce(DoAll(SignalFence(&done_fence), mt::WakeUp(&events_received))); |
4837 | } |
4838 | - } client_2{fence, second_client_done_fence}; |
4839 | + } client_2{fence, first_client_ready_fence, second_client_done_fence}; |
4840 | |
4841 | // Client 2 is launched second so will be the first to receive input |
4842 | |
4843 | |
4844 | === modified file 'tests/acceptance-tests/test_client_library.cpp' |
4845 | --- tests/acceptance-tests/test_client_library.cpp 2013-09-17 14:31:42 +0000 |
4846 | +++ tests/acceptance-tests/test_client_library.cpp 2013-09-26 15:36:41 +0000 |
4847 | @@ -22,7 +22,7 @@ |
4848 | #include "mir_toolkit/mir_client_library_debug.h" |
4849 | #include "src/client/client_buffer.h" |
4850 | |
4851 | -#include "mir/frontend/communicator.h" |
4852 | +#include "mir/frontend/connector.h" |
4853 | |
4854 | #include "mir_protobuf.pb.h" |
4855 | |
4856 | |
4857 | === modified file 'tests/acceptance-tests/test_server_shutdown.cpp' |
4858 | --- tests/acceptance-tests/test_server_shutdown.cpp 2013-09-17 14:31:42 +0000 |
4859 | +++ tests/acceptance-tests/test_server_shutdown.cpp 2013-09-26 15:36:41 +0000 |
4860 | @@ -326,19 +326,19 @@ |
4861 | */ |
4862 | std::weak_ptr<mir::graphics::Display> display = server_config->the_display(); |
4863 | std::weak_ptr<mir::compositor::Compositor> compositor = server_config->the_compositor(); |
4864 | - std::weak_ptr<mir::frontend::Communicator> communicator = server_config->the_communicator(); |
4865 | + std::weak_ptr<mir::frontend::Connector> connector = server_config->the_connector(); |
4866 | std::weak_ptr<mir::input::InputManager> input_manager = server_config->the_input_manager(); |
4867 | |
4868 | server_config.reset(); |
4869 | |
4870 | EXPECT_EQ(0, display.use_count()); |
4871 | EXPECT_EQ(0, compositor.use_count()); |
4872 | - EXPECT_EQ(0, communicator.use_count()); |
4873 | + EXPECT_EQ(0, connector.use_count()); |
4874 | EXPECT_EQ(0, input_manager.use_count()); |
4875 | |
4876 | if (display.use_count() != 0 || |
4877 | compositor.use_count() != 0 || |
4878 | - communicator.use_count() != 0 || |
4879 | + connector.use_count() != 0 || |
4880 | input_manager.use_count() != 0) |
4881 | { |
4882 | resources_freed_failure.set(); |
4883 | |
4884 | === modified file 'tests/acceptance-tests/test_test_framework.cpp' |
4885 | --- tests/acceptance-tests/test_test_framework.cpp 2013-04-24 05:22:20 +0000 |
4886 | +++ tests/acceptance-tests/test_test_framework.cpp 2013-09-26 15:36:41 +0000 |
4887 | @@ -18,7 +18,7 @@ |
4888 | |
4889 | #include "mir_test_framework/display_server_test_fixture.h" |
4890 | |
4891 | -#include "mir/frontend/communicator.h" |
4892 | +#include "mir/frontend/connector.h" |
4893 | |
4894 | #include <gmock/gmock.h> |
4895 | #include <gtest/gtest.h> |
4896 | |
4897 | === modified file 'tests/integration-tests/client/test_client_render.cpp' |
4898 | --- tests/integration-tests/client/test_client_render.cpp 2013-08-28 03:41:48 +0000 |
4899 | +++ tests/integration-tests/client/test_client_render.cpp 2013-09-26 15:36:41 +0000 |
4900 | @@ -27,7 +27,7 @@ |
4901 | #include "mir_test/stub_server_tool.h" |
4902 | #include "mir_test/test_protobuf_server.h" |
4903 | |
4904 | -#include "mir/frontend/communicator.h" |
4905 | +#include "mir/frontend/connector.h" |
4906 | |
4907 | #include <gmock/gmock.h> |
4908 | #include <thread> |
4909 | |
4910 | === modified file 'tests/integration-tests/graphics/android/test_display_integration.cpp' |
4911 | --- tests/integration-tests/graphics/android/test_display_integration.cpp 2013-08-28 03:41:48 +0000 |
4912 | +++ tests/integration-tests/graphics/android/test_display_integration.cpp 2013-09-26 15:36:41 +0000 |
4913 | @@ -111,8 +111,7 @@ |
4914 | auto fb_window = fb_factory->create_fb_native_window(fb_device); |
4915 | auto window_query = std::make_shared<mga::AndroidFramebufferWindow>(fb_window); |
4916 | auto db_factory = std::make_shared<mga::GPUAndroidDisplayBufferFactory>(); |
4917 | - auto display = std::make_shared<mga::AndroidDisplay>(window_query, db_factory, |
4918 | - mock_display_report); |
4919 | + auto display = std::make_shared<mga::AndroidDisplay>(window_query, db_factory, fb_device, mock_display_report); |
4920 | |
4921 | display->for_each_display_buffer([this](mg::DisplayBuffer& buffer) |
4922 | { |
4923 | @@ -141,12 +140,12 @@ |
4924 | auto mock_display_report = std::make_shared<testing::NiceMock<mtd::MockDisplayReport>>(); |
4925 | auto fb_window = fb_factory->create_fb_native_window(fb_device); |
4926 | auto window_query = std::make_shared<mga::AndroidFramebufferWindow>(fb_window); |
4927 | - auto layerlist = std::make_shared<mga::HWCLayerList>(); |
4928 | + auto layerlist = std::make_shared<mga::LayerList>(); |
4929 | |
4930 | auto syncer = std::make_shared<mga::HWCVsync>(); |
4931 | auto hwc = std::make_shared<mga::HWC10Device>(hwc_device, fb_device, syncer); |
4932 | auto db_factory = std::make_shared<mga::HWCAndroidDisplayBufferFactory>(hwc); |
4933 | - auto display = std::make_shared<mga::AndroidDisplay>(window_query, db_factory, |
4934 | + auto display = std::make_shared<mga::AndroidDisplay>(window_query, db_factory, hwc, |
4935 | mock_display_report); |
4936 | |
4937 | display->for_each_display_buffer([this](mg::DisplayBuffer& buffer) |
4938 | @@ -169,13 +168,12 @@ |
4939 | auto mock_display_report = std::make_shared<testing::NiceMock<mtd::MockDisplayReport>>(); |
4940 | auto fb_window = fb_factory->create_fb_native_window(fb_device); |
4941 | auto window_query = std::make_shared<mga::AndroidFramebufferWindow>(fb_window); |
4942 | - auto layerlist = std::make_shared<mga::HWCLayerList>(); |
4943 | + auto layerlist = std::make_shared<mga::LayerList>(); |
4944 | |
4945 | auto syncer = std::make_shared<mga::HWCVsync>(); |
4946 | auto hwc = std::make_shared<mga::HWC11Device>(hwc_device, layerlist, fb_device, syncer); |
4947 | auto db_factory = std::make_shared<mga::HWCAndroidDisplayBufferFactory>(hwc); |
4948 | - auto display = std::make_shared<mga::AndroidDisplay>(window_query, db_factory, |
4949 | - mock_display_report); |
4950 | + auto display = std::make_shared<mga::AndroidDisplay>(window_query, db_factory, hwc, mock_display_report); |
4951 | |
4952 | display->for_each_display_buffer([this](mg::DisplayBuffer& buffer) |
4953 | { |
4954 | |
4955 | === modified file 'tests/integration-tests/shell/test_session.cpp' |
4956 | --- tests/integration-tests/shell/test_session.cpp 2013-08-28 03:41:48 +0000 |
4957 | +++ tests/integration-tests/shell/test_session.cpp 2013-09-26 15:36:41 +0000 |
4958 | @@ -29,7 +29,7 @@ |
4959 | #include "mir/surfaces/buffer_stream.h" |
4960 | #include "mir/compositor/renderer.h" |
4961 | #include "mir/compositor/renderer_factory.h" |
4962 | -#include "mir/frontend/communicator.h" |
4963 | +#include "mir/frontend/connector.h" |
4964 | |
4965 | #include "mir_test_doubles/stub_buffer.h" |
4966 | #include "mir_test_doubles/null_display.h" |
4967 | @@ -61,15 +61,16 @@ |
4968 | return input_configuration; |
4969 | } |
4970 | |
4971 | - std::shared_ptr<mf::Communicator> the_communicator() override |
4972 | + std::shared_ptr<mf::Connector> the_connector() override |
4973 | { |
4974 | - struct NullCommunicator : public mf::Communicator |
4975 | + struct NullConnector : public mf::Connector |
4976 | { |
4977 | void start() {} |
4978 | void stop() {} |
4979 | + int client_socket_fd() const override { return 0; } |
4980 | }; |
4981 | |
4982 | - return std::make_shared<NullCommunicator>(); |
4983 | + return std::make_shared<NullConnector>(); |
4984 | } |
4985 | |
4986 | std::shared_ptr<mg::GraphicBufferAllocator> the_buffer_allocator() override |
4987 | |
4988 | === modified file 'tests/integration-tests/test_display_server_main_loop_events.cpp' |
4989 | --- tests/integration-tests/test_display_server_main_loop_events.cpp 2013-08-28 03:41:48 +0000 |
4990 | +++ tests/integration-tests/test_display_server_main_loop_events.cpp 2013-09-26 15:36:41 +0000 |
4991 | @@ -17,17 +17,19 @@ |
4992 | */ |
4993 | |
4994 | #include "mir/compositor/compositor.h" |
4995 | -#include "mir/frontend/communicator.h" |
4996 | +#include "mir/frontend/connector.h" |
4997 | #include "mir/graphics/display_configuration.h" |
4998 | #include "mir/graphics/display_configuration_policy.h" |
4999 | #include "mir/main_loop.h" |
5000 | #include "mir/display_changer.h" |
The diff has been truncated for viewing.
[ try] whole_message) );
9 {
50 ba::write(*socket, ba::buffer(
51 }
52 - catch (std::exception &)
53 + catch (std::exception &ex)
54 {
55 - // Don't care
56 + report->error(ex);
57 }
This is better written as:
boost: :system: :error_ code ec; :write( *socket, ba::buffer( whole_message) , ec);
ba:
if (!ec)
report- >error( ec.message( ));
{
}
And not throwing and catching exceptions.