Mir
hwc_fb_device.h
Go to the documentation of this file.
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: Kevin DuBois <kevin.dubois@canonical.com>
17  */
18 
19 #ifndef MIR_GRAPHICS_ANDROID_HWC_FB_DEVICE_H_
20 #define MIR_GRAPHICS_ANDROID_HWC_FB_DEVICE_H_
21 
22 #include "display_device.h"
23 #include "hardware/gralloc.h"
24 #include "hardware/fb.h"
25 #include "mir/raii.h"
26 #include "display_name.h"
27 #include <mutex>
28 #include <condition_variable>
29 
30 namespace mir
31 {
32 namespace graphics
33 {
34 namespace android
35 {
36 class HwcWrapper;
37 
38 class HwcFbDevice : public DisplayDevice
39 {
40 public:
41  HwcFbDevice(std::shared_ptr<HwcWrapper> const& hwc_wrapper,
42  std::shared_ptr<framebuffer_device_t> const& fb_device);
43 
44  bool compatible_renderlist(RenderableList const& renderlist) override;
45  void commit(std::list<DisplayContents> const& contents) override;
46  std::chrono::milliseconds recommended_sleep() const override;
47  bool can_swap_buffers() const override;
48 
49 private:
50  void content_cleared() override;
51  std::shared_ptr<HwcWrapper> const hwc_wrapper;
52  std::shared_ptr<framebuffer_device_t> const fb_device;
53  static int const num_displays{1};
54 
55  mir::raii::PairedCalls<std::function<void()>, std::function<void()>> vsync_subscription;
56  std::mutex vsync_wait_mutex;
57  std::condition_variable vsync_trigger;
58  bool vsync_occurred;
59  void notify_vsync(DisplayName, std::chrono::nanoseconds);
60 };
61 
62 }
63 }
64 }
65 
66 #endif /* MIR_GRAPHICS_ANDROID_HWC_FB_DEVICE_H_ */
std::chrono::milliseconds recommended_sleep() const override
Definition: hwc_fb_device.cpp:117
All things Mir.
Definition: atomic_callback.h:25
Definition: display_device.h:52
bool compatible_renderlist(RenderableList const &renderlist) override
Definition: hwc_fb_device.cpp:108
bool can_swap_buffers() const override
Definition: hwc_fb_device.cpp:122
DisplayName
Definition: display_name.h:32
Definition: raii.h:31
std::vector< std::shared_ptr< Renderable > > RenderableList
Definition: renderable.h:79
HwcFbDevice(std::shared_ptr< HwcWrapper > const &hwc_wrapper, std::shared_ptr< framebuffer_device_t > const &fb_device)
Definition: hwc_fb_device.cpp:39
Definition: android_input_receiver.h:36
void commit(std::list< DisplayContents > const &contents) override
Definition: hwc_fb_device.cpp:59
Definition: hwc_fb_device.h:38

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Sep 8 14:50:19 UTC 2016