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
);
233 #endif /* __WINE_ANDROID_NATIVE_H */