~hikiko/mir/mir.unity8-desktop-session

« back to all changes in this revision

Viewing changes to include/platform/mir/udev/wrapper.h

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Daniel van Vugt, Ubuntu daily release
  • Date: 2014-02-04 14:49:07 UTC
  • mfrom: (1.1.55)
  • Revision ID: package-import@ubuntu.com-20140204144907-2lcyf87mba5rdca6
Tags: 0.1.4+14.04.20140204-0ubuntu1
[ Daniel van Vugt ]
* New upstream release 0.1.4 (https://launchpad.net/mir/+milestone/0.1.4)
  - Fixed snapshotting and flicker problems for Unity8 on various Nexus
    devices.
  - Enhanced reporting of performance information:
    . Report input latency in InputReport/InputReceiverReport.
    . Added a CompositorReport for logging compositor performance and state.
  - Added a new package "mir-utils" containing new tools:
    . mirping: Displays round-trip times between client and server
    . mirout: Displays the monitor layout/configuration details
  - Added GL texture caching to improve performance when multiple surfaces
    are visible.
  - Added opacity controls to mir_demo_server_shell
  - Mir server ABI bumped to 13. Client ABI bumped to 5.
  - Removed lots of Android headers, replaced by build-dep: android-headers
  - Added support for translucent nested servers.
  - tests: Fix unitialized values and incorrect fd closing loops
  - Fix unitialized values and incorrect fd closing loops.
  - client: Add basic MirScreencast C API.
  - config: start moving default values for config options from all the
    call sites to the setup
  - tests: Provide a helper for running clients with a stub ClientPlatform.
  - android: split out HWC layers into their own file and add a
    mga::CompositionLayer type that depends on the interface mg::Renderable.
  - client: Add basic MirOutputCapture class.
  - client: Don't create mesa ClientBuffer objects from invalid
    MirBufferPackages.
  - Optimize surface resizing to avoid doing anything if the dimensions
    are unchanged.
  - SwitchingBundle - add operator<< for debugging.
  - support hwcomposer 1.2 for android 4.4 on nexus 4 (which needs hwc1.2
    support). This patch adds hwc1.2 device construction, as well as progs
    the 'skip' layer in HWC to the buffer properties of the framebuffer.
  - demo-shell: Add simple keyboard controls to rotate outputs; Ctrl +
    Alt + <arrow-key>. Fixes: https://bugs.launchpad.net/bugs/1203215.
  - frontend: exposing internals of the RPC mechanism to enable custom
    function calls to be added.
  - Make udev wrapper into a top-level citizen
  - compositor: ignore double requests to start or stop the
    MultiThreadedCompositor.
  - Add DisplayBuffer::orientation(), to tell the Renderer if we need it
    to do screen rotation in GL (for platforms which don't implement 
    rotation natively) Fixes: https://bugs.launchpad.net/bugs/1203215.
  - graphics: add an post_update function that takes a list of renderables
    to the display buffer. This will let the display buffer take advantage
    of full-surface overlays on android.
  - android-input: Improve debug output
  - the stock qcom 8960 hwcomposer chokes on getDisplayAttributes if the
    submitted arrays are not at least size 6. patched the qcom android 4.2
    hwcomposer driver on the ubuntu touch images to work properly, but
    causes us problems with in-the wild drivers, and the new 4.4 drivers.
    Make sure we always submit a larger-than-needed array to this function.
  - frontend: refactoring to make it easier to expose the underlying RPC
    transport on the server side.
  - Don't assume pressure value is zero if not yet known
  - build: Expose options to allow building but not running tests by default.
  - Translucent Server which prefers a transparent pixel format
  - frontend: refactor ProtobufMessageProcessor to separate out generic
    response sending logic from specific message handling.
  - client: expose the part of the client RPC infrastructure needed for
    downstream to prototype their own message sending.
  - Bugs fixed:
    . unity8 display flickers and stops responding on Nexus 7 (grouper)
      (LP: #1238695)
    . Mir gets textures/buffers confused when running both scroll and flicker
      demos (LP: #1263592)
    . Some snapshots on Nexus10 upside-down (LP: #1263741)
    . mir_unit_tests is crashing with SIGSEGV in libhybris gl functions
      (LP: #1264968)
    . Some snapshots on Nexus10 have swapped red/blue channels (LP: #1265787)
    . Bypass causes some non-bypassed surfaces (on top) to be invisible
      (LP: #1266385)
    . helgrind: Possible data race - MirConnection::mutex not used
      consistently (LP: #1243575)
    . helgrind: Lock order violated (potential deadlock) in
      ConnectionSurfaceMap (LP: #1243576)
    . helgrind: Possible data race - inconsistent locking in PendingCallCache
      (LP: #1243578)
    . helgrind: Lock order violated in
      mir::client::ConnectionSurfaceMap::erase(int) (LP: #1243584)
    . [enhancement] Allow a Mir nested server to have a transparent
      background (LP: #1256702)
    . Compiling without tests fails (-DMIR_ENABLE_TESTS=NO) (LP: #1263724)
    . examples, doc: Make it clear and consistent how to use
      a non-root client with a root compositor endpoint. 
      (LP: #1272143)
    . Avoid linking to umockdev on platforms (android) which don't yet
      use it. This allows mir_unit_tests to run on touch images again
      (LP: #1271434)
    . Workaround for N4 nested server issue. This change removes
      mir_pixel_format_bgr_888 - HAL_PIXEL_FORMAT_RGB_888 from the
      list of supported pixel formats on android. (LP: #1272041)
    . Don't ask glUniformMatrix4fv to transpose your matrix. That option
      was officially deprecated between OpenGL and OpenGL|ES. And some
      drivers like the Nexus 10 don't implement it, resulting in incorrect
      transformations and even nothing on screen! (LP: #1271853)
    . Fixes: bug 1272143 (LP: #1272143)
    . fix integration test failure on the galaxy nexus that was due to
      creating two surfaces and registering the same buffer twice. Fixes:
      (LP: #1272597)
    . Implement screen rotation in GLRenderer, for platforms
      which can't do it natively in DisplayBuffer.
      (LP: #1203215)
    . Add an "orientation" field to output structures in preparation for
      screen rotation. It's not yet functionally wired to anything.
      (LP: #1203215)
    . Only use SwitchingBundle::last_consumed after it has been
      set. Otherwise SwitchingBundle::compositor_acquire could follow a bogus
      code path. (LP:#1270964)
    . tests: Override configuration to avoid creating an (unused)
      filesystem endpoint for connections when using InProcessServer. 
      (LP: #1271604)
    . frontend: ensure that BasicConnector threads don't exit
      immediately. (LP: #1271655)

[ Ubuntu daily release ]
* New rebuild forced

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2013 Canonical Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it
 
5
 * under the terms of the GNU Lesser General Public License version 3,
 
6
 * as published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
 
17
 */
 
18
 
 
19
#ifndef MIR_UDEV_WRAPPER_H_
 
20
#define MIR_UDEV_WRAPPER_H_
 
21
 
 
22
#include <memory>
 
23
#include <libudev.h>
 
24
#include <mir/graphics/event_handler_register.h>
 
25
 
 
26
namespace mir
 
27
{
 
28
namespace udev
 
29
{
 
30
 
 
31
class Device;
 
32
class Enumerator;
 
33
 
 
34
class Context
 
35
{
 
36
public:
 
37
    Context();
 
38
    ~Context() noexcept;
 
39
 
 
40
    Context(Context const&) = delete;
 
41
    Context& operator=(Context const&) = delete;
 
42
 
 
43
    std::shared_ptr<Device> device_from_syspath(std::string const& syspath);
 
44
 
 
45
    ::udev* ctx() const;
 
46
 
 
47
private:
 
48
    ::udev* const context;
 
49
};
 
50
 
 
51
class Device
 
52
{
 
53
public:
 
54
    virtual ~Device() = default;
 
55
 
 
56
    Device(Device const&) = delete;
 
57
    Device& operator=(Device const&) = delete;
 
58
 
 
59
    virtual char const* subsystem() const = 0;
 
60
    virtual char const* devtype() const = 0;
 
61
    virtual char const* devpath() const = 0;
 
62
    virtual char const* devnode() const = 0;
 
63
protected:
 
64
    Device() = default;
 
65
};
 
66
 
 
67
bool operator==(Device const& lhs, Device const& rhs);
 
68
bool operator!=(Device const& lhs, Device const& rhs);
 
69
 
 
70
class Enumerator
 
71
{
 
72
public:
 
73
    Enumerator(std::shared_ptr<Context> const& ctx);
 
74
    ~Enumerator() noexcept;
 
75
 
 
76
    Enumerator(Enumerator const&) = delete;
 
77
    Enumerator& operator=(Enumerator const&) = delete;
 
78
 
 
79
    void scan_devices();
 
80
 
 
81
    void match_subsystem(std::string const& subsystem);
 
82
    void match_parent(Device const& parent);
 
83
    void match_sysname(std::string const& sysname);
 
84
 
 
85
    class iterator :
 
86
        public std::iterator<std::input_iterator_tag, Device>
 
87
    {
 
88
    public:
 
89
        iterator& operator++();
 
90
        iterator operator++(int);
 
91
 
 
92
        bool operator==(iterator const& rhs) const;
 
93
        bool operator!=(iterator const& rhs) const;
 
94
 
 
95
        Device const& operator*() const;
 
96
 
 
97
    private:
 
98
        friend class Enumerator;
 
99
 
 
100
        iterator ();
 
101
        iterator (std::shared_ptr<Context> const& ctx, udev_list_entry* entry);
 
102
 
 
103
        void increment();
 
104
 
 
105
        std::shared_ptr<Context> ctx;
 
106
        udev_list_entry* entry;
 
107
 
 
108
        std::shared_ptr<Device> current;
 
109
    };
 
110
 
 
111
    iterator begin();
 
112
    iterator end();
 
113
 
 
114
private:
 
115
    std::shared_ptr<Context> const ctx;
 
116
    udev_enumerate* const enumerator;
 
117
    bool scanned;
 
118
};
 
119
 
 
120
class Monitor
 
121
{
 
122
public:
 
123
    enum EventType {
 
124
        ADDED,
 
125
        REMOVED,
 
126
        CHANGED,
 
127
    };
 
128
 
 
129
    Monitor(const Context& ctx);
 
130
    ~Monitor() noexcept;
 
131
 
 
132
    Monitor(Monitor const&) = delete;
 
133
    Monitor& operator=(Monitor const&) = delete;
 
134
 
 
135
    void enable(void);
 
136
    int fd(void) const;
 
137
 
 
138
    void filter_by_subsystem_and_type(std::string const& subsystem, std::string const& devtype);
 
139
 
 
140
    void process_events(std::function<void(EventType, Device const&)> const& handler) const;
 
141
 
 
142
private:
 
143
    udev_monitor* const monitor;
 
144
    bool enabled;
 
145
};
 
146
 
 
147
}
 
148
}
 
149
#endif // MIR_UDEV_WRAPPER_H_