Mir
android_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 2 or 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_EXTENSIONS_ANDROID_BUFFER_H_
20#define MIR_CLIENT_EXTENSIONS_ANDROID_BUFFER_H_
21
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
48 MirConnection* connection,
49 int width, int height,
50 unsigned int hal_pixel_format,
51 unsigned int gralloc_usage_flags,
52 MirBufferCallback available_callback, void* available_context);
53
55{
58
59static inline MirExtensionAndroidBufferV1 const* mir_extension_android_buffer_v1(
60 MirConnection* connection)
61{
63 connection, "mir_extension_android_buffer", 1);
64}
65
81typedef MirBuffer* (*MirConnectionAllocateBufferAndroidSync)(
82 MirConnection* connection,
83 int width, int height,
84 unsigned int hal_pixel_format,
85 unsigned int gralloc_usage_flags);
86
92typedef bool (*MirBufferIsAndroidCompatible)(MirBuffer const* buffer);
93
104 MirBuffer const* buffer,
105 int* num_fds, int const** fds,
106 int* num_data, int const** data);
107
113typedef unsigned int (*MirBufferAndroidHalPixelFormat)(
114 MirBuffer const* buffer);
115
121typedef unsigned int (*MirBufferAndroidGrallocUsage)(
122 MirBuffer const* buffer);
123
129typedef unsigned int (*MirBufferAndroidStride)(
130 MirBuffer const* buffer);
131
136typedef void (*MirBufferAndroidIncRef)(MirBuffer* buffer);
137
142typedef void (*MirBufferAndroidDecRef)(MirBuffer* buffer);
143
145{
156
157static inline MirExtensionAndroidBufferV2 const* mir_extension_android_buffer_v2(
158 MirConnection* connection)
159{
161 connection, "mir_extension_android_buffer", 2);
162}
163#ifdef __cplusplus
164}
165#endif
166#endif /* MIR_CLIENT_EXTENSIONS_ANDROID_BUFFER_H_ */
void(* MirBufferAndroidNativeHandle)(MirBuffer const *buffer, int *num_fds, int const **fds, int *num_data, int const **data)
Access the data from the native_handle_t of the MirBuffer.
Definition: android_buffer.h:103
unsigned int(* MirBufferAndroidGrallocUsage)(MirBuffer const *buffer)
Access the GRALLOC_USAGE_FLAGS of the buffer.
Definition: android_buffer.h:121
void(* MirBufferAndroidIncRef)(MirBuffer *buffer)
Increase refcount of the ANativeWindowBuffer.
Definition: android_buffer.h:136
void(* MirBufferAndroidDecRef)(MirBuffer *buffer)
Decrease refcount of the ANativeWindowBuffer.
Definition: android_buffer.h:142
unsigned int(* MirBufferAndroidStride)(MirBuffer const *buffer)
Access the stride in bytes of the buffer.
Definition: android_buffer.h:129
struct MirExtensionAndroidBufferV2 MirExtensionAndroidBufferV2
unsigned int(* MirBufferAndroidHalPixelFormat)(MirBuffer const *buffer)
Access the HAL_PIXEL_FORMAT of the buffer.
Definition: android_buffer.h:113
void(* mir_connection_allocate_buffer_android)(MirConnection *connection, int width, int height, unsigned int hal_pixel_format, unsigned int gralloc_usage_flags, MirBufferCallback available_callback, void *available_context)
Allocate a MirBuffer usable by the android platform.
Definition: android_buffer.h:47
MirBuffer *(* MirConnectionAllocateBufferAndroidSync)(MirConnection *connection, int width, int height, unsigned int hal_pixel_format, unsigned int gralloc_usage_flags)
Allocate a MirBuffer usable by the android platform and wait for server response.
Definition: android_buffer.h:81
bool(* MirBufferIsAndroidCompatible)(MirBuffer const *buffer)
Check if a MirBuffer is suitable for android usage.
Definition: android_buffer.h:92
struct MirExtensionAndroidBufferV1 MirExtensionAndroidBufferV1
int width
Definition: client_types.h:1
int height
Definition: client_types.h:2
struct MirBuffer MirBuffer
Definition: client_types.h:56
struct MirConnection MirConnection
Definition: client_types.h:41
void(* MirBufferCallback)(MirBuffer *, void *context)
Definition: client_types.h:497
void const * mir_connection_request_extension(MirConnection *connection, char const *interface, int version)
Request a Mir extension.
Definition: android_buffer.h:55
mir_connection_allocate_buffer_android allocate_buffer_android
Definition: android_buffer.h:56
Definition: android_buffer.h:145
MirBufferAndroidGrallocUsage gralloc_usage
Definition: android_buffer.h:151
MirConnectionAllocateBufferAndroidSync allocate_buffer_android_sync
Definition: android_buffer.h:147
MirBufferIsAndroidCompatible is_android_compatible
Definition: android_buffer.h:148
MirBufferAndroidDecRef dec_ref
Definition: android_buffer.h:154
MirBufferAndroidIncRef inc_ref
Definition: android_buffer.h:153
MirBufferAndroidHalPixelFormat hal_pixel_format
Definition: android_buffer.h:150
MirBufferAndroidStride stride
Definition: android_buffer.h:152
MirBufferAndroidNativeHandle native_handle
Definition: android_buffer.h:149
mir_connection_allocate_buffer_android allocate_buffer_android
Definition: android_buffer.h:146

Copyright © 2012-2022 Canonical Ltd.
Generated on Wed Dec 28 21:01:08 UTC 2022
This documentation is licensed under the GPL version 2 or 3.