Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
framebuffers.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:
17  * Kevin DuBois <kevin.dubois@canonical.com>
18  */
19 
20 #ifndef MIR_GRAPHICS_ANDROID_FB_SIMPLE_SWAPPER_H_
21 #define MIR_GRAPHICS_ANDROID_FB_SIMPLE_SWAPPER_H_
22 
23 #include "framebuffer_bundle.h"
24 
25 #include <hardware/gralloc.h>
26 #include <hardware/fb.h>
27 #include <hardware/hwcomposer.h>
28 #include <condition_variable>
29 #include <queue>
30 #include <vector>
31 #include <mutex>
32 
33 namespace mir
34 {
35 namespace graphics
36 {
37 namespace android
38 {
39 class GraphicBufferAllocator;
40 
41 class Framebuffers : public FramebufferBundle
42 {
43 public:
44  Framebuffers(std::shared_ptr<GraphicBufferAllocator> const& buffer_allocator,
45  std::shared_ptr<hwc_composer_device_1> const& hwc);
46  Framebuffers(std::shared_ptr<GraphicBufferAllocator> const& buffer_allocator,
47  std::shared_ptr<framebuffer_device_t> const& fb);
48 
49  MirPixelFormat fb_format();
50  geometry::Size fb_size();
51  std::shared_ptr<Buffer> buffer_for_render();
52  std::shared_ptr<Buffer> last_rendered_buffer();
53  void wait_for_consumed_buffer(bool);
54 
55 private:
56  MirPixelFormat const format;
57  geometry::Size const size;
58 
59  std::mutex queue_lock;
60  std::shared_ptr<Buffer> buffer_being_rendered;
61  std::condition_variable cv;
62  std::queue<std::shared_ptr<graphics::Buffer>> queue;
63 };
64 
65 }
66 }
67 }
68 
69 #endif /* MIR_GRAPHICS_ANDROID_FB_SIMPLE_SWAPPER_H_ */
MirPixelFormat
The order of components in a format enum matches the order of the components as they would be written...
Definition: common.h:99
int const size
Definition: make_socket_rpc_channel.cpp:50

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