Mir
client_buffer.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 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_CLIENT_CLIENT_BUFFER_H_
21 #define MIR_CLIENT_CLIENT_BUFFER_H_
22 
26 #include "mir_toolkit/common.h"
27 #include "mir/geometry/size.h"
28 
29 #include <memory>
30 #include <chrono>
31 
36 struct MirBufferPackage;
39 namespace mir
40 {
41 
42 namespace client
43 {
44 
45 /* vaddr is valid from vaddr[0] to vaddr[stride.as_uint32_t() * height.as_uint32_t() - 1] */
47 {
52  std::shared_ptr<char> vaddr;
53 };
54 
56 {
57 public:
58  virtual ~ClientBuffer() = default;
59 
60  virtual std::shared_ptr<MemoryRegion> secure_for_cpu_write() = 0;
61  virtual geometry::Size size() const = 0;
62  virtual geometry::Stride stride() const = 0;
63  virtual MirPixelFormat pixel_format() const = 0;
64  virtual uint32_t age() const = 0;
65  virtual void increment_age() = 0;
66  virtual void mark_as_submitted() = 0;
67  virtual std::shared_ptr<graphics::NativeBuffer> native_buffer_handle() const = 0;
68  virtual void update_from(MirBufferPackage const& update_package) = 0;
69  virtual void fill_update_msg(MirBufferPackage& message) = 0;
70 
71  virtual MirNativeBuffer* as_mir_native_buffer() const = 0;
72  virtual void set_fence(MirNativeFence*, MirBufferAccess) = 0;
73  virtual MirNativeFence* get_fence() const = 0;
74  virtual bool wait_fence(MirBufferAccess, std::chrono::nanoseconds timeout) = 0;
75 protected:
76  ClientBuffer() = default;
77  ClientBuffer(ClientBuffer const&) = delete;
78  ClientBuffer& operator=(ClientBuffer const&) = delete;
79 };
80 
81 }
82 }
83 
84 #endif /* MIR_CLIENT_CLIENT_BUFFER_H_ */
Definition: size.h:30
All things Mir.
Definition: atomic_callback.h:25
void * MirNativeFence
Definition: client_types_nbs.h:34
geometry::Stride stride
Definition: client_buffer.h:50
std::shared_ptr< char > vaddr
Definition: client_buffer.h:52
Definition: mir_native_buffer.h:30
geometry::Height height
Definition: client_buffer.h:49
MirPixelFormat format
Definition: client_buffer.h:51
MirBufferAccess
Definition: client_types_nbs.h:38
Definition: client_buffer.h:46
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:134
geometry::Width width
Definition: client_buffer.h:48
Definition: client_buffer.h:55
int const size
Definition: make_socket_rpc_channel.cpp:51

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