Mir
buffer.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2016 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License version 3 as
6  * 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: Kevin DuBois <kevin.dubois@canonical.com>
17  */
18 
19 #ifndef MIR_CLIENT_BUFFER_H
20 #define MIR_CLIENT_BUFFER_H
21 
22 #include "mir_toolkit/mir_buffer.h"
23 #include <memory>
24 #include <chrono>
25 #include <mutex>
26 
27 namespace mir
28 {
29 namespace client
30 {
31 class ClientBuffer;
32 class MemoryRegion;
33 //this is the type backing MirBuffer*
34 class Buffer
35 {
36 public:
37  Buffer(
38  mir_buffer_callback cb, void* context,
39  int buffer_id,
40  std::shared_ptr<ClientBuffer> const& buffer,
41  MirPresentationChain* chain,
42  MirBufferUsage usage);
43  int rpc_id() const;
44 
45  void submitted();
46  void received(MirBufferPackage const& update_message);
47 
50 
52  MirNativeFence* get_fence() const;
53  bool wait_fence(MirBufferAccess, std::chrono::nanoseconds);
54 
57  geometry::Size size() const;
58 
60 private:
62  void* cb_context;
63  int const buffer_id;
64  std::shared_ptr<ClientBuffer> buffer;
65 
66  std::mutex mutex;
67  bool owned;
68  std::shared_ptr<MemoryRegion> mapped_region;
69  MirPresentationChain* const chain;
70  MirBufferUsage const usage;
71 };
72 }
73 }
74 #endif /* MIR_CLIENT_BUFFER_H_ */
Definition: size.h:30
int rpc_id() const
Definition: buffer.cpp:42
All things Mir.
Definition: atomic_callback.h:25
void * MirNativeFence
Definition: client_types_nbs.h:34
geometry::Size size() const
Definition: buffer.cpp:115
void(* mir_buffer_callback)(MirPresentationChain *, MirBuffer *, void *context)
Definition: client_types_nbs.h:36
void submitted()
Definition: buffer.cpp:47
MirBufferUsage buffer_usage() const
Definition: buffer.cpp:105
Definition: mir_native_buffer.h:30
MirGraphicsRegion map_region()
Definition: buffer.cpp:67
MirNativeBuffer * as_mir_native_buffer() const
Definition: buffer.cpp:80
MirPresentationChain * allocating_chain() const
Definition: buffer.cpp:100
MirNativeFence * get_fence() const
Definition: buffer.cpp:90
MirBufferAccess
Definition: client_types_nbs.h:38
bool wait_fence(MirBufferAccess, std::chrono::nanoseconds)
Definition: buffer.cpp:95
Definition: mir_presentation_chain.h:26
MirBufferUsage
MirBufferUsage specifies how a surface can and will be used.
Definition: client_types.h:156
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:134
void received(MirBufferPackage const &update_message)
Definition: buffer.cpp:56
MirPixelFormat pixel_format() const
Definition: buffer.cpp:110
Buffer(mir_buffer_callback cb, void *context, int buffer_id, std::shared_ptr< ClientBuffer > const &buffer, MirPresentationChain *chain, MirBufferUsage usage)
Definition: buffer.cpp:25
Retrieved information about a MirSurface.
Definition: client_types.h:232
Definition: buffer.h:34
void set_fence(MirNativeFence *, MirBufferAccess)
Definition: buffer.cpp:85

Copyright © 2012-2015 Canonical Ltd.
Generated on Wed Mar 30 00:29:56 UTC 2016