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 "power_mode.h"
25 #include <array>
26 #include <functional>
27 #include <chrono>
28 #include <vector>
29 
30 struct hwc_display_contents_1;
31 
32 namespace mir
33 {
34 namespace graphics
35 {
36 namespace android
37 {
38 
39 struct ConfigIdTag;
41 
42 struct HWCCallbacks;
44 {
45 public:
46  virtual ~HwcWrapper() = default;
47 
48  virtual void prepare(std::array<hwc_display_contents_1*, HWC_NUM_DISPLAY_TYPES> const&) const = 0;
49  virtual void set(std::array<hwc_display_contents_1*, HWC_NUM_DISPLAY_TYPES> const&) const = 0;
50  //receive vsync, invalidate, and hotplug events from the driver.
51  //As with the HWC api, these events MUST NOT call-back to the other functions in HwcWrapper.
52  virtual void subscribe_to_events(
53  void const* subscriber,
54  std::function<void(DisplayName, std::chrono::nanoseconds)> const& vsync_callback,
55  std::function<void(DisplayName, bool)> const& hotplug_callback,
56  std::function<void()> const& invalidate_callback) = 0;
57  virtual void unsubscribe_from_events(void const* subscriber) noexcept = 0;
58  virtual void vsync_signal_on(DisplayName) const = 0;
59  virtual void vsync_signal_off(DisplayName) const = 0;
60  virtual void display_on(DisplayName) const = 0;
61  virtual void display_off(DisplayName) const = 0;
62  virtual std::vector<ConfigId> display_configs(DisplayName) const = 0;
63  virtual int display_attributes(
64  DisplayName, ConfigId, uint32_t const* attributes, int32_t* values) const = 0;
65  virtual void power_mode(DisplayName, PowerMode mode) const = 0;
66  virtual bool has_active_config(DisplayName) const = 0;
67  virtual ConfigId active_config_for(DisplayName name) const = 0;
68  virtual void set_active_config(DisplayName name, ConfigId id) const = 0;
69 
70 protected:
71  HwcWrapper() = default;
72  HwcWrapper& operator=(HwcWrapper const&) = delete;
73  HwcWrapper(HwcWrapper const&) = delete;
74 };
75 }
76 }
77 }
78 
79 #endif /* MIR_GRAPHICS_ANDROID_HWC_WRAPPER_H_ */
All things Mir.
Definition: atomic_callback.h:25
virtual void unsubscribe_from_events(void const *subscriber) noexcept=0
virtual int 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:43
PowerMode
Definition: power_mode.h:31
DisplayName
Definition: display_name.h:32
virtual ConfigId active_config_for(DisplayName name) const =0
virtual void set_active_config(DisplayName name, ConfigId id) const =0
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:39
Definition: int_wrapper.h:27
virtual void power_mode(DisplayName, PowerMode mode) const =0
virtual void prepare(std::array< hwc_display_contents_1 *, HWC_NUM_DISPLAY_TYPES > const &) const =0
Definition: android_input_receiver.h:36
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
virtual bool has_active_config(DisplayName) const =0

Copyright © 2012-2015 Canonical Ltd.
Generated on Wed Mar 30 00:29:56 UTC 2016