~ubuntu-branches/ubuntu/vivid/mir/vivid

« back to all changes in this revision

Viewing changes to src/server/input/android/default_android_input_configuration.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Daniel van Vugt, Ubuntu daily release
  • Date: 2014-06-03 21:41:02 UTC
  • mfrom: (1.1.62)
  • Revision ID: package-import@ubuntu.com-20140603214102-jh0yoq6xy4x0rwn1
Tags: 0.2.0+14.10.20140603.3-0ubuntu1
[ Daniel van Vugt ]
* New upstream release 0.2.0 (https://launchpad.net/mir/+milestone/0.2.0)
  - mirclient ABI unchanged, still at 7. Clients do not need rebuilding.
  - mirserver ABI bumped to 20. Shells need rebuilding.
    . Cursor::set_image() parameters changed.
    . Display::the_cursor() renamed to Display::create_hardware_cursor()
    . Platform::create_display() requires a new parameter; gl_program_factory
    . Renderable::buffer() no longer accepts any parameter at all. Multi-
      monitor frame sync is guaranteed in other ways now.
    . Scene::generate_renderable_list() renamed to renderable_list_for(id)
      where id is an opaque compositor ID of your choosing.
    . Scene::set_change_callback() replaced by the more generic:
      add_observer() and remove_observer() functions.
    . Added default implementation for SceneObserver.  
    . SessionCreator renamed to ConnectionCreator.
    . ConnectedSessions renamed to Connections.
    . ProtobufSessionCreator renamed to ProtobufConnectionCreator.
    . SessionAuthorizer: pid_t parameters replaced by SessionCredentials.
    . Massive architectural changes to Input-everything.
    . Surface no longer implements Renderable, but emits one via
      compositor_snapshot().
    . Pass the full renderable list to Renderer::render().
    . Graceful handling of exceptions thrown from server threads.
    . Clarify size position interfaces in the Surface classes.
    . Plumbing for trusted sessions.
    . Allow posting and managing custom main-loop actions.
    . Timer extension.
    . Identify client process when client connects to Mir not when socket
      connects.
    . Use the ServerActionQueue for display config.
    . Recomposition signal moved to the MultiThreadedCompositor.
    . Make timer service replaceable.
    . Clarify assumptions about how many buffers a client can fill without
      blocking.
    . Introduce EmergencyCleanup interface.
  - Demo shell enhancements:
    . You can now change graphics modes on the fly using Ctrl+Alt+(-/=).
      To reset to the preferred mode use Ctrl+Alt+0.
    . The above mode changing as well as existing screen rotation keys
      (Ctrl+Alt+arrows) are now per-display; only applied to the monitor
      the mouse pointer is on.
    . New shell controls documented.
  - A new testing category, performance test, was introduced. It currently
    runs glmark2-es2 and compares the result to a minimum threshold. 
  - MIR_VERSION_MINOR is tied to MIRSERVER_ABI in the sense that a change
    in the former now requires dependent projects that a rebuild is 
    necessary.
  - SwitchingBundle was replaced by BufferQueue.
  - Expand credentials to include uid/gid for session authorizer.
  - Bypass control is now Mesa-specific and tied to the command line options.
    So the environment variable MIR_BYPASS has changed to MIR_SERVER_BYPASS.
  - mirscreencast screenshots now produce images with correct color instead
    of transparency.
  - Ongoing architectural changes in the compositor/renderer logic to
    prepare for overlay support, and to reduce locking overhead.
  - Made InputDispatcher replaceable.
  - Progress made on new cursor interfaces with the end goal of client and
    toolkit control of the mouse cursor appearance. More work required.
  - Updated cross-compile docs and scripts to support the latest utopic
    devel images.
  - Replaced uses of android::sp with std::shared_ptr.
  - Client cursor API infrastructure.
  - Enabled eglSwapInternal(0).
  - Make texture caching algorithm reuseable.
  - Add a DPI surface attribute.
  - Exclude arm64 from build.
  - Bugs fixed:
    . Mir doesn't install cleanly if docs are not built. (LP: #1304271)
    . Unity-system-compositor crashed [what(): Failed to set DRM crtc].
      (LP: #1294510)
    . [regression] unity8 fails to load libmirplatformgraphics
      (undefined symbol: _ZN3mir8graphics9GLProgramD1Ev). (LP: #1317200)
    . [regression] unity8 rendering artifacts. (LP: #1317260)
    . [regression] [BufferQueue] 
      BufferQueueTest.compositor_never_owns_client_buffers occasionally
      crashes with: what(): unexpected release: buffer was not given to
      compositor. (LP: #1317801)
    . Hardcoded size for serialization buffers is neither reliable nor
      secure. (LP: #1320187)
    . [regression] [BufferQueue] mir does not composite last client given
      buffer. (LP: #1321861)
    . [regression] stale frame on seen on greeter when screen is unblanked
      and toolkit/apps are laggy/throttled. (LP: #1321886)
    . [regression] [BufferQueue] current_buffer_users vector memory usage
      grows unbounded. (LP: #1317808)
    . Intermittent test failures in 
      CustomInputDispatcherFixture.custom_input_dispatcher_receives_input.
      (LP: #1318587)
    . [regression] [BufferQueue] Race condition in 
      BufferQueue::compositor_acquire could underflow shared_ptr refcount and
      delete prematurely, crash. (LP: #1318632)
    . Overflow in 
      mir::client::rpc::MirSocketRpcChannel::receive_file_descriptors as
      reported by address sanitizer. (LP: #1320821)
    . [regression] [input] Scroll events are now always zero: 
      event.motion.pointer_coordinates[0].vscroll. (LP: #1321077)
    . CI failures in CustomInputDispatcherFixture
      .custom_input_dispatcher_gets_started_and_stopped. (LP: #1321215)
    . [regression] Mir cursor vanishes after switching VTs. (LP: #1323225)
    . Server library links against libmirserverlttng. (LP: #1323317)
    . [DRM/GBM] Killing (or crashing) Mir often leaves the screen blank and
      difficult to recover. (LP: #1189770)
    . Frame rates of GL clients are limited to 60Hz on Android, even with
      swapinterval=0. (LP: #1206400)
    . mir_surface_is_valid(NULL) crashes instead of returning false.
      (LP: #1248474)
    . Mirscreencast outputs translucency instead of shadows, producing
      incorrect images. (LP: #1301210)
    . [regression] tests/unit-tests/shell/test_mediating_display_changer.cpp
      is not compiled and executed. (LP: #1312832)
    . Android platform does not reset the compositionType to HWC_FRAMEBUFFER
      before prepare() on every frame. (LP: #1314399)
    . The client process is identified when the socket connects, not when the
      client connects to Mir. (LP: #1314574)
    . [regression] Clients can't acquire multiple buffers any more.
      (LP: #1315302)
    . [regression] Enabling SwitchingBundleTest 
      DISABLED_synchronous_clients_only_get_two_real_buffers now crashes with
      no usable stack trace. It used to only fail. (LP: #1315312)
    . [regression] [BufferQueue] double-buffered client freezes as no buffer
      is returned on compositor_release. (LP: #1319765)
    . Uninitialized mem in OutputBuilder.hwc_version_11_success.
      (LP: #1312867)
    . [enhancement] In the tests make it possible to get a
      DefaultConfiguration initialized from the command line (LP: #1316987)
    . ci train blocked due to missing arm64 libandroid-properties-dev.
      (LP: #1323504)
[ Ubuntu daily release ]
* New rebuild forced

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright © 2013 Canonical Ltd.
 
2
 * Copyright © 2013-2014 Canonical Ltd.
3
3
 *
4
4
 * This program is free software: you can redistribute it and/or modify it
5
5
 * under the terms of the GNU General Public License version 3,
14
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
15
 *
16
16
 * Authored by: Robert Carr <robert.carr@canonical.com>
 
17
                Andreas Pokorny <andreas.pokorny@canonical.com>
17
18
 */
18
19
 
19
20
#include "mir/input/android/default_android_input_configuration.h"
24
25
#include "android_input_targeter.h"
25
26
#include "android_input_target_enumerator.h"
26
27
#include "android_input_manager.h"
 
28
#include "input_translator.h"
 
29
#include "input_channel_factory.h"
 
30
#include "common_input_thread.h"
 
31
 
 
32
#include "mir/input/event_filter.h"
 
33
 
 
34
#include <EventHub.h>
 
35
#include <InputDispatcher.h>
 
36
 
27
37
#include "mir/input/event_filter.h"
28
38
 
29
39
#include <EventHub.h>
39
49
namespace ms = mir::scene;
40
50
namespace msh = mir::shell;
41
51
 
42
 
namespace
43
 
{
44
 
class CommonInputThread : public mia::InputThread
45
 
{
46
 
public:
47
 
     CommonInputThread(std::string const& name, droidinput::sp<droidinput::Thread> const& thread)
48
 
      : name(name),
49
 
        thread(thread)
50
 
    {
51
 
    }
52
 
    virtual ~CommonInputThread()
53
 
    {
54
 
    }
55
 
 
56
 
    void start()
57
 
    {
58
 
        thread->run(name.c_str(), droidinput::PRIORITY_URGENT_DISPLAY);
59
 
    }
60
 
    void request_stop()
61
 
    {
62
 
        thread->requestExit();
63
 
    }
64
 
    void join()
65
 
    {
66
 
        thread->join();
67
 
    }
68
 
 
69
 
private:
70
 
    CommonInputThread(const CommonInputThread&) = delete;
71
 
    CommonInputThread& operator=(const CommonInputThread&) = delete;
72
 
 
73
 
    std::string const name;
74
 
    droidinput::sp<droidinput::Thread> const thread;
75
 
};
76
 
}
77
 
 
78
 
mia::DefaultInputConfiguration::DefaultInputConfiguration(std::shared_ptr<mi::EventFilter> const& event_filter,
79
 
                                                          std::shared_ptr<mi::InputRegion> const& input_region,
80
 
                                                          std::shared_ptr<mi::CursorListener> const& cursor_listener,
81
 
                                                          std::shared_ptr<mi::InputReport> const& input_report)
82
 
  : DispatcherInputConfiguration(event_filter, input_region, cursor_listener, input_report)
 
52
mia::DefaultInputConfiguration::DefaultInputConfiguration(
 
53
    std::shared_ptr<mi::InputDispatcher> const& input_dispatcher,
 
54
    std::shared_ptr<mi::InputRegion> const& input_region,
 
55
    std::shared_ptr<CursorListener> const& cursor_listener,
 
56
    std::shared_ptr<mi::InputReport> const& input_report) :
 
57
    input_dispatcher(input_dispatcher),
 
58
    input_region(input_region),
 
59
    cursor_listener(cursor_listener),
 
60
    input_report(input_report)
83
61
{
84
62
}
85
63
 
87
65
{
88
66
}
89
67
 
90
 
droidinput::sp<droidinput::InputDispatcherInterface> mia::DefaultInputConfiguration::the_dispatcher()
 
68
std::shared_ptr<mi::InputChannelFactory> mia::DefaultInputConfiguration::the_input_channel_factory()
91
69
{
92
 
    return dispatcher(
93
 
        [this]() -> droidinput::sp<droidinput::InputDispatcherInterface>
94
 
        {
95
 
            return new droidinput::InputDispatcher(the_dispatcher_policy(), input_report);
96
 
        });
 
70
    return std::make_shared<mia::InputChannelFactory>();
97
71
}
98
72
 
99
 
droidinput::sp<droidinput::EventHubInterface> mia::DefaultInputConfiguration::the_event_hub()
 
73
std::shared_ptr<droidinput::EventHubInterface> mia::DefaultInputConfiguration::the_event_hub()
100
74
{
101
75
    return event_hub(
102
76
        [this]()
103
77
        {
104
 
            return new droidinput::EventHub(input_report);
 
78
            return std::make_shared<droidinput::EventHub>(input_report);
105
79
        });
106
80
}
107
81
 
108
 
droidinput::sp<droidinput::InputReaderPolicyInterface> mia::DefaultInputConfiguration::the_reader_policy()
 
82
std::shared_ptr<droidinput::InputReaderPolicyInterface> mia::DefaultInputConfiguration::the_reader_policy()
109
83
{
110
84
    return reader_policy(
111
85
        [this]()
112
86
        {
113
 
            return new mia::InputReaderPolicy(input_region, cursor_listener);
 
87
            return std::make_shared<mia::InputReaderPolicy>(input_region, cursor_listener);
114
88
        });
115
89
}
116
90
 
117
91
 
118
 
droidinput::sp<droidinput::InputReaderInterface> mia::DefaultInputConfiguration::the_reader()
 
92
std::shared_ptr<droidinput::InputReaderInterface> mia::DefaultInputConfiguration::the_reader()
119
93
{
120
94
    return reader(
121
95
        [this]()
122
96
        {
123
 
            return new droidinput::InputReader(the_event_hub(), the_reader_policy(), the_dispatcher());
 
97
            return std::make_shared<droidinput::InputReader>(
 
98
                the_event_hub(), the_reader_policy(), the_input_translator());
124
99
        });
125
100
}
126
101
 
134
109
        });
135
110
}
136
111
 
 
112
std::shared_ptr<droidinput::InputListenerInterface> mia::DefaultInputConfiguration::the_input_translator()
 
113
{
 
114
    return std::make_shared<mia::InputTranslator>(input_dispatcher);
 
115
}
 
116
 
137
117
std::shared_ptr<mi::InputManager> mia::DefaultInputConfiguration::the_input_manager()
138
118
{
139
119
    return input_manager(
140
 
        [this]()
 
120
        [this]() -> std::shared_ptr<mi::InputManager>
141
121
        {
142
 
            return std::make_shared<mia::InputManager>(the_event_hub(), the_dispatcher(),
143
 
                                                       the_reader_thread(), the_dispatcher_thread());
 
122
            return std::make_shared<mia::InputManager>(
 
123
                the_event_hub(),
 
124
                the_reader_thread());
144
125
        });
145
126
}
 
127