Mir

Merge lp:~alan-griffiths/mir/conquer-android-input-static into lp:mir

Proposed by Alan Griffiths
Status: Merged
Merged at revision: 2851
Proposed branch: lp:~alan-griffiths/mir/conquer-android-input-static
Merge into: lp:mir
Prerequisite: lp:~alan-griffiths/mir/delete-dead-code-in-3rd_party
Diff against target: 359 lines (+138/-63)
13 files modified
3rd_party/android-input/android/CMakeLists.txt (+20/-18)
3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp (+0/-34)
3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp (+33/-0)
benchmarks/android-input/CMakeLists.txt (+0/-2)
src/client/input/CMakeLists.txt (+0/-5)
src/common/CMakeLists.txt (+1/-0)
src/common/symbols.map (+54/-0)
src/platform/CMakeLists.txt (+1/-0)
src/platform/symbols.map (+28/-0)
src/server/CMakeLists.txt (+0/-1)
src/utils/CMakeLists.txt (+1/-1)
tests/integration-tests/CMakeLists.txt (+0/-1)
tests/unit-tests/CMakeLists.txt (+0/-1)
To merge this branch: bzr merge lp:~alan-griffiths/mir/conquer-android-input-static
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Daniel van Vugt Abstain
Kevin DuBois (community) Approve
Cemil Azizoglu (community) Approve
Review via email: mp+267974@code.launchpad.net

Commit message

Split the old android-input-static library into two. Part goes into mircommon and part into mirplatform.

This avoid linking the same code into multiple libraries.

Description of the change

Split the old android-input-static library into two. Part goes into mircommon and part into mirplatform.

This avoid linking the same code into multiple libraries.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

Nit:
310 \ No newline at end of file

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

line could be split, looks good to me though
23 + frameworks/native/libs/utils/Timers.cpp # used by KeyCharacterMap.cpp, InputReader.cpp, InputDispatcher.cpp, Looper.cpp

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

This doesn't appear to be a bad change, or significantly beneficial either.

lib/ is now 1MB smaller and bin/ benefits from input-reader-perf.bin now being 10MB smaller.

However the issue remains that we're juggling between static and object libraries, both of which have significant drawbacks in this context. While only using the library in one place sounds like an advantage, to switch it from 'static' to 'object' is actually a disadvantage. Because 'static' libraries are used optimally by the linker, only picking and choosing the objects that get referenced. 'object' libraries on the other hand are less efficient and embed every single object into libmircommon including those we never reference. So the benefit to lib/* is negligible right now.

