Mir
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 <condition_variable>
28 #include <queue>
29 #include <vector>
30 #include <mutex>
31 
32 namespace mir
33 {
34 namespace graphics
35 {
36 namespace android
37 {
38 class GraphicBufferAllocator;
39 
41 {
42 public:
44  GraphicBufferAllocator& buffer_allocator,
45  geometry::Size size,
46  MirPixelFormat format,
47  unsigned int num_framebuffers);
48 
49  geometry::Size fb_size() override;
50  std::shared_ptr<Buffer> buffer_for_render() override;
51  std::shared_ptr<Buffer> last_rendered_buffer() override;
52 
53 private:
54  geometry::Size size;
55 
56  std::mutex queue_lock;
57  std::shared_ptr<Buffer> buffer_being_rendered;
58  std::condition_variable cv;
59  std::queue<std::shared_ptr<graphics::Buffer>> queue;
60 };
61 
62 }
63 }
64 }
65 
66 #endif /* MIR_GRAPHICS_ANDROID_FB_SIMPLE_SWAPPER_H_ */
Definition: size.h:30
All things Mir.
Definition: atomic_callback.h:25
Definition: framebuffers.h:40
Framebuffers(GraphicBufferAllocator &buffer_allocator, geometry::Size size, MirPixelFormat format, unsigned int num_framebuffers)
Definition: framebuffers.cpp:27
std::shared_ptr< Buffer > last_rendered_buffer() override
Definition: framebuffers.cpp:63
Definition: framebuffer_bundle.h:36
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:134
Definition: graphic_buffer_allocator.h:38
geometry::Size fb_size() override
Definition: framebuffers.cpp:38
Definition: android_input_receiver.h:36
std::shared_ptr< Buffer > buffer_for_render() override
Definition: framebuffers.cpp:43

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Oct 8 16:20:16 UTC 2015