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:
43  Framebuffers(GraphicBufferAllocator& buffer_allocator,
44  geometry::Size size, MirPixelFormat format, double vrefresh_hz, unsigned int num_framebuffers);
45 
48  double fb_refresh_rate();
49  std::shared_ptr<Buffer> buffer_for_render();
50  std::shared_ptr<Buffer> last_rendered_buffer();
51 
52 private:
53  MirPixelFormat const format;
54  geometry::Size size;
55  double refresh_rate_hz;
56 
57  std::mutex queue_lock;
58  std::shared_ptr<Buffer> buffer_being_rendered;
59  std::condition_variable cv;
60  std::queue<std::shared_ptr<graphics::Buffer>> queue;
61 };
62 
63 }
64 }
65 }
66 
67 #endif /* MIR_GRAPHICS_ANDROID_FB_SIMPLE_SWAPPER_H_ */
Definition: size.h:30
All things Mir.
Definition: buffer_stream.h:37
std::shared_ptr< Buffer > buffer_for_render()
Definition: framebuffers.cpp:55
Definition: framebuffers.h:40
geometry::Size fb_size()
Definition: framebuffers.cpp:45
std::shared_ptr< Buffer > last_rendered_buffer()
Definition: framebuffers.cpp:75
Definition: framebuffer_bundle.h:36
double fb_refresh_rate()
Definition: framebuffers.cpp:50
MirPixelFormat
The order of components in a format enum matches the order of the components as they would be written...
Definition: common.h:127
Definition: graphic_buffer_allocator.h:38
Definition: android_input_receiver.h:32
MirPixelFormat fb_format()
Definition: framebuffers.cpp:41
Framebuffers(GraphicBufferAllocator &buffer_allocator, geometry::Size size, MirPixelFormat format, double vrefresh_hz, unsigned int num_framebuffers)
Definition: framebuffers.cpp:27

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