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(
47  LayerList&,
48  SwappingGLContext const& context,
49  RenderableListCompositor const& list_compositor) override;
50 
51 private:
52  void content_cleared() override;
53  std::shared_ptr<HwcWrapper> const hwc_wrapper;
54  std::shared_ptr<framebuffer_device_t> const fb_device;
55  static int const num_displays{1};
56 
57  mir::raii::PairedCalls<std::function<void()>, std::function<void()>> vsync_subscription;
58  std::mutex vsync_wait_mutex;
59  std::condition_variable vsync_trigger;
60  bool vsync_occurred;
61  void notify_vsync(DisplayName, std::chrono::nanoseconds);
62 };
63 
64 }
65 }
66 }
67 
68 #endif /* MIR_GRAPHICS_ANDROID_HWC_FB_DEVICE_H_ */
All things Mir.
Definition: buffer_stream.h:37
Definition: display_device.h:40
Definition: hwc_fallback_gl_renderer.h:38
bool compatible_renderlist(RenderableList const &renderlist) override
Definition: swapping_gl_context.h:31
DisplayName
Definition: display_name.h:31
Definition: raii.h:31
std::list< std::shared_ptr< Renderable > > RenderableList
Definition: renderable.h:80
void commit(DisplayName, LayerList &, SwappingGLContext const &context, RenderableListCompositor const &list_compositor) override
Definition: hwc_layerlist.h:49
HwcFbDevice(std::shared_ptr< HwcWrapper > const &hwc_wrapper, std::shared_ptr< framebuffer_device_t > const &fb_device)
Definition: hwc_fb_device.cpp:38
Definition: android_input_receiver.h:32
Definition: hwc_fb_device.h:38

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