Mir
hwc_wrapper.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2014 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: Kevin DuBois <kevin.dubois@canonical.com>
17  */
18 
19 #ifndef MIR_GRAPHICS_ANDROID_HWC_WRAPPER_H_
20 #define MIR_GRAPHICS_ANDROID_HWC_WRAPPER_H_
21 
22 #include "mir/int_wrapper.h"
23 #include "display_name.h"
24 #include <array>
25 #include <functional>
26 #include <chrono>
27 #include <vector>
28 
29 struct hwc_display_contents_1;
30 
31 namespace mir
32 {
33 namespace graphics
34 {
35 namespace android
36 {
37 
38 struct ConfigIdTag;
40 
41 struct HWCCallbacks;
43 {
44 public:
45  virtual ~HwcWrapper() = default;
46 
47  virtual void prepare(std::array<hwc_display_contents_1*, HWC_NUM_DISPLAY_TYPES> const&) const = 0;
48  virtual void set(std::array<hwc_display_contents_1*, HWC_NUM_DISPLAY_TYPES> const&) const = 0;
49  //receive vsync, invalidate, and hotplug events from the driver.
50  //As with the HWC api, these events MUST NOT call-back to the other functions in HwcWrapper.
51  virtual void subscribe_to_events(
52  void const* subscriber,
53  std::function<void(DisplayName, std::chrono::nanoseconds)> const& vsync_callback,
54  std::function<void(DisplayName, bool)> const& hotplug_callback,
55  std::function<void()> const& invalidate_callback) = 0;
56  virtual void unsubscribe_from_events(void const* subscriber) noexcept = 0;
57  virtual void vsync_signal_on(DisplayName) const = 0;
58  virtual void vsync_signal_off(DisplayName) const = 0;
59  virtual void display_on(DisplayName) const = 0;
60  virtual void display_off(DisplayName) const = 0;
61  virtual std::vector<ConfigId> display_configs(DisplayName) const = 0;
62  virtual void display_attributes(
63  DisplayName, ConfigId, uint32_t const* attributes, int32_t* values) const = 0;
64 
65 protected:
66  HwcWrapper() = default;
67  HwcWrapper& operator=(HwcWrapper const&) = delete;
68  HwcWrapper(HwcWrapper const&) = delete;
69 };
70 }
71 }
72 }
73 
74 #endif /* MIR_GRAPHICS_ANDROID_HWC_WRAPPER_H_ */
virtual void set(std::array< hwc_display_contents_1 *, HWC_NUM_DISPLAY_TYPES > const &) const =0
All things Mir.
Definition: buffer_stream.h:37
virtual void unsubscribe_from_events(void const *subscriber) noexcept=0
virtual void display_attributes(DisplayName, ConfigId, uint32_t const *attributes, int32_t *values) const =0
virtual void vsync_signal_off(DisplayName) const =0
Definition: hwc_wrapper.h:42
DisplayName
Definition: display_name.h:31
virtual void vsync_signal_on(DisplayName) const =0
virtual std::vector< ConfigId > display_configs(DisplayName) const =0
virtual void display_on(DisplayName) const =0
virtual void display_off(DisplayName) const =0
IntWrapper< ConfigIdTag, uint32_t > ConfigId
Definition: hwc_wrapper.h:38
Definition: int_wrapper.h:27
virtual void prepare(std::array< hwc_display_contents_1 *, HWC_NUM_DISPLAY_TYPES > const &) const =0
Definition: android_input_receiver.h:32
virtual void subscribe_to_events(void const *subscriber, std::function< void(DisplayName, std::chrono::nanoseconds)> const &vsync_callback, std::function< void(DisplayName, bool)> const &hotplug_callback, std::function< void()> const &invalidate_callback)=0
HwcWrapper & operator=(HwcWrapper const &)=delete

Copyright © 2012,2013 Canonical Ltd.
Generated on Tue Mar 24 16:15:19 UTC 2015