Mir
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_ANDROID_ANDROID_CLIENT_BUFFER_H_
21 #define MIR_CLIENT_ANDROID_ANDROID_CLIENT_BUFFER_H_
22 
23 #include "android_native_buffer.h"
24 #include "mir/aging_buffer.h"
25 
26 #include <system/window.h>
27 #include <memory>
28 
29 namespace mir
30 {
31 namespace client
32 {
33 namespace android
34 {
35 
36 class BufferRegistrar;
37 class Buffer : public AgingBuffer
38 {
39 public:
40  Buffer(
41  std::shared_ptr<BufferRegistrar> const& registrar,
42  MirBufferPackage const& package,
43  MirPixelFormat pf);
44 
45  std::shared_ptr<MemoryRegion> secure_for_cpu_write() override;
46  geometry::Size size() const override;
47  geometry::Stride stride() const override;
48  MirPixelFormat pixel_format() const override;
49  std::shared_ptr<graphics::NativeBuffer> native_buffer_handle() const override;
50  void update_from(MirBufferPackage const& update_package) override;
51  void fill_update_msg(MirBufferPackage& message) override;
52  MirNativeBuffer* as_mir_native_buffer() const override;
53  void set_fence(MirNativeFence*, MirBufferAccess) override;
54  MirNativeFence* get_fence() const override;
55  bool wait_fence(MirBufferAccess, std::chrono::nanoseconds timeout) override;
56 
57  Buffer(const Buffer&) = delete;
58  Buffer& operator=(const Buffer&) = delete;
59 private:
60  void pack_native_window_buffer();
61 
62  std::shared_ptr<BufferRegistrar> const buffer_registrar;
63  std::shared_ptr<graphics::NativeBuffer> const native_buffer;
64  MirPixelFormat const buffer_pf;
65  geometry::Stride const buffer_stride;
66  geometry::Size const buffer_size;
67 };
68 
69 }
70 }
71 }
72 #endif /* MIR_CLIENT_ANDROID_ANDROID_CLIENT_BUFFER_H_ */
Definition: size.h:30
All things Mir.
Definition: atomic_callback.h:25
MirNativeBuffer * as_mir_native_buffer() const override
Definition: buffer.cpp:104
geometry::Size size() const override
Definition: buffer.cpp:56
MirNativeFence * get_fence() const override
Definition: buffer.cpp:113
void * MirNativeFence
Definition: client_types_nbs.h:34
std::shared_ptr< MemoryRegion > secure_for_cpu_write() override
Definition: buffer.cpp:43
Buffer(std::shared_ptr< BufferRegistrar > const &registrar, MirBufferPackage const &package, MirPixelFormat pf)
Definition: buffer.cpp:31
Definition: mir_native_buffer.h:30
MirPixelFormat pixel_format() const override
Definition: buffer.cpp:66
MirBufferAccess
Definition: client_types_nbs.h:38
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< graphics::NativeBuffer > native_buffer_handle() const override
Definition: buffer.cpp:71
void update_from(MirBufferPackage const &update_package) override
Definition: buffer.cpp:76
Definition: android_input_receiver.h:36
Definition: aging_buffer.h:29
geometry::Stride stride() const override
Definition: buffer.cpp:61
void set_fence(MirNativeFence *, MirBufferAccess) override
Definition: buffer.cpp:109
Definition: dimensions.h:36
Definition: buffer.h:37
Buffer & operator=(const Buffer &)=delete
void fill_update_msg(MirBufferPackage &message) override
Definition: buffer.cpp:87
bool wait_fence(MirBufferAccess, std::chrono::nanoseconds timeout) override
Definition: buffer.cpp:118

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