Mir
buffer_stream_surfaces.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU 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 General Public License for more details.
12  *
13  * You should have received a copy of the GNU 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_COMPOSITOR_BUFFER_STREAM_SCENE_H_
21 #define MIR_COMPOSITOR_BUFFER_STREAM_SCENE_H_
22 
25 
26 #include <mutex>
27 
28 namespace mir
29 {
30 namespace compositor
31 {
32 
33 class BufferIDUniqueGenerator;
34 class BufferBundle;
35 class BackBufferStrategy;
36 
38 {
39 public:
40  BufferStreamSurfaces(std::shared_ptr<BufferBundle> const& swapper);
42 
43  //from mf::BufferStream
44  void swap_buffers(
45  graphics::Buffer* old_buffer, std::function<void(graphics::Buffer* new_buffer)> complete) override;
46  void with_most_recent_buffer_do(std::function<void(graphics::Buffer&)> const& exec) override;
47  MirPixelFormat pixel_format() const override;
48  void add_observer(std::shared_ptr<scene::SurfaceObserver> const& observer) override;
49  void remove_observer(std::weak_ptr<scene::SurfaceObserver> const& observer) override;
51  void remove_buffer(graphics::BufferID) override;
52  void with_buffer(graphics::BufferID id, std::function<void(graphics::Buffer&)> const& fn) override;
53 
54  //from mc::BufferStream
55  void acquire_client_buffer(std::function<void(graphics::Buffer* buffer)> complete);
57 
58  std::shared_ptr<graphics::Buffer>
59  lock_compositor_buffer(void const* user_id) override;
60 
61  geometry::Size stream_size() override;
62  void resize(geometry::Size const& size) override;
63  void allow_framedropping(bool) override;
64  void force_requests_to_complete() override;
65  int buffers_ready_for_compositor(void const* user_id) const override;
66  void drop_old_buffers() override;
67  bool has_submitted_buffer() const override;
68  void set_scale(float scale) override;
69 
70 protected:
73 
74 private:
75  std::mutex mutable mutex;
76  std::shared_ptr<BufferBundle> const buffer_bundle;
77  scene::SurfaceObservers observers;
78  bool first_frame_posted;
79  geometry::Size logical_size; //physical size is maintained in the buffer_bundle
80  float scale;
81 };
82 
83 }
84 }
85 
86 #endif /* MIR_COMPOSITOR_BUFFER_STREAM_SCENE_H_ */
Definition: size.h:30
void remove_observer(std::weak_ptr< scene::SurfaceObserver > const &observer) override
Definition: buffer_stream_surfaces.cpp:141
All things Mir.
Definition: atomic_callback.h:25
void acquire_client_buffer(std::function< void(graphics::Buffer *buffer)> complete)
Definition: buffer_stream_surfaces.cpp:52
int buffers_ready_for_compositor(void const *user_id) const override
Definition: buffer_stream_surfaces.cpp:90
Definition: buffer_stream.h:40
Definition: buffer_stream_surfaces.h:37
void allow_framedropping(bool) override
Definition: buffer_stream_surfaces.cpp:85
void release_client_buffer(graphics::Buffer *buf)
Definition: buffer_stream_surfaces.cpp:58
void swap_buffers(graphics::Buffer *old_buffer, std::function< void(graphics::Buffer *new_buffer)> complete) override
Definition: buffer_stream_surfaces.cpp:100
void force_requests_to_complete() override
Definition: buffer_stream_surfaces.cpp:80
geometry::Size stream_size() override
Definition: buffer_stream_surfaces.cpp:67
void resize(geometry::Size const &size) override
Definition: buffer_stream_surfaces.cpp:73
void remove_buffer(graphics::BufferID) override
Definition: buffer_stream_surfaces.cpp:152
bool has_submitted_buffer() const override
Definition: buffer_stream_surfaces.cpp:118
~BufferStreamSurfaces()
Definition: buffer_stream_surfaces.cpp:39
graphics::BufferID allocate_buffer(graphics::BufferProperties const &) override
Definition: buffer_stream_surfaces.cpp:147
void with_most_recent_buffer_do(std::function< void(graphics::Buffer &)> const &exec) override
Definition: buffer_stream_surfaces.cpp:124
MirPixelFormat pixel_format() const override
Definition: buffer_stream_surfaces.cpp:131
void add_observer(std::shared_ptr< scene::SurfaceObserver > const &observer) override
Definition: buffer_stream_surfaces.cpp:136
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:134
Definition: surface_observers.h:30
BufferStreamSurfaces & operator=(const BufferStreamSurfaces &)=delete
Buffer creation properties.
Definition: buffer_properties.h:48
void with_buffer(graphics::BufferID id, std::function< void(graphics::Buffer &)> const &fn) override
Definition: buffer_stream_surfaces.cpp:157
void set_scale(float scale) override
Definition: buffer_stream_surfaces.cpp:162
Definition: buffer.h:44
std::shared_ptr< graphics::Buffer > lock_compositor_buffer(void const *user_id) override
Definition: buffer_stream_surfaces.cpp:45
BufferStreamSurfaces(std::shared_ptr< BufferBundle > const &swapper)
Definition: buffer_stream_surfaces.cpp:31
int const size
Definition: make_socket_rpc_channel.cpp:51
void drop_old_buffers() override
Definition: buffer_stream_surfaces.cpp:95

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