Mir
client_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 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: Robert Carr <robert.carr@canonical.com>
17  */
18 
19 #ifndef MIR_CLIENT_CLIENT_BUFFER_STREAM_H_
20 #define MIR_CLIENT_CLIENT_BUFFER_STREAM_H_
21 
22 #include "buffer_receiver.h"
24 #include "mir/geometry/size.h"
25 
28 #include "mir_wait_handle.h"
29 
30 #include <memory>
31 #include <functional>
32 #include <EGL/eglplatform.h>
33 
34 /*
35  * ClientBufferStream::egl_native_window() returns EGLNativeWindowType.
36  *
37  * EGLNativeWindowType is an EGL platform-specific type that is typically a
38  * (possibly slightly obfuscated) pointer. This makes our client module ABI
39  * technically EGL-platform dependent, which is awkward because we support
40  * multiple EGL platforms.
41  *
42  * On both the Mesa and the Android EGL platforms EGLNativeWindow is a
43  * pointer or a uintptr_t.
44  *
45  * In practise EGLNativeWindowType is always a typedef to a pointer-ish, but
46  * for paranoia's sake make sure the build will fail if we ever encounter a
47  * strange EGL platform where this isn't the case.
48  */
49 #include <type_traits>
50 static_assert(
51  sizeof(EGLNativeWindowType) == sizeof(void*) &&
52  std::is_pod<EGLNativeWindowType>::value,
53  "The ClientBufferStream requires that EGLNativeWindowType be no-op convertible to void*");
54 
55 #undef EGLNativeWindowType
56 #define EGLNativeWindowType void*
57 
58 namespace mir
59 {
60 namespace protobuf
61 {
62 class Buffer;
63 }
64 namespace client
65 {
66 class ClientBuffer;
67 class MemoryRegion;
68 
70 {
71 public:
72  virtual ~ClientBufferStream() = default;
73 
74  virtual MirSurfaceParameters get_parameters() const = 0;
75  virtual std::shared_ptr<ClientBuffer> get_current_buffer() = 0;
76  virtual uint32_t get_current_buffer_id() = 0;
77  virtual EGLNativeWindowType egl_native_window() = 0;
78  virtual MirWaitHandle* next_buffer(std::function<void()> const& done) = 0;
79 
80  virtual std::shared_ptr<MemoryRegion> secure_for_cpu_write() = 0;
81 
82  virtual int swap_interval() const = 0;
83  virtual MirWaitHandle* set_swap_interval(int interval) = 0;
84 
85  virtual MirNativeBuffer* get_current_buffer_package() = 0;
86  virtual MirPlatformType platform_type() = 0;
87 
88  virtual frontend::BufferStreamId rpc_id() const = 0;
89 
90  virtual bool valid() const = 0;
91  virtual void set_size(geometry::Size) = 0;
92  virtual MirWaitHandle* set_scale(float) = 0;
93  virtual char const* get_error_message() const = 0;
94  virtual MirConnection* connection() const = 0;
95 
96 protected:
97  ClientBufferStream() = default;
98  ClientBufferStream(const ClientBufferStream&) = delete;
99  ClientBufferStream& operator=(const ClientBufferStream&) = delete;
100 };
101 
102 }
103 }
104 
105 #endif /* MIR_CLIENT_CLIENT_BUFFER_STREAM_H_ */
Definition: size.h:30
All things Mir.
Definition: atomic_callback.h:25
Definition: mir_wait_handle.h:31
Definition: buffer_receiver.h:31
Definition: mir_native_buffer.h:30
Definition: client_buffer_stream.h:69
Definition: mir_connection.h:96
#define EGLNativeWindowType
Definition: client_buffer_stream.h:56
MirPlatformType
The native buffer type for the system the client is connected on.
Definition: client_types.h:197
MirSurfaceParameters is the structure of minimum required information that you must provide to Mir in...
Definition: client_types.h:166

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