Mir
buffer_stream.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2015 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: Robert Carr <robert.carr@canonical.com>
17  */
18 
19 #ifndef MIR_FRONTEND_BUFFER_STREAM_H_
20 #define MIR_FRONTEND_BUFFER_STREAM_H_
21 
22 #include <mir_toolkit/common.h>
23 #include "mir/graphics/buffer_id.h"
24 #include <functional>
25 #include <memory>
26 
27 namespace mir
28 {
29 namespace graphics
30 {
31 class Buffer;
32 struct BufferProperties;
33 }
34 namespace scene
35 {
36 class SurfaceObserver;
37 }
38 
39 namespace frontend
40 {
41 
43 {
44 public:
45  virtual ~BufferStream() = default;
46 
47  virtual void swap_buffers(graphics::Buffer* old_buffer, std::function<void(graphics::Buffer* new_buffer)> complete) = 0;
48 
49  virtual void add_observer(std::shared_ptr<scene::SurfaceObserver> const& observer) = 0;
50  virtual void remove_observer(std::weak_ptr<scene::SurfaceObserver> const& observer) = 0;
51 
52  virtual void with_most_recent_buffer_do(
53  std::function<void(graphics::Buffer&)> const& exec) = 0;
54 
55  virtual MirPixelFormat pixel_format() const = 0;
56 
57  //TODO: associate/disassociate_buffer are only used for timeout framedropping policy decisions.
58  // They will be removed once timeout framedropping policy moves to the client side.
59  virtual void associate_buffer(graphics::BufferID) = 0;
60  virtual void disassociate_buffer(graphics::BufferID) = 0;
61 
62  //TODO: framedropping for swapinterval-0 can probably be effectively managed from the client
63  // side once we only support the NBS system.
64  virtual void allow_framedropping(bool) = 0;
65  virtual void set_scale(float scale) = 0;
66 protected:
67  BufferStream() = default;
68  BufferStream(BufferStream const&) = delete;
69  BufferStream& operator=(BufferStream const&) = delete;
70 };
71 
72 }
73 }
74 
75 
76 #endif /* MIR_FRONTEND_BUFFER_STREAM_H_ */
All things Mir.
Definition: atomic_callback.h:25
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:134
Definition: buffer_stream.h:42
Definition: buffer.h:44

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Sep 8 14:50:19 UTC 2016