Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
hwc_layers.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_LAYERS_H_
20 #define MIR_GRAPHICS_ANDROID_HWC_LAYERS_H_
21 
24 #include "mir/geometry/rectangle.h"
25 #include <hardware/hwcomposer.h>
26 #include <memory>
27 #include <vector>
28 #include <initializer_list>
29 #include <list>
30 
31 namespace mir
32 {
33 namespace graphics
34 {
35 
36 class Renderable;
37 class Buffer;
38 class NativeBuffer;
39 
40 namespace android
41 {
42 enum LayerType
43 {
44  gl_rendered,
45  overlay,
46  framebuffer_target,
47  skip
48 };
49 
50 class HWCLayer
51 {
52 public:
53  HWCLayer(std::shared_ptr<hwc_display_contents_1_t> list, size_t layer_index);
54  HWCLayer(LayerType,
55  geometry::Rectangle screen_position,
56  bool alpha_enabled,
57  std::shared_ptr<hwc_display_contents_1_t> list, size_t layer_index);
58 
59  HWCLayer& operator=(HWCLayer && layer);
60  HWCLayer(HWCLayer && layer);
61 
62  HWCLayer& operator=(HWCLayer const& layer) = delete;
63  HWCLayer(HWCLayer const& layer) = delete;
64 
65  void set_layer_type(LayerType type);
66  void set_render_parameters(geometry::Rectangle screen_position, bool alpha_enabled);
67  void set_buffer(Buffer const& buffer);
68 
69  void update_fence_and_release_buffer();
70  bool needs_gl_render() const;
71  bool needs_hwc_commit() const;
72  void prepare_for_draw();
73 private:
74  hwc_layer_1_t* hwc_layer;
75  std::shared_ptr<hwc_display_contents_1_t> hwc_list;
76  hwc_rect_t visible_rect;
77  std::shared_ptr<NativeBuffer> associated_buffer;
78  bool updated{false};
79 };
80 }
81 }
82 }
83 
84 #endif /* MIR_GRAPHICS_ANDROID_HWC_LAYERS_H_ */
struct MirBufferPackage NativeBuffer
Definition: native_buffer.h:35

Copyright © 2012,2013 Canonical Ltd.
Generated on Fri Apr 11 21:14:53 UTC 2014