Mir
hwc_layerlist.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_LAYERLIST_H_
20 #define MIR_GRAPHICS_ANDROID_HWC_LAYERLIST_H_
21 
22 #include "fence.h"
23 #include "mir/geometry/rectangle.h"
25 #include "hwc_layers.h"
26 #include <hardware/hwcomposer.h>
27 #include <memory>
28 #include <vector>
29 #include <initializer_list>
30 #include <list>
31 
32 namespace mir
33 {
34 namespace graphics
35 {
36 
37 class Renderable;
38 class Buffer;
39 
40 namespace android
41 {
42 
44 {
48 };
49 
50 class LayerList
51 {
52 public:
53  LayerList(
54  std::shared_ptr<LayerAdapter> const& layer_adapter,
55  RenderableList const& renderlist,
56  geometry::Displacement list_offset);
57  void update_list(RenderableList const& renderlist, geometry::Displacement list_offset);
58 
59  std::list<HwcLayerEntry>::iterator begin();
60  std::list<HwcLayerEntry>::iterator end();
61 
62  RenderableList rejected_renderables();
63  void setup_fb(std::shared_ptr<Buffer> const& fb_target);
64  bool needs_swapbuffers();
65  void swap_occurred();
66 
67  hwc_display_contents_1_t* native_list();
68  NativeFence retirement_fence();
69 private:
70  LayerList& operator=(LayerList const&) = delete;
71  LayerList(LayerList const&) = delete;
72 
73  RenderableList renderable_list;
74 
75  void update_list_mode(RenderableList const& renderlist);
76 
77  std::shared_ptr<LayerAdapter> const layer_adapter;
78  std::list<HwcLayerEntry> layers;
79  std::shared_ptr<hwc_display_contents_1_t> hwc_representation;
80  enum Mode
81  {
82  no_extra_layers,
83  skip_only,
84  target_only,
85  skip_and_target
86  } mode;
87  size_t additional_layers_for(Mode mode);
88 };
89 
90 }
91 }
92 }
93 
94 #endif /* MIR_GRAPHICS_ANDROID_HWC_LAYERLIST_H_ */
All things Mir.
Definition: atomic_callback.h:25
pixel_iterator end(MirGraphicsRegion const &region)
Definition: multi_stream.cpp:156
Definition: hwc_layers.h:82
pixel_iterator begin(MirGraphicsRegion const &region)
Definition: multi_stream.cpp:151
HWCLayer layer
Definition: hwc_layerlist.h:46
int NativeFence
Definition: fence.h:30
Definition: hwc_layerlist.h:43
Definition: displacement.h:32
Definition: hwc_layerlist.h:50
std::vector< std::shared_ptr< Renderable > > RenderableList
Definition: renderable.h:79
HwcLayerEntry(HWCLayer &&layer, bool needs_commit)
Definition: hwc_layerlist.cpp:54
Definition: android_input_receiver.h:36
bool needs_commit
Definition: hwc_layerlist.h:47

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