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_MESA_CLIENT_BUFFER_H_
21 #define MIR_CLIENT_MESA_CLIENT_BUFFER_H_
22 
23 #include "mir/aging_buffer.h"
25 #include "mir/geometry/rectangle.h"
26 
27 #include <memory>
28 
29 namespace mir
30 {
31 namespace client
32 {
33 namespace mesa
34 {
35 
36 class BufferFileOps;
37 
38 class ClientBuffer : public AgingBuffer
39 {
40 public:
41  ClientBuffer(std::shared_ptr<BufferFileOps> const& buffer_file_ops,
42  std::shared_ptr<MirBufferPackage> const& buffer_package,
44  MirPixelFormat pf);
45 
46  ~ClientBuffer() noexcept;
47 
48  std::shared_ptr<MemoryRegion> secure_for_cpu_write();
49  geometry::Size size() const;
50  geometry::Stride stride() const;
52  std::shared_ptr<MirNativeBuffer> native_buffer_handle() const;
53  void update_from(MirBufferPackage const&);
57  MirNativeFence* get_fence() const;
58  bool wait_fence(MirBufferAccess, std::chrono::nanoseconds timeout);
59 
60 private:
61  std::shared_ptr<BufferFileOps> const buffer_file_ops;
62  std::shared_ptr<MirBufferPackage> const creation_package;
63  geometry::Rectangle const rect;
64  MirPixelFormat const buffer_pf;
65 };
66 
67 }
68 }
69 }
70 #endif /* MIR_CLIENT_MESA_CLIENT_BUFFER_H_ */
Definition: size.h:30
All things Mir.
Definition: atomic_callback.h:25
void * MirNativeFence
Definition: client_types_nbs.h:34
geometry::Size size() const
Definition: client_buffer.cpp:114
void set_fence(MirNativeFence *, MirBufferAccess)
Definition: client_buffer.cpp:151
geometry::Stride stride() const
Definition: client_buffer.cpp:119
Definition: client_buffer.h:38
bool wait_fence(MirBufferAccess, std::chrono::nanoseconds timeout)
Definition: client_buffer.cpp:160
void update_from(MirBufferPackage const &)
Definition: client_buffer.cpp:135
Definition: mir_native_buffer.h:30
MirNativeFence * get_fence() const
Definition: client_buffer.cpp:155
MirBufferAccess
Definition: client_types_nbs.h:38
~ClientBuffer() noexcept
Definition: client_buffer.cpp:96
MirNativeBuffer * as_mir_native_buffer() const
Definition: client_buffer.cpp:145
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:134
std::shared_ptr< MirNativeBuffer > native_buffer_handle() const
Definition: client_buffer.cpp:129
std::shared_ptr< MemoryRegion > secure_for_cpu_write()
Definition: client_buffer.cpp:103
Definition: rectangle.h:33
void fill_update_msg(MirBufferPackage &)
Definition: client_buffer.cpp:139
Definition: aging_buffer.h:29
MirPixelFormat pixel_format() const
Definition: client_buffer.cpp:124
Definition: dimensions.h:36

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