review: Abstain
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> However the issue remains that we're juggling between static and object
> libraries, both of which have significant drawbacks in this context. While
> only using the library in one place sounds like an advantage, to switch it
> from 'static' to 'object' is actually a disadvantage. Because 'static'
> libraries are used optimally by the linker, only picking and choosing the
> objects that get referenced. 'object' libraries on the other hand are less
> efficient and embed every single object into libmircommon including those we
> never reference. So the benefit to lib/* is negligible right now.

The move is from having a static library (linked in multiple libraries/executables) to being part of two dynamic libraries. (The "object" library is just an implementation artifact to make this change.)

Dynamic libraries always have the disadvantage that they are not selective in the objects they bring into the process and that is the reason that I've split android-input-static in two. (And deleted a substantial part of it.)

The objects referenced by libmirclient are in android-input-common and reside in libmircommon.

The objects referenced elsewhere are in android-input-platform and reside in libmirplatform.

The objects that are not referenced have been deleted (in other MPs that have now landed).

If we delete stuff when we stop using it then there is a significant benefit over having it in a static library and not the linker not pulling it into a binary.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '3rd_party/android-input/android/CMakeLists.txt'
2--- 3rd_party/android-input/android/CMakeLists.txt 2015-08-12 09:14:15 +0000
3+++ 3rd_party/android-input/android/CMakeLists.txt 2015-08-17 09:31:56 +0000
4@@ -7,7 +7,6 @@
5 system/extras/ext4_utils
6
7 ${PROJECT_SOURCE_DIR}/include/server
8- ${PROJECT_SOURCE_DIR}/src/include/server
9 ${PROJECT_SOURCE_DIR}/include/platform
10 )
11
12@@ -15,36 +14,39 @@
13 -DANDROID_SMP=1
14 )
15
16-add_library(android-input-static STATIC
17+add_library(android-input-common OBJECT
18+ frameworks/base/services/input/InputTransport.cpp
19+ frameworks/base/services/input/Input.cpp
20+ frameworks/base/services/input/IntSet.cpp
21+ frameworks/base/services/input/MirLog.cpp
22+ frameworks/native/libs/utils/RefBase.cpp # used a lot
23+ frameworks/native/libs/utils/Timers.cpp # used by KeyCharacterMap.cpp, InputReader.cpp, InputDispatcher.cpp, Looper.cpp
24+)
25+
26+add_library(android-input-platform OBJECT
27 frameworks/base/services/input/EventHub.cpp
28 frameworks/base/services/input/InputDevice.cpp
29 frameworks/base/services/input/InputListener.cpp
30 frameworks/base/services/input/InputReader.cpp
31- frameworks/base/services/input/InputTransport.cpp
32- frameworks/base/services/input/Input.cpp
33- frameworks/base/services/input/IntSet.cpp
34 frameworks/base/services/input/GenericKeyMap.cpp
35 frameworks/base/services/input/Keyboard.cpp
36 frameworks/base/services/input/KeyCharacterMap.cpp
37 frameworks/base/services/input/KeyLayoutMap.cpp
38- frameworks/base/services/input/MirLog.cpp
39 frameworks/native/libs/utils/Tokenizer.cpp
40 frameworks/base/services/input/VelocityControl.cpp
41 frameworks/base/services/input/VelocityTracker.cpp
42 frameworks/base/services/input/VirtualKeyMap.cpp
43 frameworks/native/libs/utils/FileMap.cpp
44- frameworks/native/libs/utils/RefBase.cpp # used a lot
45- frameworks/native/libs/utils/Timers.cpp # used by KeyCharacterMap.cpp, InputReader.cpp, InputDispatcher.cpp, Looper.cpp
46-)
47-
48-target_link_libraries(
49- android-input-static
50-
51- ${Boost_LIBRARIES}
52-)
53-
54-set_target_properties(
55- android-input-static
56+)
57+
58+set_target_properties(
59+ android-input-common
60+ PROPERTIES
61+ COMPILE_FLAGS ${ANDROID_INPUT_COMPILE_FLAGS}
62+)
63+
64+set_target_properties(
65+ android-input-platform
66 PROPERTIES
67 COMPILE_FLAGS ${ANDROID_INPUT_COMPILE_FLAGS}
68 )
69
70=== modified file '3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp'
71--- 3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp 2015-06-17 05:20:42 +0000
72+++ 3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp 2015-08-17 09:31:56 +0000
73@@ -140,40 +140,6 @@
74 c_str(identifier.descriptor));
75 }
76
77-// --- Global Functions ---
78-
79-uint32_t getAbsAxisUsage(int32_t axis, uint32_t deviceClasses) {
80- // Touch devices get dibs on touch-related axes.
81- if (deviceClasses & INPUT_DEVICE_CLASS_TOUCH) {
82- switch (axis) {
83- case ABS_X:
84- case ABS_Y:
85- case ABS_PRESSURE:
86- case ABS_TOOL_WIDTH:
87- case ABS_DISTANCE:
88- case ABS_TILT_X:
89- case ABS_TILT_Y:
90- case ABS_MT_SLOT:
91- case ABS_MT_TOUCH_MAJOR:
92- case ABS_MT_TOUCH_MINOR:
93- case ABS_MT_WIDTH_MAJOR:
94- case ABS_MT_WIDTH_MINOR:
95- case ABS_MT_ORIENTATION:
96- case ABS_MT_POSITION_X:
97- case ABS_MT_POSITION_Y:
98- case ABS_MT_TOOL_TYPE:
99- case ABS_MT_BLOB_ID:
100- case ABS_MT_TRACKING_ID:
101- case ABS_MT_PRESSURE:
102- case ABS_MT_DISTANCE:
103- return INPUT_DEVICE_CLASS_TOUCH;
104- }
105- }
106-
107- // Joystick devices get the rest.
108- return deviceClasses & INPUT_DEVICE_CLASS_JOYSTICK;
109-}
110-
111 // --- EventHub::Device ---
112
113 EventHub::Device::Device(int fd, int32_t id, const String8& path,
114
115=== modified file '3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp'
116--- 3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp 2015-08-13 11:19:39 +0000
117+++ 3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp 2015-08-17 09:31:56 +0000
118@@ -208,6 +208,39 @@
119 AMOTION_EVENT_BUTTON_FORWARD, AKEYCODE_FORWARD);
120 }
121
122+// --- Global Functions ---
123+
124+uint32_t getAbsAxisUsage(int32_t axis, uint32_t deviceClasses) {
125+ // Touch devices get dibs on touch-related axes.
126+ if (deviceClasses & INPUT_DEVICE_CLASS_TOUCH) {
127+ switch (axis) {
128+ case ABS_X:
129+ case ABS_Y:
130+ case ABS_PRESSURE:
131+ case ABS_TOOL_WIDTH:
132+ case ABS_DISTANCE:
133+ case ABS_TILT_X:
134+ case ABS_TILT_Y:
135+ case ABS_MT_SLOT:
136+ case ABS_MT_TOUCH_MAJOR:
137+ case ABS_MT_TOUCH_MINOR:
138+ case ABS_MT_WIDTH_MAJOR:
139+ case ABS_MT_WIDTH_MINOR:
140+ case ABS_MT_ORIENTATION:
141+ case ABS_MT_POSITION_X:
142+ case ABS_MT_POSITION_Y:
143+ case ABS_MT_TOOL_TYPE:
144+ case ABS_MT_BLOB_ID:
145+ case ABS_MT_TRACKING_ID:
146+ case ABS_MT_PRESSURE:
147+ case ABS_MT_DISTANCE:
148+ return INPUT_DEVICE_CLASS_TOUCH;
149+ }
150+ }
151+
152+ // Joystick devices get the rest.
153+ return deviceClasses & INPUT_DEVICE_CLASS_JOYSTICK;
154+}
155
156 // --- InputReaderConfiguration ---
157
158
159=== modified file 'benchmarks/android-input/CMakeLists.txt'
160--- benchmarks/android-input/CMakeLists.txt 2015-07-27 07:24:50 +0000
161+++ benchmarks/android-input/CMakeLists.txt 2015-08-17 09:31:56 +0000
162@@ -14,9 +14,7 @@
163 target_link_libraries(
164 input-reader-perf
165
166- android-input-static
167 mir-test-assist
168- mirserver
169 )
170
171 uses_android_input(input-reader-perf)
172
173=== modified file 'src/client/input/CMakeLists.txt'
174--- src/client/input/CMakeLists.txt 2015-06-17 05:20:42 +0000
175+++ src/client/input/CMakeLists.txt 2015-08-17 09:31:56 +0000
176@@ -29,11 +29,6 @@
177 ${CMAKE_CURRENT_SOURCE_DIR}/xkb_mapper.cpp
178 )
179
180-# As we put android-input-static in MIR_CLIENT_REFERENCES it ends up linked into
181-# libmirserver. But linking into libmircommon fails as it in turn needs
182-# mir::mir::terminate_with_current_exception() from mirserver
183-list(APPEND MIR_CLIENT_REFERENCES android-input-static)
184-
185 list(APPEND MIR_CLIENT_REFERENCES ${XKBCOMMON_LIBRARIES})
186
187 set(MIR_CLIENT_SOURCES ${MIR_CLIENT_SOURCES} PARENT_SCOPE)
188
189=== modified file 'src/common/CMakeLists.txt'
190--- src/common/CMakeLists.txt 2015-08-12 11:37:22 +0000
191+++ src/common/CMakeLists.txt 2015-08-17 09:31:56 +0000
192@@ -22,6 +22,7 @@
193 list(APPEND MIR_COMMON_SOURCES
194 $<TARGET_OBJECTS:mirtime>
195 $<TARGET_OBJECTS:mirfatal>
196+ $<TARGET_OBJECTS:android-input-common>
197 ${CMAKE_CURRENT_SOURCE_DIR}/log.cpp
198 )
199
200
201=== modified file 'src/common/symbols.map'
202--- src/common/symbols.map 2015-08-12 11:37:22 +0000
203+++ src/common/symbols.map 2015-08-17 09:31:56 +0000
204@@ -142,3 +142,57 @@
205 };
206 local: *;
207 };
208+
209+MIR_COMMON_5.1 {
210+ global:
211+ extern "C++" {
212+ android::InputChannel::InputChannel*;
213+ android::InputChannel::openInputFdPair*;
214+ android::InputConsumer::consume*;
215+ android::InputConsumer::hasDeferredEvent*;
216+ android::InputConsumer::hasPendingBatch*;
217+ android::InputConsumer::?InputConsumer*;
218+ android::InputConsumer::InputConsumer*;
219+ android::InputConsumer::sendFinishedSignal*;
220+ android::InputPublisher::?InputPublisher*;
221+ android::InputPublisher::InputPublisher*;
222+ android::InputPublisher::publishKeyEvent*;
223+ android::InputPublisher::publishMotionEvent*;
224+ android::InputPublisher::receiveFinishedSignal*;
225+ android::InputReaderConfiguration::setDisplayInfo*;
226+ android::IntSet::contains*;
227+ android::IntSet::indexOf*;
228+ android::IntSet::?IntSet*;
229+ android::IntSet::IntSet*;
230+ android::IntSet::operator*;
231+ android::IntSet::remove*;
232+ android::KeyEvent::initialize*;
233+ __android_log_assert*;
234+ __android_log_print*;
235+ android::MotionEvent::getAxisValue*;
236+ android::MotionEvent::getAxisValue*;
237+ android::MotionEvent::getHistoricalAxisValue*;
238+ android::MotionEvent::getRawAxisValue*;
239+ android::MotionEvent::getRawAxisValue*;
240+ android::PointerCoords::copyFrom*;
241+ android::PointerCoords::getAxisValue*;
242+ android::PointerCoords::operator*;
243+ android::PointerCoords::setAxisValue*;
244+ android::PointerProperties::copyFrom*;
245+ android::PointerProperties::operator*;
246+ android::RefBase::decStrong*;
247+ android::RefBase::incStrong*;
248+ android::RefBase::onFirstRef*;
249+ android::RefBase::onIncStrongAttempted*;
250+ android::RefBase::onLastStrongRef*;
251+ android::RefBase::onLastWeakRef*;
252+ android::RefBase::?RefBase*;
253+ android::RefBase::RefBase*;
254+ mir::write_to_log;
255+ systemTime;
256+ toMillisecondTimeoutDelay*;
257+ typeinfo?for?android::RefBase;
258+ vtable?for?android::IntSet;
259+ };
260+ local: *;
261+} MIR_COMMON_5;
262
263=== modified file 'src/platform/CMakeLists.txt'
264--- src/platform/CMakeLists.txt 2015-06-18 02:46:16 +0000
265+++ src/platform/CMakeLists.txt 2015-08-17 09:31:56 +0000
266@@ -14,6 +14,7 @@
267 $<TARGET_OBJECTS:mirplatformgraphicscommon>
268 $<TARGET_OBJECTS:miroptions>
269 $<TARGET_OBJECTS:mirudev>
270+ $<TARGET_OBJECTS:android-input-platform>
271 )
272
273 set(MIR_PLATFORM_REFERENCES
274
275=== modified file 'src/platform/symbols.map'
276--- src/platform/symbols.map 2015-07-20 03:16:27 +0000
277+++ src/platform/symbols.map 2015-08-17 09:31:56 +0000
278@@ -278,3 +278,31 @@
279 };
280 local: *;
281 };
282+
283+MIRPLATFORM_9.1 {
284+ global:
285+ extern "C++" {
286+ android::EventHub::EventHub*;
287+ android::getAbsAxisUsage*;
288+ android::getInputDeviceConfigurationFilePathByDeviceIdentifier*;
289+ android::InputDeviceInfo::?InputDeviceInfo*;
290+ android::InputDeviceInfo::InputDeviceInfo*;
291+ android::InputReaderConfiguration::setDisplayInfo*;
292+ android::InputReader::InputReader*;
293+ android::isEligibleBuiltInKeyboard*;
294+ android::KeyCharacterMap::combine*;
295+ android::KeyCharacterMap::empty*;
296+ android::KeyCharacterMap::mapKey*;
297+ android::KeyLayoutMap::findScanCodesForKey*;
298+ android::KeyLayoutMap::mapAxis*;
299+ android::KeyLayoutMap::mapKey*;
300+ android::KeyMap::?KeyMap*;
301+ android::KeyMap::KeyMap*;
302+ android::KeyMap::load*;
303+ android::KeyMap::loadGenericMaps*;
304+ __android_log_assert;
305+ __android_log_print;
306+ android::VirtualKeyMap::load*;
307+ android::VirtualKeyMap::?VirtualKeyMap*;
308+ };
309+} MIRPLATFORM_9;
310\ No newline at end of file
311
312=== modified file 'src/server/CMakeLists.txt'
313--- src/server/CMakeLists.txt 2015-08-12 11:37:22 +0000
314+++ src/server/CMakeLists.txt 2015-08-17 09:31:56 +0000
315@@ -94,7 +94,6 @@
316 mircommon
317 mirprotobuf
318
319- android-input-static
320 xcursorloader-static
321
322 ${GLog_LIBRARY}
323
324=== modified file 'src/utils/CMakeLists.txt'
325--- src/utils/CMakeLists.txt 2015-06-17 05:20:42 +0000
326+++ src/utils/CMakeLists.txt 2015-08-17 09:31:56 +0000
327@@ -11,7 +11,7 @@
328 target_link_libraries(mirping mirclient)
329
330 mir_add_wrapped_executable(mirout out.c)
331-target_link_libraries(mirout mirclient)
332+target_link_libraries(mirout mirclient m)
333
334 mir_add_wrapped_executable(mirscreencast screencast.cpp)
335
336
337=== modified file 'tests/integration-tests/CMakeLists.txt'
338--- tests/integration-tests/CMakeLists.txt 2015-07-29 01:18:16 +0000
339+++ tests/integration-tests/CMakeLists.txt 2015-08-17 09:31:56 +0000
340@@ -91,7 +91,6 @@
341 mirclientrpc-static
342 mirclientlttng-static
343
344- android-input-static
345 xcursorloader-static
346
347 ${PROTOBUF_LITE_LIBRARIES}
348
349=== modified file 'tests/unit-tests/CMakeLists.txt'
350--- tests/unit-tests/CMakeLists.txt 2015-08-03 15:19:34 +0000
351+++ tests/unit-tests/CMakeLists.txt 2015-08-17 09:31:56 +0000
352@@ -116,7 +116,6 @@
353 mir-test-doubles-static
354 mir-test-doubles-platform-static
355
356- android-input-static
357 xcursorloader-static
358
359 ${PROTOBUF_LITE_LIBRARIES}

Subscribers

People subscribed via source and target branches