2 * Android native system definitions
4 * Copyright 2013 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 /* Copy of some Android native structures to avoid depending on the Android source */
22 /* Hopefully these won't change too frequently... */
24 #ifndef __WINE_ANDROID_NATIVE_H
25 #define __WINE_ANDROID_NATIVE_H
27 /* Native window definitions */
29 typedef struct native_handle
37 typedef const native_handle_t
*buffer_handle_t
;
39 struct android_native_base_t
44 void (*incRef
)(struct android_native_base_t
*base
);
45 void (*decRef
)(struct android_native_base_t
*base
);
48 typedef struct android_native_rect_t
54 } android_native_rect_t
;
56 struct ANativeWindowBuffer
58 struct android_native_base_t common
;
65 buffer_handle_t handle
;
66 void *reserved_proc
[8];
71 struct android_native_base_t common
;
78 int (*setSwapInterval
)(struct ANativeWindow
*window
, int interval
);
79 int (*dequeueBuffer_DEPRECATED
)(struct ANativeWindow
*window
, struct ANativeWindowBuffer
**buffer
);
80 int (*lockBuffer_DEPRECATED
)(struct ANativeWindow
*window
, struct ANativeWindowBuffer
*buffer
);
81 int (*queueBuffer_DEPRECATED
)(struct ANativeWindow
*window
, struct ANativeWindowBuffer
*buffer
);
82 int (*query
)(const struct ANativeWindow
*window
, int what
, int *value
);
83 int (*perform
)(struct ANativeWindow
*window
, int operation
, ... );
84 int (*cancelBuffer_DEPRECATED
)(struct ANativeWindow
*window
, struct ANativeWindowBuffer
*buffer
);
85 int (*dequeueBuffer
)(struct ANativeWindow
*window
, struct ANativeWindowBuffer
**buffer
, int *fenceFd
);
86 int (*queueBuffer
)(struct ANativeWindow
*window
, struct ANativeWindowBuffer
*buffer
, int fenceFd
);
87 int (*cancelBuffer
)(struct ANativeWindow
*window
, struct ANativeWindowBuffer
*buffer
, int fenceFd
);
90 enum native_window_query
92 NATIVE_WINDOW_WIDTH
= 0,
93 NATIVE_WINDOW_HEIGHT
= 1,
94 NATIVE_WINDOW_FORMAT
= 2,
95 NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS
= 3,
96 NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER
= 4,
97 NATIVE_WINDOW_CONCRETE_TYPE
= 5,
98 NATIVE_WINDOW_DEFAULT_WIDTH
= 6,
99 NATIVE_WINDOW_DEFAULT_HEIGHT
= 7,
100 NATIVE_WINDOW_TRANSFORM_HINT
= 8,
101 NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND
= 9
104 enum native_window_perform
106 NATIVE_WINDOW_SET_USAGE
= 0,
107 NATIVE_WINDOW_CONNECT
= 1,
108 NATIVE_WINDOW_DISCONNECT
= 2,
109 NATIVE_WINDOW_SET_CROP
= 3,
110 NATIVE_WINDOW_SET_BUFFER_COUNT
= 4,
111 NATIVE_WINDOW_SET_BUFFERS_GEOMETRY
= 5,
112 NATIVE_WINDOW_SET_BUFFERS_TRANSFORM
= 6,
113 NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP
= 7,
114 NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS
= 8,
115 NATIVE_WINDOW_SET_BUFFERS_FORMAT
= 9,
116 NATIVE_WINDOW_SET_SCALING_MODE
= 10,
117 NATIVE_WINDOW_LOCK
= 11,
118 NATIVE_WINDOW_UNLOCK_AND_POST
= 12,
119 NATIVE_WINDOW_API_CONNECT
= 13,
120 NATIVE_WINDOW_API_DISCONNECT
= 14,
121 NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS
= 15,
122 NATIVE_WINDOW_SET_POST_TRANSFORM_CROP
= 16
125 enum native_window_api
127 NATIVE_WINDOW_API_EGL
= 1,
128 NATIVE_WINDOW_API_CPU
= 2,
129 NATIVE_WINDOW_API_MEDIA
= 3,
130 NATIVE_WINDOW_API_CAMERA
= 4
133 enum android_pixel_format
145 /* Hardware module definitions */
147 struct hw_module_methods_t
;
149 struct android_ycbcr
;
154 uint16_t module_api_version
;
155 uint16_t hal_api_version
;
159 struct hw_module_methods_t
*methods
;
161 void *reserved
[32-7];
164 struct hw_module_methods_t
166 int (*open
)(const struct hw_module_t
*module
, const char *id
, struct hw_device_t
**device
);
173 struct hw_module_t
*module
;
175 int (*close
)(struct hw_device_t
*device
);
178 struct gralloc_module_t
180 struct hw_module_t common
;
181 int (*registerBuffer
)(struct gralloc_module_t
const *module
, buffer_handle_t handle
);
182 int (*unregisterBuffer
)(struct gralloc_module_t
const *module
, buffer_handle_t handle
);
183 int (*lock
)(struct gralloc_module_t
const *module
, buffer_handle_t handle
, int usage
, int l
, int t
, int w
, int h
, void **vaddr
);
184 int (*unlock
)(struct gralloc_module_t
const *module
, buffer_handle_t handle
);
185 int (*perform
)(struct gralloc_module_t
const *module
, int operation
, ... );
186 int (*lock_ycbcr
)(struct gralloc_module_t
const *module
, buffer_handle_t handle
, int usage
, int l
, int t
, int w
, int h
, struct android_ycbcr
*ycbcr
);
187 void *reserved_proc
[6];
190 #define ANDROID_NATIVE_MAKE_CONSTANT(a,b,c,d) \
191 (((unsigned)(a)<<24)|((unsigned)(b)<<16)|((unsigned)(c)<<8)|(unsigned)(d))
193 #define ANDROID_NATIVE_WINDOW_MAGIC \
194 ANDROID_NATIVE_MAKE_CONSTANT('_','w','n','d')
196 #define ANDROID_NATIVE_BUFFER_MAGIC \
197 ANDROID_NATIVE_MAKE_CONSTANT('_','b','f','r')
201 GRALLOC_USAGE_SW_READ_NEVER
= 0x00000000,
202 GRALLOC_USAGE_SW_READ_RARELY
= 0x00000002,
203 GRALLOC_USAGE_SW_READ_OFTEN
= 0x00000003,
204 GRALLOC_USAGE_SW_READ_MASK
= 0x0000000F,
205 GRALLOC_USAGE_SW_WRITE_NEVER
= 0x00000000,
206 GRALLOC_USAGE_SW_WRITE_RARELY
= 0x00000020,
207 GRALLOC_USAGE_SW_WRITE_OFTEN
= 0x00000030,
208 GRALLOC_USAGE_SW_WRITE_MASK
= 0x000000F0,
209 GRALLOC_USAGE_HW_TEXTURE
= 0x00000100,
210 GRALLOC_USAGE_HW_RENDER
= 0x00000200,
211 GRALLOC_USAGE_HW_2D
= 0x00000400,
212 GRALLOC_USAGE_HW_COMPOSER
= 0x00000800,
213 GRALLOC_USAGE_HW_FB
= 0x00001000,
214 GRALLOC_USAGE_HW_VIDEO_ENCODER
= 0x00010000,
215 GRALLOC_USAGE_HW_CAMERA_WRITE
= 0x00020000,
216 GRALLOC_USAGE_HW_CAMERA_READ
= 0x00040000,
217 GRALLOC_USAGE_HW_CAMERA_ZSL
= 0x00060000,
218 GRALLOC_USAGE_HW_CAMERA_MASK
= 0x00060000,
219 GRALLOC_USAGE_HW_MASK
= 0x00071F00,
220 GRALLOC_USAGE_EXTERNAL_DISP
= 0x00002000,
221 GRALLOC_USAGE_PROTECTED
= 0x00004000,
222 GRALLOC_USAGE_PRIVATE_0
= 0x10000000,
223 GRALLOC_USAGE_PRIVATE_1
= 0x20000000,
224 GRALLOC_USAGE_PRIVATE_2
= 0x40000000,
225 GRALLOC_USAGE_PRIVATE_3
= 0x80000000,
226 GRALLOC_USAGE_PRIVATE_MASK
= 0xF0000000,
229 #define GRALLOC_HARDWARE_MODULE_ID "gralloc"
231 extern int hw_get_module(const char *id
, const struct hw_module_t
**module
);
235 GRALLOC1_CAPABILITY_INVALID
= 0,
236 GRALLOC1_CAPABILITY_TEST_ALLOCATE
= 1,
237 GRALLOC1_CAPABILITY_LAYERED_BUFFERS
= 2,
238 GRALLOC1_CAPABILITY_RELEASE_IMPLY_DELETE
= 3,
239 GRALLOC1_LAST_CAPABILITY
= 3,
240 } gralloc1_capability_t
;
244 GRALLOC1_FUNCTION_INVALID
= 0,
245 GRALLOC1_FUNCTION_DUMP
= 1,
246 GRALLOC1_FUNCTION_CREATE_DESCRIPTOR
= 2,
247 GRALLOC1_FUNCTION_DESTROY_DESCRIPTOR
= 3,
248 GRALLOC1_FUNCTION_SET_CONSUMER_USAGE
= 4,
249 GRALLOC1_FUNCTION_SET_DIMENSIONS
= 5,
250 GRALLOC1_FUNCTION_SET_FORMAT
= 6,
251 GRALLOC1_FUNCTION_SET_PRODUCER_USAGE
= 7,
252 GRALLOC1_FUNCTION_GET_BACKING_STORE
= 8,
253 GRALLOC1_FUNCTION_GET_CONSUMER_USAGE
= 9,
254 GRALLOC1_FUNCTION_GET_DIMENSIONS
= 10,
255 GRALLOC1_FUNCTION_GET_FORMAT
= 11,
256 GRALLOC1_FUNCTION_GET_PRODUCER_USAGE
= 12,
257 GRALLOC1_FUNCTION_GET_STRIDE
= 13,
258 GRALLOC1_FUNCTION_ALLOCATE
= 14,
259 GRALLOC1_FUNCTION_RETAIN
= 15,
260 GRALLOC1_FUNCTION_RELEASE
= 16,
261 GRALLOC1_FUNCTION_GET_NUM_FLEX_PLANES
= 17,
262 GRALLOC1_FUNCTION_LOCK
= 18,
263 GRALLOC1_FUNCTION_LOCK_FLEX
= 19,
264 GRALLOC1_FUNCTION_UNLOCK
= 20,
265 GRALLOC1_FUNCTION_SET_LAYER_COUNT
= 21,
266 GRALLOC1_FUNCTION_GET_LAYER_COUNT
= 22,
267 GRALLOC1_FUNCTION_VALIDATE_BUFFER_SIZE
= 23,
268 GRALLOC1_FUNCTION_GET_TRANSPORT_SIZE
= 24,
269 GRALLOC1_FUNCTION_IMPORT_BUFFER
= 25,
270 GRALLOC1_LAST_FUNCTION
= 25,
271 } gralloc1_function_descriptor_t
;
275 GRALLOC1_ERROR_NONE
= 0,
276 GRALLOC1_ERROR_BAD_DESCRIPTOR
= 1,
277 GRALLOC1_ERROR_BAD_HANDLE
= 2,
278 GRALLOC1_ERROR_BAD_VALUE
= 3,
279 GRALLOC1_ERROR_NOT_SHARED
= 4,
280 GRALLOC1_ERROR_NO_RESOURCES
= 5,
281 GRALLOC1_ERROR_UNDEFINED
= 6,
282 GRALLOC1_ERROR_UNSUPPORTED
= 7,
287 GRALLOC1_PRODUCER_USAGE_NONE
= 0,
288 GRALLOC1_PRODUCER_USAGE_CPU_READ
= 1u << 1,
289 GRALLOC1_PRODUCER_USAGE_CPU_READ_OFTEN
= 1u << 2 | GRALLOC1_PRODUCER_USAGE_CPU_READ
,
290 GRALLOC1_PRODUCER_USAGE_CPU_WRITE
= 1u << 5,
291 GRALLOC1_PRODUCER_USAGE_CPU_WRITE_OFTEN
= 1u << 6 | GRALLOC1_PRODUCER_USAGE_CPU_WRITE
,
292 } gralloc1_producer_usage_t
;
296 GRALLOC1_CONSUMER_USAGE_NONE
= 0,
297 GRALLOC1_CONSUMER_USAGE_CPU_READ
= 1u << 1,
298 GRALLOC1_CONSUMER_USAGE_CPU_READ_OFTEN
= 1u << 2 | GRALLOC1_CONSUMER_USAGE_CPU_READ
,
299 } gralloc1_consumer_usage_t
;
301 typedef struct gralloc1_device
303 struct hw_device_t common
;
304 void (*getCapabilities
)(struct gralloc1_device
*device
, uint32_t *outCount
, int32_t *outCapabilities
);
305 void* (*getFunction
)(struct gralloc1_device
*device
, int32_t descriptor
);
308 typedef struct gralloc1_rect
316 #endif /* __WINE_ANDROID_NATIVE_H */