Merge lp:~kdub/mir/upgrade-hal-headers-to-4.2 into lp:~mir-team/mir/trunk
- upgrade-hal-headers-to-4.2
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Alan Griffiths |
Approved revision: | no longer in the source branch. |
Merged at revision: | 466 |
Proposed branch: | lp:~kdub/mir/upgrade-hal-headers-to-4.2 |
Merge into: | lp:~mir-team/mir/trunk |
Diff against target: |
5324 lines (+974/-3859) 20 files modified
3rd_party/android-deps/android/native_window.h (+10/-1) 3rd_party/android-deps/hardware/audio.h (+0/-343) 3rd_party/android-deps/hardware/audio_effect.h (+0/-897) 3rd_party/android-deps/hardware/audio_policy.h (+0/-386) 3rd_party/android-deps/hardware/camera.h (+0/-309) 3rd_party/android-deps/hardware/fb.h (+4/-1) 3rd_party/android-deps/hardware/gps.h (+0/-679) 3rd_party/android-deps/hardware/gralloc.h (+49/-12) 3rd_party/android-deps/hardware/hardware.h (+110/-5) 3rd_party/android-deps/hardware/hwcomposer.h (+462/-224) 3rd_party/android-deps/hardware/lights.h (+0/-137) 3rd_party/android-deps/hardware/nfc.h (+0/-96) 3rd_party/android-deps/hardware/qemu_pipe.h (+0/-91) 3rd_party/android-deps/hardware/qemud.h (+0/-153) 3rd_party/android-deps/hardware/sensors.h (+0/-485) 3rd_party/android-deps/sync/sync.h (+62/-0) 3rd_party/android-deps/system/graphics.h (+33/-2) 3rd_party/android-deps/system/window.h (+228/-22) src/client/android/mir_native_window.cpp (+4/-4) tests/unit-tests/client/test_android_native_window.cpp (+12/-12) |
To merge this branch: | bzr merge lp:~kdub/mir/upgrade-hal-headers-to-4.2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alan Griffiths | Approve | ||
Alexandros Frantzis (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+151856@code.launchpad.net |
Commit message
bump the HAL headers in 3rd_party surrounding the android graphics stack from GB headers to ICS headers.
Description of the change
bump the HAL headers in 3rd_party surrounding the android graphics stack from GB headers to ICS headers.
This is necessary because some of the headers changed slightly between GB and ICS and the nexus 4 needs the new support that comes in the ICS headers. The ICS headers are backwards compatible with GB drivers.
Tested on Galaxy Nexus.
This is mostly a code drop/update from our phablet build sources (cyanogen). however, I had to change the names of some of our functions to get things to compile
I left the headers used by the input stack (eg, the things that Alan ported) alone
PS Jenkins bot (ps-jenkins) wrote : | # |
Alexandros Frantzis (afrantzis) wrote : | # |
Looks good (can't test on a real device, though).
Alan Griffiths (alan-griffiths) wrote : | # |
> Looks good (can't test on a real device, though).
+1
Preview Diff
1 | === modified file '3rd_party/android-deps/android/native_window.h' | |||
2 | --- 3rd_party/android-deps/android/native_window.h 2013-01-08 17:44:16 +0000 | |||
3 | +++ 3rd_party/android-deps/android/native_window.h 2013-03-06 00:16:21 +0000 | |||
4 | @@ -95,11 +95,20 @@ | |||
5 | 95 | * | 95 | * |
6 | 96 | * For all of these parameters, if 0 is supplied then the window's base | 96 | * For all of these parameters, if 0 is supplied then the window's base |
7 | 97 | * value will come back in force. | 97 | * value will come back in force. |
8 | 98 | * | ||
9 | 99 | * width and height must be either both zero or both non-zero. | ||
10 | 100 | * | ||
11 | 98 | */ | 101 | */ |
13 | 99 | int32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window, int32_t width, int32_t height, int32_t format); | 102 | int32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window, |
14 | 103 | int32_t width, int32_t height, int32_t format); | ||
15 | 100 | 104 | ||
16 | 101 | /** | 105 | /** |
17 | 102 | * Lock the window's next drawing surface for writing. | 106 | * Lock the window's next drawing surface for writing. |
18 | 107 | * inOutDirtyBounds is used as an in/out parameter, upon entering the | ||
19 | 108 | * function, it contains the dirty region, that is, the region the caller | ||
20 | 109 | * intends to redraw. When the function returns, inOutDirtyBounds is updated | ||
21 | 110 | * with the actual area the caller needs to redraw -- this region is often | ||
22 | 111 | * extended by ANativeWindow_lock. | ||
23 | 103 | */ | 112 | */ |
24 | 104 | int32_t ANativeWindow_lock(ANativeWindow* window, ANativeWindow_Buffer* outBuffer, | 113 | int32_t ANativeWindow_lock(ANativeWindow* window, ANativeWindow_Buffer* outBuffer, |
25 | 105 | ARect* inOutDirtyBounds); | 114 | ARect* inOutDirtyBounds); |
26 | 106 | 115 | ||
27 | === removed file '3rd_party/android-deps/hardware/audio.h' | |||
28 | --- 3rd_party/android-deps/hardware/audio.h 2013-01-08 17:44:16 +0000 | |||
29 | +++ 3rd_party/android-deps/hardware/audio.h 1970-01-01 00:00:00 +0000 | |||
30 | @@ -1,343 +0,0 @@ | |||
31 | 1 | /* | ||
32 | 2 | * Copyright (C) 2011 The Android Open Source Project | ||
33 | 3 | * | ||
34 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
35 | 5 | * you may not use this file except in compliance with the License. | ||
36 | 6 | * You may obtain a copy of the License at | ||
37 | 7 | * | ||
38 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
39 | 9 | * | ||
40 | 10 | * Unless required by applicable law or agreed to in writing, software | ||
41 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
42 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
43 | 13 | * See the License for the specific language governing permissions and | ||
44 | 14 | * limitations under the License. | ||
45 | 15 | */ | ||
46 | 16 | |||
47 | 17 | |||
48 | 18 | #ifndef ANDROID_AUDIO_HAL_INTERFACE_H | ||
49 | 19 | #define ANDROID_AUDIO_HAL_INTERFACE_H | ||
50 | 20 | |||
51 | 21 | #include <stdint.h> | ||
52 | 22 | #include <strings.h> | ||
53 | 23 | #include <sys/cdefs.h> | ||
54 | 24 | #include <sys/types.h> | ||
55 | 25 | |||
56 | 26 | #include <cutils/bitops.h> | ||
57 | 27 | |||
58 | 28 | #include <hardware/hardware.h> | ||
59 | 29 | #include <system/audio.h> | ||
60 | 30 | #include <hardware/audio_effect.h> | ||
61 | 31 | |||
62 | 32 | __BEGIN_DECLS | ||
63 | 33 | |||
64 | 34 | /** | ||
65 | 35 | * The id of this module | ||
66 | 36 | */ | ||
67 | 37 | #define AUDIO_HARDWARE_MODULE_ID "audio" | ||
68 | 38 | |||
69 | 39 | /** | ||
70 | 40 | * Name of the audio devices to open | ||
71 | 41 | */ | ||
72 | 42 | #define AUDIO_HARDWARE_INTERFACE "audio_hw_if" | ||
73 | 43 | |||
74 | 44 | /**************************************/ | ||
75 | 45 | |||
76 | 46 | /** | ||
77 | 47 | * standard audio parameters that the HAL may need to handle | ||
78 | 48 | */ | ||
79 | 49 | |||
80 | 50 | /** | ||
81 | 51 | * audio device parameters | ||
82 | 52 | */ | ||
83 | 53 | |||
84 | 54 | /* BT SCO Noise Reduction + Echo Cancellation parameters */ | ||
85 | 55 | #define AUDIO_PARAMETER_KEY_BT_NREC "bt_headset_nrec" | ||
86 | 56 | #define AUDIO_PARAMETER_VALUE_ON "on" | ||
87 | 57 | #define AUDIO_PARAMETER_VALUE_OFF "off" | ||
88 | 58 | |||
89 | 59 | /* TTY mode selection */ | ||
90 | 60 | #define AUDIO_PARAMETER_KEY_TTY_MODE "tty_mode" | ||
91 | 61 | #define AUDIO_PARAMETER_VALUE_TTY_OFF "tty_off" | ||
92 | 62 | #define AUDIO_PARAMETER_VALUE_TTY_VCO "tty_vco" | ||
93 | 63 | #define AUDIO_PARAMETER_VALUE_TTY_HCO "tty_hco" | ||
94 | 64 | #define AUDIO_PARAMETER_VALUE_TTY_FULL "tty_full" | ||
95 | 65 | |||
96 | 66 | /** | ||
97 | 67 | * audio stream parameters | ||
98 | 68 | */ | ||
99 | 69 | |||
100 | 70 | #define AUDIO_PARAMETER_STREAM_ROUTING "routing" | ||
101 | 71 | #define AUDIO_PARAMETER_STREAM_FORMAT "format" | ||
102 | 72 | #define AUDIO_PARAMETER_STREAM_CHANNELS "channels" | ||
103 | 73 | #define AUDIO_PARAMETER_STREAM_FRAME_COUNT "frame_count" | ||
104 | 74 | #define AUDIO_PARAMETER_STREAM_INPUT_SOURCE "input_source" | ||
105 | 75 | |||
106 | 76 | /**************************************/ | ||
107 | 77 | |||
108 | 78 | /* common audio stream parameters and operations */ | ||
109 | 79 | struct audio_stream { | ||
110 | 80 | |||
111 | 81 | /** | ||
112 | 82 | * sampling rate is in Hz - eg. 44100 | ||
113 | 83 | */ | ||
114 | 84 | uint32_t (*get_sample_rate)(const struct audio_stream *stream); | ||
115 | 85 | |||
116 | 86 | /* currently unused - use set_parameters with key | ||
117 | 87 | * AUDIO_PARAMETER_STREAM_SAMPLING_RATE | ||
118 | 88 | */ | ||
119 | 89 | int (*set_sample_rate)(struct audio_stream *stream, uint32_t rate); | ||
120 | 90 | |||
121 | 91 | /** | ||
122 | 92 | * size of output buffer in bytes - eg. 4800 | ||
123 | 93 | */ | ||
124 | 94 | size_t (*get_buffer_size)(const struct audio_stream *stream); | ||
125 | 95 | |||
126 | 96 | /** | ||
127 | 97 | * the channel mask - | ||
128 | 98 | * e.g. AUDIO_CHANNEL_OUT_STEREO or AUDIO_CHANNEL_IN_STEREO | ||
129 | 99 | */ | ||
130 | 100 | uint32_t (*get_channels)(const struct audio_stream *stream); | ||
131 | 101 | |||
132 | 102 | /** | ||
133 | 103 | * audio format - eg. AUDIO_FORMAT_PCM_16_BIT | ||
134 | 104 | */ | ||
135 | 105 | int (*get_format)(const struct audio_stream *stream); | ||
136 | 106 | |||
137 | 107 | /* currently unused - use set_parameters with key | ||
138 | 108 | * AUDIO_PARAMETER_STREAM_FORMAT | ||
139 | 109 | */ | ||
140 | 110 | int (*set_format)(struct audio_stream *stream, int format); | ||
141 | 111 | |||
142 | 112 | /** | ||
143 | 113 | * Put the audio hardware input/output into standby mode. | ||
144 | 114 | * Returns 0 on success and <0 on failure. | ||
145 | 115 | */ | ||
146 | 116 | int (*standby)(struct audio_stream *stream); | ||
147 | 117 | |||
148 | 118 | /** dump the state of the audio input/output device */ | ||
149 | 119 | int (*dump)(const struct audio_stream *stream, int fd); | ||
150 | 120 | |||
151 | 121 | audio_devices_t (*get_device)(const struct audio_stream *stream); | ||
152 | 122 | int (*set_device)(struct audio_stream *stream, audio_devices_t device); | ||
153 | 123 | |||
154 | 124 | /** | ||
155 | 125 | * set/get audio stream parameters. The function accepts a list of | ||
156 | 126 | * parameter key value pairs in the form: key1=value1;key2=value2;... | ||
157 | 127 | * | ||
158 | 128 | * Some keys are reserved for standard parameters (See AudioParameter class) | ||
159 | 129 | * | ||
160 | 130 | * If the implementation does not accept a parameter change while | ||
161 | 131 | * the output is active but the parameter is acceptable otherwise, it must | ||
162 | 132 | * return -ENOSYS. | ||
163 | 133 | * | ||
164 | 134 | * The audio flinger will put the stream in standby and then change the | ||
165 | 135 | * parameter value. | ||
166 | 136 | */ | ||
167 | 137 | int (*set_parameters)(struct audio_stream *stream, const char *kv_pairs); | ||
168 | 138 | |||
169 | 139 | /* | ||
170 | 140 | * Returns a pointer to a heap allocated string. The caller is responsible | ||
171 | 141 | * for freeing the memory for it. | ||
172 | 142 | */ | ||
173 | 143 | char * (*get_parameters)(const struct audio_stream *stream, | ||
174 | 144 | const char *keys); | ||
175 | 145 | int (*add_audio_effect)(const struct audio_stream *stream, | ||
176 | 146 | effect_handle_t effect); | ||
177 | 147 | int (*remove_audio_effect)(const struct audio_stream *stream, | ||
178 | 148 | effect_handle_t effect); | ||
179 | 149 | }; | ||
180 | 150 | typedef struct audio_stream audio_stream_t; | ||
181 | 151 | |||
182 | 152 | /** | ||
183 | 153 | * audio_stream_out is the abstraction interface for the audio output hardware. | ||
184 | 154 | * | ||
185 | 155 | * It provides information about various properties of the audio output | ||
186 | 156 | * hardware driver. | ||
187 | 157 | */ | ||
188 | 158 | |||
189 | 159 | struct audio_stream_out { | ||
190 | 160 | struct audio_stream common; | ||
191 | 161 | |||
192 | 162 | /** | ||
193 | 163 | * return the audio hardware driver latency in milli seconds. | ||
194 | 164 | */ | ||
195 | 165 | uint32_t (*get_latency)(const struct audio_stream_out *stream); | ||
196 | 166 | |||
197 | 167 | /** | ||
198 | 168 | * Use this method in situations where audio mixing is done in the | ||
199 | 169 | * hardware. This method serves as a direct interface with hardware, | ||
200 | 170 | * allowing you to directly set the volume as apposed to via the framework. | ||
201 | 171 | * This method might produce multiple PCM outputs or hardware accelerated | ||
202 | 172 | * codecs, such as MP3 or AAC. | ||
203 | 173 | */ | ||
204 | 174 | int (*set_volume)(struct audio_stream_out *stream, float left, float right); | ||
205 | 175 | |||
206 | 176 | /** | ||
207 | 177 | * write audio buffer to driver. Returns number of bytes written | ||
208 | 178 | */ | ||
209 | 179 | ssize_t (*write)(struct audio_stream_out *stream, const void* buffer, | ||
210 | 180 | size_t bytes); | ||
211 | 181 | |||
212 | 182 | /* return the number of audio frames written by the audio dsp to DAC since | ||
213 | 183 | * the output has exited standby | ||
214 | 184 | */ | ||
215 | 185 | int (*get_render_position)(const struct audio_stream_out *stream, | ||
216 | 186 | uint32_t *dsp_frames); | ||
217 | 187 | }; | ||
218 | 188 | typedef struct audio_stream_out audio_stream_out_t; | ||
219 | 189 | |||
220 | 190 | struct audio_stream_in { | ||
221 | 191 | struct audio_stream common; | ||
222 | 192 | |||
223 | 193 | /** set the input gain for the audio driver. This method is for | ||
224 | 194 | * for future use */ | ||
225 | 195 | int (*set_gain)(struct audio_stream_in *stream, float gain); | ||
226 | 196 | |||
227 | 197 | /** read audio buffer in from audio driver */ | ||
228 | 198 | ssize_t (*read)(struct audio_stream_in *stream, void* buffer, | ||
229 | 199 | size_t bytes); | ||
230 | 200 | |||
231 | 201 | /** | ||
232 | 202 | * Return the amount of input frames lost in the audio driver since the | ||
233 | 203 | * last call of this function. | ||
234 | 204 | * Audio driver is expected to reset the value to 0 and restart counting | ||
235 | 205 | * upon returning the current value by this function call. | ||
236 | 206 | * Such loss typically occurs when the user space process is blocked | ||
237 | 207 | * longer than the capacity of audio driver buffers. | ||
238 | 208 | * | ||
239 | 209 | * Unit: the number of input audio frames | ||
240 | 210 | */ | ||
241 | 211 | uint32_t (*get_input_frames_lost)(struct audio_stream_in *stream); | ||
242 | 212 | }; | ||
243 | 213 | typedef struct audio_stream_in audio_stream_in_t; | ||
244 | 214 | |||
245 | 215 | /** | ||
246 | 216 | * return the frame size (number of bytes per sample). | ||
247 | 217 | */ | ||
248 | 218 | static inline uint32_t audio_stream_frame_size(struct audio_stream *s) | ||
249 | 219 | { | ||
250 | 220 | int chan_samp_sz; | ||
251 | 221 | |||
252 | 222 | switch (s->get_format(s)) { | ||
253 | 223 | case AUDIO_FORMAT_PCM_16_BIT: | ||
254 | 224 | chan_samp_sz = sizeof(int16_t); | ||
255 | 225 | break; | ||
256 | 226 | case AUDIO_FORMAT_PCM_8_BIT: | ||
257 | 227 | default: | ||
258 | 228 | chan_samp_sz = sizeof(int8_t); | ||
259 | 229 | break; | ||
260 | 230 | } | ||
261 | 231 | |||
262 | 232 | return popcount(s->get_channels(s)) * chan_samp_sz; | ||
263 | 233 | } | ||
264 | 234 | |||
265 | 235 | |||
266 | 236 | /**********************************************************************/ | ||
267 | 237 | |||
268 | 238 | /** | ||
269 | 239 | * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM | ||
270 | 240 | * and the fields of this data structure must begin with hw_module_t | ||
271 | 241 | * followed by module specific information. | ||
272 | 242 | */ | ||
273 | 243 | struct audio_module { | ||
274 | 244 | struct hw_module_t common; | ||
275 | 245 | }; | ||
276 | 246 | |||
277 | 247 | struct audio_hw_device { | ||
278 | 248 | struct hw_device_t common; | ||
279 | 249 | |||
280 | 250 | /** | ||
281 | 251 | * used by audio flinger to enumerate what devices are supported by | ||
282 | 252 | * each audio_hw_device implementation. | ||
283 | 253 | * | ||
284 | 254 | * Return value is a bitmask of 1 or more values of audio_devices_t | ||
285 | 255 | */ | ||
286 | 256 | uint32_t (*get_supported_devices)(const struct audio_hw_device *dev); | ||
287 | 257 | |||
288 | 258 | /** | ||
289 | 259 | * check to see if the audio hardware interface has been initialized. | ||
290 | 260 | * returns 0 on success, -ENODEV on failure. | ||
291 | 261 | */ | ||
292 | 262 | int (*init_check)(const struct audio_hw_device *dev); | ||
293 | 263 | |||
294 | 264 | /** set the audio volume of a voice call. Range is between 0.0 and 1.0 */ | ||
295 | 265 | int (*set_voice_volume)(struct audio_hw_device *dev, float volume); | ||
296 | 266 | |||
297 | 267 | /** | ||
298 | 268 | * set the audio volume for all audio activities other than voice call. | ||
299 | 269 | * Range between 0.0 and 1.0. If any value other than 0 is returned, | ||
300 | 270 | * the software mixer will emulate this capability. | ||
301 | 271 | */ | ||
302 | 272 | int (*set_master_volume)(struct audio_hw_device *dev, float volume); | ||
303 | 273 | |||
304 | 274 | /** | ||
305 | 275 | * setMode is called when the audio mode changes. AUDIO_MODE_NORMAL mode | ||
306 | 276 | * is for standard audio playback, AUDIO_MODE_RINGTONE when a ringtone is | ||
307 | 277 | * playing, and AUDIO_MODE_IN_CALL when a call is in progress. | ||
308 | 278 | */ | ||
309 | 279 | int (*set_mode)(struct audio_hw_device *dev, int mode); | ||
310 | 280 | |||
311 | 281 | /* mic mute */ | ||
312 | 282 | int (*set_mic_mute)(struct audio_hw_device *dev, bool state); | ||
313 | 283 | int (*get_mic_mute)(const struct audio_hw_device *dev, bool *state); | ||
314 | 284 | |||
315 | 285 | /* set/get global audio parameters */ | ||
316 | 286 | int (*set_parameters)(struct audio_hw_device *dev, const char *kv_pairs); | ||
317 | 287 | |||
318 | 288 | /* | ||
319 | 289 | * Returns a pointer to a heap allocated string. The caller is responsible | ||
320 | 290 | * for freeing the memory for it. | ||
321 | 291 | */ | ||
322 | 292 | char * (*get_parameters)(const struct audio_hw_device *dev, | ||
323 | 293 | const char *keys); | ||
324 | 294 | |||
325 | 295 | /* Returns audio input buffer size according to parameters passed or | ||
326 | 296 | * 0 if one of the parameters is not supported | ||
327 | 297 | */ | ||
328 | 298 | size_t (*get_input_buffer_size)(const struct audio_hw_device *dev, | ||
329 | 299 | uint32_t sample_rate, int format, | ||
330 | 300 | int channel_count); | ||
331 | 301 | |||
332 | 302 | /** This method creates and opens the audio hardware output stream */ | ||
333 | 303 | int (*open_output_stream)(struct audio_hw_device *dev, uint32_t devices, | ||
334 | 304 | int *format, uint32_t *channels, | ||
335 | 305 | uint32_t *sample_rate, | ||
336 | 306 | struct audio_stream_out **out); | ||
337 | 307 | |||
338 | 308 | void (*close_output_stream)(struct audio_hw_device *dev, | ||
339 | 309 | struct audio_stream_out* out); | ||
340 | 310 | |||
341 | 311 | /** This method creates and opens the audio hardware input stream */ | ||
342 | 312 | int (*open_input_stream)(struct audio_hw_device *dev, uint32_t devices, | ||
343 | 313 | int *format, uint32_t *channels, | ||
344 | 314 | uint32_t *sample_rate, | ||
345 | 315 | audio_in_acoustics_t acoustics, | ||
346 | 316 | struct audio_stream_in **stream_in); | ||
347 | 317 | |||
348 | 318 | void (*close_input_stream)(struct audio_hw_device *dev, | ||
349 | 319 | struct audio_stream_in *in); | ||
350 | 320 | |||
351 | 321 | /** This method dumps the state of the audio hardware */ | ||
352 | 322 | int (*dump)(const struct audio_hw_device *dev, int fd); | ||
353 | 323 | }; | ||
354 | 324 | typedef struct audio_hw_device audio_hw_device_t; | ||
355 | 325 | |||
356 | 326 | /** convenience API for opening and closing a supported device */ | ||
357 | 327 | |||
358 | 328 | static inline int audio_hw_device_open(const struct hw_module_t* module, | ||
359 | 329 | struct audio_hw_device** device) | ||
360 | 330 | { | ||
361 | 331 | return module->methods->open(module, AUDIO_HARDWARE_INTERFACE, | ||
362 | 332 | (struct hw_device_t**)device); | ||
363 | 333 | } | ||
364 | 334 | |||
365 | 335 | static inline int audio_hw_device_close(struct audio_hw_device* device) | ||
366 | 336 | { | ||
367 | 337 | return device->common.close(&device->common); | ||
368 | 338 | } | ||
369 | 339 | |||
370 | 340 | |||
371 | 341 | __END_DECLS | ||
372 | 342 | |||
373 | 343 | #endif // ANDROID_AUDIO_INTERFACE_H | ||
374 | 344 | 0 | ||
375 | === removed file '3rd_party/android-deps/hardware/audio_effect.h' | |||
376 | --- 3rd_party/android-deps/hardware/audio_effect.h 2013-01-08 17:44:16 +0000 | |||
377 | +++ 3rd_party/android-deps/hardware/audio_effect.h 1970-01-01 00:00:00 +0000 | |||
378 | @@ -1,897 +0,0 @@ | |||
379 | 1 | /* | ||
380 | 2 | * Copyright (C) 2011 The Android Open Source Project | ||
381 | 3 | * | ||
382 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
383 | 5 | * you may not use this file except in compliance with the License. | ||
384 | 6 | * You may obtain a copy of the License at | ||
385 | 7 | * | ||
386 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
387 | 9 | * | ||
388 | 10 | * Unless required by applicable law or agreed to in writing, software | ||
389 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
390 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
391 | 13 | * See the License for the specific language governing permissions and | ||
392 | 14 | * limitations under the License. | ||
393 | 15 | */ | ||
394 | 16 | |||
395 | 17 | |||
396 | 18 | #ifndef ANDROID_AUDIO_EFFECT_H | ||
397 | 19 | #define ANDROID_AUDIO_EFFECT_H | ||
398 | 20 | |||
399 | 21 | #include <errno.h> | ||
400 | 22 | #include <stdint.h> | ||
401 | 23 | #include <strings.h> | ||
402 | 24 | #include <sys/cdefs.h> | ||
403 | 25 | #include <sys/types.h> | ||
404 | 26 | |||
405 | 27 | #include <cutils/bitops.h> | ||
406 | 28 | |||
407 | 29 | #include <system/audio.h> | ||
408 | 30 | |||
409 | 31 | |||
410 | 32 | __BEGIN_DECLS | ||
411 | 33 | |||
412 | 34 | |||
413 | 35 | ///////////////////////////////////////////////// | ||
414 | 36 | // Common Definitions | ||
415 | 37 | ///////////////////////////////////////////////// | ||
416 | 38 | |||
417 | 39 | // | ||
418 | 40 | //--- Effect descriptor structure effect_descriptor_t | ||
419 | 41 | // | ||
420 | 42 | |||
421 | 43 | // Unique effect ID (can be generated from the following site: | ||
422 | 44 | // http://www.itu.int/ITU-T/asn1/uuid.html) | ||
423 | 45 | // This format is used for both "type" and "uuid" fields of the effect descriptor structure. | ||
424 | 46 | // - When used for effect type and the engine is implementing and effect corresponding to a standard | ||
425 | 47 | // OpenSL ES interface, this ID must be the one defined in OpenSLES_IID.h for that interface. | ||
426 | 48 | // - When used as uuid, it should be a unique UUID for this particular implementation. | ||
427 | 49 | typedef struct effect_uuid_s { | ||
428 | 50 | uint32_t timeLow; | ||
429 | 51 | uint16_t timeMid; | ||
430 | 52 | uint16_t timeHiAndVersion; | ||
431 | 53 | uint16_t clockSeq; | ||
432 | 54 | uint8_t node[6]; | ||
433 | 55 | } effect_uuid_t; | ||
434 | 56 | |||
435 | 57 | // Maximum length of character strings in structures defines by this API. | ||
436 | 58 | #define EFFECT_STRING_LEN_MAX 64 | ||
437 | 59 | |||
438 | 60 | // NULL UUID definition (matches SL_IID_NULL_) | ||
439 | 61 | #define EFFECT_UUID_INITIALIZER { 0xec7178ec, 0xe5e1, 0x4432, 0xa3f4, \ | ||
440 | 62 | { 0x46, 0x57, 0xe6, 0x79, 0x52, 0x10 } } | ||
441 | 63 | static const effect_uuid_t EFFECT_UUID_NULL_ = EFFECT_UUID_INITIALIZER; | ||
442 | 64 | const effect_uuid_t * const EFFECT_UUID_NULL = &EFFECT_UUID_NULL_; | ||
443 | 65 | const char * const EFFECT_UUID_NULL_STR = "ec7178ec-e5e1-4432-a3f4-4657e6795210"; | ||
444 | 66 | |||
445 | 67 | // The effect descriptor contains necessary information to facilitate the enumeration of the effect | ||
446 | 68 | // engines present in a library. | ||
447 | 69 | typedef struct effect_descriptor_s { | ||
448 | 70 | effect_uuid_t type; // UUID of to the OpenSL ES interface implemented by this effect | ||
449 | 71 | effect_uuid_t uuid; // UUID for this particular implementation | ||
450 | 72 | uint32_t apiVersion; // Version of the effect control API implemented | ||
451 | 73 | uint32_t flags; // effect engine capabilities/requirements flags (see below) | ||
452 | 74 | uint16_t cpuLoad; // CPU load indication (see below) | ||
453 | 75 | uint16_t memoryUsage; // Data Memory usage (see below) | ||
454 | 76 | char name[EFFECT_STRING_LEN_MAX]; // human readable effect name | ||
455 | 77 | char implementor[EFFECT_STRING_LEN_MAX]; // human readable effect implementor name | ||
456 | 78 | } effect_descriptor_t; | ||
457 | 79 | |||
458 | 80 | // CPU load and memory usage indication: each effect implementation must provide an indication of | ||
459 | 81 | // its CPU and memory usage for the audio effect framework to limit the number of effects | ||
460 | 82 | // instantiated at a given time on a given platform. | ||
461 | 83 | // The CPU load is expressed in 0.1 MIPS units as estimated on an ARM9E core (ARMv5TE) with 0 WS. | ||
462 | 84 | // The memory usage is expressed in KB and includes only dynamically allocated memory | ||
463 | 85 | |||
464 | 86 | // Definitions for flags field of effect descriptor. | ||
465 | 87 | // +---------------------------+-----------+----------------------------------- | ||
466 | 88 | // | description | bits | values | ||
467 | 89 | // +---------------------------+-----------+----------------------------------- | ||
468 | 90 | // | connection mode | 0..2 | 0 insert: after track process | ||
469 | 91 | // | | | 1 auxiliary: connect to track auxiliary | ||
470 | 92 | // | | | output and use send level | ||
471 | 93 | // | | | 2 replace: replaces track process function; | ||
472 | 94 | // | | | must implement SRC, volume and mono to stereo. | ||
473 | 95 | // | | | 3 pre processing: applied below audio HAL on input | ||
474 | 96 | // | | | 4 post processing: applied below audio HAL on output | ||
475 | 97 | // | | | 5 - 7 reserved | ||
476 | 98 | // +---------------------------+-----------+----------------------------------- | ||
477 | 99 | // | insertion preference | 3..5 | 0 none | ||
478 | 100 | // | | | 1 first of the chain | ||
479 | 101 | // | | | 2 last of the chain | ||
480 | 102 | // | | | 3 exclusive (only effect in the insert chain) | ||
481 | 103 | // | | | 4..7 reserved | ||
482 | 104 | // +---------------------------+-----------+----------------------------------- | ||
483 | 105 | // | Volume management | 6..8 | 0 none | ||
484 | 106 | // | | | 1 implements volume control | ||
485 | 107 | // | | | 2 requires volume indication | ||
486 | 108 | // | | | 4 reserved | ||
487 | 109 | // +---------------------------+-----------+----------------------------------- | ||
488 | 110 | // | Device indication | 9..11 | 0 none | ||
489 | 111 | // | | | 1 requires device updates | ||
490 | 112 | // | | | 2, 4 reserved | ||
491 | 113 | // +---------------------------+-----------+----------------------------------- | ||
492 | 114 | // | Sample input mode | 12..13 | 1 direct: process() function or EFFECT_CMD_CONFIGURE | ||
493 | 115 | // | | | command must specify a buffer descriptor | ||
494 | 116 | // | | | 2 provider: process() function uses the | ||
495 | 117 | // | | | bufferProvider indicated by the | ||
496 | 118 | // | | | EFFECT_CMD_CONFIGURE command to request input. | ||
497 | 119 | // | | | buffers. | ||
498 | 120 | // | | | 3 both: both input modes are supported | ||
499 | 121 | // +---------------------------+-----------+----------------------------------- | ||
500 | 122 | // | Sample output mode | 14..15 | 1 direct: process() function or EFFECT_CMD_CONFIGURE | ||
501 | 123 | // | | | command must specify a buffer descriptor | ||
502 | 124 | // | | | 2 provider: process() function uses the | ||
503 | 125 | // | | | bufferProvider indicated by the | ||
504 | 126 | // | | | EFFECT_CMD_CONFIGURE command to request output | ||
505 | 127 | // | | | buffers. | ||
506 | 128 | // | | | 3 both: both output modes are supported | ||
507 | 129 | // +---------------------------+-----------+----------------------------------- | ||
508 | 130 | // | Hardware acceleration | 16..17 | 0 No hardware acceleration | ||
509 | 131 | // | | | 1 non tunneled hw acceleration: the process() function | ||
510 | 132 | // | | | reads the samples, send them to HW accelerated | ||
511 | 133 | // | | | effect processor, reads back the processed samples | ||
512 | 134 | // | | | and returns them to the output buffer. | ||
513 | 135 | // | | | 2 tunneled hw acceleration: the process() function is | ||
514 | 136 | // | | | transparent. The effect interface is only used to | ||
515 | 137 | // | | | control the effect engine. This mode is relevant for | ||
516 | 138 | // | | | global effects actually applied by the audio | ||
517 | 139 | // | | | hardware on the output stream. | ||
518 | 140 | // +---------------------------+-----------+----------------------------------- | ||
519 | 141 | // | Audio Mode indication | 18..19 | 0 none | ||
520 | 142 | // | | | 1 requires audio mode updates | ||
521 | 143 | // | | | 2..3 reserved | ||
522 | 144 | // +---------------------------+-----------+----------------------------------- | ||
523 | 145 | |||
524 | 146 | // Insert mode | ||
525 | 147 | #define EFFECT_FLAG_TYPE_SHIFT 0 | ||
526 | 148 | #define EFFECT_FLAG_TYPE_SIZE 3 | ||
527 | 149 | #define EFFECT_FLAG_TYPE_MASK (((1 << EFFECT_FLAG_TYPE_SIZE) -1) \ | ||
528 | 150 | << EFFECT_FLAG_TYPE_SHIFT) | ||
529 | 151 | #define EFFECT_FLAG_TYPE_INSERT (0 << EFFECT_FLAG_TYPE_SHIFT) | ||
530 | 152 | #define EFFECT_FLAG_TYPE_AUXILIARY (1 << EFFECT_FLAG_TYPE_SHIFT) | ||
531 | 153 | #define EFFECT_FLAG_TYPE_REPLACE (2 << EFFECT_FLAG_TYPE_SHIFT) | ||
532 | 154 | #define EFFECT_FLAG_TYPE_PRE_PROC (3 << EFFECT_FLAG_TYPE_SHIFT) | ||
533 | 155 | #define EFFECT_FLAG_TYPE_POST_PROC (4 << EFFECT_FLAG_TYPE_SHIFT) | ||
534 | 156 | |||
535 | 157 | // Insert preference | ||
536 | 158 | #define EFFECT_FLAG_INSERT_SHIFT (EFFECT_FLAG_TYPE_SHIFT + EFFECT_FLAG_TYPE_SIZE) | ||
537 | 159 | #define EFFECT_FLAG_INSERT_SIZE 3 | ||
538 | 160 | #define EFFECT_FLAG_INSERT_MASK (((1 << EFFECT_FLAG_INSERT_SIZE) -1) \ | ||
539 | 161 | << EFFECT_FLAG_INSERT_SHIFT) | ||
540 | 162 | #define EFFECT_FLAG_INSERT_ANY (0 << EFFECT_FLAG_INSERT_SHIFT) | ||
541 | 163 | #define EFFECT_FLAG_INSERT_FIRST (1 << EFFECT_FLAG_INSERT_SHIFT) | ||
542 | 164 | #define EFFECT_FLAG_INSERT_LAST (2 << EFFECT_FLAG_INSERT_SHIFT) | ||
543 | 165 | #define EFFECT_FLAG_INSERT_EXCLUSIVE (3 << EFFECT_FLAG_INSERT_SHIFT) | ||
544 | 166 | |||
545 | 167 | |||
546 | 168 | // Volume control | ||
547 | 169 | #define EFFECT_FLAG_VOLUME_SHIFT (EFFECT_FLAG_INSERT_SHIFT + EFFECT_FLAG_INSERT_SIZE) | ||
548 | 170 | #define EFFECT_FLAG_VOLUME_SIZE 3 | ||
549 | 171 | #define EFFECT_FLAG_VOLUME_MASK (((1 << EFFECT_FLAG_VOLUME_SIZE) -1) \ | ||
550 | 172 | << EFFECT_FLAG_VOLUME_SHIFT) | ||
551 | 173 | #define EFFECT_FLAG_VOLUME_CTRL (1 << EFFECT_FLAG_VOLUME_SHIFT) | ||
552 | 174 | #define EFFECT_FLAG_VOLUME_IND (2 << EFFECT_FLAG_VOLUME_SHIFT) | ||
553 | 175 | #define EFFECT_FLAG_VOLUME_NONE (0 << EFFECT_FLAG_VOLUME_SHIFT) | ||
554 | 176 | |||
555 | 177 | // Device indication | ||
556 | 178 | #define EFFECT_FLAG_DEVICE_SHIFT (EFFECT_FLAG_VOLUME_SHIFT + EFFECT_FLAG_VOLUME_SIZE) | ||
557 | 179 | #define EFFECT_FLAG_DEVICE_SIZE 3 | ||
558 | 180 | #define EFFECT_FLAG_DEVICE_MASK (((1 << EFFECT_FLAG_DEVICE_SIZE) -1) \ | ||
559 | 181 | << EFFECT_FLAG_DEVICE_SHIFT) | ||
560 | 182 | #define EFFECT_FLAG_DEVICE_IND (1 << EFFECT_FLAG_DEVICE_SHIFT) | ||
561 | 183 | #define EFFECT_FLAG_DEVICE_NONE (0 << EFFECT_FLAG_DEVICE_SHIFT) | ||
562 | 184 | |||
563 | 185 | // Sample input modes | ||
564 | 186 | #define EFFECT_FLAG_INPUT_SHIFT (EFFECT_FLAG_DEVICE_SHIFT + EFFECT_FLAG_DEVICE_SIZE) | ||
565 | 187 | #define EFFECT_FLAG_INPUT_SIZE 2 | ||
566 | 188 | #define EFFECT_FLAG_INPUT_MASK (((1 << EFFECT_FLAG_INPUT_SIZE) -1) \ | ||
567 | 189 | << EFFECT_FLAG_INPUT_SHIFT) | ||
568 | 190 | #define EFFECT_FLAG_INPUT_DIRECT (1 << EFFECT_FLAG_INPUT_SHIFT) | ||
569 | 191 | #define EFFECT_FLAG_INPUT_PROVIDER (2 << EFFECT_FLAG_INPUT_SHIFT) | ||
570 | 192 | #define EFFECT_FLAG_INPUT_BOTH (3 << EFFECT_FLAG_INPUT_SHIFT) | ||
571 | 193 | |||
572 | 194 | // Sample output modes | ||
573 | 195 | #define EFFECT_FLAG_OUTPUT_SHIFT (EFFECT_FLAG_INPUT_SHIFT + EFFECT_FLAG_INPUT_SIZE) | ||
574 | 196 | #define EFFECT_FLAG_OUTPUT_SIZE 2 | ||
575 | 197 | #define EFFECT_FLAG_OUTPUT_MASK (((1 << EFFECT_FLAG_OUTPUT_SIZE) -1) \ | ||
576 | 198 | << EFFECT_FLAG_OUTPUT_SHIFT) | ||
577 | 199 | #define EFFECT_FLAG_OUTPUT_DIRECT (1 << EFFECT_FLAG_OUTPUT_SHIFT) | ||
578 | 200 | #define EFFECT_FLAG_OUTPUT_PROVIDER (2 << EFFECT_FLAG_OUTPUT_SHIFT) | ||
579 | 201 | #define EFFECT_FLAG_OUTPUT_BOTH (3 << EFFECT_FLAG_OUTPUT_SHIFT) | ||
580 | 202 | |||
581 | 203 | // Hardware acceleration mode | ||
582 | 204 | #define EFFECT_FLAG_HW_ACC_SHIFT (EFFECT_FLAG_OUTPUT_SHIFT + EFFECT_FLAG_OUTPUT_SIZE) | ||
583 | 205 | #define EFFECT_FLAG_HW_ACC_SIZE 2 | ||
584 | 206 | #define EFFECT_FLAG_HW_ACC_MASK (((1 << EFFECT_FLAG_HW_ACC_SIZE) -1) \ | ||
585 | 207 | << EFFECT_FLAG_HW_ACC_SHIFT) | ||
586 | 208 | #define EFFECT_FLAG_HW_ACC_SIMPLE (1 << EFFECT_FLAG_HW_ACC_SHIFT) | ||
587 | 209 | #define EFFECT_FLAG_HW_ACC_TUNNEL (2 << EFFECT_FLAG_HW_ACC_SHIFT) | ||
588 | 210 | |||
589 | 211 | // Audio mode indication | ||
590 | 212 | #define EFFECT_FLAG_AUDIO_MODE_SHIFT (EFFECT_FLAG_HW_ACC_SHIFT + EFFECT_FLAG_HW_ACC_SIZE) | ||
591 | 213 | #define EFFECT_FLAG_AUDIO_MODE_SIZE 2 | ||
592 | 214 | #define EFFECT_FLAG_AUDIO_MODE_MASK (((1 << EFFECT_FLAG_AUDIO_MODE_SIZE) -1) \ | ||
593 | 215 | << EFFECT_FLAG_AUDIO_MODE_SHIFT) | ||
594 | 216 | #define EFFECT_FLAG_AUDIO_MODE_IND (1 << EFFECT_FLAG_AUDIO_MODE_SHIFT) | ||
595 | 217 | #define EFFECT_FLAG_AUDIO_MODE_NONE (0 << EFFECT_FLAG_AUDIO_MODE_SHIFT) | ||
596 | 218 | |||
597 | 219 | |||
598 | 220 | #define EFFECT_MAKE_API_VERSION(M, m) (((M)<<16) | ((m) & 0xFFFF)) | ||
599 | 221 | #define EFFECT_API_VERSION_MAJOR(v) ((v)>>16) | ||
600 | 222 | #define EFFECT_API_VERSION_MINOR(v) ((m) & 0xFFFF) | ||
601 | 223 | |||
602 | 224 | |||
603 | 225 | |||
604 | 226 | ///////////////////////////////////////////////// | ||
605 | 227 | // Effect control interface | ||
606 | 228 | ///////////////////////////////////////////////// | ||
607 | 229 | |||
608 | 230 | // Effect control interface version 2.0 | ||
609 | 231 | #define EFFECT_CONTROL_API_VERSION EFFECT_MAKE_API_VERSION(2,0) | ||
610 | 232 | |||
611 | 233 | // Effect control interface structure: effect_interface_s | ||
612 | 234 | // The effect control interface is exposed by each effect engine implementation. It consists of | ||
613 | 235 | // a set of functions controlling the configuration, activation and process of the engine. | ||
614 | 236 | // The functions are grouped in a structure of type effect_interface_s. | ||
615 | 237 | // | ||
616 | 238 | // Effect control interface handle: effect_handle_t | ||
617 | 239 | // The effect_handle_t serves two purposes regarding the implementation of the effect engine: | ||
618 | 240 | // - 1 it is the address of a pointer to an effect_interface_s structure where the functions | ||
619 | 241 | // of the effect control API for a particular effect are located. | ||
620 | 242 | // - 2 it is the address of the context of a particular effect instance. | ||
621 | 243 | // A typical implementation in the effect library would define a structure as follows: | ||
622 | 244 | // struct effect_module_s { | ||
623 | 245 | // const struct effect_interface_s *itfe; | ||
624 | 246 | // effect_config_t config; | ||
625 | 247 | // effect_context_t context; | ||
626 | 248 | // } | ||
627 | 249 | // The implementation of EffectCreate() function would then allocate a structure of this | ||
628 | 250 | // type and return its address as effect_handle_t | ||
629 | 251 | typedef struct effect_interface_s **effect_handle_t; | ||
630 | 252 | |||
631 | 253 | |||
632 | 254 | // Forward definition of type audio_buffer_t | ||
633 | 255 | typedef struct audio_buffer_s audio_buffer_t; | ||
634 | 256 | |||
635 | 257 | |||
636 | 258 | |||
637 | 259 | |||
638 | 260 | |||
639 | 261 | |||
640 | 262 | // Effect control interface definition | ||
641 | 263 | struct effect_interface_s { | ||
642 | 264 | //////////////////////////////////////////////////////////////////////////////// | ||
643 | 265 | // | ||
644 | 266 | // Function: process | ||
645 | 267 | // | ||
646 | 268 | // Description: Effect process function. Takes input samples as specified | ||
647 | 269 | // (count and location) in input buffer descriptor and output processed | ||
648 | 270 | // samples as specified in output buffer descriptor. If the buffer descriptor | ||
649 | 271 | // is not specified the function must use either the buffer or the | ||
650 | 272 | // buffer provider function installed by the EFFECT_CMD_CONFIGURE command. | ||
651 | 273 | // The effect framework will call the process() function after the EFFECT_CMD_ENABLE | ||
652 | 274 | // command is received and until the EFFECT_CMD_DISABLE is received. When the engine | ||
653 | 275 | // receives the EFFECT_CMD_DISABLE command it should turn off the effect gracefully | ||
654 | 276 | // and when done indicate that it is OK to stop calling the process() function by | ||
655 | 277 | // returning the -ENODATA status. | ||
656 | 278 | // | ||
657 | 279 | // NOTE: the process() function implementation should be "real-time safe" that is | ||
658 | 280 | // it should not perform blocking calls: malloc/free, sleep, read/write/open/close, | ||
659 | 281 | // pthread_cond_wait/pthread_mutex_lock... | ||
660 | 282 | // | ||
661 | 283 | // Input: | ||
662 | 284 | // self: handle to the effect interface this function | ||
663 | 285 | // is called on. | ||
664 | 286 | // inBuffer: buffer descriptor indicating where to read samples to process. | ||
665 | 287 | // If NULL, use the configuration passed by EFFECT_CMD_CONFIGURE command. | ||
666 | 288 | // | ||
667 | 289 | // outBuffer: buffer descriptor indicating where to write processed samples. | ||
668 | 290 | // If NULL, use the configuration passed by EFFECT_CMD_CONFIGURE command. | ||
669 | 291 | // | ||
670 | 292 | // Output: | ||
671 | 293 | // returned value: 0 successful operation | ||
672 | 294 | // -ENODATA the engine has finished the disable phase and the framework | ||
673 | 295 | // can stop calling process() | ||
674 | 296 | // -EINVAL invalid interface handle or | ||
675 | 297 | // invalid input/output buffer description | ||
676 | 298 | //////////////////////////////////////////////////////////////////////////////// | ||
677 | 299 | int32_t (*process)(effect_handle_t self, | ||
678 | 300 | audio_buffer_t *inBuffer, | ||
679 | 301 | audio_buffer_t *outBuffer); | ||
680 | 302 | //////////////////////////////////////////////////////////////////////////////// | ||
681 | 303 | // | ||
682 | 304 | // Function: command | ||
683 | 305 | // | ||
684 | 306 | // Description: Send a command and receive a response to/from effect engine. | ||
685 | 307 | // | ||
686 | 308 | // Input: | ||
687 | 309 | // self: handle to the effect interface this function | ||
688 | 310 | // is called on. | ||
689 | 311 | // cmdCode: command code: the command can be a standardized command defined in | ||
690 | 312 | // effect_command_e (see below) or a proprietary command. | ||
691 | 313 | // cmdSize: size of command in bytes | ||
692 | 314 | // pCmdData: pointer to command data | ||
693 | 315 | // pReplyData: pointer to reply data | ||
694 | 316 | // | ||
695 | 317 | // Input/Output: | ||
696 | 318 | // replySize: maximum size of reply data as input | ||
697 | 319 | // actual size of reply data as output | ||
698 | 320 | // | ||
699 | 321 | // Output: | ||
700 | 322 | // returned value: 0 successful operation | ||
701 | 323 | // -EINVAL invalid interface handle or | ||
702 | 324 | // invalid command/reply size or format according to command code | ||
703 | 325 | // The return code should be restricted to indicate problems related to the this | ||
704 | 326 | // API specification. Status related to the execution of a particular command should be | ||
705 | 327 | // indicated as part of the reply field. | ||
706 | 328 | // | ||
707 | 329 | // *pReplyData updated with command response | ||
708 | 330 | // | ||
709 | 331 | //////////////////////////////////////////////////////////////////////////////// | ||
710 | 332 | int32_t (*command)(effect_handle_t self, | ||
711 | 333 | uint32_t cmdCode, | ||
712 | 334 | uint32_t cmdSize, | ||
713 | 335 | void *pCmdData, | ||
714 | 336 | uint32_t *replySize, | ||
715 | 337 | void *pReplyData); | ||
716 | 338 | //////////////////////////////////////////////////////////////////////////////// | ||
717 | 339 | // | ||
718 | 340 | // Function: get_descriptor | ||
719 | 341 | // | ||
720 | 342 | // Description: Returns the effect descriptor | ||
721 | 343 | // | ||
722 | 344 | // Input: | ||
723 | 345 | // self: handle to the effect interface this function | ||
724 | 346 | // is called on. | ||
725 | 347 | // | ||
726 | 348 | // Input/Output: | ||
727 | 349 | // pDescriptor: address where to return the effect descriptor. | ||
728 | 350 | // | ||
729 | 351 | // Output: | ||
730 | 352 | // returned value: 0 successful operation. | ||
731 | 353 | // -EINVAL invalid interface handle or invalid pDescriptor | ||
732 | 354 | // *pDescriptor: updated with the effect descriptor. | ||
733 | 355 | // | ||
734 | 356 | //////////////////////////////////////////////////////////////////////////////// | ||
735 | 357 | int32_t (*get_descriptor)(effect_handle_t self, | ||
736 | 358 | effect_descriptor_t *pDescriptor); | ||
737 | 359 | //////////////////////////////////////////////////////////////////////////////// | ||
738 | 360 | // | ||
739 | 361 | // Function: process_reverse | ||
740 | 362 | // | ||
741 | 363 | // Description: Process reverse stream function. This function is used to pass | ||
742 | 364 | // a reference stream to the effect engine. If the engine does not need a reference | ||
743 | 365 | // stream, this function pointer can be set to NULL. | ||
744 | 366 | // This function would typically implemented by an Echo Canceler. | ||
745 | 367 | // | ||
746 | 368 | // Input: | ||
747 | 369 | // self: handle to the effect interface this function | ||
748 | 370 | // is called on. | ||
749 | 371 | // inBuffer: buffer descriptor indicating where to read samples to process. | ||
750 | 372 | // If NULL, use the configuration passed by EFFECT_CMD_CONFIGURE_REVERSE command. | ||
751 | 373 | // | ||
752 | 374 | // outBuffer: buffer descriptor indicating where to write processed samples. | ||
753 | 375 | // If NULL, use the configuration passed by EFFECT_CMD_CONFIGURE_REVERSE command. | ||
754 | 376 | // If the buffer and buffer provider in the configuration received by | ||
755 | 377 | // EFFECT_CMD_CONFIGURE_REVERSE are also NULL, do not return modified reverse | ||
756 | 378 | // stream data | ||
757 | 379 | // | ||
758 | 380 | // Output: | ||
759 | 381 | // returned value: 0 successful operation | ||
760 | 382 | // -ENODATA the engine has finished the disable phase and the framework | ||
761 | 383 | // can stop calling process_reverse() | ||
762 | 384 | // -EINVAL invalid interface handle or | ||
763 | 385 | // invalid input/output buffer description | ||
764 | 386 | //////////////////////////////////////////////////////////////////////////////// | ||
765 | 387 | int32_t (*process_reverse)(effect_handle_t self, | ||
766 | 388 | audio_buffer_t *inBuffer, | ||
767 | 389 | audio_buffer_t *outBuffer); | ||
768 | 390 | }; | ||
769 | 391 | |||
770 | 392 | |||
771 | 393 | // | ||
772 | 394 | //--- Standardized command codes for command() function | ||
773 | 395 | // | ||
774 | 396 | enum effect_command_e { | ||
775 | 397 | EFFECT_CMD_INIT, // initialize effect engine | ||
776 | 398 | EFFECT_CMD_CONFIGURE, // configure effect engine (see effect_config_t) | ||
777 | 399 | EFFECT_CMD_RESET, // reset effect engine | ||
778 | 400 | EFFECT_CMD_ENABLE, // enable effect process | ||
779 | 401 | EFFECT_CMD_DISABLE, // disable effect process | ||
780 | 402 | EFFECT_CMD_SET_PARAM, // set parameter immediately (see effect_param_t) | ||
781 | 403 | EFFECT_CMD_SET_PARAM_DEFERRED, // set parameter deferred | ||
782 | 404 | EFFECT_CMD_SET_PARAM_COMMIT, // commit previous set parameter deferred | ||
783 | 405 | EFFECT_CMD_GET_PARAM, // get parameter | ||
784 | 406 | EFFECT_CMD_SET_DEVICE, // set audio device (see audio.h, audio_devices_t) | ||
785 | 407 | EFFECT_CMD_SET_VOLUME, // set volume | ||
786 | 408 | EFFECT_CMD_SET_AUDIO_MODE, // set the audio mode (normal, ring, ...) | ||
787 | 409 | EFFECT_CMD_CONFIGURE_REVERSE, // configure effect engine reverse stream(see effect_config_t) | ||
788 | 410 | EFFECT_CMD_SET_INPUT_DEVICE, // set capture device (see audio.h, audio_devices_t) | ||
789 | 411 | EFFECT_CMD_FIRST_PROPRIETARY = 0x10000 // first proprietary command code | ||
790 | 412 | }; | ||
791 | 413 | |||
792 | 414 | //================================================================================================== | ||
793 | 415 | // command: EFFECT_CMD_INIT | ||
794 | 416 | //-------------------------------------------------------------------------------------------------- | ||
795 | 417 | // description: | ||
796 | 418 | // Initialize effect engine: All configurations return to default | ||
797 | 419 | //-------------------------------------------------------------------------------------------------- | ||
798 | 420 | // command format: | ||
799 | 421 | // size: 0 | ||
800 | 422 | // data: N/A | ||
801 | 423 | //-------------------------------------------------------------------------------------------------- | ||
802 | 424 | // reply format: | ||
803 | 425 | // size: sizeof(int) | ||
804 | 426 | // data: status | ||
805 | 427 | //================================================================================================== | ||
806 | 428 | // command: EFFECT_CMD_CONFIGURE | ||
807 | 429 | //-------------------------------------------------------------------------------------------------- | ||
808 | 430 | // description: | ||
809 | 431 | // Apply new audio parameters configurations for input and output buffers | ||
810 | 432 | //-------------------------------------------------------------------------------------------------- | ||
811 | 433 | // command format: | ||
812 | 434 | // size: sizeof(effect_config_t) | ||
813 | 435 | // data: effect_config_t | ||
814 | 436 | //-------------------------------------------------------------------------------------------------- | ||
815 | 437 | // reply format: | ||
816 | 438 | // size: sizeof(int) | ||
817 | 439 | // data: status | ||
818 | 440 | //================================================================================================== | ||
819 | 441 | // command: EFFECT_CMD_RESET | ||
820 | 442 | //-------------------------------------------------------------------------------------------------- | ||
821 | 443 | // description: | ||
822 | 444 | // Reset the effect engine. Keep configuration but resets state and buffer content | ||
823 | 445 | //-------------------------------------------------------------------------------------------------- | ||
824 | 446 | // command format: | ||
825 | 447 | // size: 0 | ||
826 | 448 | // data: N/A | ||
827 | 449 | //-------------------------------------------------------------------------------------------------- | ||
828 | 450 | // reply format: | ||
829 | 451 | // size: 0 | ||
830 | 452 | // data: N/A | ||
831 | 453 | //================================================================================================== | ||
832 | 454 | // command: EFFECT_CMD_ENABLE | ||
833 | 455 | //-------------------------------------------------------------------------------------------------- | ||
834 | 456 | // description: | ||
835 | 457 | // Enable the process. Called by the framework before the first call to process() | ||
836 | 458 | //-------------------------------------------------------------------------------------------------- | ||
837 | 459 | // command format: | ||
838 | 460 | // size: 0 | ||
839 | 461 | // data: N/A | ||
840 | 462 | //-------------------------------------------------------------------------------------------------- | ||
841 | 463 | // reply format: | ||
842 | 464 | // size: sizeof(int) | ||
843 | 465 | // data: status | ||
844 | 466 | //================================================================================================== | ||
845 | 467 | // command: EFFECT_CMD_DISABLE | ||
846 | 468 | //-------------------------------------------------------------------------------------------------- | ||
847 | 469 | // description: | ||
848 | 470 | // Disable the process. Called by the framework after the last call to process() | ||
849 | 471 | //-------------------------------------------------------------------------------------------------- | ||
850 | 472 | // command format: | ||
851 | 473 | // size: 0 | ||
852 | 474 | // data: N/A | ||
853 | 475 | //-------------------------------------------------------------------------------------------------- | ||
854 | 476 | // reply format: | ||
855 | 477 | // size: sizeof(int) | ||
856 | 478 | // data: status | ||
857 | 479 | //================================================================================================== | ||
858 | 480 | // command: EFFECT_CMD_SET_PARAM | ||
859 | 481 | //-------------------------------------------------------------------------------------------------- | ||
860 | 482 | // description: | ||
861 | 483 | // Set a parameter and apply it immediately | ||
862 | 484 | //-------------------------------------------------------------------------------------------------- | ||
863 | 485 | // command format: | ||
864 | 486 | // size: sizeof(effect_param_t) + size of param and value | ||
865 | 487 | // data: effect_param_t + param + value. See effect_param_t definition below for value offset | ||
866 | 488 | //-------------------------------------------------------------------------------------------------- | ||
867 | 489 | // reply format: | ||
868 | 490 | // size: sizeof(int) | ||
869 | 491 | // data: status | ||
870 | 492 | //================================================================================================== | ||
871 | 493 | // command: EFFECT_CMD_SET_PARAM_DEFERRED | ||
872 | 494 | //-------------------------------------------------------------------------------------------------- | ||
873 | 495 | // description: | ||
874 | 496 | // Set a parameter but apply it only when receiving EFFECT_CMD_SET_PARAM_COMMIT command | ||
875 | 497 | //-------------------------------------------------------------------------------------------------- | ||
876 | 498 | // command format: | ||
877 | 499 | // size: sizeof(effect_param_t) + size of param and value | ||
878 | 500 | // data: effect_param_t + param + value. See effect_param_t definition below for value offset | ||
879 | 501 | //-------------------------------------------------------------------------------------------------- | ||
880 | 502 | // reply format: | ||
881 | 503 | // size: 0 | ||
882 | 504 | // data: N/A | ||
883 | 505 | //================================================================================================== | ||
884 | 506 | // command: EFFECT_CMD_SET_PARAM_COMMIT | ||
885 | 507 | //-------------------------------------------------------------------------------------------------- | ||
886 | 508 | // description: | ||
887 | 509 | // Apply all previously received EFFECT_CMD_SET_PARAM_DEFERRED commands | ||
888 | 510 | //-------------------------------------------------------------------------------------------------- | ||
889 | 511 | // command format: | ||
890 | 512 | // size: 0 | ||
891 | 513 | // data: N/A | ||
892 | 514 | //-------------------------------------------------------------------------------------------------- | ||
893 | 515 | // reply format: | ||
894 | 516 | // size: sizeof(int) | ||
895 | 517 | // data: status | ||
896 | 518 | //================================================================================================== | ||
897 | 519 | // command: EFFECT_CMD_GET_PARAM | ||
898 | 520 | //-------------------------------------------------------------------------------------------------- | ||
899 | 521 | // description: | ||
900 | 522 | // Get a parameter value | ||
901 | 523 | //-------------------------------------------------------------------------------------------------- | ||
902 | 524 | // command format: | ||
903 | 525 | // size: sizeof(effect_param_t) + size of param | ||
904 | 526 | // data: effect_param_t + param | ||
905 | 527 | //-------------------------------------------------------------------------------------------------- | ||
906 | 528 | // reply format: | ||
907 | 529 | // size: sizeof(effect_param_t) + size of param and value | ||
908 | 530 | // data: effect_param_t + param + value. See effect_param_t definition below for value offset | ||
909 | 531 | //================================================================================================== | ||
910 | 532 | // command: EFFECT_CMD_SET_DEVICE | ||
911 | 533 | //-------------------------------------------------------------------------------------------------- | ||
912 | 534 | // description: | ||
913 | 535 | // Set the rendering device the audio output path is connected to. See audio.h, audio_devices_t | ||
914 | 536 | // for device values. | ||
915 | 537 | // The effect implementation must set EFFECT_FLAG_DEVICE_IND flag in its descriptor to receive this | ||
916 | 538 | // command when the device changes | ||
917 | 539 | //-------------------------------------------------------------------------------------------------- | ||
918 | 540 | // command format: | ||
919 | 541 | // size: sizeof(uint32_t) | ||
920 | 542 | // data: uint32_t | ||
921 | 543 | //-------------------------------------------------------------------------------------------------- | ||
922 | 544 | // reply format: | ||
923 | 545 | // size: 0 | ||
924 | 546 | // data: N/A | ||
925 | 547 | //================================================================================================== | ||
926 | 548 | // command: EFFECT_CMD_SET_VOLUME | ||
927 | 549 | //-------------------------------------------------------------------------------------------------- | ||
928 | 550 | // description: | ||
929 | 551 | // Set and get volume. Used by audio framework to delegate volume control to effect engine. | ||
930 | 552 | // The effect implementation must set EFFECT_FLAG_VOLUME_IND or EFFECT_FLAG_VOLUME_CTRL flag in | ||
931 | 553 | // its descriptor to receive this command before every call to process() function | ||
932 | 554 | // If EFFECT_FLAG_VOLUME_CTRL flag is set in the effect descriptor, the effect engine must return | ||
933 | 555 | // the volume that should be applied before the effect is processed. The overall volume (the volume | ||
934 | 556 | // actually applied by the effect engine multiplied by the returned value) should match the value | ||
935 | 557 | // indicated in the command. | ||
936 | 558 | //-------------------------------------------------------------------------------------------------- | ||
937 | 559 | // command format: | ||
938 | 560 | // size: n * sizeof(uint32_t) | ||
939 | 561 | // data: volume for each channel defined in effect_config_t for output buffer expressed in | ||
940 | 562 | // 8.24 fixed point format | ||
941 | 563 | //-------------------------------------------------------------------------------------------------- | ||
942 | 564 | // reply format: | ||
943 | 565 | // size: n * sizeof(uint32_t) / 0 | ||
944 | 566 | // data: - if EFFECT_FLAG_VOLUME_CTRL is set in effect descriptor: | ||
945 | 567 | // volume for each channel defined in effect_config_t for output buffer expressed in | ||
946 | 568 | // 8.24 fixed point format | ||
947 | 569 | // - if EFFECT_FLAG_VOLUME_CTRL is not set in effect descriptor: | ||
948 | 570 | // N/A | ||
949 | 571 | // It is legal to receive a null pointer as pReplyData in which case the effect framework has | ||
950 | 572 | // delegated volume control to another effect | ||
951 | 573 | //================================================================================================== | ||
952 | 574 | // command: EFFECT_CMD_SET_AUDIO_MODE | ||
953 | 575 | //-------------------------------------------------------------------------------------------------- | ||
954 | 576 | // description: | ||
955 | 577 | // Set the audio mode. The effect implementation must set EFFECT_FLAG_AUDIO_MODE_IND flag in its | ||
956 | 578 | // descriptor to receive this command when the audio mode changes. | ||
957 | 579 | //-------------------------------------------------------------------------------------------------- | ||
958 | 580 | // command format: | ||
959 | 581 | // size: sizeof(uint32_t) | ||
960 | 582 | // data: audio_mode_e | ||
961 | 583 | //-------------------------------------------------------------------------------------------------- | ||
962 | 584 | // reply format: | ||
963 | 585 | // size: 0 | ||
964 | 586 | // data: N/A | ||
965 | 587 | //================================================================================================== | ||
966 | 588 | // command: EFFECT_CMD_CONFIGURE_REVERSE | ||
967 | 589 | //-------------------------------------------------------------------------------------------------- | ||
968 | 590 | // description: | ||
969 | 591 | // Apply new audio parameters configurations for input and output buffers of reverse stream | ||
970 | 592 | //-------------------------------------------------------------------------------------------------- | ||
971 | 593 | // command format: | ||
972 | 594 | // size: sizeof(effect_config_t) | ||
973 | 595 | // data: effect_config_t | ||
974 | 596 | //-------------------------------------------------------------------------------------------------- | ||
975 | 597 | // reply format: | ||
976 | 598 | // size: sizeof(int) | ||
977 | 599 | // data: status | ||
978 | 600 | //================================================================================================== | ||
979 | 601 | // command: EFFECT_CMD_SET_INPUT_DEVICE | ||
980 | 602 | //-------------------------------------------------------------------------------------------------- | ||
981 | 603 | // description: | ||
982 | 604 | // Set the capture device the audio input path is connected to. See audio.h, audio_devices_t | ||
983 | 605 | // for device values. | ||
984 | 606 | // The effect implementation must set EFFECT_FLAG_DEVICE_IND flag in its descriptor to receive this | ||
985 | 607 | // command when the device changes | ||
986 | 608 | //-------------------------------------------------------------------------------------------------- | ||
987 | 609 | // command format: | ||
988 | 610 | // size: sizeof(uint32_t) | ||
989 | 611 | // data: uint32_t | ||
990 | 612 | //-------------------------------------------------------------------------------------------------- | ||
991 | 613 | // reply format: | ||
992 | 614 | // size: 0 | ||
993 | 615 | // data: N/A | ||
994 | 616 | //================================================================================================== | ||
995 | 617 | // command: EFFECT_CMD_FIRST_PROPRIETARY | ||
996 | 618 | //-------------------------------------------------------------------------------------------------- | ||
997 | 619 | // description: | ||
998 | 620 | // All proprietary effect commands must use command codes above this value. The size and format of | ||
999 | 621 | // command and response fields is free in this case | ||
1000 | 622 | //================================================================================================== | ||
1001 | 623 | |||
1002 | 624 | |||
1003 | 625 | // Audio buffer descriptor used by process(), bufferProvider() functions and buffer_config_t | ||
1004 | 626 | // structure. Multi-channel audio is always interleaved. The channel order is from LSB to MSB with | ||
1005 | 627 | // regard to the channel mask definition in audio.h, audio_channels_t e.g : | ||
1006 | 628 | // Stereo: left, right | ||
1007 | 629 | // 5 point 1: front left, front right, front center, low frequency, back left, back right | ||
1008 | 630 | // The buffer size is expressed in frame count, a frame being composed of samples for all | ||
1009 | 631 | // channels at a given time. Frame size for unspecified format (AUDIO_FORMAT_OTHER) is 8 bit by | ||
1010 | 632 | // definition | ||
1011 | 633 | struct audio_buffer_s { | ||
1012 | 634 | size_t frameCount; // number of frames in buffer | ||
1013 | 635 | union { | ||
1014 | 636 | void* raw; // raw pointer to start of buffer | ||
1015 | 637 | int32_t* s32; // pointer to signed 32 bit data at start of buffer | ||
1016 | 638 | int16_t* s16; // pointer to signed 16 bit data at start of buffer | ||
1017 | 639 | uint8_t* u8; // pointer to unsigned 8 bit data at start of buffer | ||
1018 | 640 | }; | ||
1019 | 641 | }; | ||
1020 | 642 | |||
1021 | 643 | // The buffer_provider_s structure contains functions that can be used | ||
1022 | 644 | // by the effect engine process() function to query and release input | ||
1023 | 645 | // or output audio buffer. | ||
1024 | 646 | // The getBuffer() function is called to retrieve a buffer where data | ||
1025 | 647 | // should read from or written to by process() function. | ||
1026 | 648 | // The releaseBuffer() function MUST be called when the buffer retrieved | ||
1027 | 649 | // with getBuffer() is not needed anymore. | ||
1028 | 650 | // The process function should use the buffer provider mechanism to retrieve | ||
1029 | 651 | // input or output buffer if the inBuffer or outBuffer passed as argument is NULL | ||
1030 | 652 | // and the buffer configuration (buffer_config_t) given by the EFFECT_CMD_CONFIGURE | ||
1031 | 653 | // command did not specify an audio buffer. | ||
1032 | 654 | |||
1033 | 655 | typedef int32_t (* buffer_function_t)(void *cookie, audio_buffer_t *buffer); | ||
1034 | 656 | |||
1035 | 657 | typedef struct buffer_provider_s { | ||
1036 | 658 | buffer_function_t getBuffer; // retrieve next buffer | ||
1037 | 659 | buffer_function_t releaseBuffer; // release used buffer | ||
1038 | 660 | void *cookie; // for use by client of buffer provider functions | ||
1039 | 661 | } buffer_provider_t; | ||
1040 | 662 | |||
1041 | 663 | |||
1042 | 664 | // The buffer_config_s structure specifies the input or output audio format | ||
1043 | 665 | // to be used by the effect engine. It is part of the effect_config_t | ||
1044 | 666 | // structure that defines both input and output buffer configurations and is | ||
1045 | 667 | // passed by the EFFECT_CMD_CONFIGURE or EFFECT_CMD_CONFIGURE_REVERSE command. | ||
1046 | 668 | typedef struct buffer_config_s { | ||
1047 | 669 | audio_buffer_t buffer; // buffer for use by process() function if not passed explicitly | ||
1048 | 670 | uint32_t samplingRate; // sampling rate | ||
1049 | 671 | uint32_t channels; // channel mask (see audio_channels_t in audio.h) | ||
1050 | 672 | buffer_provider_t bufferProvider; // buffer provider | ||
1051 | 673 | uint8_t format; // Audio format (see see audio_format_t in audio.h) | ||
1052 | 674 | uint8_t accessMode; // read/write or accumulate in buffer (effect_buffer_access_e) | ||
1053 | 675 | uint16_t mask; // indicates which of the above fields is valid | ||
1054 | 676 | } buffer_config_t; | ||
1055 | 677 | |||
1056 | 678 | // Values for "accessMode" field of buffer_config_t: | ||
1057 | 679 | // overwrite, read only, accumulate (read/modify/write) | ||
1058 | 680 | enum effect_buffer_access_e { | ||
1059 | 681 | EFFECT_BUFFER_ACCESS_WRITE, | ||
1060 | 682 | EFFECT_BUFFER_ACCESS_READ, | ||
1061 | 683 | EFFECT_BUFFER_ACCESS_ACCUMULATE | ||
1062 | 684 | |||
1063 | 685 | }; | ||
1064 | 686 | |||
1065 | 687 | // Values for bit field "mask" in buffer_config_t. If a bit is set, the corresponding field | ||
1066 | 688 | // in buffer_config_t must be taken into account when executing the EFFECT_CMD_CONFIGURE command | ||
1067 | 689 | #define EFFECT_CONFIG_BUFFER 0x0001 // buffer field must be taken into account | ||
1068 | 690 | #define EFFECT_CONFIG_SMP_RATE 0x0002 // samplingRate field must be taken into account | ||
1069 | 691 | #define EFFECT_CONFIG_CHANNELS 0x0004 // channels field must be taken into account | ||
1070 | 692 | #define EFFECT_CONFIG_FORMAT 0x0008 // format field must be taken into account | ||
1071 | 693 | #define EFFECT_CONFIG_ACC_MODE 0x0010 // accessMode field must be taken into account | ||
1072 | 694 | #define EFFECT_CONFIG_PROVIDER 0x0020 // bufferProvider field must be taken into account | ||
1073 | 695 | #define EFFECT_CONFIG_ALL (EFFECT_CONFIG_BUFFER | EFFECT_CONFIG_SMP_RATE | \ | ||
1074 | 696 | EFFECT_CONFIG_CHANNELS | EFFECT_CONFIG_FORMAT | \ | ||
1075 | 697 | EFFECT_CONFIG_ACC_MODE | EFFECT_CONFIG_PROVIDER) | ||
1076 | 698 | |||
1077 | 699 | |||
1078 | 700 | // effect_config_s structure describes the format of the pCmdData argument of EFFECT_CMD_CONFIGURE | ||
1079 | 701 | // command to configure audio parameters and buffers for effect engine input and output. | ||
1080 | 702 | typedef struct effect_config_s { | ||
1081 | 703 | buffer_config_t inputCfg; | ||
1082 | 704 | buffer_config_t outputCfg; | ||
1083 | 705 | } effect_config_t; | ||
1084 | 706 | |||
1085 | 707 | |||
1086 | 708 | // effect_param_s structure describes the format of the pCmdData argument of EFFECT_CMD_SET_PARAM | ||
1087 | 709 | // command and pCmdData and pReplyData of EFFECT_CMD_GET_PARAM command. | ||
1088 | 710 | // psize and vsize represent the actual size of parameter and value. | ||
1089 | 711 | // | ||
1090 | 712 | // NOTE: the start of value field inside the data field is always on a 32 bit boundary: | ||
1091 | 713 | // | ||
1092 | 714 | // +-----------+ | ||
1093 | 715 | // | status | sizeof(int) | ||
1094 | 716 | // +-----------+ | ||
1095 | 717 | // | psize | sizeof(int) | ||
1096 | 718 | // +-----------+ | ||
1097 | 719 | // | vsize | sizeof(int) | ||
1098 | 720 | // +-----------+ | ||
1099 | 721 | // | | | | | ||
1100 | 722 | // ~ parameter ~ > psize | | ||
1101 | 723 | // | | | > ((psize - 1)/sizeof(int) + 1) * sizeof(int) | ||
1102 | 724 | // +-----------+ | | ||
1103 | 725 | // | padding | | | ||
1104 | 726 | // +-----------+ | ||
1105 | 727 | // | | | | ||
1106 | 728 | // ~ value ~ > vsize | ||
1107 | 729 | // | | | | ||
1108 | 730 | // +-----------+ | ||
1109 | 731 | |||
1110 | 732 | typedef struct effect_param_s { | ||
1111 | 733 | int32_t status; // Transaction status (unused for command, used for reply) | ||
1112 | 734 | uint32_t psize; // Parameter size | ||
1113 | 735 | uint32_t vsize; // Value size | ||
1114 | 736 | char data[]; // Start of Parameter + Value data | ||
1115 | 737 | } effect_param_t; | ||
1116 | 738 | |||
1117 | 739 | |||
1118 | 740 | |||
1119 | 741 | ///////////////////////////////////////////////// | ||
1120 | 742 | // Effect library interface | ||
1121 | 743 | ///////////////////////////////////////////////// | ||
1122 | 744 | |||
1123 | 745 | // Effect library interface version 2.0 | ||
1124 | 746 | #define EFFECT_LIBRARY_API_VERSION EFFECT_MAKE_API_VERSION(2,0) | ||
1125 | 747 | |||
1126 | 748 | #define AUDIO_EFFECT_LIBRARY_TAG ((('A') << 24) | (('E') << 16) | (('L') << 8) | ('T')) | ||
1127 | 749 | |||
1128 | 750 | // Every effect library must have a data structure named AUDIO_EFFECT_LIBRARY_INFO_SYM | ||
1129 | 751 | // and the fields of this data structure must begin with audio_effect_library_t | ||
1130 | 752 | |||
1131 | 753 | typedef struct audio_effect_library_s { | ||
1132 | 754 | // tag must be initialized to AUDIO_EFFECT_LIBRARY_TAG | ||
1133 | 755 | uint32_t tag; | ||
1134 | 756 | // Version of the effect library API : 0xMMMMmmmm MMMM: Major, mmmm: minor | ||
1135 | 757 | uint32_t version; | ||
1136 | 758 | // Name of this library | ||
1137 | 759 | const char *name; | ||
1138 | 760 | // Author/owner/implementor of the library | ||
1139 | 761 | const char *implementor; | ||
1140 | 762 | |||
1141 | 763 | //////////////////////////////////////////////////////////////////////////////// | ||
1142 | 764 | // | ||
1143 | 765 | // Function: query_num_effects | ||
1144 | 766 | // | ||
1145 | 767 | // Description: Returns the number of different effects exposed by the | ||
1146 | 768 | // library. Each effect must have a unique effect uuid (see | ||
1147 | 769 | // effect_descriptor_t). This function together with EffectQueryEffect() | ||
1148 | 770 | // is used to enumerate all effects present in the library. | ||
1149 | 771 | // | ||
1150 | 772 | // Input/Output: | ||
1151 | 773 | // pNumEffects: address where the number of effects should be returned. | ||
1152 | 774 | // | ||
1153 | 775 | // Output: | ||
1154 | 776 | // returned value: 0 successful operation. | ||
1155 | 777 | // -ENODEV library failed to initialize | ||
1156 | 778 | // -EINVAL invalid pNumEffects | ||
1157 | 779 | // *pNumEffects: updated with number of effects in library | ||
1158 | 780 | // | ||
1159 | 781 | //////////////////////////////////////////////////////////////////////////////// | ||
1160 | 782 | int32_t (*query_num_effects)(uint32_t *pNumEffects); | ||
1161 | 783 | |||
1162 | 784 | //////////////////////////////////////////////////////////////////////////////// | ||
1163 | 785 | // | ||
1164 | 786 | // Function: query_effect | ||
1165 | 787 | // | ||
1166 | 788 | // Description: Returns the descriptor of the effect engine which index is | ||
1167 | 789 | // given as argument. | ||
1168 | 790 | // See effect_descriptor_t for details on effect descriptors. | ||
1169 | 791 | // This function together with EffectQueryNumberEffects() is used to enumerate all | ||
1170 | 792 | // effects present in the library. The enumeration sequence is: | ||
1171 | 793 | // EffectQueryNumberEffects(&num_effects); | ||
1172 | 794 | // for (i = 0; i < num_effects; i++) | ||
1173 | 795 | // EffectQueryEffect(i,...); | ||
1174 | 796 | // | ||
1175 | 797 | // Input/Output: | ||
1176 | 798 | // index: index of the effect | ||
1177 | 799 | // pDescriptor: address where to return the effect descriptor. | ||
1178 | 800 | // | ||
1179 | 801 | // Output: | ||
1180 | 802 | // returned value: 0 successful operation. | ||
1181 | 803 | // -ENODEV library failed to initialize | ||
1182 | 804 | // -EINVAL invalid pDescriptor or index | ||
1183 | 805 | // -ENOSYS effect list has changed since last execution of | ||
1184 | 806 | // EffectQueryNumberEffects() | ||
1185 | 807 | // -ENOENT no more effect available | ||
1186 | 808 | // *pDescriptor: updated with the effect descriptor. | ||
1187 | 809 | // | ||
1188 | 810 | //////////////////////////////////////////////////////////////////////////////// | ||
1189 | 811 | int32_t (*query_effect)(uint32_t index, | ||
1190 | 812 | effect_descriptor_t *pDescriptor); | ||
1191 | 813 | |||
1192 | 814 | //////////////////////////////////////////////////////////////////////////////// | ||
1193 | 815 | // | ||
1194 | 816 | // Function: create_effect | ||
1195 | 817 | // | ||
1196 | 818 | // Description: Creates an effect engine of the specified implementation uuid and | ||
1197 | 819 | // returns an effect control interface on this engine. The function will allocate the | ||
1198 | 820 | // resources for an instance of the requested effect engine and return | ||
1199 | 821 | // a handle on the effect control interface. | ||
1200 | 822 | // | ||
1201 | 823 | // Input: | ||
1202 | 824 | // uuid: pointer to the effect uuid. | ||
1203 | 825 | // sessionId: audio session to which this effect instance will be attached. All effects | ||
1204 | 826 | // created with the same session ID are connected in series and process the same signal | ||
1205 | 827 | // stream. Knowing that two effects are part of the same effect chain can help the | ||
1206 | 828 | // library implement some kind of optimizations. | ||
1207 | 829 | // ioId: identifies the output or input stream this effect is directed to at audio HAL. | ||
1208 | 830 | // For future use especially with tunneled HW accelerated effects | ||
1209 | 831 | // | ||
1210 | 832 | // Input/Output: | ||
1211 | 833 | // pHandle: address where to return the effect interface handle. | ||
1212 | 834 | // | ||
1213 | 835 | // Output: | ||
1214 | 836 | // returned value: 0 successful operation. | ||
1215 | 837 | // -ENODEV library failed to initialize | ||
1216 | 838 | // -EINVAL invalid pEffectUuid or pHandle | ||
1217 | 839 | // -ENOENT no effect with this uuid found | ||
1218 | 840 | // *pHandle: updated with the effect interface handle. | ||
1219 | 841 | // | ||
1220 | 842 | //////////////////////////////////////////////////////////////////////////////// | ||
1221 | 843 | int32_t (*create_effect)(effect_uuid_t *uuid, | ||
1222 | 844 | int32_t sessionId, | ||
1223 | 845 | int32_t ioId, | ||
1224 | 846 | effect_handle_t *pHandle); | ||
1225 | 847 | |||
1226 | 848 | //////////////////////////////////////////////////////////////////////////////// | ||
1227 | 849 | // | ||
1228 | 850 | // Function: release_effect | ||
1229 | 851 | // | ||
1230 | 852 | // Description: Releases the effect engine whose handle is given as argument. | ||
1231 | 853 | // All resources allocated to this particular instance of the effect are | ||
1232 | 854 | // released. | ||
1233 | 855 | // | ||
1234 | 856 | // Input: | ||
1235 | 857 | // handle: handle on the effect interface to be released. | ||
1236 | 858 | // | ||
1237 | 859 | // Output: | ||
1238 | 860 | // returned value: 0 successful operation. | ||
1239 | 861 | // -ENODEV library failed to initialize | ||
1240 | 862 | // -EINVAL invalid interface handle | ||
1241 | 863 | // | ||
1242 | 864 | //////////////////////////////////////////////////////////////////////////////// | ||
1243 | 865 | int32_t (*release_effect)(effect_handle_t handle); | ||
1244 | 866 | |||
1245 | 867 | //////////////////////////////////////////////////////////////////////////////// | ||
1246 | 868 | // | ||
1247 | 869 | // Function: get_descriptor | ||
1248 | 870 | // | ||
1249 | 871 | // Description: Returns the descriptor of the effect engine which implementation UUID is | ||
1250 | 872 | // given as argument. | ||
1251 | 873 | // | ||
1252 | 874 | // Input/Output: | ||
1253 | 875 | // uuid: pointer to the effect uuid. | ||
1254 | 876 | // pDescriptor: address where to return the effect descriptor. | ||
1255 | 877 | // | ||
1256 | 878 | // Output: | ||
1257 | 879 | // returned value: 0 successful operation. | ||
1258 | 880 | // -ENODEV library failed to initialize | ||
1259 | 881 | // -EINVAL invalid pDescriptor or uuid | ||
1260 | 882 | // *pDescriptor: updated with the effect descriptor. | ||
1261 | 883 | // | ||
1262 | 884 | //////////////////////////////////////////////////////////////////////////////// | ||
1263 | 885 | int32_t (*get_descriptor)(effect_uuid_t *uuid, | ||
1264 | 886 | effect_descriptor_t *pDescriptor); | ||
1265 | 887 | } audio_effect_library_t; | ||
1266 | 888 | |||
1267 | 889 | // Name of the hal_module_info | ||
1268 | 890 | #define AUDIO_EFFECT_LIBRARY_INFO_SYM AELI | ||
1269 | 891 | |||
1270 | 892 | // Name of the hal_module_info as a string | ||
1271 | 893 | #define AUDIO_EFFECT_LIBRARY_INFO_SYM_AS_STR "AELI" | ||
1272 | 894 | |||
1273 | 895 | __END_DECLS | ||
1274 | 896 | |||
1275 | 897 | #endif // ANDROID_AUDIO_EFFECT_H | ||
1276 | 898 | 0 | ||
1277 | === removed file '3rd_party/android-deps/hardware/audio_policy.h' | |||
1278 | --- 3rd_party/android-deps/hardware/audio_policy.h 2013-01-08 17:44:16 +0000 | |||
1279 | +++ 3rd_party/android-deps/hardware/audio_policy.h 1970-01-01 00:00:00 +0000 | |||
1280 | @@ -1,386 +0,0 @@ | |||
1281 | 1 | /* | ||
1282 | 2 | * Copyright (C) 2011 The Android Open Source Project | ||
1283 | 3 | * | ||
1284 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
1285 | 5 | * you may not use this file except in compliance with the License. | ||
1286 | 6 | * You may obtain a copy of the License at | ||
1287 | 7 | * | ||
1288 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
1289 | 9 | * | ||
1290 | 10 | * Unless required by applicable law or agreed to in writing, software | ||
1291 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
1292 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
1293 | 13 | * See the License for the specific language governing permissions and | ||
1294 | 14 | * limitations under the License. | ||
1295 | 15 | */ | ||
1296 | 16 | |||
1297 | 17 | |||
1298 | 18 | #ifndef ANDROID_AUDIO_POLICY_INTERFACE_H | ||
1299 | 19 | #define ANDROID_AUDIO_POLICY_INTERFACE_H | ||
1300 | 20 | |||
1301 | 21 | #include <stdint.h> | ||
1302 | 22 | #include <sys/cdefs.h> | ||
1303 | 23 | #include <sys/types.h> | ||
1304 | 24 | |||
1305 | 25 | #include <hardware/hardware.h> | ||
1306 | 26 | |||
1307 | 27 | #include <system/audio.h> | ||
1308 | 28 | #include <system/audio_policy.h> | ||
1309 | 29 | |||
1310 | 30 | __BEGIN_DECLS | ||
1311 | 31 | |||
1312 | 32 | /** | ||
1313 | 33 | * The id of this module | ||
1314 | 34 | */ | ||
1315 | 35 | #define AUDIO_POLICY_HARDWARE_MODULE_ID "audio_policy" | ||
1316 | 36 | |||
1317 | 37 | /** | ||
1318 | 38 | * Name of the audio devices to open | ||
1319 | 39 | */ | ||
1320 | 40 | #define AUDIO_POLICY_INTERFACE "policy" | ||
1321 | 41 | |||
1322 | 42 | /* ---------------------------------------------------------------------------- */ | ||
1323 | 43 | |||
1324 | 44 | /* | ||
1325 | 45 | * The audio_policy and audio_policy_service_ops structs define the | ||
1326 | 46 | * communication interfaces between the platform specific audio policy manager | ||
1327 | 47 | * and Android generic audio policy manager. | ||
1328 | 48 | * The platform specific audio policy manager must implement methods of the | ||
1329 | 49 | * audio_policy struct. | ||
1330 | 50 | * This implementation makes use of the audio_policy_service_ops to control | ||
1331 | 51 | * the activity and configuration of audio input and output streams. | ||
1332 | 52 | * | ||
1333 | 53 | * The platform specific audio policy manager is in charge of the audio | ||
1334 | 54 | * routing and volume control policies for a given platform. | ||
1335 | 55 | * The main roles of this module are: | ||
1336 | 56 | * - keep track of current system state (removable device connections, phone | ||
1337 | 57 | * state, user requests...). | ||
1338 | 58 | * System state changes and user actions are notified to audio policy | ||
1339 | 59 | * manager with methods of the audio_policy. | ||
1340 | 60 | * | ||
1341 | 61 | * - process get_output() queries received when AudioTrack objects are | ||
1342 | 62 | * created: Those queries return a handler on an output that has been | ||
1343 | 63 | * selected, configured and opened by the audio policy manager and that | ||
1344 | 64 | * must be used by the AudioTrack when registering to the AudioFlinger | ||
1345 | 65 | * with the createTrack() method. | ||
1346 | 66 | * When the AudioTrack object is released, a release_output() query | ||
1347 | 67 | * is received and the audio policy manager can decide to close or | ||
1348 | 68 | * reconfigure the output depending on other streams using this output and | ||
1349 | 69 | * current system state. | ||
1350 | 70 | * | ||
1351 | 71 | * - similarly process get_input() and release_input() queries received from | ||
1352 | 72 | * AudioRecord objects and configure audio inputs. | ||
1353 | 73 | * - process volume control requests: the stream volume is converted from | ||
1354 | 74 | * an index value (received from UI) to a float value applicable to each | ||
1355 | 75 | * output as a function of platform specific settings and current output | ||
1356 | 76 | * route (destination device). It also make sure that streams are not | ||
1357 | 77 | * muted if not allowed (e.g. camera shutter sound in some countries). | ||
1358 | 78 | */ | ||
1359 | 79 | |||
1360 | 80 | /* XXX: this should be defined OUTSIDE of frameworks/base */ | ||
1361 | 81 | struct effect_descriptor_s; | ||
1362 | 82 | |||
1363 | 83 | struct audio_policy { | ||
1364 | 84 | /* | ||
1365 | 85 | * configuration functions | ||
1366 | 86 | */ | ||
1367 | 87 | |||
1368 | 88 | /* indicate a change in device connection status */ | ||
1369 | 89 | int (*set_device_connection_state)(struct audio_policy *pol, | ||
1370 | 90 | audio_devices_t device, | ||
1371 | 91 | audio_policy_dev_state_t state, | ||
1372 | 92 | const char *device_address); | ||
1373 | 93 | |||
1374 | 94 | /* retreive a device connection status */ | ||
1375 | 95 | audio_policy_dev_state_t (*get_device_connection_state)( | ||
1376 | 96 | const struct audio_policy *pol, | ||
1377 | 97 | audio_devices_t device, | ||
1378 | 98 | const char *device_address); | ||
1379 | 99 | |||
1380 | 100 | /* indicate a change in phone state. Valid phones states are defined | ||
1381 | 101 | * by audio_mode_t */ | ||
1382 | 102 | void (*set_phone_state)(struct audio_policy *pol, int state); | ||
1383 | 103 | |||
1384 | 104 | /* indicate a change in ringer mode */ | ||
1385 | 105 | void (*set_ringer_mode)(struct audio_policy *pol, uint32_t mode, | ||
1386 | 106 | uint32_t mask); | ||
1387 | 107 | |||
1388 | 108 | /* force using a specific device category for the specified usage */ | ||
1389 | 109 | void (*set_force_use)(struct audio_policy *pol, | ||
1390 | 110 | audio_policy_force_use_t usage, | ||
1391 | 111 | audio_policy_forced_cfg_t config); | ||
1392 | 112 | |||
1393 | 113 | /* retreive current device category forced for a given usage */ | ||
1394 | 114 | audio_policy_forced_cfg_t (*get_force_use)(const struct audio_policy *pol, | ||
1395 | 115 | audio_policy_force_use_t usage); | ||
1396 | 116 | |||
1397 | 117 | /* if can_mute is true, then audio streams that are marked ENFORCED_AUDIBLE | ||
1398 | 118 | * can still be muted. */ | ||
1399 | 119 | void (*set_can_mute_enforced_audible)(struct audio_policy *pol, | ||
1400 | 120 | bool can_mute); | ||
1401 | 121 | |||
1402 | 122 | /* check proper initialization */ | ||
1403 | 123 | int (*init_check)(const struct audio_policy *pol); | ||
1404 | 124 | |||
1405 | 125 | /* | ||
1406 | 126 | * Audio routing query functions | ||
1407 | 127 | */ | ||
1408 | 128 | |||
1409 | 129 | /* request an output appriate for playback of the supplied stream type and | ||
1410 | 130 | * parameters */ | ||
1411 | 131 | audio_io_handle_t (*get_output)(struct audio_policy *pol, | ||
1412 | 132 | audio_stream_type_t stream, | ||
1413 | 133 | uint32_t samplingRate, | ||
1414 | 134 | uint32_t format, | ||
1415 | 135 | uint32_t channels, | ||
1416 | 136 | audio_policy_output_flags_t flags); | ||
1417 | 137 | |||
1418 | 138 | /* indicates to the audio policy manager that the output starts being used | ||
1419 | 139 | * by corresponding stream. */ | ||
1420 | 140 | int (*start_output)(struct audio_policy *pol, | ||
1421 | 141 | audio_io_handle_t output, | ||
1422 | 142 | audio_stream_type_t stream, | ||
1423 | 143 | int session); | ||
1424 | 144 | |||
1425 | 145 | /* indicates to the audio policy manager that the output stops being used | ||
1426 | 146 | * by corresponding stream. */ | ||
1427 | 147 | int (*stop_output)(struct audio_policy *pol, | ||
1428 | 148 | audio_io_handle_t output, | ||
1429 | 149 | audio_stream_type_t stream, | ||
1430 | 150 | int session); | ||
1431 | 151 | |||
1432 | 152 | /* releases the output. */ | ||
1433 | 153 | void (*release_output)(struct audio_policy *pol, audio_io_handle_t output); | ||
1434 | 154 | |||
1435 | 155 | /* request an input appriate for record from the supplied device with | ||
1436 | 156 | * supplied parameters. */ | ||
1437 | 157 | audio_io_handle_t (*get_input)(struct audio_policy *pol, int inputSource, | ||
1438 | 158 | uint32_t samplingRate, | ||
1439 | 159 | uint32_t format, | ||
1440 | 160 | uint32_t channels, | ||
1441 | 161 | audio_in_acoustics_t acoustics); | ||
1442 | 162 | |||
1443 | 163 | /* indicates to the audio policy manager that the input starts being used */ | ||
1444 | 164 | int (*start_input)(struct audio_policy *pol, audio_io_handle_t input); | ||
1445 | 165 | |||
1446 | 166 | /* indicates to the audio policy manager that the input stops being used. */ | ||
1447 | 167 | int (*stop_input)(struct audio_policy *pol, audio_io_handle_t input); | ||
1448 | 168 | |||
1449 | 169 | /* releases the input. */ | ||
1450 | 170 | void (*release_input)(struct audio_policy *pol, audio_io_handle_t input); | ||
1451 | 171 | |||
1452 | 172 | /* | ||
1453 | 173 | * volume control functions | ||
1454 | 174 | */ | ||
1455 | 175 | |||
1456 | 176 | /* initialises stream volume conversion parameters by specifying volume | ||
1457 | 177 | * index range. */ | ||
1458 | 178 | void (*init_stream_volume)(struct audio_policy *pol, | ||
1459 | 179 | audio_stream_type_t stream, | ||
1460 | 180 | int index_min, | ||
1461 | 181 | int index_max); | ||
1462 | 182 | |||
1463 | 183 | /* sets the new stream volume at a level corresponding to the supplied | ||
1464 | 184 | * index */ | ||
1465 | 185 | int (*set_stream_volume_index)(struct audio_policy *pol, | ||
1466 | 186 | audio_stream_type_t stream, | ||
1467 | 187 | int index); | ||
1468 | 188 | |||
1469 | 189 | /* retreive current volume index for the specified stream */ | ||
1470 | 190 | int (*get_stream_volume_index)(const struct audio_policy *pol, | ||
1471 | 191 | audio_stream_type_t stream, | ||
1472 | 192 | int *index); | ||
1473 | 193 | |||
1474 | 194 | /* return the strategy corresponding to a given stream type */ | ||
1475 | 195 | uint32_t (*get_strategy_for_stream)(const struct audio_policy *pol, | ||
1476 | 196 | audio_stream_type_t stream); | ||
1477 | 197 | |||
1478 | 198 | /* return the enabled output devices for the given stream type */ | ||
1479 | 199 | uint32_t (*get_devices_for_stream)(const struct audio_policy *pol, | ||
1480 | 200 | audio_stream_type_t stream); | ||
1481 | 201 | |||
1482 | 202 | /* Audio effect management */ | ||
1483 | 203 | audio_io_handle_t (*get_output_for_effect)(struct audio_policy *pol, | ||
1484 | 204 | struct effect_descriptor_s *desc); | ||
1485 | 205 | |||
1486 | 206 | int (*register_effect)(struct audio_policy *pol, | ||
1487 | 207 | struct effect_descriptor_s *desc, | ||
1488 | 208 | audio_io_handle_t output, | ||
1489 | 209 | uint32_t strategy, | ||
1490 | 210 | int session, | ||
1491 | 211 | int id); | ||
1492 | 212 | |||
1493 | 213 | int (*unregister_effect)(struct audio_policy *pol, int id); | ||
1494 | 214 | |||
1495 | 215 | int (*set_effect_enabled)(struct audio_policy *pol, int id, bool enabled); | ||
1496 | 216 | |||
1497 | 217 | bool (*is_stream_active)(const struct audio_policy *pol, | ||
1498 | 218 | int stream, | ||
1499 | 219 | uint32_t in_past_ms); | ||
1500 | 220 | |||
1501 | 221 | /* dump state */ | ||
1502 | 222 | int (*dump)(const struct audio_policy *pol, int fd); | ||
1503 | 223 | }; | ||
1504 | 224 | |||
1505 | 225 | struct audio_policy_service_ops { | ||
1506 | 226 | /* | ||
1507 | 227 | * Audio output Control functions | ||
1508 | 228 | */ | ||
1509 | 229 | |||
1510 | 230 | /* Opens an audio output with the requested parameters. | ||
1511 | 231 | * | ||
1512 | 232 | * The parameter values can indicate to use the default values in case the | ||
1513 | 233 | * audio policy manager has no specific requirements for the output being | ||
1514 | 234 | * opened. | ||
1515 | 235 | * | ||
1516 | 236 | * When the function returns, the parameter values reflect the actual | ||
1517 | 237 | * values used by the audio hardware output stream. | ||
1518 | 238 | * | ||
1519 | 239 | * The audio policy manager can check if the proposed parameters are | ||
1520 | 240 | * suitable or not and act accordingly. | ||
1521 | 241 | */ | ||
1522 | 242 | audio_io_handle_t (*open_output)(void *service, | ||
1523 | 243 | uint32_t *pDevices, | ||
1524 | 244 | uint32_t *pSamplingRate, | ||
1525 | 245 | uint32_t *pFormat, | ||
1526 | 246 | uint32_t *pChannels, | ||
1527 | 247 | uint32_t *pLatencyMs, | ||
1528 | 248 | audio_policy_output_flags_t flags); | ||
1529 | 249 | |||
1530 | 250 | /* creates a special output that is duplicated to the two outputs passed as | ||
1531 | 251 | * arguments. The duplication is performed by | ||
1532 | 252 | * a special mixer thread in the AudioFlinger. | ||
1533 | 253 | */ | ||
1534 | 254 | audio_io_handle_t (*open_duplicate_output)(void *service, | ||
1535 | 255 | audio_io_handle_t output1, | ||
1536 | 256 | audio_io_handle_t output2); | ||
1537 | 257 | |||
1538 | 258 | /* closes the output stream */ | ||
1539 | 259 | int (*close_output)(void *service, audio_io_handle_t output); | ||
1540 | 260 | |||
1541 | 261 | /* suspends the output. | ||
1542 | 262 | * | ||
1543 | 263 | * When an output is suspended, the corresponding audio hardware output | ||
1544 | 264 | * stream is placed in standby and the AudioTracks attached to the mixer | ||
1545 | 265 | * thread are still processed but the output mix is discarded. | ||
1546 | 266 | */ | ||
1547 | 267 | int (*suspend_output)(void *service, audio_io_handle_t output); | ||
1548 | 268 | |||
1549 | 269 | /* restores a suspended output. */ | ||
1550 | 270 | int (*restore_output)(void *service, audio_io_handle_t output); | ||
1551 | 271 | |||
1552 | 272 | /* */ | ||
1553 | 273 | /* Audio input Control functions */ | ||
1554 | 274 | /* */ | ||
1555 | 275 | |||
1556 | 276 | /* opens an audio input */ | ||
1557 | 277 | audio_io_handle_t (*open_input)(void *service, | ||
1558 | 278 | uint32_t *pDevices, | ||
1559 | 279 | uint32_t *pSamplingRate, | ||
1560 | 280 | uint32_t *pFormat, | ||
1561 | 281 | uint32_t *pChannels, | ||
1562 | 282 | uint32_t acoustics); | ||
1563 | 283 | |||
1564 | 284 | /* closes an audio input */ | ||
1565 | 285 | int (*close_input)(void *service, audio_io_handle_t input); | ||
1566 | 286 | |||
1567 | 287 | /* */ | ||
1568 | 288 | /* misc control functions */ | ||
1569 | 289 | /* */ | ||
1570 | 290 | |||
1571 | 291 | /* set a stream volume for a particular output. | ||
1572 | 292 | * | ||
1573 | 293 | * For the same user setting, a given stream type can have different | ||
1574 | 294 | * volumes for each output (destination device) it is attached to. | ||
1575 | 295 | */ | ||
1576 | 296 | int (*set_stream_volume)(void *service, | ||
1577 | 297 | audio_stream_type_t stream, | ||
1578 | 298 | float volume, | ||
1579 | 299 | audio_io_handle_t output, | ||
1580 | 300 | int delay_ms); | ||
1581 | 301 | |||
1582 | 302 | /* reroute a given stream type to the specified output */ | ||
1583 | 303 | int (*set_stream_output)(void *service, | ||
1584 | 304 | audio_stream_type_t stream, | ||
1585 | 305 | audio_io_handle_t output); | ||
1586 | 306 | |||
1587 | 307 | /* function enabling to send proprietary informations directly from audio | ||
1588 | 308 | * policy manager to audio hardware interface. */ | ||
1589 | 309 | void (*set_parameters)(void *service, | ||
1590 | 310 | audio_io_handle_t io_handle, | ||
1591 | 311 | const char *kv_pairs, | ||
1592 | 312 | int delay_ms); | ||
1593 | 313 | |||
1594 | 314 | /* function enabling to receive proprietary informations directly from | ||
1595 | 315 | * audio hardware interface to audio policy manager. | ||
1596 | 316 | * | ||
1597 | 317 | * Returns a pointer to a heap allocated string. The caller is responsible | ||
1598 | 318 | * for freeing the memory for it. | ||
1599 | 319 | */ | ||
1600 | 320 | |||
1601 | 321 | char * (*get_parameters)(void *service, audio_io_handle_t io_handle, | ||
1602 | 322 | const char *keys); | ||
1603 | 323 | |||
1604 | 324 | /* request the playback of a tone on the specified stream. | ||
1605 | 325 | * used for instance to replace notification sounds when playing over a | ||
1606 | 326 | * telephony device during a phone call. | ||
1607 | 327 | */ | ||
1608 | 328 | int (*start_tone)(void *service, | ||
1609 | 329 | audio_policy_tone_t tone, | ||
1610 | 330 | audio_stream_type_t stream); | ||
1611 | 331 | |||
1612 | 332 | int (*stop_tone)(void *service); | ||
1613 | 333 | |||
1614 | 334 | /* set down link audio volume. */ | ||
1615 | 335 | int (*set_voice_volume)(void *service, | ||
1616 | 336 | float volume, | ||
1617 | 337 | int delay_ms); | ||
1618 | 338 | |||
1619 | 339 | /* move effect to the specified output */ | ||
1620 | 340 | int (*move_effects)(void *service, | ||
1621 | 341 | int session, | ||
1622 | 342 | audio_io_handle_t src_output, | ||
1623 | 343 | audio_io_handle_t dst_output); | ||
1624 | 344 | }; | ||
1625 | 345 | |||
1626 | 346 | /**********************************************************************/ | ||
1627 | 347 | |||
1628 | 348 | /** | ||
1629 | 349 | * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM | ||
1630 | 350 | * and the fields of this data structure must begin with hw_module_t | ||
1631 | 351 | * followed by module specific information. | ||
1632 | 352 | */ | ||
1633 | 353 | typedef struct audio_policy_module { | ||
1634 | 354 | struct hw_module_t common; | ||
1635 | 355 | } audio_policy_module_t; | ||
1636 | 356 | |||
1637 | 357 | struct audio_policy_device { | ||
1638 | 358 | struct hw_device_t common; | ||
1639 | 359 | |||
1640 | 360 | int (*create_audio_policy)(const struct audio_policy_device *device, | ||
1641 | 361 | struct audio_policy_service_ops *aps_ops, | ||
1642 | 362 | void *service, | ||
1643 | 363 | struct audio_policy **ap); | ||
1644 | 364 | |||
1645 | 365 | int (*destroy_audio_policy)(const struct audio_policy_device *device, | ||
1646 | 366 | struct audio_policy *ap); | ||
1647 | 367 | }; | ||
1648 | 368 | |||
1649 | 369 | /** convenience API for opening and closing a supported device */ | ||
1650 | 370 | |||
1651 | 371 | static inline int audio_policy_dev_open(const hw_module_t* module, | ||
1652 | 372 | struct audio_policy_device** device) | ||
1653 | 373 | { | ||
1654 | 374 | return module->methods->open(module, AUDIO_POLICY_INTERFACE, | ||
1655 | 375 | (hw_device_t**)device); | ||
1656 | 376 | } | ||
1657 | 377 | |||
1658 | 378 | static inline int audio_policy_dev_close(struct audio_policy_device* device) | ||
1659 | 379 | { | ||
1660 | 380 | return device->common.close(&device->common); | ||
1661 | 381 | } | ||
1662 | 382 | |||
1663 | 383 | |||
1664 | 384 | __END_DECLS | ||
1665 | 385 | |||
1666 | 386 | #endif // ANDROID_AUDIO_POLICY_INTERFACE_H | ||
1667 | 387 | 0 | ||
1668 | === removed file '3rd_party/android-deps/hardware/camera.h' | |||
1669 | --- 3rd_party/android-deps/hardware/camera.h 2013-01-08 17:44:16 +0000 | |||
1670 | +++ 3rd_party/android-deps/hardware/camera.h 1970-01-01 00:00:00 +0000 | |||
1671 | @@ -1,309 +0,0 @@ | |||
1672 | 1 | /* | ||
1673 | 2 | * Copyright (C) 2010-2011 The Android Open Source Project | ||
1674 | 3 | * | ||
1675 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
1676 | 5 | * you may not use this file except in compliance with the License. | ||
1677 | 6 | * You may obtain a copy of the License at | ||
1678 | 7 | * | ||
1679 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
1680 | 9 | * | ||
1681 | 10 | * Unless required by applicable law or agreed to in writing, software | ||
1682 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
1683 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
1684 | 13 | * See the License for the specific language governing permissions and | ||
1685 | 14 | * limitations under the License. | ||
1686 | 15 | */ | ||
1687 | 16 | |||
1688 | 17 | // FIXME: add well-defined names for cameras | ||
1689 | 18 | |||
1690 | 19 | #ifndef ANDROID_INCLUDE_CAMERA_H | ||
1691 | 20 | #define ANDROID_INCLUDE_CAMERA_H | ||
1692 | 21 | |||
1693 | 22 | #include <stdint.h> | ||
1694 | 23 | #include <sys/cdefs.h> | ||
1695 | 24 | #include <sys/types.h> | ||
1696 | 25 | #include <cutils/native_handle.h> | ||
1697 | 26 | #include <system/camera.h> | ||
1698 | 27 | #include <hardware/hardware.h> | ||
1699 | 28 | #include <hardware/gralloc.h> | ||
1700 | 29 | |||
1701 | 30 | __BEGIN_DECLS | ||
1702 | 31 | |||
1703 | 32 | /** | ||
1704 | 33 | * The id of this module | ||
1705 | 34 | */ | ||
1706 | 35 | #define CAMERA_HARDWARE_MODULE_ID "camera" | ||
1707 | 36 | |||
1708 | 37 | struct camera_info { | ||
1709 | 38 | /** | ||
1710 | 39 | * The direction that the camera faces to. It should be CAMERA_FACING_BACK | ||
1711 | 40 | * or CAMERA_FACING_FRONT. | ||
1712 | 41 | */ | ||
1713 | 42 | int facing; | ||
1714 | 43 | |||
1715 | 44 | /** | ||
1716 | 45 | * The orientation of the camera image. The value is the angle that the | ||
1717 | 46 | * camera image needs to be rotated clockwise so it shows correctly on the | ||
1718 | 47 | * display in its natural orientation. It should be 0, 90, 180, or 270. | ||
1719 | 48 | * | ||
1720 | 49 | * For example, suppose a device has a naturally tall screen. The | ||
1721 | 50 | * back-facing camera sensor is mounted in landscape. You are looking at | ||
1722 | 51 | * the screen. If the top side of the camera sensor is aligned with the | ||
1723 | 52 | * right edge of the screen in natural orientation, the value should be | ||
1724 | 53 | * 90. If the top side of a front-facing camera sensor is aligned with the | ||
1725 | 54 | * right of the screen, the value should be 270. | ||
1726 | 55 | */ | ||
1727 | 56 | int orientation; | ||
1728 | 57 | }; | ||
1729 | 58 | |||
1730 | 59 | typedef struct camera_module { | ||
1731 | 60 | hw_module_t common; | ||
1732 | 61 | int (*get_number_of_cameras)(void); | ||
1733 | 62 | int (*get_camera_info)(int camera_id, struct camera_info *info); | ||
1734 | 63 | } camera_module_t; | ||
1735 | 64 | |||
1736 | 65 | struct camera_memory; | ||
1737 | 66 | typedef void (*camera_release_memory)(struct camera_memory *mem); | ||
1738 | 67 | |||
1739 | 68 | typedef struct camera_memory { | ||
1740 | 69 | void *data; | ||
1741 | 70 | size_t size; | ||
1742 | 71 | void *handle; | ||
1743 | 72 | camera_release_memory release; | ||
1744 | 73 | } camera_memory_t; | ||
1745 | 74 | |||
1746 | 75 | typedef camera_memory_t* (*camera_request_memory)(int fd, size_t buf_size, unsigned int num_bufs, | ||
1747 | 76 | void *user); | ||
1748 | 77 | |||
1749 | 78 | typedef void (*camera_notify_callback)(int32_t msg_type, | ||
1750 | 79 | int32_t ext1, | ||
1751 | 80 | int32_t ext2, | ||
1752 | 81 | void *user); | ||
1753 | 82 | |||
1754 | 83 | typedef void (*camera_data_callback)(int32_t msg_type, | ||
1755 | 84 | const camera_memory_t *data, unsigned int index, | ||
1756 | 85 | camera_frame_metadata_t *metadata, void *user); | ||
1757 | 86 | |||
1758 | 87 | typedef void (*camera_data_timestamp_callback)(int64_t timestamp, | ||
1759 | 88 | int32_t msg_type, | ||
1760 | 89 | const camera_memory_t *data, unsigned int index, | ||
1761 | 90 | void *user); | ||
1762 | 91 | |||
1763 | 92 | #define HAL_CAMERA_PREVIEW_WINDOW_TAG 0xcafed00d | ||
1764 | 93 | |||
1765 | 94 | typedef struct preview_stream_ops { | ||
1766 | 95 | int (*dequeue_buffer)(struct preview_stream_ops* w, | ||
1767 | 96 | buffer_handle_t** buffer, int *stride); | ||
1768 | 97 | int (*enqueue_buffer)(struct preview_stream_ops* w, | ||
1769 | 98 | buffer_handle_t* buffer); | ||
1770 | 99 | int (*cancel_buffer)(struct preview_stream_ops* w, | ||
1771 | 100 | buffer_handle_t* buffer); | ||
1772 | 101 | int (*set_buffer_count)(struct preview_stream_ops* w, int count); | ||
1773 | 102 | int (*set_buffers_geometry)(struct preview_stream_ops* pw, | ||
1774 | 103 | int w, int h, int format); | ||
1775 | 104 | int (*set_crop)(struct preview_stream_ops *w, | ||
1776 | 105 | int left, int top, int right, int bottom); | ||
1777 | 106 | int (*set_usage)(struct preview_stream_ops* w, int usage); | ||
1778 | 107 | int (*set_swap_interval)(struct preview_stream_ops *w, int interval); | ||
1779 | 108 | int (*get_min_undequeued_buffer_count)(const struct preview_stream_ops *w, | ||
1780 | 109 | int *count); | ||
1781 | 110 | int (*lock_buffer)(struct preview_stream_ops* w, | ||
1782 | 111 | buffer_handle_t* buffer); | ||
1783 | 112 | } preview_stream_ops_t; | ||
1784 | 113 | |||
1785 | 114 | struct camera_device; | ||
1786 | 115 | typedef struct camera_device_ops { | ||
1787 | 116 | /** Set the ANativeWindow to which preview frames are sent */ | ||
1788 | 117 | int (*set_preview_window)(struct camera_device *, | ||
1789 | 118 | struct preview_stream_ops *window); | ||
1790 | 119 | |||
1791 | 120 | /** Set the notification and data callbacks */ | ||
1792 | 121 | void (*set_callbacks)(struct camera_device *, | ||
1793 | 122 | camera_notify_callback notify_cb, | ||
1794 | 123 | camera_data_callback data_cb, | ||
1795 | 124 | camera_data_timestamp_callback data_cb_timestamp, | ||
1796 | 125 | camera_request_memory get_memory, | ||
1797 | 126 | void *user); | ||
1798 | 127 | |||
1799 | 128 | /** | ||
1800 | 129 | * The following three functions all take a msg_type, which is a bitmask of | ||
1801 | 130 | * the messages defined in include/ui/Camera.h | ||
1802 | 131 | */ | ||
1803 | 132 | |||
1804 | 133 | /** | ||
1805 | 134 | * Enable a message, or set of messages. | ||
1806 | 135 | */ | ||
1807 | 136 | void (*enable_msg_type)(struct camera_device *, int32_t msg_type); | ||
1808 | 137 | |||
1809 | 138 | /** | ||
1810 | 139 | * Disable a message, or a set of messages. | ||
1811 | 140 | * | ||
1812 | 141 | * Once received a call to disableMsgType(CAMERA_MSG_VIDEO_FRAME), camera | ||
1813 | 142 | * HAL should not rely on its client to call releaseRecordingFrame() to | ||
1814 | 143 | * release video recording frames sent out by the cameral HAL before and | ||
1815 | 144 | * after the disableMsgType(CAMERA_MSG_VIDEO_FRAME) call. Camera HAL | ||
1816 | 145 | * clients must not modify/access any video recording frame after calling | ||
1817 | 146 | * disableMsgType(CAMERA_MSG_VIDEO_FRAME). | ||
1818 | 147 | */ | ||
1819 | 148 | void (*disable_msg_type)(struct camera_device *, int32_t msg_type); | ||
1820 | 149 | |||
1821 | 150 | /** | ||
1822 | 151 | * Query whether a message, or a set of messages, is enabled. Note that | ||
1823 | 152 | * this is operates as an AND, if any of the messages queried are off, this | ||
1824 | 153 | * will return false. | ||
1825 | 154 | */ | ||
1826 | 155 | int (*msg_type_enabled)(struct camera_device *, int32_t msg_type); | ||
1827 | 156 | |||
1828 | 157 | /** | ||
1829 | 158 | * Start preview mode. | ||
1830 | 159 | */ | ||
1831 | 160 | int (*start_preview)(struct camera_device *); | ||
1832 | 161 | |||
1833 | 162 | /** | ||
1834 | 163 | * Stop a previously started preview. | ||
1835 | 164 | */ | ||
1836 | 165 | void (*stop_preview)(struct camera_device *); | ||
1837 | 166 | |||
1838 | 167 | /** | ||
1839 | 168 | * Returns true if preview is enabled. | ||
1840 | 169 | */ | ||
1841 | 170 | int (*preview_enabled)(struct camera_device *); | ||
1842 | 171 | |||
1843 | 172 | /** | ||
1844 | 173 | * Request the camera HAL to store meta data or real YUV data in the video | ||
1845 | 174 | * buffers sent out via CAMERA_MSG_VIDEO_FRAME for a recording session. If | ||
1846 | 175 | * it is not called, the default camera HAL behavior is to store real YUV | ||
1847 | 176 | * data in the video buffers. | ||
1848 | 177 | * | ||
1849 | 178 | * This method should be called before startRecording() in order to be | ||
1850 | 179 | * effective. | ||
1851 | 180 | * | ||
1852 | 181 | * If meta data is stored in the video buffers, it is up to the receiver of | ||
1853 | 182 | * the video buffers to interpret the contents and to find the actual frame | ||
1854 | 183 | * data with the help of the meta data in the buffer. How this is done is | ||
1855 | 184 | * outside of the scope of this method. | ||
1856 | 185 | * | ||
1857 | 186 | * Some camera HALs may not support storing meta data in the video buffers, | ||
1858 | 187 | * but all camera HALs should support storing real YUV data in the video | ||
1859 | 188 | * buffers. If the camera HAL does not support storing the meta data in the | ||
1860 | 189 | * video buffers when it is requested to do do, INVALID_OPERATION must be | ||
1861 | 190 | * returned. It is very useful for the camera HAL to pass meta data rather | ||
1862 | 191 | * than the actual frame data directly to the video encoder, since the | ||
1863 | 192 | * amount of the uncompressed frame data can be very large if video size is | ||
1864 | 193 | * large. | ||
1865 | 194 | * | ||
1866 | 195 | * @param enable if true to instruct the camera HAL to store | ||
1867 | 196 | * meta data in the video buffers; false to instruct | ||
1868 | 197 | * the camera HAL to store real YUV data in the video | ||
1869 | 198 | * buffers. | ||
1870 | 199 | * | ||
1871 | 200 | * @return OK on success. | ||
1872 | 201 | */ | ||
1873 | 202 | int (*store_meta_data_in_buffers)(struct camera_device *, int enable); | ||
1874 | 203 | |||
1875 | 204 | /** | ||
1876 | 205 | * Start record mode. When a record image is available, a | ||
1877 | 206 | * CAMERA_MSG_VIDEO_FRAME message is sent with the corresponding | ||
1878 | 207 | * frame. Every record frame must be released by a camera HAL client via | ||
1879 | 208 | * releaseRecordingFrame() before the client calls | ||
1880 | 209 | * disableMsgType(CAMERA_MSG_VIDEO_FRAME). After the client calls | ||
1881 | 210 | * disableMsgType(CAMERA_MSG_VIDEO_FRAME), it is the camera HAL's | ||
1882 | 211 | * responsibility to manage the life-cycle of the video recording frames, | ||
1883 | 212 | * and the client must not modify/access any video recording frames. | ||
1884 | 213 | */ | ||
1885 | 214 | int (*start_recording)(struct camera_device *); | ||
1886 | 215 | |||
1887 | 216 | /** | ||
1888 | 217 | * Stop a previously started recording. | ||
1889 | 218 | */ | ||
1890 | 219 | void (*stop_recording)(struct camera_device *); | ||
1891 | 220 | |||
1892 | 221 | /** | ||
1893 | 222 | * Returns true if recording is enabled. | ||
1894 | 223 | */ | ||
1895 | 224 | int (*recording_enabled)(struct camera_device *); | ||
1896 | 225 | |||
1897 | 226 | /** | ||
1898 | 227 | * Release a record frame previously returned by CAMERA_MSG_VIDEO_FRAME. | ||
1899 | 228 | * | ||
1900 | 229 | * It is camera HAL client's responsibility to release video recording | ||
1901 | 230 | * frames sent out by the camera HAL before the camera HAL receives a call | ||
1902 | 231 | * to disableMsgType(CAMERA_MSG_VIDEO_FRAME). After it receives the call to | ||
1903 | 232 | * disableMsgType(CAMERA_MSG_VIDEO_FRAME), it is the camera HAL's | ||
1904 | 233 | * responsibility to manage the life-cycle of the video recording frames. | ||
1905 | 234 | */ | ||
1906 | 235 | void (*release_recording_frame)(struct camera_device *, | ||
1907 | 236 | const void *opaque); | ||
1908 | 237 | |||
1909 | 238 | /** | ||
1910 | 239 | * Start auto focus, the notification callback routine is called with | ||
1911 | 240 | * CAMERA_MSG_FOCUS once when focusing is complete. autoFocus() will be | ||
1912 | 241 | * called again if another auto focus is needed. | ||
1913 | 242 | */ | ||
1914 | 243 | int (*auto_focus)(struct camera_device *); | ||
1915 | 244 | |||
1916 | 245 | /** | ||
1917 | 246 | * Cancels auto-focus function. If the auto-focus is still in progress, | ||
1918 | 247 | * this function will cancel it. Whether the auto-focus is in progress or | ||
1919 | 248 | * not, this function will return the focus position to the default. If | ||
1920 | 249 | * the camera does not support auto-focus, this is a no-op. | ||
1921 | 250 | */ | ||
1922 | 251 | int (*cancel_auto_focus)(struct camera_device *); | ||
1923 | 252 | |||
1924 | 253 | /** | ||
1925 | 254 | * Take a picture. | ||
1926 | 255 | */ | ||
1927 | 256 | int (*take_picture)(struct camera_device *); | ||
1928 | 257 | |||
1929 | 258 | /** | ||
1930 | 259 | * Cancel a picture that was started with takePicture. Calling this method | ||
1931 | 260 | * when no picture is being taken is a no-op. | ||
1932 | 261 | */ | ||
1933 | 262 | int (*cancel_picture)(struct camera_device *); | ||
1934 | 263 | |||
1935 | 264 | /** | ||
1936 | 265 | * Set the camera parameters. This returns BAD_VALUE if any parameter is | ||
1937 | 266 | * invalid or not supported. | ||
1938 | 267 | */ | ||
1939 | 268 | int (*set_parameters)(struct camera_device *, const char *parms); | ||
1940 | 269 | |||
1941 | 270 | /** Retrieve the camera parameters. The buffer returned by the camera HAL | ||
1942 | 271 | must be returned back to it with put_parameters, if put_parameters | ||
1943 | 272 | is not NULL. | ||
1944 | 273 | */ | ||
1945 | 274 | char *(*get_parameters)(struct camera_device *); | ||
1946 | 275 | |||
1947 | 276 | /** The camera HAL uses its own memory to pass us the parameters when we | ||
1948 | 277 | call get_parameters. Use this function to return the memory back to | ||
1949 | 278 | the camera HAL, if put_parameters is not NULL. If put_parameters | ||
1950 | 279 | is NULL, then you have to use free() to release the memory. | ||
1951 | 280 | */ | ||
1952 | 281 | void (*put_parameters)(struct camera_device *, char *); | ||
1953 | 282 | |||
1954 | 283 | /** | ||
1955 | 284 | * Send command to camera driver. | ||
1956 | 285 | */ | ||
1957 | 286 | int (*send_command)(struct camera_device *, | ||
1958 | 287 | int32_t cmd, int32_t arg1, int32_t arg2); | ||
1959 | 288 | |||
1960 | 289 | /** | ||
1961 | 290 | * Release the hardware resources owned by this object. Note that this is | ||
1962 | 291 | * *not* done in the destructor. | ||
1963 | 292 | */ | ||
1964 | 293 | void (*release)(struct camera_device *); | ||
1965 | 294 | |||
1966 | 295 | /** | ||
1967 | 296 | * Dump state of the camera hardware | ||
1968 | 297 | */ | ||
1969 | 298 | int (*dump)(struct camera_device *, int fd); | ||
1970 | 299 | } camera_device_ops_t; | ||
1971 | 300 | |||
1972 | 301 | typedef struct camera_device { | ||
1973 | 302 | hw_device_t common; | ||
1974 | 303 | camera_device_ops_t *ops; | ||
1975 | 304 | void *priv; | ||
1976 | 305 | } camera_device_t; | ||
1977 | 306 | |||
1978 | 307 | __END_DECLS | ||
1979 | 308 | |||
1980 | 309 | #endif /* ANDROID_INCLUDE_CAMERA_H */ | ||
1981 | 310 | 0 | ||
1982 | === modified file '3rd_party/android-deps/hardware/fb.h' | |||
1983 | --- 3rd_party/android-deps/hardware/fb.h 2013-01-08 17:44:16 +0000 | |||
1984 | +++ 3rd_party/android-deps/hardware/fb.h 2013-03-06 00:16:21 +0000 | |||
1985 | @@ -64,7 +64,10 @@ | |||
1986 | 64 | /* max swap interval supported by this framebuffer */ | 64 | /* max swap interval supported by this framebuffer */ |
1987 | 65 | const int maxSwapInterval; | 65 | const int maxSwapInterval; |
1988 | 66 | 66 | ||
1990 | 67 | int reserved[8]; | 67 | /* Number of framebuffers supported*/ |
1991 | 68 | const int numFramebuffers; | ||
1992 | 69 | |||
1993 | 70 | int reserved[7]; | ||
1994 | 68 | 71 | ||
1995 | 69 | /* | 72 | /* |
1996 | 70 | * requests a specific swap-interval (same definition than EGL) | 73 | * requests a specific swap-interval (same definition than EGL) |
1997 | 71 | 74 | ||
1998 | === removed file '3rd_party/android-deps/hardware/gps.h' | |||
1999 | --- 3rd_party/android-deps/hardware/gps.h 2013-01-08 17:44:16 +0000 | |||
2000 | +++ 3rd_party/android-deps/hardware/gps.h 1970-01-01 00:00:00 +0000 | |||
2001 | @@ -1,679 +0,0 @@ | |||
2002 | 1 | /* | ||
2003 | 2 | * Copyright (C) 2010 The Android Open Source Project | ||
2004 | 3 | * | ||
2005 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
2006 | 5 | * you may not use this file except in compliance with the License. | ||
2007 | 6 | * You may obtain a copy of the License at | ||
2008 | 7 | * | ||
2009 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
2010 | 9 | * | ||
2011 | 10 | * Unless required by applicable law or agreed to in writing, software | ||
2012 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
2013 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
2014 | 13 | * See the License for the specific language governing permissions and | ||
2015 | 14 | * limitations under the License. | ||
2016 | 15 | */ | ||
2017 | 16 | |||
2018 | 17 | #ifndef ANDROID_INCLUDE_HARDWARE_GPS_H | ||
2019 | 18 | #define ANDROID_INCLUDE_HARDWARE_GPS_H | ||
2020 | 19 | |||
2021 | 20 | #include <stdint.h> | ||
2022 | 21 | #include <sys/cdefs.h> | ||
2023 | 22 | #include <sys/types.h> | ||
2024 | 23 | #include <pthread.h> | ||
2025 | 24 | |||
2026 | 25 | #include <hardware/hardware.h> | ||
2027 | 26 | |||
2028 | 27 | __BEGIN_DECLS | ||
2029 | 28 | |||
2030 | 29 | /** | ||
2031 | 30 | * The id of this module | ||
2032 | 31 | */ | ||
2033 | 32 | #define GPS_HARDWARE_MODULE_ID "gps" | ||
2034 | 33 | |||
2035 | 34 | |||
2036 | 35 | /** Milliseconds since January 1, 1970 */ | ||
2037 | 36 | typedef int64_t GpsUtcTime; | ||
2038 | 37 | |||
2039 | 38 | /** Maximum number of SVs for gps_sv_status_callback(). */ | ||
2040 | 39 | #define GPS_MAX_SVS 32 | ||
2041 | 40 | |||
2042 | 41 | /** Requested operational mode for GPS operation. */ | ||
2043 | 42 | typedef uint32_t GpsPositionMode; | ||
2044 | 43 | // IMPORTANT: Note that the following values must match | ||
2045 | 44 | // constants in GpsLocationProvider.java. | ||
2046 | 45 | /** Mode for running GPS standalone (no assistance). */ | ||
2047 | 46 | #define GPS_POSITION_MODE_STANDALONE 0 | ||
2048 | 47 | /** AGPS MS-Based mode. */ | ||
2049 | 48 | #define GPS_POSITION_MODE_MS_BASED 1 | ||
2050 | 49 | /** AGPS MS-Assisted mode. */ | ||
2051 | 50 | #define GPS_POSITION_MODE_MS_ASSISTED 2 | ||
2052 | 51 | |||
2053 | 52 | /** Requested recurrence mode for GPS operation. */ | ||
2054 | 53 | typedef uint32_t GpsPositionRecurrence; | ||
2055 | 54 | // IMPORTANT: Note that the following values must match | ||
2056 | 55 | // constants in GpsLocationProvider.java. | ||
2057 | 56 | /** Receive GPS fixes on a recurring basis at a specified period. */ | ||
2058 | 57 | #define GPS_POSITION_RECURRENCE_PERIODIC 0 | ||
2059 | 58 | /** Request a single shot GPS fix. */ | ||
2060 | 59 | #define GPS_POSITION_RECURRENCE_SINGLE 1 | ||
2061 | 60 | |||
2062 | 61 | /** GPS status event values. */ | ||
2063 | 62 | typedef uint16_t GpsStatusValue; | ||
2064 | 63 | // IMPORTANT: Note that the following values must match | ||
2065 | 64 | // constants in GpsLocationProvider.java. | ||
2066 | 65 | /** GPS status unknown. */ | ||
2067 | 66 | #define GPS_STATUS_NONE 0 | ||
2068 | 67 | /** GPS has begun navigating. */ | ||
2069 | 68 | #define GPS_STATUS_SESSION_BEGIN 1 | ||
2070 | 69 | /** GPS has stopped navigating. */ | ||
2071 | 70 | #define GPS_STATUS_SESSION_END 2 | ||
2072 | 71 | /** GPS has powered on but is not navigating. */ | ||
2073 | 72 | #define GPS_STATUS_ENGINE_ON 3 | ||
2074 | 73 | /** GPS is powered off. */ | ||
2075 | 74 | #define GPS_STATUS_ENGINE_OFF 4 | ||
2076 | 75 | |||
2077 | 76 | /** Flags to indicate which values are valid in a GpsLocation. */ | ||
2078 | 77 | typedef uint16_t GpsLocationFlags; | ||
2079 | 78 | // IMPORTANT: Note that the following values must match | ||
2080 | 79 | // constants in GpsLocationProvider.java. | ||
2081 | 80 | /** GpsLocation has valid latitude and longitude. */ | ||
2082 | 81 | #define GPS_LOCATION_HAS_LAT_LONG 0x0001 | ||
2083 | 82 | /** GpsLocation has valid altitude. */ | ||
2084 | 83 | #define GPS_LOCATION_HAS_ALTITUDE 0x0002 | ||
2085 | 84 | /** GpsLocation has valid speed. */ | ||
2086 | 85 | #define GPS_LOCATION_HAS_SPEED 0x0004 | ||
2087 | 86 | /** GpsLocation has valid bearing. */ | ||
2088 | 87 | #define GPS_LOCATION_HAS_BEARING 0x0008 | ||
2089 | 88 | /** GpsLocation has valid accuracy. */ | ||
2090 | 89 | #define GPS_LOCATION_HAS_ACCURACY 0x0010 | ||
2091 | 90 | |||
2092 | 91 | /** Flags for the gps_set_capabilities callback. */ | ||
2093 | 92 | |||
2094 | 93 | /** GPS HAL schedules fixes for GPS_POSITION_RECURRENCE_PERIODIC mode. | ||
2095 | 94 | If this is not set, then the framework will use 1000ms for min_interval | ||
2096 | 95 | and will start and call start() and stop() to schedule the GPS. | ||
2097 | 96 | */ | ||
2098 | 97 | #define GPS_CAPABILITY_SCHEDULING 0x0000001 | ||
2099 | 98 | /** GPS supports MS-Based AGPS mode */ | ||
2100 | 99 | #define GPS_CAPABILITY_MSB 0x0000002 | ||
2101 | 100 | /** GPS supports MS-Assisted AGPS mode */ | ||
2102 | 101 | #define GPS_CAPABILITY_MSA 0x0000004 | ||
2103 | 102 | /** GPS supports single-shot fixes */ | ||
2104 | 103 | #define GPS_CAPABILITY_SINGLE_SHOT 0x0000008 | ||
2105 | 104 | /** GPS supports on demand time injection */ | ||
2106 | 105 | #define GPS_CAPABILITY_ON_DEMAND_TIME 0x0000010 | ||
2107 | 106 | |||
2108 | 107 | /** Flags used to specify which aiding data to delete | ||
2109 | 108 | when calling delete_aiding_data(). */ | ||
2110 | 109 | typedef uint16_t GpsAidingData; | ||
2111 | 110 | // IMPORTANT: Note that the following values must match | ||
2112 | 111 | // constants in GpsLocationProvider.java. | ||
2113 | 112 | #define GPS_DELETE_EPHEMERIS 0x0001 | ||
2114 | 113 | #define GPS_DELETE_ALMANAC 0x0002 | ||
2115 | 114 | #define GPS_DELETE_POSITION 0x0004 | ||
2116 | 115 | #define GPS_DELETE_TIME 0x0008 | ||
2117 | 116 | #define GPS_DELETE_IONO 0x0010 | ||
2118 | 117 | #define GPS_DELETE_UTC 0x0020 | ||
2119 | 118 | #define GPS_DELETE_HEALTH 0x0040 | ||
2120 | 119 | #define GPS_DELETE_SVDIR 0x0080 | ||
2121 | 120 | #define GPS_DELETE_SVSTEER 0x0100 | ||
2122 | 121 | #define GPS_DELETE_SADATA 0x0200 | ||
2123 | 122 | #define GPS_DELETE_RTI 0x0400 | ||
2124 | 123 | #define GPS_DELETE_CELLDB_INFO 0x8000 | ||
2125 | 124 | #define GPS_DELETE_ALL 0xFFFF | ||
2126 | 125 | |||
2127 | 126 | /** AGPS type */ | ||
2128 | 127 | typedef uint16_t AGpsType; | ||
2129 | 128 | #define AGPS_TYPE_SUPL 1 | ||
2130 | 129 | #define AGPS_TYPE_C2K 2 | ||
2131 | 130 | |||
2132 | 131 | typedef uint16_t AGpsSetIDType; | ||
2133 | 132 | #define AGPS_SETID_TYPE_NONE 0 | ||
2134 | 133 | #define AGPS_SETID_TYPE_IMSI 1 | ||
2135 | 134 | #define AGPS_SETID_TYPE_MSISDN 2 | ||
2136 | 135 | |||
2137 | 136 | /** | ||
2138 | 137 | * String length constants | ||
2139 | 138 | */ | ||
2140 | 139 | #define GPS_NI_SHORT_STRING_MAXLEN 256 | ||
2141 | 140 | #define GPS_NI_LONG_STRING_MAXLEN 2048 | ||
2142 | 141 | |||
2143 | 142 | /** | ||
2144 | 143 | * GpsNiType constants | ||
2145 | 144 | */ | ||
2146 | 145 | typedef uint32_t GpsNiType; | ||
2147 | 146 | #define GPS_NI_TYPE_VOICE 1 | ||
2148 | 147 | #define GPS_NI_TYPE_UMTS_SUPL 2 | ||
2149 | 148 | #define GPS_NI_TYPE_UMTS_CTRL_PLANE 3 | ||
2150 | 149 | |||
2151 | 150 | /** | ||
2152 | 151 | * GpsNiNotifyFlags constants | ||
2153 | 152 | */ | ||
2154 | 153 | typedef uint32_t GpsNiNotifyFlags; | ||
2155 | 154 | /** NI requires notification */ | ||
2156 | 155 | #define GPS_NI_NEED_NOTIFY 0x0001 | ||
2157 | 156 | /** NI requires verification */ | ||
2158 | 157 | #define GPS_NI_NEED_VERIFY 0x0002 | ||
2159 | 158 | /** NI requires privacy override, no notification/minimal trace */ | ||
2160 | 159 | #define GPS_NI_PRIVACY_OVERRIDE 0x0004 | ||
2161 | 160 | |||
2162 | 161 | /** | ||
2163 | 162 | * GPS NI responses, used to define the response in | ||
2164 | 163 | * NI structures | ||
2165 | 164 | */ | ||
2166 | 165 | typedef int GpsUserResponseType; | ||
2167 | 166 | #define GPS_NI_RESPONSE_ACCEPT 1 | ||
2168 | 167 | #define GPS_NI_RESPONSE_DENY 2 | ||
2169 | 168 | #define GPS_NI_RESPONSE_NORESP 3 | ||
2170 | 169 | |||
2171 | 170 | /** | ||
2172 | 171 | * NI data encoding scheme | ||
2173 | 172 | */ | ||
2174 | 173 | typedef int GpsNiEncodingType; | ||
2175 | 174 | #define GPS_ENC_NONE 0 | ||
2176 | 175 | #define GPS_ENC_SUPL_GSM_DEFAULT 1 | ||
2177 | 176 | #define GPS_ENC_SUPL_UTF8 2 | ||
2178 | 177 | #define GPS_ENC_SUPL_UCS2 3 | ||
2179 | 178 | #define GPS_ENC_UNKNOWN -1 | ||
2180 | 179 | |||
2181 | 180 | /** AGPS status event values. */ | ||
2182 | 181 | typedef uint16_t AGpsStatusValue; | ||
2183 | 182 | /** GPS requests data connection for AGPS. */ | ||
2184 | 183 | #define GPS_REQUEST_AGPS_DATA_CONN 1 | ||
2185 | 184 | /** GPS releases the AGPS data connection. */ | ||
2186 | 185 | #define GPS_RELEASE_AGPS_DATA_CONN 2 | ||
2187 | 186 | /** AGPS data connection initiated */ | ||
2188 | 187 | #define GPS_AGPS_DATA_CONNECTED 3 | ||
2189 | 188 | /** AGPS data connection completed */ | ||
2190 | 189 | #define GPS_AGPS_DATA_CONN_DONE 4 | ||
2191 | 190 | /** AGPS data connection failed */ | ||
2192 | 191 | #define GPS_AGPS_DATA_CONN_FAILED 5 | ||
2193 | 192 | |||
2194 | 193 | #define AGPS_REF_LOCATION_TYPE_GSM_CELLID 1 | ||
2195 | 194 | #define AGPS_REF_LOCATION_TYPE_UMTS_CELLID 2 | ||
2196 | 195 | #define AGPS_REG_LOCATION_TYPE_MAC 3 | ||
2197 | 196 | |||
2198 | 197 | /** Network types for update_network_state "type" parameter */ | ||
2199 | 198 | #define AGPS_RIL_NETWORK_TYPE_MOBILE 0 | ||
2200 | 199 | #define AGPS_RIL_NETWORK_TYPE_WIFI 1 | ||
2201 | 200 | #define AGPS_RIL_NETWORK_TYPE_MOBILE_MMS 2 | ||
2202 | 201 | #define AGPS_RIL_NETWORK_TYPE_MOBILE_SUPL 3 | ||
2203 | 202 | #define AGPS_RIL_NETWORK_TTYPE_MOBILE_DUN 4 | ||
2204 | 203 | #define AGPS_RIL_NETWORK_TTYPE_MOBILE_HIPRI 5 | ||
2205 | 204 | #define AGPS_RIL_NETWORK_TTYPE_WIMAX 6 | ||
2206 | 205 | |||
2207 | 206 | /** | ||
2208 | 207 | * Name for the GPS XTRA interface. | ||
2209 | 208 | */ | ||
2210 | 209 | #define GPS_XTRA_INTERFACE "gps-xtra" | ||
2211 | 210 | |||
2212 | 211 | /** | ||
2213 | 212 | * Name for the GPS DEBUG interface. | ||
2214 | 213 | */ | ||
2215 | 214 | #define GPS_DEBUG_INTERFACE "gps-debug" | ||
2216 | 215 | |||
2217 | 216 | /** | ||
2218 | 217 | * Name for the AGPS interface. | ||
2219 | 218 | */ | ||
2220 | 219 | #define AGPS_INTERFACE "agps" | ||
2221 | 220 | |||
2222 | 221 | /** | ||
2223 | 222 | * Name for NI interface | ||
2224 | 223 | */ | ||
2225 | 224 | #define GPS_NI_INTERFACE "gps-ni" | ||
2226 | 225 | |||
2227 | 226 | /** | ||
2228 | 227 | * Name for the AGPS-RIL interface. | ||
2229 | 228 | */ | ||
2230 | 229 | #define AGPS_RIL_INTERFACE "agps_ril" | ||
2231 | 230 | |||
2232 | 231 | /** Represents a location. */ | ||
2233 | 232 | typedef struct { | ||
2234 | 233 | /** set to sizeof(GpsLocation) */ | ||
2235 | 234 | size_t size; | ||
2236 | 235 | /** Contains GpsLocationFlags bits. */ | ||
2237 | 236 | uint16_t flags; | ||
2238 | 237 | /** Represents latitude in degrees. */ | ||
2239 | 238 | double latitude; | ||
2240 | 239 | /** Represents longitude in degrees. */ | ||
2241 | 240 | double longitude; | ||
2242 | 241 | /** Represents altitude in meters above the WGS 84 reference | ||
2243 | 242 | * ellipsoid. */ | ||
2244 | 243 | double altitude; | ||
2245 | 244 | /** Represents speed in meters per second. */ | ||
2246 | 245 | float speed; | ||
2247 | 246 | /** Represents heading in degrees. */ | ||
2248 | 247 | float bearing; | ||
2249 | 248 | /** Represents expected accuracy in meters. */ | ||
2250 | 249 | float accuracy; | ||
2251 | 250 | /** Timestamp for the location fix. */ | ||
2252 | 251 | GpsUtcTime timestamp; | ||
2253 | 252 | } GpsLocation; | ||
2254 | 253 | |||
2255 | 254 | /** Represents the status. */ | ||
2256 | 255 | typedef struct { | ||
2257 | 256 | /** set to sizeof(GpsStatus) */ | ||
2258 | 257 | size_t size; | ||
2259 | 258 | GpsStatusValue status; | ||
2260 | 259 | } GpsStatus; | ||
2261 | 260 | |||
2262 | 261 | /** Represents SV information. */ | ||
2263 | 262 | typedef struct { | ||
2264 | 263 | /** set to sizeof(GpsSvInfo) */ | ||
2265 | 264 | size_t size; | ||
2266 | 265 | /** Pseudo-random number for the SV. */ | ||
2267 | 266 | int prn; | ||
2268 | 267 | /** Signal to noise ratio. */ | ||
2269 | 268 | float snr; | ||
2270 | 269 | /** Elevation of SV in degrees. */ | ||
2271 | 270 | float elevation; | ||
2272 | 271 | /** Azimuth of SV in degrees. */ | ||
2273 | 272 | float azimuth; | ||
2274 | 273 | } GpsSvInfo; | ||
2275 | 274 | |||
2276 | 275 | /** Represents SV status. */ | ||
2277 | 276 | typedef struct { | ||
2278 | 277 | /** set to sizeof(GpsSvStatus) */ | ||
2279 | 278 | size_t size; | ||
2280 | 279 | |||
2281 | 280 | /** Number of SVs currently visible. */ | ||
2282 | 281 | int num_svs; | ||
2283 | 282 | |||
2284 | 283 | /** Contains an array of SV information. */ | ||
2285 | 284 | GpsSvInfo sv_list[GPS_MAX_SVS]; | ||
2286 | 285 | |||
2287 | 286 | /** Represents a bit mask indicating which SVs | ||
2288 | 287 | * have ephemeris data. | ||
2289 | 288 | */ | ||
2290 | 289 | uint32_t ephemeris_mask; | ||
2291 | 290 | |||
2292 | 291 | /** Represents a bit mask indicating which SVs | ||
2293 | 292 | * have almanac data. | ||
2294 | 293 | */ | ||
2295 | 294 | uint32_t almanac_mask; | ||
2296 | 295 | |||
2297 | 296 | /** | ||
2298 | 297 | * Represents a bit mask indicating which SVs | ||
2299 | 298 | * were used for computing the most recent position fix. | ||
2300 | 299 | */ | ||
2301 | 300 | uint32_t used_in_fix_mask; | ||
2302 | 301 | } GpsSvStatus; | ||
2303 | 302 | |||
2304 | 303 | /* 2G and 3G */ | ||
2305 | 304 | /* In 3G lac is discarded */ | ||
2306 | 305 | typedef struct { | ||
2307 | 306 | uint16_t type; | ||
2308 | 307 | uint16_t mcc; | ||
2309 | 308 | uint16_t mnc; | ||
2310 | 309 | uint16_t lac; | ||
2311 | 310 | uint32_t cid; | ||
2312 | 311 | } AGpsRefLocationCellID; | ||
2313 | 312 | |||
2314 | 313 | typedef struct { | ||
2315 | 314 | uint8_t mac[6]; | ||
2316 | 315 | } AGpsRefLocationMac; | ||
2317 | 316 | |||
2318 | 317 | /** Represents ref locations */ | ||
2319 | 318 | typedef struct { | ||
2320 | 319 | uint16_t type; | ||
2321 | 320 | union { | ||
2322 | 321 | AGpsRefLocationCellID cellID; | ||
2323 | 322 | AGpsRefLocationMac mac; | ||
2324 | 323 | } u; | ||
2325 | 324 | } AGpsRefLocation; | ||
2326 | 325 | |||
2327 | 326 | /** Callback with location information. | ||
2328 | 327 | * Can only be called from a thread created by create_thread_cb. | ||
2329 | 328 | */ | ||
2330 | 329 | typedef void (* gps_location_callback)(GpsLocation* location); | ||
2331 | 330 | |||
2332 | 331 | /** Callback with status information. | ||
2333 | 332 | * Can only be called from a thread created by create_thread_cb. | ||
2334 | 333 | */ | ||
2335 | 334 | typedef void (* gps_status_callback)(GpsStatus* status); | ||
2336 | 335 | |||
2337 | 336 | /** Callback with SV status information. | ||
2338 | 337 | * Can only be called from a thread created by create_thread_cb. | ||
2339 | 338 | */ | ||
2340 | 339 | typedef void (* gps_sv_status_callback)(GpsSvStatus* sv_info); | ||
2341 | 340 | |||
2342 | 341 | /** Callback for reporting NMEA sentences. | ||
2343 | 342 | * Can only be called from a thread created by create_thread_cb. | ||
2344 | 343 | */ | ||
2345 | 344 | typedef void (* gps_nmea_callback)(GpsUtcTime timestamp, const char* nmea, int length); | ||
2346 | 345 | |||
2347 | 346 | /** Callback to inform framework of the GPS engine's capabilities. | ||
2348 | 347 | * Capability parameter is a bit field of GPS_CAPABILITY_* flags. | ||
2349 | 348 | */ | ||
2350 | 349 | typedef void (* gps_set_capabilities)(uint32_t capabilities); | ||
2351 | 350 | |||
2352 | 351 | /** Callback utility for acquiring the GPS wakelock. | ||
2353 | 352 | * This can be used to prevent the CPU from suspending while handling GPS events. | ||
2354 | 353 | */ | ||
2355 | 354 | typedef void (* gps_acquire_wakelock)(); | ||
2356 | 355 | |||
2357 | 356 | /** Callback utility for releasing the GPS wakelock. */ | ||
2358 | 357 | typedef void (* gps_release_wakelock)(); | ||
2359 | 358 | |||
2360 | 359 | /** Callback for requesting NTP time */ | ||
2361 | 360 | typedef void (* gps_request_utc_time)(); | ||
2362 | 361 | |||
2363 | 362 | /** Callback for creating a thread that can call into the Java framework code. | ||
2364 | 363 | * This must be used to create any threads that report events up to the framework. | ||
2365 | 364 | */ | ||
2366 | 365 | typedef pthread_t (* gps_create_thread)(const char* name, void (*start)(void *), void* arg); | ||
2367 | 366 | |||
2368 | 367 | /** GPS callback structure. */ | ||
2369 | 368 | typedef struct { | ||
2370 | 369 | /** set to sizeof(GpsCallbacks) */ | ||
2371 | 370 | size_t size; | ||
2372 | 371 | gps_location_callback location_cb; | ||
2373 | 372 | gps_status_callback status_cb; | ||
2374 | 373 | gps_sv_status_callback sv_status_cb; | ||
2375 | 374 | gps_nmea_callback nmea_cb; | ||
2376 | 375 | gps_set_capabilities set_capabilities_cb; | ||
2377 | 376 | gps_acquire_wakelock acquire_wakelock_cb; | ||
2378 | 377 | gps_release_wakelock release_wakelock_cb; | ||
2379 | 378 | gps_create_thread create_thread_cb; | ||
2380 | 379 | gps_request_utc_time request_utc_time_cb; | ||
2381 | 380 | } GpsCallbacks; | ||
2382 | 381 | |||
2383 | 382 | |||
2384 | 383 | /** Represents the standard GPS interface. */ | ||
2385 | 384 | typedef struct { | ||
2386 | 385 | /** set to sizeof(GpsInterface) */ | ||
2387 | 386 | size_t size; | ||
2388 | 387 | /** | ||
2389 | 388 | * Opens the interface and provides the callback routines | ||
2390 | 389 | * to the implemenation of this interface. | ||
2391 | 390 | */ | ||
2392 | 391 | int (*init)( GpsCallbacks* callbacks ); | ||
2393 | 392 | |||
2394 | 393 | /** Starts navigating. */ | ||
2395 | 394 | int (*start)( void ); | ||
2396 | 395 | |||
2397 | 396 | /** Stops navigating. */ | ||
2398 | 397 | int (*stop)( void ); | ||
2399 | 398 | |||
2400 | 399 | /** Closes the interface. */ | ||
2401 | 400 | void (*cleanup)( void ); | ||
2402 | 401 | |||
2403 | 402 | /** Injects the current time. */ | ||
2404 | 403 | int (*inject_time)(GpsUtcTime time, int64_t timeReference, | ||
2405 | 404 | int uncertainty); | ||
2406 | 405 | |||
2407 | 406 | /** Injects current location from another location provider | ||
2408 | 407 | * (typically cell ID). | ||
2409 | 408 | * latitude and longitude are measured in degrees | ||
2410 | 409 | * expected accuracy is measured in meters | ||
2411 | 410 | */ | ||
2412 | 411 | int (*inject_location)(double latitude, double longitude, float accuracy); | ||
2413 | 412 | |||
2414 | 413 | /** | ||
2415 | 414 | * Specifies that the next call to start will not use the | ||
2416 | 415 | * information defined in the flags. GPS_DELETE_ALL is passed for | ||
2417 | 416 | * a cold start. | ||
2418 | 417 | */ | ||
2419 | 418 | void (*delete_aiding_data)(GpsAidingData flags); | ||
2420 | 419 | |||
2421 | 420 | /** | ||
2422 | 421 | * min_interval represents the time between fixes in milliseconds. | ||
2423 | 422 | * preferred_accuracy represents the requested fix accuracy in meters. | ||
2424 | 423 | * preferred_time represents the requested time to first fix in milliseconds. | ||
2425 | 424 | */ | ||
2426 | 425 | int (*set_position_mode)(GpsPositionMode mode, GpsPositionRecurrence recurrence, | ||
2427 | 426 | uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time); | ||
2428 | 427 | |||
2429 | 428 | /** Get a pointer to extension information. */ | ||
2430 | 429 | const void* (*get_extension)(const char* name); | ||
2431 | 430 | } GpsInterface; | ||
2432 | 431 | |||
2433 | 432 | /** Callback to request the client to download XTRA data. | ||
2434 | 433 | * The client should download XTRA data and inject it by calling inject_xtra_data(). | ||
2435 | 434 | * Can only be called from a thread created by create_thread_cb. | ||
2436 | 435 | */ | ||
2437 | 436 | typedef void (* gps_xtra_download_request)(); | ||
2438 | 437 | |||
2439 | 438 | /** Callback structure for the XTRA interface. */ | ||
2440 | 439 | typedef struct { | ||
2441 | 440 | gps_xtra_download_request download_request_cb; | ||
2442 | 441 | gps_create_thread create_thread_cb; | ||
2443 | 442 | } GpsXtraCallbacks; | ||
2444 | 443 | |||
2445 | 444 | /** Extended interface for XTRA support. */ | ||
2446 | 445 | typedef struct { | ||
2447 | 446 | /** set to sizeof(GpsXtraInterface) */ | ||
2448 | 447 | size_t size; | ||
2449 | 448 | /** | ||
2450 | 449 | * Opens the XTRA interface and provides the callback routines | ||
2451 | 450 | * to the implemenation of this interface. | ||
2452 | 451 | */ | ||
2453 | 452 | int (*init)( GpsXtraCallbacks* callbacks ); | ||
2454 | 453 | /** Injects XTRA data into the GPS. */ | ||
2455 | 454 | int (*inject_xtra_data)( char* data, int length ); | ||
2456 | 455 | } GpsXtraInterface; | ||
2457 | 456 | |||
2458 | 457 | /** Extended interface for DEBUG support. */ | ||
2459 | 458 | typedef struct { | ||
2460 | 459 | /** set to sizeof(GpsDebugInterface) */ | ||
2461 | 460 | size_t size; | ||
2462 | 461 | |||
2463 | 462 | /** | ||
2464 | 463 | * This function should return any information that the native | ||
2465 | 464 | * implementation wishes to include in a bugreport. | ||
2466 | 465 | */ | ||
2467 | 466 | size_t (*get_internal_state)(char* buffer, size_t bufferSize); | ||
2468 | 467 | } GpsDebugInterface; | ||
2469 | 468 | |||
2470 | 469 | /** Represents the status of AGPS. */ | ||
2471 | 470 | typedef struct { | ||
2472 | 471 | /** set to sizeof(AGpsStatus) */ | ||
2473 | 472 | size_t size; | ||
2474 | 473 | |||
2475 | 474 | AGpsType type; | ||
2476 | 475 | AGpsStatusValue status; | ||
2477 | 476 | uint32_t ipaddr; | ||
2478 | 477 | } AGpsStatus; | ||
2479 | 478 | |||
2480 | 479 | /** Callback with AGPS status information. | ||
2481 | 480 | * Can only be called from a thread created by create_thread_cb. | ||
2482 | 481 | */ | ||
2483 | 482 | typedef void (* agps_status_callback)(AGpsStatus* status); | ||
2484 | 483 | |||
2485 | 484 | /** Callback structure for the AGPS interface. */ | ||
2486 | 485 | typedef struct { | ||
2487 | 486 | agps_status_callback status_cb; | ||
2488 | 487 | gps_create_thread create_thread_cb; | ||
2489 | 488 | } AGpsCallbacks; | ||
2490 | 489 | |||
2491 | 490 | |||
2492 | 491 | /** Extended interface for AGPS support. */ | ||
2493 | 492 | typedef struct { | ||
2494 | 493 | /** set to sizeof(AGpsInterface) */ | ||
2495 | 494 | size_t size; | ||
2496 | 495 | |||
2497 | 496 | /** | ||
2498 | 497 | * Opens the AGPS interface and provides the callback routines | ||
2499 | 498 | * to the implemenation of this interface. | ||
2500 | 499 | */ | ||
2501 | 500 | void (*init)( AGpsCallbacks* callbacks ); | ||
2502 | 501 | /** | ||
2503 | 502 | * Notifies that a data connection is available and sets | ||
2504 | 503 | * the name of the APN to be used for SUPL. | ||
2505 | 504 | */ | ||
2506 | 505 | int (*data_conn_open)( const char* apn ); | ||
2507 | 506 | /** | ||
2508 | 507 | * Notifies that the AGPS data connection has been closed. | ||
2509 | 508 | */ | ||
2510 | 509 | int (*data_conn_closed)(); | ||
2511 | 510 | /** | ||
2512 | 511 | * Notifies that a data connection is not available for AGPS. | ||
2513 | 512 | */ | ||
2514 | 513 | int (*data_conn_failed)(); | ||
2515 | 514 | /** | ||
2516 | 515 | * Sets the hostname and port for the AGPS server. | ||
2517 | 516 | */ | ||
2518 | 517 | int (*set_server)( AGpsType type, const char* hostname, int port ); | ||
2519 | 518 | } AGpsInterface; | ||
2520 | 519 | |||
2521 | 520 | |||
2522 | 521 | /** Represents an NI request */ | ||
2523 | 522 | typedef struct { | ||
2524 | 523 | /** set to sizeof(GpsNiNotification) */ | ||
2525 | 524 | size_t size; | ||
2526 | 525 | |||
2527 | 526 | /** | ||
2528 | 527 | * An ID generated by HAL to associate NI notifications and UI | ||
2529 | 528 | * responses | ||
2530 | 529 | */ | ||
2531 | 530 | int notification_id; | ||
2532 | 531 | |||
2533 | 532 | /** | ||
2534 | 533 | * An NI type used to distinguish different categories of NI | ||
2535 | 534 | * events, such as GPS_NI_TYPE_VOICE, GPS_NI_TYPE_UMTS_SUPL, ... | ||
2536 | 535 | */ | ||
2537 | 536 | GpsNiType ni_type; | ||
2538 | 537 | |||
2539 | 538 | /** | ||
2540 | 539 | * Notification/verification options, combinations of GpsNiNotifyFlags constants | ||
2541 | 540 | */ | ||
2542 | 541 | GpsNiNotifyFlags notify_flags; | ||
2543 | 542 | |||
2544 | 543 | /** | ||
2545 | 544 | * Timeout period to wait for user response. | ||
2546 | 545 | * Set to 0 for no time out limit. | ||
2547 | 546 | */ | ||
2548 | 547 | int timeout; | ||
2549 | 548 | |||
2550 | 549 | /** | ||
2551 | 550 | * Default response when time out. | ||
2552 | 551 | */ | ||
2553 | 552 | GpsUserResponseType default_response; | ||
2554 | 553 | |||
2555 | 554 | /** | ||
2556 | 555 | * Requestor ID | ||
2557 | 556 | */ | ||
2558 | 557 | char requestor_id[GPS_NI_SHORT_STRING_MAXLEN]; | ||
2559 | 558 | |||
2560 | 559 | /** | ||
2561 | 560 | * Notification message. It can also be used to store client_id in some cases | ||
2562 | 561 | */ | ||
2563 | 562 | char text[GPS_NI_LONG_STRING_MAXLEN]; | ||
2564 | 563 | |||
2565 | 564 | /** | ||
2566 | 565 | * Client name decoding scheme | ||
2567 | 566 | */ | ||
2568 | 567 | GpsNiEncodingType requestor_id_encoding; | ||
2569 | 568 | |||
2570 | 569 | /** | ||
2571 | 570 | * Client name decoding scheme | ||
2572 | 571 | */ | ||
2573 | 572 | GpsNiEncodingType text_encoding; | ||
2574 | 573 | |||
2575 | 574 | /** | ||
2576 | 575 | * A pointer to extra data. Format: | ||
2577 | 576 | * key_1 = value_1 | ||
2578 | 577 | * key_2 = value_2 | ||
2579 | 578 | */ | ||
2580 | 579 | char extras[GPS_NI_LONG_STRING_MAXLEN]; | ||
2581 | 580 | |||
2582 | 581 | } GpsNiNotification; | ||
2583 | 582 | |||
2584 | 583 | /** Callback with NI notification. | ||
2585 | 584 | * Can only be called from a thread created by create_thread_cb. | ||
2586 | 585 | */ | ||
2587 | 586 | typedef void (*gps_ni_notify_callback)(GpsNiNotification *notification); | ||
2588 | 587 | |||
2589 | 588 | /** GPS NI callback structure. */ | ||
2590 | 589 | typedef struct | ||
2591 | 590 | { | ||
2592 | 591 | /** | ||
2593 | 592 | * Sends the notification request from HAL to GPSLocationProvider. | ||
2594 | 593 | */ | ||
2595 | 594 | gps_ni_notify_callback notify_cb; | ||
2596 | 595 | gps_create_thread create_thread_cb; | ||
2597 | 596 | } GpsNiCallbacks; | ||
2598 | 597 | |||
2599 | 598 | /** | ||
2600 | 599 | * Extended interface for Network-initiated (NI) support. | ||
2601 | 600 | */ | ||
2602 | 601 | typedef struct | ||
2603 | 602 | { | ||
2604 | 603 | /** set to sizeof(GpsNiInterface) */ | ||
2605 | 604 | size_t size; | ||
2606 | 605 | |||
2607 | 606 | /** Registers the callbacks for HAL to use. */ | ||
2608 | 607 | void (*init) (GpsNiCallbacks *callbacks); | ||
2609 | 608 | |||
2610 | 609 | /** Sends a response to HAL. */ | ||
2611 | 610 | void (*respond) (int notif_id, GpsUserResponseType user_response); | ||
2612 | 611 | } GpsNiInterface; | ||
2613 | 612 | |||
2614 | 613 | struct gps_device_t { | ||
2615 | 614 | struct hw_device_t common; | ||
2616 | 615 | |||
2617 | 616 | /** | ||
2618 | 617 | * Set the provided lights to the provided values. | ||
2619 | 618 | * | ||
2620 | 619 | * Returns: 0 on succes, error code on failure. | ||
2621 | 620 | */ | ||
2622 | 621 | const GpsInterface* (*get_gps_interface)(struct gps_device_t* dev); | ||
2623 | 622 | }; | ||
2624 | 623 | |||
2625 | 624 | #define AGPS_RIL_REQUEST_SETID_IMSI (1<<0L) | ||
2626 | 625 | #define AGPS_RIL_REQUEST_SETID_MSISDN (1<<1L) | ||
2627 | 626 | |||
2628 | 627 | #define AGPS_RIL_REQUEST_REFLOC_CELLID (1<<0L) | ||
2629 | 628 | #define AGPS_RIL_REQUEST_REFLOC_MAC (1<<1L) | ||
2630 | 629 | |||
2631 | 630 | typedef void (*agps_ril_request_set_id)(uint32_t flags); | ||
2632 | 631 | typedef void (*agps_ril_request_ref_loc)(uint32_t flags); | ||
2633 | 632 | |||
2634 | 633 | typedef struct { | ||
2635 | 634 | agps_ril_request_set_id request_setid; | ||
2636 | 635 | agps_ril_request_ref_loc request_refloc; | ||
2637 | 636 | gps_create_thread create_thread_cb; | ||
2638 | 637 | } AGpsRilCallbacks; | ||
2639 | 638 | |||
2640 | 639 | /** Extended interface for AGPS_RIL support. */ | ||
2641 | 640 | typedef struct { | ||
2642 | 641 | /** set to sizeof(AGpsRilInterface) */ | ||
2643 | 642 | size_t size; | ||
2644 | 643 | /** | ||
2645 | 644 | * Opens the AGPS interface and provides the callback routines | ||
2646 | 645 | * to the implemenation of this interface. | ||
2647 | 646 | */ | ||
2648 | 647 | void (*init)( AGpsRilCallbacks* callbacks ); | ||
2649 | 648 | |||
2650 | 649 | /** | ||
2651 | 650 | * Sets the reference location. | ||
2652 | 651 | */ | ||
2653 | 652 | void (*set_ref_location) (const AGpsRefLocation *agps_reflocation, size_t sz_struct); | ||
2654 | 653 | /** | ||
2655 | 654 | * Sets the set ID. | ||
2656 | 655 | */ | ||
2657 | 656 | void (*set_set_id) (AGpsSetIDType type, const char* setid); | ||
2658 | 657 | |||
2659 | 658 | /** | ||
2660 | 659 | * Send network initiated message. | ||
2661 | 660 | */ | ||
2662 | 661 | void (*ni_message) (uint8_t *msg, size_t len); | ||
2663 | 662 | |||
2664 | 663 | /** | ||
2665 | 664 | * Notify GPS of network status changes. | ||
2666 | 665 | * These parameters match values in the android.net.NetworkInfo class. | ||
2667 | 666 | */ | ||
2668 | 667 | void (*update_network_state) (int connected, int type, int roaming, const char* extra_info); | ||
2669 | 668 | |||
2670 | 669 | /** | ||
2671 | 670 | * Notify GPS of network status changes. | ||
2672 | 671 | * These parameters match values in the android.net.NetworkInfo class. | ||
2673 | 672 | */ | ||
2674 | 673 | void (*update_network_availability) (int avaiable, const char* apn); | ||
2675 | 674 | } AGpsRilInterface; | ||
2676 | 675 | |||
2677 | 676 | __END_DECLS | ||
2678 | 677 | |||
2679 | 678 | #endif /* ANDROID_INCLUDE_HARDWARE_GPS_H */ | ||
2680 | 679 | |||
2681 | 680 | 0 | ||
2682 | === modified file '3rd_party/android-deps/hardware/gralloc.h' | |||
2683 | --- 3rd_party/android-deps/hardware/gralloc.h 2013-01-08 17:44:16 +0000 | |||
2684 | +++ 3rd_party/android-deps/hardware/gralloc.h 2013-03-06 00:16:21 +0000 | |||
2685 | @@ -76,16 +76,16 @@ | |||
2686 | 76 | GRALLOC_USAGE_HW_FB = 0x00001000, | 76 | GRALLOC_USAGE_HW_FB = 0x00001000, |
2687 | 77 | /* buffer will be used with the HW video encoder */ | 77 | /* buffer will be used with the HW video encoder */ |
2688 | 78 | GRALLOC_USAGE_HW_VIDEO_ENCODER = 0x00010000, | 78 | GRALLOC_USAGE_HW_VIDEO_ENCODER = 0x00010000, |
2689 | 79 | /* buffer will be written by the HW camera pipeline */ | ||
2690 | 80 | GRALLOC_USAGE_HW_CAMERA_WRITE = 0x00020000, | ||
2691 | 81 | /* buffer will be read by the HW camera pipeline */ | ||
2692 | 82 | GRALLOC_USAGE_HW_CAMERA_READ = 0x00040000, | ||
2693 | 83 | /* buffer will be used as part of zero-shutter-lag queue */ | ||
2694 | 84 | GRALLOC_USAGE_HW_CAMERA_ZSL = 0x00060000, | ||
2695 | 85 | /* mask for the camera access values */ | ||
2696 | 86 | GRALLOC_USAGE_HW_CAMERA_MASK = 0x00060000, | ||
2697 | 79 | /* mask for the software usage bit-mask */ | 87 | /* mask for the software usage bit-mask */ |
2707 | 80 | GRALLOC_USAGE_HW_MASK = 0x00011F00, | 88 | GRALLOC_USAGE_HW_MASK = 0x00071F00, |
2699 | 81 | |||
2700 | 82 | #ifdef SAMSUNG_CODEC_SUPPORT | ||
2701 | 83 | GRALLOC_USAGE_HW_FIMC1 = 0x01000000, | ||
2702 | 84 | GRALLOC_USAGE_HW_ION = 0x02000000, | ||
2703 | 85 | GRALLOC_USAGE_YUV_ADDR = 0x04000000, | ||
2704 | 86 | /* SEC Private usage , for Overlay path at HWC */ | ||
2705 | 87 | GRALLOC_USAGE_HWC_HWOVERLAY = 0x20000000, | ||
2706 | 88 | #endif | ||
2708 | 89 | 89 | ||
2709 | 90 | /* buffer should be displayed full-screen on an external display when | 90 | /* buffer should be displayed full-screen on an external display when |
2710 | 91 | * possible | 91 | * possible |
2711 | @@ -106,8 +106,26 @@ | |||
2712 | 106 | GRALLOC_USAGE_PRIVATE_2 = 0x40000000, | 106 | GRALLOC_USAGE_PRIVATE_2 = 0x40000000, |
2713 | 107 | GRALLOC_USAGE_PRIVATE_3 = 0x80000000, | 107 | GRALLOC_USAGE_PRIVATE_3 = 0x80000000, |
2714 | 108 | GRALLOC_USAGE_PRIVATE_MASK = 0xF0000000, | 108 | GRALLOC_USAGE_PRIVATE_MASK = 0xF0000000, |
2717 | 109 | }; | 109 | |
2718 | 110 | 110 | #ifdef EXYNOS4_ENHANCEMENTS | |
2719 | 111 | /* SAMSUNG */ | ||
2720 | 112 | GRALLOC_USAGE_PRIVATE_NONECACHE = 0x00800000, | ||
2721 | 113 | |||
2722 | 114 | GRALLOC_USAGE_HW_FIMC1 = 0x01000000, | ||
2723 | 115 | GRALLOC_USAGE_HW_ION = 0x02000000, | ||
2724 | 116 | GRALLOC_USAGE_YUV_ADDR = 0x04000000, | ||
2725 | 117 | GRALLOC_USAGE_CAMERA = 0x08000000, | ||
2726 | 118 | |||
2727 | 119 | /* SEC Private usage , for Overlay path at HWC */ | ||
2728 | 120 | GRALLOC_USAGE_HWC_HWOVERLAY = 0x20000000, | ||
2729 | 121 | #endif | ||
2730 | 122 | }; | ||
2731 | 123 | |||
2732 | 124 | enum { | ||
2733 | 125 | /* Gralloc perform enums */ | ||
2734 | 126 | GRALLOC_MODULE_PERFORM_UPDATE_BUFFER_GEOMETRY = 0, | ||
2735 | 127 | GRALLOC_MODULE_PERFORM_PRIVATE_START | ||
2736 | 128 | }; | ||
2737 | 111 | /*****************************************************************************/ | 129 | /*****************************************************************************/ |
2738 | 112 | 130 | ||
2739 | 113 | /** | 131 | /** |
2740 | @@ -196,6 +214,10 @@ | |||
2741 | 196 | int (*unlock)(struct gralloc_module_t const* module, | 214 | int (*unlock)(struct gralloc_module_t const* module, |
2742 | 197 | buffer_handle_t handle); | 215 | buffer_handle_t handle); |
2743 | 198 | 216 | ||
2744 | 217 | #ifdef EXYNOS4_ENHANCEMENTS | ||
2745 | 218 | int (*getphys) (struct gralloc_module_t const* module, | ||
2746 | 219 | buffer_handle_t handle, void** paddr); | ||
2747 | 220 | #endif | ||
2748 | 199 | 221 | ||
2749 | 200 | /* reserved for future use */ | 222 | /* reserved for future use */ |
2750 | 201 | int (*perform)(struct gralloc_module_t const* module, | 223 | int (*perform)(struct gralloc_module_t const* module, |
2751 | @@ -215,6 +237,21 @@ | |||
2752 | 215 | typedef struct alloc_device_t { | 237 | typedef struct alloc_device_t { |
2753 | 216 | struct hw_device_t common; | 238 | struct hw_device_t common; |
2754 | 217 | 239 | ||
2755 | 240 | #ifdef QCOM_HARDWARE | ||
2756 | 241 | /* | ||
2757 | 242 | * (*allocSize)() Allocates a buffer in graphic memory with the requested | ||
2758 | 243 | * bufferSize parameter and returns a buffer_handle_t and the stride in | ||
2759 | 244 | * pixels to allow the implementation to satisfy hardware constraints on | ||
2760 | 245 | * the width of a pixmap (eg: it may have to be multiple of 8 pixels). | ||
2761 | 246 | * The CALLER TAKES OWNERSHIP of the buffer_handle_t. | ||
2762 | 247 | * | ||
2763 | 248 | * Returns 0 on success or -errno on error. | ||
2764 | 249 | */ | ||
2765 | 250 | int (*allocSize)(struct alloc_device_t* dev, | ||
2766 | 251 | int w, int h, int format, int usage, | ||
2767 | 252 | buffer_handle_t* handle, int* stride, int bufferSize); | ||
2768 | 253 | #endif | ||
2769 | 254 | |||
2770 | 218 | /* | 255 | /* |
2771 | 219 | * (*alloc)() Allocates a buffer in graphic memory with the requested | 256 | * (*alloc)() Allocates a buffer in graphic memory with the requested |
2772 | 220 | * parameters and returns a buffer_handle_t and the stride in pixels to | 257 | * parameters and returns a buffer_handle_t and the stride in pixels to |
2773 | @@ -266,4 +303,4 @@ | |||
2774 | 266 | 303 | ||
2775 | 267 | __END_DECLS | 304 | __END_DECLS |
2776 | 268 | 305 | ||
2778 | 269 | #endif // ANDROID_ALLOC_INTERFACE_H | 306 | #endif // ANDROID_GRALLOC_INTERFACE_H |
2779 | 270 | 307 | ||
2780 | === modified file '3rd_party/android-deps/hardware/hardware.h' | |||
2781 | --- 3rd_party/android-deps/hardware/hardware.h 2013-01-08 17:44:16 +0000 | |||
2782 | +++ 3rd_party/android-deps/hardware/hardware.h 2013-03-06 00:16:21 +0000 | |||
2783 | @@ -33,6 +33,60 @@ | |||
2784 | 33 | 33 | ||
2785 | 34 | #define HARDWARE_MODULE_TAG MAKE_TAG_CONSTANT('H', 'W', 'M', 'T') | 34 | #define HARDWARE_MODULE_TAG MAKE_TAG_CONSTANT('H', 'W', 'M', 'T') |
2786 | 35 | #define HARDWARE_DEVICE_TAG MAKE_TAG_CONSTANT('H', 'W', 'D', 'T') | 35 | #define HARDWARE_DEVICE_TAG MAKE_TAG_CONSTANT('H', 'W', 'D', 'T') |
2787 | 36 | #ifdef QCOM_HARDWARE | ||
2788 | 37 | #define IS_TARGET_MPQ(status) \ | ||
2789 | 38 | { \ | ||
2790 | 39 | int id = 0; \ | ||
2791 | 40 | FILE *fp; \ | ||
2792 | 41 | if ((fp = fopen("/sys/devices/system/soc/soc0/id", "r")) != NULL) { \ | ||
2793 | 42 | fscanf(fp, "%d", &id); \ | ||
2794 | 43 | fclose(fp); \ | ||
2795 | 44 | } \ | ||
2796 | 45 | if (id == 130) \ | ||
2797 | 46 | status = 1; \ | ||
2798 | 47 | else \ | ||
2799 | 48 | status = 0;\ | ||
2800 | 49 | } | ||
2801 | 50 | #endif | ||
2802 | 51 | #define HARDWARE_MAKE_API_VERSION(maj,min) \ | ||
2803 | 52 | ((((maj) & 0xff) << 8) | ((min) & 0xff)) | ||
2804 | 53 | |||
2805 | 54 | #define HARDWARE_MAKE_API_VERSION_2(maj,min,hdr) \ | ||
2806 | 55 | ((((maj) & 0xff) << 24) | (((min) & 0xff) << 16) | ((hdr) & 0xffff)) | ||
2807 | 56 | #define HARDWARE_API_VERSION_2_MAJ_MIN_MASK 0xffff0000 | ||
2808 | 57 | #define HARDWARE_API_VERSION_2_HEADER_MASK 0x0000ffff | ||
2809 | 58 | |||
2810 | 59 | |||
2811 | 60 | /* | ||
2812 | 61 | * The current HAL API version. | ||
2813 | 62 | * | ||
2814 | 63 | * All module implementations must set the hw_module_t.hal_api_version field | ||
2815 | 64 | * to this value when declaring the module with HAL_MODULE_INFO_SYM. | ||
2816 | 65 | * | ||
2817 | 66 | * Note that previous implementations have always set this field to 0. | ||
2818 | 67 | * Therefore, libhardware HAL API will always consider versions 0.0 and 1.0 | ||
2819 | 68 | * to be 100% binary compatible. | ||
2820 | 69 | * | ||
2821 | 70 | */ | ||
2822 | 71 | #define HARDWARE_HAL_API_VERSION HARDWARE_MAKE_API_VERSION(1, 0) | ||
2823 | 72 | |||
2824 | 73 | /* | ||
2825 | 74 | * Helper macros for module implementors. | ||
2826 | 75 | * | ||
2827 | 76 | * The derived modules should provide convenience macros for supported | ||
2828 | 77 | * versions so that implementations can explicitly specify module/device | ||
2829 | 78 | * versions at definition time. | ||
2830 | 79 | * | ||
2831 | 80 | * Use this macro to set the hw_module_t.module_api_version field. | ||
2832 | 81 | */ | ||
2833 | 82 | #define HARDWARE_MODULE_API_VERSION(maj,min) HARDWARE_MAKE_API_VERSION(maj,min) | ||
2834 | 83 | #define HARDWARE_MODULE_API_VERSION_2(maj,min,hdr) HARDWARE_MAKE_API_VERSION_2(maj,min,hdr) | ||
2835 | 84 | |||
2836 | 85 | /* | ||
2837 | 86 | * Use this macro to set the hw_device_t.version field | ||
2838 | 87 | */ | ||
2839 | 88 | #define HARDWARE_DEVICE_API_VERSION(maj,min) HARDWARE_MAKE_API_VERSION(maj,min) | ||
2840 | 89 | #define HARDWARE_DEVICE_API_VERSION_2(maj,min,hdr) HARDWARE_MAKE_API_VERSION_2(maj,min,hdr) | ||
2841 | 36 | 90 | ||
2842 | 37 | struct hw_module_t; | 91 | struct hw_module_t; |
2843 | 38 | struct hw_module_methods_t; | 92 | struct hw_module_methods_t; |
2844 | @@ -47,11 +101,47 @@ | |||
2845 | 47 | /** tag must be initialized to HARDWARE_MODULE_TAG */ | 101 | /** tag must be initialized to HARDWARE_MODULE_TAG */ |
2846 | 48 | uint32_t tag; | 102 | uint32_t tag; |
2847 | 49 | 103 | ||
2850 | 50 | /** major version number for the module */ | 104 | /** |
2851 | 51 | uint16_t version_major; | 105 | * The API version of the implemented module. The module owner is |
2852 | 106 | * responsible for updating the version when a module interface has | ||
2853 | 107 | * changed. | ||
2854 | 108 | * | ||
2855 | 109 | * The derived modules such as gralloc and audio own and manage this field. | ||
2856 | 110 | * The module user must interpret the version field to decide whether or | ||
2857 | 111 | * not to inter-operate with the supplied module implementation. | ||
2858 | 112 | * For example, SurfaceFlinger is responsible for making sure that | ||
2859 | 113 | * it knows how to manage different versions of the gralloc-module API, | ||
2860 | 114 | * and AudioFlinger must know how to do the same for audio-module API. | ||
2861 | 115 | * | ||
2862 | 116 | * The module API version should include a major and a minor component. | ||
2863 | 117 | * For example, version 1.0 could be represented as 0x0100. This format | ||
2864 | 118 | * implies that versions 0x0100-0x01ff are all API-compatible. | ||
2865 | 119 | * | ||
2866 | 120 | * In the future, libhardware will expose a hw_get_module_version() | ||
2867 | 121 | * (or equivalent) function that will take minimum/maximum supported | ||
2868 | 122 | * versions as arguments and would be able to reject modules with | ||
2869 | 123 | * versions outside of the supplied range. | ||
2870 | 124 | */ | ||
2871 | 125 | uint16_t module_api_version; | ||
2872 | 126 | #define version_major module_api_version | ||
2873 | 127 | /** | ||
2874 | 128 | * version_major/version_minor defines are supplied here for temporary | ||
2875 | 129 | * source code compatibility. They will be removed in the next version. | ||
2876 | 130 | * ALL clients must convert to the new version format. | ||
2877 | 131 | */ | ||
2878 | 52 | 132 | ||
2881 | 53 | /** minor version number of the module */ | 133 | /** |
2882 | 54 | uint16_t version_minor; | 134 | * The API version of the HAL module interface. This is meant to |
2883 | 135 | * version the hw_module_t, hw_module_methods_t, and hw_device_t | ||
2884 | 136 | * structures and definitions. | ||
2885 | 137 | * | ||
2886 | 138 | * The HAL interface owns this field. Module users/implementations | ||
2887 | 139 | * must NOT rely on this value for version information. | ||
2888 | 140 | * | ||
2889 | 141 | * Presently, 0 is the only valid value. | ||
2890 | 142 | */ | ||
2891 | 143 | uint16_t hal_api_version; | ||
2892 | 144 | #define version_minor hal_api_version | ||
2893 | 55 | 145 | ||
2894 | 56 | /** Identifier of module */ | 146 | /** Identifier of module */ |
2895 | 57 | const char *id; | 147 | const char *id; |
2896 | @@ -88,7 +178,22 @@ | |||
2897 | 88 | /** tag must be initialized to HARDWARE_DEVICE_TAG */ | 178 | /** tag must be initialized to HARDWARE_DEVICE_TAG */ |
2898 | 89 | uint32_t tag; | 179 | uint32_t tag; |
2899 | 90 | 180 | ||
2901 | 91 | /** version number for hw_device_t */ | 181 | /** |
2902 | 182 | * Version of the module-specific device API. This value is used by | ||
2903 | 183 | * the derived-module user to manage different device implementations. | ||
2904 | 184 | * | ||
2905 | 185 | * The module user is responsible for checking the module_api_version | ||
2906 | 186 | * and device version fields to ensure that the user is capable of | ||
2907 | 187 | * communicating with the specific module implementation. | ||
2908 | 188 | * | ||
2909 | 189 | * One module can support multiple devices with different versions. This | ||
2910 | 190 | * can be useful when a device interface changes in an incompatible way | ||
2911 | 191 | * but it is still necessary to support older implementations at the same | ||
2912 | 192 | * time. One such example is the Camera 2.0 API. | ||
2913 | 193 | * | ||
2914 | 194 | * This field is interpreted by the module user and is ignored by the | ||
2915 | 195 | * HAL interface itself. | ||
2916 | 196 | */ | ||
2917 | 92 | uint32_t version; | 197 | uint32_t version; |
2918 | 93 | 198 | ||
2919 | 94 | /** reference to the module this device belongs to */ | 199 | /** reference to the module this device belongs to */ |
2920 | 95 | 200 | ||
2921 | === modified file '3rd_party/android-deps/hardware/hwcomposer.h' | |||
2922 | --- 3rd_party/android-deps/hardware/hwcomposer.h 2013-01-08 17:44:16 +0000 | |||
2923 | +++ 3rd_party/android-deps/hardware/hwcomposer.h 2013-03-06 00:16:21 +0000 | |||
2924 | @@ -24,11 +24,30 @@ | |||
2925 | 24 | #include <hardware/hardware.h> | 24 | #include <hardware/hardware.h> |
2926 | 25 | #include <cutils/native_handle.h> | 25 | #include <cutils/native_handle.h> |
2927 | 26 | 26 | ||
2928 | 27 | #include <hardware/hwcomposer_defs.h> | ||
2929 | 28 | |||
2930 | 27 | __BEGIN_DECLS | 29 | __BEGIN_DECLS |
2931 | 28 | 30 | ||
2932 | 29 | /*****************************************************************************/ | 31 | /*****************************************************************************/ |
2933 | 30 | 32 | ||
2935 | 31 | #define HWC_API_VERSION 1 | 33 | /* for compatibility */ |
2936 | 34 | #define HWC_MODULE_API_VERSION HWC_MODULE_API_VERSION_0_1 | ||
2937 | 35 | #define HWC_DEVICE_API_VERSION HWC_DEVICE_API_VERSION_0_1 | ||
2938 | 36 | #define HWC_API_VERSION HWC_DEVICE_API_VERSION | ||
2939 | 37 | |||
2940 | 38 | /* Users of this header can define HWC_REMOVE_DEPRECATED_VERSIONS to test that | ||
2941 | 39 | * they still work with just the current version declared, before the | ||
2942 | 40 | * deprecated versions are actually removed. | ||
2943 | 41 | * | ||
2944 | 42 | * To find code that still depends on the old versions, set the #define to 1 | ||
2945 | 43 | * here. Code that explicitly sets it to zero (rather than simply not defining | ||
2946 | 44 | * it) will still see the old versions. | ||
2947 | 45 | */ | ||
2948 | 46 | #if !defined(HWC_REMOVE_DEPRECATED_VERSIONS) | ||
2949 | 47 | #define HWC_REMOVE_DEPRECATED_VERSIONS 0 | ||
2950 | 48 | #endif | ||
2951 | 49 | |||
2952 | 50 | /*****************************************************************************/ | ||
2953 | 32 | 51 | ||
2954 | 33 | /** | 52 | /** |
2955 | 34 | * The id of this module | 53 | * The id of this module |
2956 | @@ -40,89 +59,6 @@ | |||
2957 | 40 | */ | 59 | */ |
2958 | 41 | #define HWC_HARDWARE_COMPOSER "composer" | 60 | #define HWC_HARDWARE_COMPOSER "composer" |
2959 | 42 | 61 | ||
2960 | 43 | |||
2961 | 44 | enum { | ||
2962 | 45 | /* hwc_composer_device_t::set failed in EGL */ | ||
2963 | 46 | HWC_EGL_ERROR = -1 | ||
2964 | 47 | }; | ||
2965 | 48 | |||
2966 | 49 | /* | ||
2967 | 50 | * hwc_layer_t::hints values | ||
2968 | 51 | * Hints are set by the HAL and read by SurfaceFlinger | ||
2969 | 52 | */ | ||
2970 | 53 | enum { | ||
2971 | 54 | /* | ||
2972 | 55 | * HWC can set the HWC_HINT_TRIPLE_BUFFER hint to indicate to SurfaceFlinger | ||
2973 | 56 | * that it should triple buffer this layer. Typically HWC does this when | ||
2974 | 57 | * the layer will be unavailable for use for an extended period of time, | ||
2975 | 58 | * e.g. if the display will be fetching data directly from the layer and | ||
2976 | 59 | * the layer can not be modified until after the next set(). | ||
2977 | 60 | */ | ||
2978 | 61 | HWC_HINT_TRIPLE_BUFFER = 0x00000001, | ||
2979 | 62 | |||
2980 | 63 | /* | ||
2981 | 64 | * HWC sets HWC_HINT_CLEAR_FB to tell SurfaceFlinger that it should clear the | ||
2982 | 65 | * framebuffer with transparent pixels where this layer would be. | ||
2983 | 66 | * SurfaceFlinger will only honor this flag when the layer has no blending | ||
2984 | 67 | * | ||
2985 | 68 | */ | ||
2986 | 69 | HWC_HINT_CLEAR_FB = 0x00000002 | ||
2987 | 70 | }; | ||
2988 | 71 | |||
2989 | 72 | /* | ||
2990 | 73 | * hwc_layer_t::flags values | ||
2991 | 74 | * Flags are set by SurfaceFlinger and read by the HAL | ||
2992 | 75 | */ | ||
2993 | 76 | enum { | ||
2994 | 77 | /* | ||
2995 | 78 | * HWC_SKIP_LAYER is set by SurfaceFlnger to indicate that the HAL | ||
2996 | 79 | * shall not consider this layer for composition as it will be handled | ||
2997 | 80 | * by SurfaceFlinger (just as if compositionType was set to HWC_OVERLAY). | ||
2998 | 81 | */ | ||
2999 | 82 | HWC_SKIP_LAYER = 0x00000001, | ||
3000 | 83 | }; | ||
3001 | 84 | |||
3002 | 85 | /* | ||
3003 | 86 | * hwc_layer_t::compositionType values | ||
3004 | 87 | */ | ||
3005 | 88 | enum { | ||
3006 | 89 | /* this layer is to be drawn into the framebuffer by SurfaceFlinger */ | ||
3007 | 90 | HWC_FRAMEBUFFER = 0, | ||
3008 | 91 | |||
3009 | 92 | /* this layer will be handled in the HWC */ | ||
3010 | 93 | HWC_OVERLAY = 1, | ||
3011 | 94 | }; | ||
3012 | 95 | |||
3013 | 96 | /* | ||
3014 | 97 | * hwc_layer_t::blending values | ||
3015 | 98 | */ | ||
3016 | 99 | enum { | ||
3017 | 100 | /* no blending */ | ||
3018 | 101 | HWC_BLENDING_NONE = 0x0100, | ||
3019 | 102 | |||
3020 | 103 | /* ONE / ONE_MINUS_SRC_ALPHA */ | ||
3021 | 104 | HWC_BLENDING_PREMULT = 0x0105, | ||
3022 | 105 | |||
3023 | 106 | /* SRC_ALPHA / ONE_MINUS_SRC_ALPHA */ | ||
3024 | 107 | HWC_BLENDING_COVERAGE = 0x0405 | ||
3025 | 108 | }; | ||
3026 | 109 | |||
3027 | 110 | /* | ||
3028 | 111 | * hwc_layer_t::transform values | ||
3029 | 112 | */ | ||
3030 | 113 | enum { | ||
3031 | 114 | /* flip source image horizontally */ | ||
3032 | 115 | HWC_TRANSFORM_FLIP_H = HAL_TRANSFORM_FLIP_H, | ||
3033 | 116 | /* flip source image vertically */ | ||
3034 | 117 | HWC_TRANSFORM_FLIP_V = HAL_TRANSFORM_FLIP_V, | ||
3035 | 118 | /* rotate source image 90 degrees clock-wise */ | ||
3036 | 119 | HWC_TRANSFORM_ROT_90 = HAL_TRANSFORM_ROT_90, | ||
3037 | 120 | /* rotate source image 180 degrees */ | ||
3038 | 121 | HWC_TRANSFORM_ROT_180 = HAL_TRANSFORM_ROT_180, | ||
3039 | 122 | /* rotate source image 270 degrees clock-wise */ | ||
3040 | 123 | HWC_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270, | ||
3041 | 124 | }; | ||
3042 | 125 | |||
3043 | 126 | typedef struct hwc_rect { | 62 | typedef struct hwc_rect { |
3044 | 127 | int left; | 63 | int left; |
3045 | 128 | int top; | 64 | int top; |
3046 | @@ -135,69 +71,163 @@ | |||
3047 | 135 | hwc_rect_t const* rects; | 71 | hwc_rect_t const* rects; |
3048 | 136 | } hwc_region_t; | 72 | } hwc_region_t; |
3049 | 137 | 73 | ||
3051 | 138 | typedef struct hwc_layer { | 74 | typedef struct hwc_color { |
3052 | 75 | uint8_t r; | ||
3053 | 76 | uint8_t g; | ||
3054 | 77 | uint8_t b; | ||
3055 | 78 | uint8_t a; | ||
3056 | 79 | } hwc_color_t; | ||
3057 | 80 | |||
3058 | 81 | typedef struct hwc_layer_1 { | ||
3059 | 139 | /* | 82 | /* |
3064 | 140 | * initially set to HWC_FRAMEBUFFER, indicates the layer will | 83 | * compositionType is used to specify this layer's type and is set by either |
3065 | 141 | * be drawn into the framebuffer using OpenGL ES. | 84 | * the hardware composer implementation, or by the caller (see below). |
3066 | 142 | * The HWC can toggle this value to HWC_OVERLAY, to indicate | 85 | * |
3067 | 143 | * it will handle the layer. | 86 | * This field is always reset to HWC_BACKGROUND or HWC_FRAMEBUFFER |
3068 | 87 | * before (*prepare)() is called when the HWC_GEOMETRY_CHANGED flag is | ||
3069 | 88 | * also set, otherwise, this field is preserved between (*prepare)() | ||
3070 | 89 | * calls. | ||
3071 | 90 | * | ||
3072 | 91 | * HWC_BACKGROUND | ||
3073 | 92 | * Always set by the caller before calling (*prepare)(), this value | ||
3074 | 93 | * indicates this is a special "background" layer. The only valid field | ||
3075 | 94 | * is backgroundColor. | ||
3076 | 95 | * The HWC can toggle this value to HWC_FRAMEBUFFER to indicate it CANNOT | ||
3077 | 96 | * handle the background color. | ||
3078 | 97 | * | ||
3079 | 98 | * | ||
3080 | 99 | * HWC_FRAMEBUFFER_TARGET | ||
3081 | 100 | * Always set by the caller before calling (*prepare)(), this value | ||
3082 | 101 | * indicates this layer is the framebuffer surface used as the target of | ||
3083 | 102 | * OpenGL ES composition. If the HWC sets all other layers to HWC_OVERLAY | ||
3084 | 103 | * or HWC_BACKGROUND, then no OpenGL ES composition will be done, and | ||
3085 | 104 | * this layer should be ignored during set(). | ||
3086 | 105 | * | ||
3087 | 106 | * This flag (and the framebuffer surface layer) will only be used if the | ||
3088 | 107 | * HWC version is HWC_DEVICE_API_VERSION_1_1 or higher. In older versions, | ||
3089 | 108 | * the OpenGL ES target surface is communicated by the (dpy, sur) fields | ||
3090 | 109 | * in hwc_compositor_device_1_t. | ||
3091 | 110 | * | ||
3092 | 111 | * This value cannot be set by the HWC implementation. | ||
3093 | 112 | * | ||
3094 | 113 | * | ||
3095 | 114 | * HWC_FRAMEBUFFER | ||
3096 | 115 | * Set by the caller before calling (*prepare)() ONLY when the | ||
3097 | 116 | * HWC_GEOMETRY_CHANGED flag is also set. | ||
3098 | 117 | * | ||
3099 | 118 | * Set by the HWC implementation during (*prepare)(), this indicates | ||
3100 | 119 | * that the layer will be drawn into the framebuffer using OpenGL ES. | ||
3101 | 120 | * The HWC can toggle this value to HWC_OVERLAY to indicate it will | ||
3102 | 121 | * handle the layer. | ||
3103 | 122 | * | ||
3104 | 123 | * | ||
3105 | 124 | * HWC_OVERLAY | ||
3106 | 125 | * Set by the HWC implementation during (*prepare)(), this indicates | ||
3107 | 126 | * that the layer will be handled by the HWC (ie: it must not be | ||
3108 | 127 | * composited with OpenGL ES). | ||
3109 | 128 | * | ||
3110 | 144 | */ | 129 | */ |
3111 | 145 | int32_t compositionType; | 130 | int32_t compositionType; |
3112 | 146 | 131 | ||
3114 | 147 | /* see hwc_layer_t::hints above */ | 132 | /* |
3115 | 133 | * hints is bit mask set by the HWC implementation during (*prepare)(). | ||
3116 | 134 | * It is preserved between (*prepare)() calls, unless the | ||
3117 | 135 | * HWC_GEOMETRY_CHANGED flag is set, in which case it is reset to 0. | ||
3118 | 136 | * | ||
3119 | 137 | * see hwc_layer_t::hints | ||
3120 | 138 | */ | ||
3121 | 148 | uint32_t hints; | 139 | uint32_t hints; |
3122 | 149 | 140 | ||
3174 | 150 | /* see hwc_layer_t::flags above */ | 141 | /* see hwc_layer_t::flags */ |
3175 | 151 | uint32_t flags; | 142 | uint32_t flags; |
3176 | 152 | 143 | ||
3177 | 153 | /* handle of buffer to compose. this handle is guaranteed to have been | 144 | union { |
3178 | 154 | * allocated with gralloc */ | 145 | /* color of the background. hwc_color_t.a is ignored */ |
3179 | 155 | buffer_handle_t handle; | 146 | hwc_color_t backgroundColor; |
3180 | 156 | 147 | ||
3181 | 157 | /* transformation to apply to the buffer during composition */ | 148 | struct { |
3182 | 158 | uint32_t transform; | 149 | /* handle of buffer to compose. This handle is guaranteed to have been |
3183 | 159 | 150 | * allocated from gralloc using the GRALLOC_USAGE_HW_COMPOSER usage flag. If | |
3184 | 160 | /* blending to apply during composition */ | 151 | * the layer's handle is unchanged across two consecutive prepare calls and |
3185 | 161 | int32_t blending; | 152 | * the HWC_GEOMETRY_CHANGED flag is not set for the second call then the |
3186 | 162 | 153 | * HWComposer implementation may assume that the contents of the buffer have | |
3187 | 163 | /* area of the source to consider, the origin is the top-left corner of | 154 | * not changed. */ |
3188 | 164 | * the buffer */ | 155 | buffer_handle_t handle; |
3189 | 165 | hwc_rect_t sourceCrop; | 156 | |
3190 | 166 | 157 | /* transformation to apply to the buffer during composition */ | |
3191 | 167 | /* where to composite the sourceCrop onto the display. The sourceCrop | 158 | uint32_t transform; |
3192 | 168 | * is scaled using linear filtering to the displayFrame. The origin is the | 159 | |
3193 | 169 | * top-left corner of the screen. | 160 | #ifdef QCOM_HARDWARE |
3194 | 170 | */ | 161 | /* source transform of the buffer */ |
3195 | 171 | hwc_rect_t displayFrame; | 162 | uint32_t sourceTransform; |
3196 | 172 | 163 | #endif | |
3197 | 173 | /* visible region in screen space. The origin is the | 164 | |
3198 | 174 | * top-left corner of the screen. | 165 | /* blending to apply during composition */ |
3199 | 175 | * The visible region INCLUDES areas overlapped by a translucent layer. | 166 | int32_t blending; |
3200 | 176 | */ | 167 | |
3201 | 177 | hwc_region_t visibleRegionScreen; | 168 | /* area of the source to consider, the origin is the top-left corner of |
3202 | 178 | } hwc_layer_t; | 169 | * the buffer */ |
3203 | 179 | 170 | hwc_rect_t sourceCrop; | |
3204 | 180 | 171 | ||
3205 | 181 | /* | 172 | /* where to composite the sourceCrop onto the display. The sourceCrop |
3206 | 182 | * hwc_layer_list_t::flags values | 173 | * is scaled using linear filtering to the displayFrame. The origin is the |
3207 | 183 | */ | 174 | * top-left corner of the screen. |
3208 | 184 | enum { | 175 | */ |
3209 | 185 | /* | 176 | hwc_rect_t displayFrame; |
3210 | 186 | * HWC_GEOMETRY_CHANGED is set by SurfaceFlinger to indicate that the list | 177 | |
3211 | 187 | * passed to (*prepare)() has changed by more than just the buffer handles. | 178 | /* visible region in screen space. The origin is the |
3212 | 188 | */ | 179 | * top-left corner of the screen. |
3213 | 189 | HWC_GEOMETRY_CHANGED = 0x00000001, | 180 | * The visible region INCLUDES areas overlapped by a translucent layer. |
3214 | 190 | }; | 181 | */ |
3215 | 191 | 182 | hwc_region_t visibleRegionScreen; | |
3216 | 192 | /* | 183 | |
3217 | 193 | * List of layers. | 184 | /* Sync fence object that will be signaled when the buffer's |
3218 | 194 | * The handle members of hwLayers elements must be unique. | 185 | * contents are available. May be -1 if the contents are already |
3219 | 195 | */ | 186 | * available. This field is only valid during set(), and should be |
3220 | 196 | typedef struct hwc_layer_list { | 187 | * ignored during prepare(). The set() call must not wait for the |
3221 | 197 | uint32_t flags; | 188 | * fence to be signaled before returning, but the HWC must wait for |
3222 | 198 | size_t numHwLayers; | 189 | * all buffers to be signaled before reading from them. |
3223 | 199 | hwc_layer_t hwLayers[0]; | 190 | * |
3224 | 200 | } hwc_layer_list_t; | 191 | * HWC_FRAMEBUFFER layers will never have an acquire fence, since |
3225 | 192 | * reads from them are complete before the framebuffer is ready for | ||
3226 | 193 | * display. | ||
3227 | 194 | * | ||
3228 | 195 | * The HWC takes ownership of the acquireFenceFd and is responsible | ||
3229 | 196 | * for closing it when no longer needed. | ||
3230 | 197 | */ | ||
3231 | 198 | int acquireFenceFd; | ||
3232 | 199 | |||
3233 | 200 | /* During set() the HWC must set this field to a file descriptor for | ||
3234 | 201 | * a sync fence object that will signal after the HWC has finished | ||
3235 | 202 | * reading from the buffer. The field is ignored by prepare(). Each | ||
3236 | 203 | * layer should have a unique file descriptor, even if more than one | ||
3237 | 204 | * refer to the same underlying fence object; this allows each to be | ||
3238 | 205 | * closed independently. | ||
3239 | 206 | * | ||
3240 | 207 | * If buffer reads can complete at significantly different times, | ||
3241 | 208 | * then using independent fences is preferred. For example, if the | ||
3242 | 209 | * HWC handles some layers with a blit engine and others with | ||
3243 | 210 | * overlays, then the blit layers can be reused immediately after | ||
3244 | 211 | * the blit completes, but the overlay layers can't be reused until | ||
3245 | 212 | * a subsequent frame has been displayed. | ||
3246 | 213 | * | ||
3247 | 214 | * Since HWC doesn't read from HWC_FRAMEBUFFER layers, it shouldn't | ||
3248 | 215 | * produce a release fence for them. The releaseFenceFd will be -1 | ||
3249 | 216 | * for these layers when set() is called. | ||
3250 | 217 | * | ||
3251 | 218 | * The HWC client taks ownership of the releaseFenceFd and is | ||
3252 | 219 | * responsible for closing it when no longer needed. | ||
3253 | 220 | */ | ||
3254 | 221 | int releaseFenceFd; | ||
3255 | 222 | }; | ||
3256 | 223 | }; | ||
3257 | 224 | |||
3258 | 225 | /* Allow for expansion w/o breaking binary compatibility. | ||
3259 | 226 | * Pad layer to 96 bytes, assuming 32-bit pointers. | ||
3260 | 227 | */ | ||
3261 | 228 | int32_t reserved[24 - 18]; | ||
3262 | 229 | |||
3263 | 230 | } hwc_layer_1_t; | ||
3264 | 201 | 231 | ||
3265 | 202 | /* This represents a display, typically an EGLDisplay object */ | 232 | /* This represents a display, typically an EGLDisplay object */ |
3266 | 203 | typedef void* hwc_display_t; | 233 | typedef void* hwc_display_t; |
3267 | @@ -205,10 +235,82 @@ | |||
3268 | 205 | /* This represents a surface, typically an EGLSurface object */ | 235 | /* This represents a surface, typically an EGLSurface object */ |
3269 | 206 | typedef void* hwc_surface_t; | 236 | typedef void* hwc_surface_t; |
3270 | 207 | 237 | ||
3271 | 238 | /* | ||
3272 | 239 | * hwc_display_contents_1_t::flags values | ||
3273 | 240 | */ | ||
3274 | 241 | enum { | ||
3275 | 242 | /* | ||
3276 | 243 | * HWC_GEOMETRY_CHANGED is set by SurfaceFlinger to indicate that the list | ||
3277 | 244 | * passed to (*prepare)() has changed by more than just the buffer handles | ||
3278 | 245 | * and acquire fences. | ||
3279 | 246 | */ | ||
3280 | 247 | HWC_GEOMETRY_CHANGED = 0x00000001, | ||
3281 | 248 | }; | ||
3282 | 249 | |||
3283 | 250 | /* | ||
3284 | 251 | * Description of the contents to output on a display. | ||
3285 | 252 | * | ||
3286 | 253 | * This is the top-level structure passed to the prepare and set calls to | ||
3287 | 254 | * negotiate and commit the composition of a display image. | ||
3288 | 255 | */ | ||
3289 | 256 | typedef struct hwc_display_contents_1 { | ||
3290 | 257 | /* File descriptor referring to a Sync HAL fence object which will signal | ||
3291 | 258 | * when this composition is retired. For a physical display, a composition | ||
3292 | 259 | * is retired when it has been replaced on-screen by a subsequent set. For | ||
3293 | 260 | * a virtual display, the composition is retired when the writes to | ||
3294 | 261 | * outputBuffer are complete and can be read. The fence object is created | ||
3295 | 262 | * and returned by the set call; this field will be -1 on entry to prepare | ||
3296 | 263 | * and set. SurfaceFlinger will close the returned file descriptor. | ||
3297 | 264 | */ | ||
3298 | 265 | int retireFenceFd; | ||
3299 | 266 | |||
3300 | 267 | union { | ||
3301 | 268 | /* Fields only relevant for HWC_DEVICE_VERSION_1_0. */ | ||
3302 | 269 | struct { | ||
3303 | 270 | /* (dpy, sur) is the target of SurfaceFlinger's OpenGL ES | ||
3304 | 271 | * composition for HWC_DEVICE_VERSION_1_0. They aren't relevant to | ||
3305 | 272 | * prepare. The set call should commit this surface atomically to | ||
3306 | 273 | * the display along with any overlay layers. | ||
3307 | 274 | */ | ||
3308 | 275 | hwc_display_t dpy; | ||
3309 | 276 | hwc_surface_t sur; | ||
3310 | 277 | }; | ||
3311 | 278 | |||
3312 | 279 | /* Fields only relevant for HWC_DEVICE_VERSION_1_2 and later. */ | ||
3313 | 280 | struct { | ||
3314 | 281 | /* outbuf is the buffer that receives the composed image for | ||
3315 | 282 | * virtual displays. Writes to the outbuf must wait until | ||
3316 | 283 | * outbufAcquireFenceFd signals. A fence that will signal when | ||
3317 | 284 | * writes to outbuf are complete should be returned in | ||
3318 | 285 | * retireFenceFd. | ||
3319 | 286 | * | ||
3320 | 287 | * For physical displays, outbuf will be NULL. | ||
3321 | 288 | */ | ||
3322 | 289 | buffer_handle_t outbuf; | ||
3323 | 290 | |||
3324 | 291 | /* File descriptor for a fence that will signal when outbuf is | ||
3325 | 292 | * ready to be written. The h/w composer is responsible for closing | ||
3326 | 293 | * this when no longer needed. | ||
3327 | 294 | * | ||
3328 | 295 | * Will be -1 whenever outbuf is NULL, or when the outbuf can be | ||
3329 | 296 | * written immediately. | ||
3330 | 297 | */ | ||
3331 | 298 | int outbufAcquireFenceFd; | ||
3332 | 299 | }; | ||
3333 | 300 | }; | ||
3334 | 301 | |||
3335 | 302 | /* List of layers that will be composed on the display. The buffer handles | ||
3336 | 303 | * in the list will be unique. If numHwLayers is 0, all composition will be | ||
3337 | 304 | * performed by SurfaceFlinger. | ||
3338 | 305 | */ | ||
3339 | 306 | uint32_t flags; | ||
3340 | 307 | size_t numHwLayers; | ||
3341 | 308 | hwc_layer_1_t hwLayers[0]; | ||
3342 | 309 | |||
3343 | 310 | } hwc_display_contents_1_t; | ||
3344 | 208 | 311 | ||
3345 | 209 | /* see hwc_composer_device::registerProcs() | 312 | /* see hwc_composer_device::registerProcs() |
3348 | 210 | * Any of the callbacks can be NULL, in which case the corresponding | 313 | * All of the callbacks are required and non-NULL unless otherwise noted. |
3347 | 211 | * functionality is not supported. | ||
3349 | 212 | */ | 314 | */ |
3350 | 213 | typedef struct hwc_procs { | 315 | typedef struct hwc_procs { |
3351 | 214 | /* | 316 | /* |
3352 | @@ -220,7 +322,52 @@ | |||
3353 | 220 | * it is safe to call invalidate() from any of hwc_composer_device | 322 | * it is safe to call invalidate() from any of hwc_composer_device |
3354 | 221 | * hooks, unless noted otherwise. | 323 | * hooks, unless noted otherwise. |
3355 | 222 | */ | 324 | */ |
3357 | 223 | void (*invalidate)(struct hwc_procs* procs); | 325 | void (*invalidate)(const struct hwc_procs* procs); |
3358 | 326 | |||
3359 | 327 | /* | ||
3360 | 328 | * (*vsync)() is called by the h/w composer HAL when a vsync event is | ||
3361 | 329 | * received and HWC_EVENT_VSYNC is enabled on a display | ||
3362 | 330 | * (see: hwc_event_control). | ||
3363 | 331 | * | ||
3364 | 332 | * the "disp" parameter indicates which display the vsync event is for. | ||
3365 | 333 | * the "timestamp" parameter is the system monotonic clock timestamp in | ||
3366 | 334 | * nanosecond of when the vsync event happened. | ||
3367 | 335 | * | ||
3368 | 336 | * vsync() is GUARANTEED TO NOT CALL BACK into the h/w composer HAL. | ||
3369 | 337 | * | ||
3370 | 338 | * It is expected that vsync() is called from a thread of at least | ||
3371 | 339 | * HAL_PRIORITY_URGENT_DISPLAY with as little latency as possible, | ||
3372 | 340 | * typically less than 0.5 ms. | ||
3373 | 341 | * | ||
3374 | 342 | * It is a (silent) error to have HWC_EVENT_VSYNC enabled when calling | ||
3375 | 343 | * hwc_composer_device.set(..., 0, 0, 0) (screen off). The implementation | ||
3376 | 344 | * can either stop or continue to process VSYNC events, but must not | ||
3377 | 345 | * crash or cause other problems. | ||
3378 | 346 | */ | ||
3379 | 347 | void (*vsync)(const struct hwc_procs* procs, int disp, int64_t timestamp); | ||
3380 | 348 | |||
3381 | 349 | /* | ||
3382 | 350 | * (*hotplug)() is called by the h/w composer HAL when a display is | ||
3383 | 351 | * connected or disconnected. The PRIMARY display is always connected and | ||
3384 | 352 | * the hotplug callback should not be called for it. | ||
3385 | 353 | * | ||
3386 | 354 | * The disp parameter indicates which display type this event is for. | ||
3387 | 355 | * The connected parameter indicates whether the display has just been | ||
3388 | 356 | * connected (1) or disconnected (0). | ||
3389 | 357 | * | ||
3390 | 358 | * The hotplug() callback may call back into the h/w composer on the same | ||
3391 | 359 | * thread to query refresh rate and dpi for the display. Additionally, | ||
3392 | 360 | * other threads may be calling into the h/w composer while the callback | ||
3393 | 361 | * is in progress. | ||
3394 | 362 | * | ||
3395 | 363 | * The h/w composer must serialize calls to the hotplug callback; only | ||
3396 | 364 | * one thread may call it at a time. | ||
3397 | 365 | * | ||
3398 | 366 | * This callback will be NULL if the h/w composer is using | ||
3399 | 367 | * HWC_DEVICE_API_VERSION_1_0. | ||
3400 | 368 | */ | ||
3401 | 369 | void (*hotplug)(const struct hwc_procs* procs, int disp, int connected); | ||
3402 | 370 | |||
3403 | 224 | } hwc_procs_t; | 371 | } hwc_procs_t; |
3404 | 225 | 372 | ||
3405 | 226 | 373 | ||
3406 | @@ -230,8 +377,7 @@ | |||
3407 | 230 | struct hw_module_t common; | 377 | struct hw_module_t common; |
3408 | 231 | } hwc_module_t; | 378 | } hwc_module_t; |
3409 | 232 | 379 | ||
3412 | 233 | 380 | typedef struct hwc_composer_device_1 { | |
3411 | 234 | typedef struct hwc_composer_device { | ||
3413 | 235 | struct hw_device_t common; | 381 | struct hw_device_t common; |
3414 | 236 | 382 | ||
3415 | 237 | /* | 383 | /* |
3416 | @@ -240,115 +386,207 @@ | |||
3417 | 240 | * | 386 | * |
3418 | 241 | * (*prepare)() can be called more than once, the last call prevails. | 387 | * (*prepare)() can be called more than once, the last call prevails. |
3419 | 242 | * | 388 | * |
3424 | 243 | * The HWC responds by setting the compositionType field to either | 389 | * The HWC responds by setting the compositionType field in each layer to |
3425 | 244 | * HWC_FRAMEBUFFER or HWC_OVERLAY. In the former case, the composition for | 390 | * either HWC_FRAMEBUFFER or HWC_OVERLAY. In the former case, the |
3426 | 245 | * this layer is handled by SurfaceFlinger with OpenGL ES, in the later | 391 | * composition for the layer is handled by SurfaceFlinger with OpenGL ES, |
3427 | 246 | * case, the HWC will have to handle this layer's composition. | 392 | * in the later case, the HWC will have to handle the layer's composition. |
3428 | 393 | * compositionType and hints are preserved between (*prepare)() calles | ||
3429 | 394 | * unless the HWC_GEOMETRY_CHANGED flag is set. | ||
3430 | 247 | * | 395 | * |
3431 | 248 | * (*prepare)() is called with HWC_GEOMETRY_CHANGED to indicate that the | 396 | * (*prepare)() is called with HWC_GEOMETRY_CHANGED to indicate that the |
3432 | 249 | * list's geometry has changed, that is, when more than just the buffer's | 397 | * list's geometry has changed, that is, when more than just the buffer's |
3433 | 250 | * handles have been updated. Typically this happens (but is not limited to) | 398 | * handles have been updated. Typically this happens (but is not limited to) |
3438 | 251 | * when a window is added, removed, resized or moved. | 399 | * when a window is added, removed, resized or moved. In this case |
3439 | 252 | * | 400 | * compositionType and hints are reset to their default value. |
3440 | 253 | * a NULL list parameter or a numHwLayers of zero indicates that the | 401 | * |
3441 | 254 | * entire composition will be handled by SurfaceFlinger with OpenGL ES. | 402 | * For HWC 1.0, numDisplays will always be one, and displays[0] will be |
3442 | 403 | * non-NULL. | ||
3443 | 404 | * | ||
3444 | 405 | * For HWC 1.1, numDisplays will always be HWC_NUM_DISPLAY_TYPES. Entries | ||
3445 | 406 | * for unsupported or disabled/disconnected display types will be NULL. | ||
3446 | 407 | * | ||
3447 | 408 | * For HWC 1.2 and later, numDisplays will be HWC_NUM_DISPLAY_TYPES or more. | ||
3448 | 409 | * The extra entries correspond to enabled virtual displays, and will be | ||
3449 | 410 | * non-NULL. In HWC 1.2, support for one virtual display is required, and | ||
3450 | 411 | * no more than one will be used. Future HWC versions might require more. | ||
3451 | 255 | * | 412 | * |
3452 | 256 | * returns: 0 on success. An negative error code on error. If an error is | 413 | * returns: 0 on success. An negative error code on error. If an error is |
3453 | 257 | * returned, SurfaceFlinger will assume that none of the layer will be | 414 | * returned, SurfaceFlinger will assume that none of the layer will be |
3454 | 258 | * handled by the HWC. | 415 | * handled by the HWC. |
3455 | 259 | */ | 416 | */ |
3458 | 260 | int (*prepare)(struct hwc_composer_device *dev, hwc_layer_list_t* list); | 417 | int (*prepare)(struct hwc_composer_device_1 *dev, |
3459 | 261 | 418 | size_t numDisplays, hwc_display_contents_1_t** displays); | |
3460 | 262 | 419 | ||
3461 | 263 | /* | 420 | /* |
3462 | 264 | * (*set)() is used in place of eglSwapBuffers(), and assumes the same | 421 | * (*set)() is used in place of eglSwapBuffers(), and assumes the same |
3463 | 265 | * functionality, except it also commits the work list atomically with | 422 | * functionality, except it also commits the work list atomically with |
3464 | 266 | * the actual eglSwapBuffers(). | 423 | * the actual eglSwapBuffers(). |
3465 | 267 | * | 424 | * |
3500 | 268 | * The list parameter is guaranteed to be the same as the one returned | 425 | * The layer lists are guaranteed to be the same as the ones returned from |
3501 | 269 | * from the last call to (*prepare)(). | 426 | * the last call to (*prepare)(). |
3502 | 270 | * | 427 | * |
3503 | 271 | * When this call returns the caller assumes that: | 428 | * When this call returns the caller assumes that the displays will be |
3504 | 272 | * | 429 | * updated in the near future with the content of their work lists, without |
3505 | 273 | * - the display will be updated in the near future with the content | 430 | * artifacts during the transition from the previous frame. |
3506 | 274 | * of the work list, without artifacts during the transition from the | 431 | * |
3507 | 275 | * previous frame. | 432 | * A display with zero layers indicates that the entire composition has |
3508 | 276 | * | 433 | * been handled by SurfaceFlinger with OpenGL ES. In this case, (*set)() |
3509 | 277 | * - all objects are available for immediate access or destruction, in | 434 | * behaves just like eglSwapBuffers(). |
3510 | 278 | * particular, hwc_region_t::rects data and hwc_layer_t::layer's buffer. | 435 | * |
3511 | 279 | * Note that this means that immediately accessing (potentially from a | 436 | * For HWC 1.0, numDisplays will always be one, and displays[0] will be |
3512 | 280 | * different process) a buffer used in this call will not result in | 437 | * non-NULL. |
3513 | 281 | * screen corruption, the driver must apply proper synchronization or | 438 | * |
3514 | 282 | * scheduling (eg: block the caller, such as gralloc_module_t::lock(), | 439 | * For HWC 1.1, numDisplays will always be HWC_NUM_DISPLAY_TYPES. Entries |
3515 | 283 | * OpenGL ES, Camera, Codecs, etc..., or schedule the caller's work | 440 | * for unsupported or disabled/disconnected display types will be NULL. |
3516 | 284 | * after the buffer is freed from the actual composition). | 441 | * |
3517 | 285 | * | 442 | * For HWC 1.2 and later, numDisplays will be HWC_NUM_DISPLAY_TYPES or more. |
3518 | 286 | * a NULL list parameter or a numHwLayers of zero indicates that the | 443 | * The extra entries correspond to enabled virtual displays, and will be |
3519 | 287 | * entire composition has been handled by SurfaceFlinger with OpenGL ES. | 444 | * non-NULL. In HWC 1.2, support for one virtual display is required, and |
3520 | 288 | * In this case, (*set)() behaves just like eglSwapBuffers(). | 445 | * no more than one will be used. Future HWC versions might require more. |
3521 | 289 | * | 446 | * |
3522 | 290 | * dpy, sur, and list are set to NULL to indicate that the screen is | 447 | * IMPORTANT NOTE: There is an implicit layer containing opaque black |
3523 | 291 | * turning off. This happens WITHOUT prepare() being called first. | 448 | * pixels behind all the layers in the list. It is the responsibility of |
3524 | 292 | * This is a good time to free h/w resources and/or power | 449 | * the hwcomposer module to make sure black pixels are output (or blended |
3525 | 293 | * the relevant h/w blocks down. | 450 | * from). |
3526 | 294 | * | 451 | * |
3527 | 295 | * IMPORTANT NOTE: there is an implicit layer containing opaque black | 452 | * IMPORTANT NOTE: In the event of an error this call *MUST* still cause |
3528 | 296 | * pixels behind all the layers in the list. | 453 | * any fences returned in the previous call to set to eventually become |
3529 | 297 | * It is the responsibility of the hwcomposer module to make | 454 | * signaled. The caller may have already issued wait commands on these |
3530 | 298 | * sure black pixels are output (or blended from). | 455 | * fences, and having set return without causing those fences to signal |
3531 | 299 | * | 456 | * will likely result in a deadlock. |
3532 | 300 | * returns: 0 on success. An negative error code on error: | 457 | * |
3533 | 301 | * HWC_EGL_ERROR: eglGetError() will provide the proper error code | 458 | * returns: 0 on success. A negative error code on error: |
3534 | 459 | * HWC_EGL_ERROR: eglGetError() will provide the proper error code (only | ||
3535 | 460 | * allowed prior to HWComposer 1.1) | ||
3536 | 302 | * Another code for non EGL errors. | 461 | * Another code for non EGL errors. |
3545 | 303 | * | 462 | */ |
3546 | 304 | */ | 463 | int (*set)(struct hwc_composer_device_1 *dev, |
3547 | 305 | int (*set)(struct hwc_composer_device *dev, | 464 | size_t numDisplays, hwc_display_contents_1_t** displays); |
3548 | 306 | hwc_display_t dpy, | 465 | |
3549 | 307 | hwc_surface_t sur, | 466 | /* |
3550 | 308 | hwc_layer_list_t* list); | 467 | * eventControl(..., event, enabled) |
3551 | 309 | /* | 468 | * Enables or disables h/w composer events for a display. |
3552 | 310 | * This hook is OPTIONAL. | 469 | * |
3553 | 470 | * eventControl can be called from any thread and takes effect | ||
3554 | 471 | * immediately. | ||
3555 | 472 | * | ||
3556 | 473 | * Supported events are: | ||
3557 | 474 | * HWC_EVENT_VSYNC | ||
3558 | 475 | * | ||
3559 | 476 | * returns -EINVAL if the "event" parameter is not one of the value above | ||
3560 | 477 | * or if the "enabled" parameter is not 0 or 1. | ||
3561 | 478 | */ | ||
3562 | 479 | int (*eventControl)(struct hwc_composer_device_1* dev, int disp, | ||
3563 | 480 | int event, int enabled); | ||
3564 | 481 | |||
3565 | 482 | /* | ||
3566 | 483 | * blank(..., blank) | ||
3567 | 484 | * Blanks or unblanks a display's screen. | ||
3568 | 485 | * | ||
3569 | 486 | * Turns the screen off when blank is nonzero, on when blank is zero. | ||
3570 | 487 | * Multiple sequential calls with the same blank value must be supported. | ||
3571 | 488 | * The screen state transition must be be complete when the function | ||
3572 | 489 | * returns. | ||
3573 | 490 | * | ||
3574 | 491 | * returns 0 on success, negative on error. | ||
3575 | 492 | */ | ||
3576 | 493 | int (*blank)(struct hwc_composer_device_1* dev, int disp, int blank); | ||
3577 | 494 | |||
3578 | 495 | /* | ||
3579 | 496 | * Used to retrieve information about the h/w composer | ||
3580 | 497 | * | ||
3581 | 498 | * Returns 0 on success or -errno on error. | ||
3582 | 499 | */ | ||
3583 | 500 | int (*query)(struct hwc_composer_device_1* dev, int what, int* value); | ||
3584 | 501 | |||
3585 | 502 | /* | ||
3586 | 503 | * (*registerProcs)() registers callbacks that the h/w composer HAL can | ||
3587 | 504 | * later use. It will be called immediately after the composer device is | ||
3588 | 505 | * opened with non-NULL procs. It is FORBIDDEN to call any of the callbacks | ||
3589 | 506 | * from within registerProcs(). registerProcs() must save the hwc_procs_t | ||
3590 | 507 | * pointer which is needed when calling a registered callback. | ||
3591 | 508 | */ | ||
3592 | 509 | void (*registerProcs)(struct hwc_composer_device_1* dev, | ||
3593 | 510 | hwc_procs_t const* procs); | ||
3594 | 511 | |||
3595 | 512 | /* | ||
3596 | 513 | * This field is OPTIONAL and can be NULL. | ||
3597 | 311 | * | 514 | * |
3598 | 312 | * If non NULL it will be called by SurfaceFlinger on dumpsys | 515 | * If non NULL it will be called by SurfaceFlinger on dumpsys |
3599 | 313 | */ | 516 | */ |
3622 | 314 | void (*dump)(struct hwc_composer_device* dev, char *buff, int buff_len); | 517 | void (*dump)(struct hwc_composer_device_1* dev, char *buff, int buff_len); |
3623 | 315 | 518 | ||
3624 | 316 | /* | 519 | /* |
3625 | 317 | * This hook is OPTIONAL. | 520 | * (*getDisplayConfigs)() returns handles for the configurations available |
3626 | 318 | * | 521 | * on the connected display. These handles must remain valid as long as the |
3627 | 319 | * (*registerProcs)() registers a set of callbacks the h/w composer HAL | 522 | * display is connected. |
3628 | 320 | * can later use. It is FORBIDDEN to call any of the callbacks from | 523 | * |
3629 | 321 | * within registerProcs(). registerProcs() must save the hwc_procs_t pointer | 524 | * Configuration handles are written to configs. The number of entries |
3630 | 322 | * which is needed when calling a registered callback. | 525 | * allocated by the caller is passed in *numConfigs; getDisplayConfigs must |
3631 | 323 | * Each call to registerProcs replaces the previous set of callbacks. | 526 | * not try to write more than this number of config handles. On return, the |
3632 | 324 | * registerProcs is called with NULL to unregister all callbacks. | 527 | * total number of configurations available for the display is returned in |
3633 | 325 | * | 528 | * *numConfigs. If *numConfigs is zero on entry, then configs may be NULL. |
3634 | 326 | * Any of the callbacks can be NULL, in which case the corresponding | 529 | * |
3635 | 327 | * functionality is not supported. | 530 | * HWC_DEVICE_API_VERSION_1_1 does not provide a way to choose a config. |
3636 | 328 | */ | 531 | * For displays that support multiple configurations, the h/w composer |
3637 | 329 | void (*registerProcs)(struct hwc_composer_device* dev, | 532 | * implementation should choose one and report it as the first config in |
3638 | 330 | hwc_procs_t const* procs); | 533 | * the list. Reporting the not-chosen configs is not required. |
3639 | 331 | 534 | * | |
3640 | 332 | void* reserved_proc[6]; | 535 | * Returns 0 on success or -errno on error. If disp is a hotpluggable |
3641 | 333 | 536 | * display type and no display is connected, an error should be returned. | |
3642 | 334 | } hwc_composer_device_t; | 537 | * |
3643 | 335 | 538 | * This field is REQUIRED for HWC_DEVICE_API_VERSION_1_1 and later. | |
3644 | 539 | * It should be NULL for previous versions. | ||
3645 | 540 | */ | ||
3646 | 541 | int (*getDisplayConfigs)(struct hwc_composer_device_1* dev, int disp, | ||
3647 | 542 | uint32_t* configs, size_t* numConfigs); | ||
3648 | 543 | |||
3649 | 544 | /* | ||
3650 | 545 | * (*getDisplayAttributes)() returns attributes for a specific config of a | ||
3651 | 546 | * connected display. The config parameter is one of the config handles | ||
3652 | 547 | * returned by getDisplayConfigs. | ||
3653 | 548 | * | ||
3654 | 549 | * The list of attributes to return is provided in the attributes | ||
3655 | 550 | * parameter, terminated by HWC_DISPLAY_NO_ATTRIBUTE. The value for each | ||
3656 | 551 | * requested attribute is written in order to the values array. The | ||
3657 | 552 | * HWC_DISPLAY_NO_ATTRIBUTE attribute does not have a value, so the values | ||
3658 | 553 | * array will have one less value than the attributes array. | ||
3659 | 554 | * | ||
3660 | 555 | * This field is REQUIRED for HWC_DEVICE_API_VERSION_1_1 and later. | ||
3661 | 556 | * It should be NULL for previous versions. | ||
3662 | 557 | * | ||
3663 | 558 | * If disp is a hotpluggable display type and no display is connected, | ||
3664 | 559 | * or if config is not a valid configuration for the display, a negative | ||
3665 | 560 | * value should be returned. | ||
3666 | 561 | */ | ||
3667 | 562 | int (*getDisplayAttributes)(struct hwc_composer_device_1* dev, int disp, | ||
3668 | 563 | uint32_t config, const uint32_t* attributes, int32_t* values); | ||
3669 | 564 | |||
3670 | 565 | /* | ||
3671 | 566 | * Reserved for future use. Must be NULL. | ||
3672 | 567 | */ | ||
3673 | 568 | void* reserved_proc[4]; | ||
3674 | 569 | |||
3675 | 570 | } hwc_composer_device_1_t; | ||
3676 | 336 | 571 | ||
3677 | 337 | /** convenience API for opening and closing a device */ | 572 | /** convenience API for opening and closing a device */ |
3678 | 338 | 573 | ||
3681 | 339 | static inline int hwc_open(const struct hw_module_t* module, | 574 | static inline int hwc_open_1(const struct hw_module_t* module, |
3682 | 340 | hwc_composer_device_t** device) { | 575 | hwc_composer_device_1_t** device) { |
3683 | 341 | return module->methods->open(module, | 576 | return module->methods->open(module, |
3684 | 342 | HWC_HARDWARE_COMPOSER, (struct hw_device_t**)device); | 577 | HWC_HARDWARE_COMPOSER, (struct hw_device_t**)device); |
3685 | 343 | } | 578 | } |
3686 | 344 | 579 | ||
3688 | 345 | static inline int hwc_close(hwc_composer_device_t* device) { | 580 | static inline int hwc_close_1(hwc_composer_device_1_t* device) { |
3689 | 346 | return device->common.close(&device->common); | 581 | return device->common.close(&device->common); |
3690 | 347 | } | 582 | } |
3691 | 348 | 583 | ||
3692 | 349 | |||
3693 | 350 | /*****************************************************************************/ | 584 | /*****************************************************************************/ |
3694 | 351 | 585 | ||
3695 | 586 | #if !HWC_REMOVE_DEPRECATED_VERSIONS | ||
3696 | 587 | #include <hardware/hwcomposer_v0.h> | ||
3697 | 588 | #endif | ||
3698 | 589 | |||
3699 | 352 | __END_DECLS | 590 | __END_DECLS |
3700 | 353 | 591 | ||
3701 | 354 | #endif /* ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_H */ | 592 | #endif /* ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_H */ |
3702 | 355 | 593 | ||
3703 | === removed file '3rd_party/android-deps/hardware/lights.h' | |||
3704 | --- 3rd_party/android-deps/hardware/lights.h 2013-01-08 17:44:16 +0000 | |||
3705 | +++ 3rd_party/android-deps/hardware/lights.h 1970-01-01 00:00:00 +0000 | |||
3706 | @@ -1,137 +0,0 @@ | |||
3707 | 1 | /* | ||
3708 | 2 | * Copyright (C) 2008 The Android Open Source Project | ||
3709 | 3 | * | ||
3710 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
3711 | 5 | * you may not use this file except in compliance with the License. | ||
3712 | 6 | * You may obtain a copy of the License at | ||
3713 | 7 | * | ||
3714 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
3715 | 9 | * | ||
3716 | 10 | * Unless required by applicable law or agreed to in writing, software | ||
3717 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
3718 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
3719 | 13 | * See the License for the specific language governing permissions and | ||
3720 | 14 | * limitations under the License. | ||
3721 | 15 | */ | ||
3722 | 16 | |||
3723 | 17 | #ifndef ANDROID_LIGHTS_INTERFACE_H | ||
3724 | 18 | #define ANDROID_LIGHTS_INTERFACE_H | ||
3725 | 19 | |||
3726 | 20 | #include <stdint.h> | ||
3727 | 21 | #include <sys/cdefs.h> | ||
3728 | 22 | #include <sys/types.h> | ||
3729 | 23 | |||
3730 | 24 | #include <hardware/hardware.h> | ||
3731 | 25 | |||
3732 | 26 | __BEGIN_DECLS | ||
3733 | 27 | |||
3734 | 28 | /** | ||
3735 | 29 | * The id of this module | ||
3736 | 30 | */ | ||
3737 | 31 | #define LIGHTS_HARDWARE_MODULE_ID "lights" | ||
3738 | 32 | |||
3739 | 33 | /* | ||
3740 | 34 | * These light IDs correspond to logical lights, not physical. | ||
3741 | 35 | * So for example, if your INDICATOR light is in line with your | ||
3742 | 36 | * BUTTONS, it might make sense to also light the INDICATOR | ||
3743 | 37 | * light to a reasonable color when the BUTTONS are lit. | ||
3744 | 38 | */ | ||
3745 | 39 | #define LIGHT_ID_BACKLIGHT "backlight" | ||
3746 | 40 | #define LIGHT_ID_KEYBOARD "keyboard" | ||
3747 | 41 | #define LIGHT_ID_BUTTONS "buttons" | ||
3748 | 42 | #define LIGHT_ID_BATTERY "battery" | ||
3749 | 43 | #define LIGHT_ID_NOTIFICATIONS "notifications" | ||
3750 | 44 | #define LIGHT_ID_ATTENTION "attention" | ||
3751 | 45 | |||
3752 | 46 | /* | ||
3753 | 47 | * These lights aren't currently supported by the higher | ||
3754 | 48 | * layers, but could be someday, so we have the constants | ||
3755 | 49 | * here now. | ||
3756 | 50 | */ | ||
3757 | 51 | #define LIGHT_ID_BLUETOOTH "bluetooth" | ||
3758 | 52 | #define LIGHT_ID_WIFI "wifi" | ||
3759 | 53 | |||
3760 | 54 | /* ************************************************************************ | ||
3761 | 55 | * Flash modes for the flashMode field of light_state_t. | ||
3762 | 56 | */ | ||
3763 | 57 | |||
3764 | 58 | #define LIGHT_FLASH_NONE 0 | ||
3765 | 59 | |||
3766 | 60 | /** | ||
3767 | 61 | * To flash the light at a given rate, set flashMode to LIGHT_FLASH_TIMED, | ||
3768 | 62 | * and then flashOnMS should be set to the number of milliseconds to turn | ||
3769 | 63 | * the light on, followed by the number of milliseconds to turn the light | ||
3770 | 64 | * off. | ||
3771 | 65 | */ | ||
3772 | 66 | #define LIGHT_FLASH_TIMED 1 | ||
3773 | 67 | |||
3774 | 68 | /** | ||
3775 | 69 | * To flash the light using hardware assist, set flashMode to | ||
3776 | 70 | * the hardware mode. | ||
3777 | 71 | */ | ||
3778 | 72 | #define LIGHT_FLASH_HARDWARE 2 | ||
3779 | 73 | |||
3780 | 74 | /** | ||
3781 | 75 | * Light brightness is managed by a user setting. | ||
3782 | 76 | */ | ||
3783 | 77 | #define BRIGHTNESS_MODE_USER 0 | ||
3784 | 78 | |||
3785 | 79 | /** | ||
3786 | 80 | * Light brightness is managed by a light sensor. | ||
3787 | 81 | */ | ||
3788 | 82 | #define BRIGHTNESS_MODE_SENSOR 1 | ||
3789 | 83 | |||
3790 | 84 | /** | ||
3791 | 85 | * The parameters that can be set for a given light. | ||
3792 | 86 | * | ||
3793 | 87 | * Not all lights must support all parameters. If you | ||
3794 | 88 | * can do something backward-compatible, you should. | ||
3795 | 89 | */ | ||
3796 | 90 | struct light_state_t { | ||
3797 | 91 | /** | ||
3798 | 92 | * The color of the LED in ARGB. | ||
3799 | 93 | * | ||
3800 | 94 | * Do your best here. | ||
3801 | 95 | * - If your light can only do red or green, if they ask for blue, | ||
3802 | 96 | * you should do green. | ||
3803 | 97 | * - If you can only do a brightness ramp, then use this formula: | ||
3804 | 98 | * unsigned char brightness = ((77*((color>>16)&0x00ff)) | ||
3805 | 99 | * + (150*((color>>8)&0x00ff)) + (29*(color&0x00ff))) >> 8; | ||
3806 | 100 | * - If you can only do on or off, 0 is off, anything else is on. | ||
3807 | 101 | * | ||
3808 | 102 | * The high byte should be ignored. Callers will set it to 0xff (which | ||
3809 | 103 | * would correspond to 255 alpha). | ||
3810 | 104 | */ | ||
3811 | 105 | unsigned int color; | ||
3812 | 106 | |||
3813 | 107 | /** | ||
3814 | 108 | * See the LIGHT_FLASH_* constants | ||
3815 | 109 | */ | ||
3816 | 110 | int flashMode; | ||
3817 | 111 | int flashOnMS; | ||
3818 | 112 | int flashOffMS; | ||
3819 | 113 | |||
3820 | 114 | /** | ||
3821 | 115 | * Policy used by the framework to manage the light's brightness. | ||
3822 | 116 | * Currently the values are BRIGHTNESS_MODE_USER and BRIGHTNESS_MODE_SENSOR. | ||
3823 | 117 | */ | ||
3824 | 118 | int brightnessMode; | ||
3825 | 119 | }; | ||
3826 | 120 | |||
3827 | 121 | struct light_device_t { | ||
3828 | 122 | struct hw_device_t common; | ||
3829 | 123 | |||
3830 | 124 | /** | ||
3831 | 125 | * Set the provided lights to the provided values. | ||
3832 | 126 | * | ||
3833 | 127 | * Returns: 0 on succes, error code on failure. | ||
3834 | 128 | */ | ||
3835 | 129 | int (*set_light)(struct light_device_t* dev, | ||
3836 | 130 | struct light_state_t const* state); | ||
3837 | 131 | }; | ||
3838 | 132 | |||
3839 | 133 | |||
3840 | 134 | __END_DECLS | ||
3841 | 135 | |||
3842 | 136 | #endif // ANDROID_LIGHTS_INTERFACE_H | ||
3843 | 137 | |||
3844 | 138 | 0 | ||
3845 | === removed file '3rd_party/android-deps/hardware/nfc.h' | |||
3846 | --- 3rd_party/android-deps/hardware/nfc.h 2013-01-08 17:44:16 +0000 | |||
3847 | +++ 3rd_party/android-deps/hardware/nfc.h 1970-01-01 00:00:00 +0000 | |||
3848 | @@ -1,96 +0,0 @@ | |||
3849 | 1 | /* | ||
3850 | 2 | * Copyright (C) 2011 The Android Open Source Project | ||
3851 | 3 | * | ||
3852 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
3853 | 5 | * you may not use this file except in compliance with the License. | ||
3854 | 6 | * You may obtain a copy of the License at | ||
3855 | 7 | * | ||
3856 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
3857 | 9 | * | ||
3858 | 10 | * Unless required by applicable law or agreed to in writing, software | ||
3859 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
3860 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
3861 | 13 | * See the License for the specific language governing permissions and | ||
3862 | 14 | * limitations under the License. | ||
3863 | 15 | */ | ||
3864 | 16 | |||
3865 | 17 | |||
3866 | 18 | #ifndef ANDROID_NFC_HAL_INTERFACE_H | ||
3867 | 19 | #define ANDROID_NFC_HAL_INTERFACE_H | ||
3868 | 20 | |||
3869 | 21 | #include <stdint.h> | ||
3870 | 22 | #include <strings.h> | ||
3871 | 23 | #include <sys/cdefs.h> | ||
3872 | 24 | #include <sys/types.h> | ||
3873 | 25 | |||
3874 | 26 | #include <hardware/hardware.h> | ||
3875 | 27 | |||
3876 | 28 | __BEGIN_DECLS | ||
3877 | 29 | |||
3878 | 30 | #define NFC_HARDWARE_MODULE_ID "nfc" | ||
3879 | 31 | |||
3880 | 32 | /* | ||
3881 | 33 | * Begin PN544 specific HAL | ||
3882 | 34 | */ | ||
3883 | 35 | #define NFC_PN544_CONTROLLER "pn544" | ||
3884 | 36 | |||
3885 | 37 | typedef struct nfc_module_t { | ||
3886 | 38 | struct hw_module_t common; | ||
3887 | 39 | } nfc_module_t; | ||
3888 | 40 | |||
3889 | 41 | /* | ||
3890 | 42 | * PN544 linktypes. | ||
3891 | 43 | * UART | ||
3892 | 44 | * I2C | ||
3893 | 45 | * USB (uses UART DAL) | ||
3894 | 46 | */ | ||
3895 | 47 | typedef enum { | ||
3896 | 48 | PN544_LINK_TYPE_UART, | ||
3897 | 49 | PN544_LINK_TYPE_I2C, | ||
3898 | 50 | PN544_LINK_TYPE_USB, | ||
3899 | 51 | PN544_LINK_TYPE_INVALID, | ||
3900 | 52 | } nfc_pn544_linktype; | ||
3901 | 53 | |||
3902 | 54 | typedef struct { | ||
3903 | 55 | struct hw_device_t common; | ||
3904 | 56 | |||
3905 | 57 | /* The number of EEPROM registers to write */ | ||
3906 | 58 | uint32_t num_eeprom_settings; | ||
3907 | 59 | |||
3908 | 60 | /* The actual EEPROM settings | ||
3909 | 61 | * For PN544, each EEPROM setting is a 4-byte entry, | ||
3910 | 62 | * of the format [0x00, addr_msb, addr_lsb, value]. | ||
3911 | 63 | */ | ||
3912 | 64 | uint8_t* eeprom_settings; | ||
3913 | 65 | |||
3914 | 66 | /* The link type to which the PN544 is connected */ | ||
3915 | 67 | nfc_pn544_linktype linktype; | ||
3916 | 68 | |||
3917 | 69 | /* The device node to which the PN544 is connected */ | ||
3918 | 70 | const char* device_node; | ||
3919 | 71 | |||
3920 | 72 | /* On Crespo we had an I2C issue that would cause us to sometimes read | ||
3921 | 73 | * the I2C slave address (0x57) over the bus. libnfc contains | ||
3922 | 74 | * a hack to ignore this byte and try to read the length byte | ||
3923 | 75 | * again. | ||
3924 | 76 | * Set to 0 to disable the workaround, 1 to enable it. | ||
3925 | 77 | */ | ||
3926 | 78 | uint8_t enable_i2c_workaround; | ||
3927 | 79 | } nfc_pn544_device_t; | ||
3928 | 80 | |||
3929 | 81 | static inline int nfc_pn544_open(const struct hw_module_t* module, | ||
3930 | 82 | nfc_pn544_device_t** dev) { | ||
3931 | 83 | return module->methods->open(module, NFC_PN544_CONTROLLER, | ||
3932 | 84 | (struct hw_device_t**) dev); | ||
3933 | 85 | } | ||
3934 | 86 | |||
3935 | 87 | static inline int nfc_pn544_close(nfc_pn544_device_t* dev) { | ||
3936 | 88 | return dev->common.close(&dev->common); | ||
3937 | 89 | } | ||
3938 | 90 | /* | ||
3939 | 91 | * End PN544 specific HAL | ||
3940 | 92 | */ | ||
3941 | 93 | |||
3942 | 94 | __END_DECLS | ||
3943 | 95 | |||
3944 | 96 | #endif // ANDROID_NFC_HAL_INTERFACE_H | ||
3945 | 97 | 0 | ||
3946 | === removed file '3rd_party/android-deps/hardware/qemu_pipe.h' | |||
3947 | --- 3rd_party/android-deps/hardware/qemu_pipe.h 2013-01-08 17:44:16 +0000 | |||
3948 | +++ 3rd_party/android-deps/hardware/qemu_pipe.h 1970-01-01 00:00:00 +0000 | |||
3949 | @@ -1,91 +0,0 @@ | |||
3950 | 1 | /* | ||
3951 | 2 | * Copyright (C) 2011 The Android Open Source Project | ||
3952 | 3 | * | ||
3953 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
3954 | 5 | * you may not use this file except in compliance with the License. | ||
3955 | 6 | * You may obtain a copy of the License at | ||
3956 | 7 | * | ||
3957 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
3958 | 9 | * | ||
3959 | 10 | * Unless required by applicable law or agreed to in writing, software | ||
3960 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
3961 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
3962 | 13 | * See the License for the specific language governing permissions and | ||
3963 | 14 | * limitations under the License. | ||
3964 | 15 | */ | ||
3965 | 16 | #ifndef ANDROID_INCLUDE_HARDWARE_QEMU_PIPE_H | ||
3966 | 17 | #define ANDROID_INCLUDE_HARDWARE_QEMU_PIPE_H | ||
3967 | 18 | |||
3968 | 19 | #include <sys/cdefs.h> | ||
3969 | 20 | #include <unistd.h> | ||
3970 | 21 | #include <fcntl.h> | ||
3971 | 22 | #include <sys/mman.h> | ||
3972 | 23 | #include <pthread.h> /* for pthread_once() */ | ||
3973 | 24 | #include <stdlib.h> | ||
3974 | 25 | #include <stdio.h> | ||
3975 | 26 | #include <errno.h> | ||
3976 | 27 | |||
3977 | 28 | #ifndef D | ||
3978 | 29 | # define D(...) do{}while(0) | ||
3979 | 30 | #endif | ||
3980 | 31 | |||
3981 | 32 | /* Try to open a new Qemu fast-pipe. This function returns a file descriptor | ||
3982 | 33 | * that can be used to communicate with a named service managed by the | ||
3983 | 34 | * emulator. | ||
3984 | 35 | * | ||
3985 | 36 | * This file descriptor can be used as a standard pipe/socket descriptor. | ||
3986 | 37 | * | ||
3987 | 38 | * 'pipeName' is the name of the emulator service you want to connect to. | ||
3988 | 39 | * E.g. 'opengles' or 'camera'. | ||
3989 | 40 | * | ||
3990 | 41 | * On success, return a valid file descriptor | ||
3991 | 42 | * Returns -1 on error, and errno gives the error code, e.g.: | ||
3992 | 43 | * | ||
3993 | 44 | * EINVAL -> unknown/unsupported pipeName | ||
3994 | 45 | * ENOSYS -> fast pipes not available in this system. | ||
3995 | 46 | * | ||
3996 | 47 | * ENOSYS should never happen, except if you're trying to run within a | ||
3997 | 48 | * misconfigured emulator. | ||
3998 | 49 | * | ||
3999 | 50 | * You should be able to open several pipes to the same pipe service, | ||
4000 | 51 | * except for a few special cases (e.g. GSM modem), where EBUSY will be | ||
4001 | 52 | * returned if more than one client tries to connect to it. | ||
4002 | 53 | */ | ||
4003 | 54 | static __inline__ int | ||
4004 | 55 | qemu_pipe_open(const char* pipeName) | ||
4005 | 56 | { | ||
4006 | 57 | char buff[256]; | ||
4007 | 58 | int buffLen; | ||
4008 | 59 | int fd, ret; | ||
4009 | 60 | |||
4010 | 61 | if (pipeName == NULL || pipeName[0] == '\0') { | ||
4011 | 62 | errno = EINVAL; | ||
4012 | 63 | return -1; | ||
4013 | 64 | } | ||
4014 | 65 | |||
4015 | 66 | snprintf(buff, sizeof buff, "pipe:%s", pipeName); | ||
4016 | 67 | |||
4017 | 68 | fd = open("/dev/qemu_pipe", O_RDWR); | ||
4018 | 69 | if (fd < 0) { | ||
4019 | 70 | D("%s: Could not open /dev/qemu_pipe: %s", __FUNCTION__, strerror(errno)); | ||
4020 | 71 | //errno = ENOSYS; | ||
4021 | 72 | return -1; | ||
4022 | 73 | } | ||
4023 | 74 | |||
4024 | 75 | buffLen = strlen(buff); | ||
4025 | 76 | |||
4026 | 77 | ret = TEMP_FAILURE_RETRY(write(fd, buff, buffLen+1)); | ||
4027 | 78 | if (ret != buffLen+1) { | ||
4028 | 79 | D("%s: Could not connect to %s pipe service: %s", __FUNCTION__, pipeName, strerror(errno)); | ||
4029 | 80 | if (ret == 0) { | ||
4030 | 81 | errno = ECONNRESET; | ||
4031 | 82 | } else if (ret > 0) { | ||
4032 | 83 | errno = EINVAL; | ||
4033 | 84 | } | ||
4034 | 85 | return -1; | ||
4035 | 86 | } | ||
4036 | 87 | |||
4037 | 88 | return fd; | ||
4038 | 89 | } | ||
4039 | 90 | |||
4040 | 91 | #endif /* ANDROID_INCLUDE_HARDWARE_QEMUD_PIPE_H */ | ||
4041 | 92 | 0 | ||
4042 | === removed file '3rd_party/android-deps/hardware/qemud.h' | |||
4043 | --- 3rd_party/android-deps/hardware/qemud.h 2013-01-08 17:44:16 +0000 | |||
4044 | +++ 3rd_party/android-deps/hardware/qemud.h 1970-01-01 00:00:00 +0000 | |||
4045 | @@ -1,153 +0,0 @@ | |||
4046 | 1 | /* | ||
4047 | 2 | * Copyright (C) 2008 The Android Open Source Project | ||
4048 | 3 | * | ||
4049 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
4050 | 5 | * you may not use this file except in compliance with the License. | ||
4051 | 6 | * You may obtain a copy of the License at | ||
4052 | 7 | * | ||
4053 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
4054 | 9 | * | ||
4055 | 10 | * Unless required by applicable law or agreed to in writing, software | ||
4056 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
4057 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
4058 | 13 | * See the License for the specific language governing permissions and | ||
4059 | 14 | * limitations under the License. | ||
4060 | 15 | */ | ||
4061 | 16 | |||
4062 | 17 | #ifndef ANDROID_INCLUDE_HARDWARE_QEMUD_H | ||
4063 | 18 | #define ANDROID_INCLUDE_HARDWARE_QEMUD_H | ||
4064 | 19 | |||
4065 | 20 | #include <cutils/sockets.h> | ||
4066 | 21 | #include "qemu_pipe.h" | ||
4067 | 22 | |||
4068 | 23 | /* the following is helper code that is used by the QEMU-specific | ||
4069 | 24 | * hardware HAL modules to communicate with the emulator program | ||
4070 | 25 | * through the 'qemud' multiplexing daemon, or through the qemud | ||
4071 | 26 | * pipe. | ||
4072 | 27 | * | ||
4073 | 28 | * see the documentation comments for details in | ||
4074 | 29 | * development/emulator/qemud/qemud.c | ||
4075 | 30 | * | ||
4076 | 31 | * all definitions here are built into the HAL module to avoid | ||
4077 | 32 | * having to write a tiny shared library for this. | ||
4078 | 33 | */ | ||
4079 | 34 | |||
4080 | 35 | /* we expect the D macro to be defined to a function macro | ||
4081 | 36 | * that sends its formatted string argument(s) to the log. | ||
4082 | 37 | * If not, ignore the traces. | ||
4083 | 38 | */ | ||
4084 | 39 | #ifndef D | ||
4085 | 40 | # define D(...) ((void)0) | ||
4086 | 41 | #endif | ||
4087 | 42 | |||
4088 | 43 | static __inline__ int | ||
4089 | 44 | qemud_fd_write(int fd, const void* buff, int len) | ||
4090 | 45 | { | ||
4091 | 46 | int len2; | ||
4092 | 47 | do { | ||
4093 | 48 | len2 = write(fd, buff, len); | ||
4094 | 49 | } while (len2 < 0 && errno == EINTR); | ||
4095 | 50 | return len2; | ||
4096 | 51 | } | ||
4097 | 52 | |||
4098 | 53 | static __inline__ int | ||
4099 | 54 | qemud_fd_read(int fd, void* buff, int len) | ||
4100 | 55 | { | ||
4101 | 56 | int len2; | ||
4102 | 57 | do { | ||
4103 | 58 | len2 = read(fd, buff, len); | ||
4104 | 59 | } while (len2 < 0 && errno == EINTR); | ||
4105 | 60 | return len2; | ||
4106 | 61 | } | ||
4107 | 62 | |||
4108 | 63 | static __inline__ int | ||
4109 | 64 | qemud_channel_open(const char* name) | ||
4110 | 65 | { | ||
4111 | 66 | int fd; | ||
4112 | 67 | int namelen = strlen(name); | ||
4113 | 68 | char answer[2]; | ||
4114 | 69 | char pipe_name[256]; | ||
4115 | 70 | |||
4116 | 71 | /* First, try to connect to the pipe. */ | ||
4117 | 72 | snprintf(pipe_name, sizeof(pipe_name), "qemud:%s", name); | ||
4118 | 73 | fd = qemu_pipe_open(pipe_name); | ||
4119 | 74 | if (fd < 0) { | ||
4120 | 75 | D("QEMUD pipe is not available for %s: %s", name, strerror(errno)); | ||
4121 | 76 | /* If pipe is not available, connect to qemud control socket */ | ||
4122 | 77 | fd = socket_local_client( "qemud", | ||
4123 | 78 | ANDROID_SOCKET_NAMESPACE_RESERVED, | ||
4124 | 79 | SOCK_STREAM ); | ||
4125 | 80 | if (fd < 0) { | ||
4126 | 81 | D("no qemud control socket: %s", strerror(errno)); | ||
4127 | 82 | return -1; | ||
4128 | 83 | } | ||
4129 | 84 | |||
4130 | 85 | /* send service name to connect */ | ||
4131 | 86 | if (qemud_fd_write(fd, name, namelen) != namelen) { | ||
4132 | 87 | D("can't send service name to qemud: %s", | ||
4133 | 88 | strerror(errno)); | ||
4134 | 89 | close(fd); | ||
4135 | 90 | return -1; | ||
4136 | 91 | } | ||
4137 | 92 | |||
4138 | 93 | /* read answer from daemon */ | ||
4139 | 94 | if (qemud_fd_read(fd, answer, 2) != 2 || | ||
4140 | 95 | answer[0] != 'O' || answer[1] != 'K') { | ||
4141 | 96 | D("cant' connect to %s service through qemud", name); | ||
4142 | 97 | close(fd); | ||
4143 | 98 | return -1; | ||
4144 | 99 | } | ||
4145 | 100 | } | ||
4146 | 101 | return fd; | ||
4147 | 102 | } | ||
4148 | 103 | |||
4149 | 104 | static __inline__ int | ||
4150 | 105 | qemud_channel_send(int fd, const void* msg, int msglen) | ||
4151 | 106 | { | ||
4152 | 107 | char header[5]; | ||
4153 | 108 | |||
4154 | 109 | if (msglen < 0) | ||
4155 | 110 | msglen = strlen((const char*)msg); | ||
4156 | 111 | |||
4157 | 112 | if (msglen == 0) | ||
4158 | 113 | return 0; | ||
4159 | 114 | |||
4160 | 115 | snprintf(header, sizeof header, "%04x", msglen); | ||
4161 | 116 | if (qemud_fd_write(fd, header, 4) != 4) { | ||
4162 | 117 | D("can't write qemud frame header: %s", strerror(errno)); | ||
4163 | 118 | return -1; | ||
4164 | 119 | } | ||
4165 | 120 | |||
4166 | 121 | if (qemud_fd_write(fd, msg, msglen) != msglen) { | ||
4167 | 122 | D("can4t write qemud frame payload: %s", strerror(errno)); | ||
4168 | 123 | return -1; | ||
4169 | 124 | } | ||
4170 | 125 | return 0; | ||
4171 | 126 | } | ||
4172 | 127 | |||
4173 | 128 | static __inline__ int | ||
4174 | 129 | qemud_channel_recv(int fd, void* msg, int msgsize) | ||
4175 | 130 | { | ||
4176 | 131 | char header[5]; | ||
4177 | 132 | int size, avail; | ||
4178 | 133 | |||
4179 | 134 | if (qemud_fd_read(fd, header, 4) != 4) { | ||
4180 | 135 | D("can't read qemud frame header: %s", strerror(errno)); | ||
4181 | 136 | return -1; | ||
4182 | 137 | } | ||
4183 | 138 | header[4] = 0; | ||
4184 | 139 | if (sscanf(header, "%04x", &size) != 1) { | ||
4185 | 140 | D("malformed qemud frame header: '%.*s'", 4, header); | ||
4186 | 141 | return -1; | ||
4187 | 142 | } | ||
4188 | 143 | if (size > msgsize) | ||
4189 | 144 | return -1; | ||
4190 | 145 | |||
4191 | 146 | if (qemud_fd_read(fd, msg, size) != size) { | ||
4192 | 147 | D("can't read qemud frame payload: %s", strerror(errno)); | ||
4193 | 148 | return -1; | ||
4194 | 149 | } | ||
4195 | 150 | return size; | ||
4196 | 151 | } | ||
4197 | 152 | |||
4198 | 153 | #endif /* ANDROID_INCLUDE_HARDWARE_QEMUD_H */ | ||
4199 | 154 | 0 | ||
4200 | === removed file '3rd_party/android-deps/hardware/sensors.h' | |||
4201 | --- 3rd_party/android-deps/hardware/sensors.h 2013-01-08 17:44:16 +0000 | |||
4202 | +++ 3rd_party/android-deps/hardware/sensors.h 1970-01-01 00:00:00 +0000 | |||
4203 | @@ -1,485 +0,0 @@ | |||
4204 | 1 | /* | ||
4205 | 2 | * Copyright (C) 2008 The Android Open Source Project | ||
4206 | 3 | * | ||
4207 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
4208 | 5 | * you may not use this file except in compliance with the License. | ||
4209 | 6 | * You may obtain a copy of the License at | ||
4210 | 7 | * | ||
4211 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
4212 | 9 | * | ||
4213 | 10 | * Unless required by applicable law or agreed to in writing, software | ||
4214 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
4215 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
4216 | 13 | * See the License for the specific language governing permissions and | ||
4217 | 14 | * limitations under the License. | ||
4218 | 15 | */ | ||
4219 | 16 | |||
4220 | 17 | #ifndef ANDROID_SENSORS_INTERFACE_H | ||
4221 | 18 | #define ANDROID_SENSORS_INTERFACE_H | ||
4222 | 19 | |||
4223 | 20 | #include <stdint.h> | ||
4224 | 21 | #include <sys/cdefs.h> | ||
4225 | 22 | #include <sys/types.h> | ||
4226 | 23 | |||
4227 | 24 | #include <hardware/hardware.h> | ||
4228 | 25 | #include <cutils/native_handle.h> | ||
4229 | 26 | |||
4230 | 27 | __BEGIN_DECLS | ||
4231 | 28 | |||
4232 | 29 | /** | ||
4233 | 30 | * The id of this module | ||
4234 | 31 | */ | ||
4235 | 32 | #define SENSORS_HARDWARE_MODULE_ID "sensors" | ||
4236 | 33 | |||
4237 | 34 | /** | ||
4238 | 35 | * Name of the sensors device to open | ||
4239 | 36 | */ | ||
4240 | 37 | #define SENSORS_HARDWARE_POLL "poll" | ||
4241 | 38 | |||
4242 | 39 | /** | ||
4243 | 40 | * Handles must be higher than SENSORS_HANDLE_BASE and must be unique. | ||
4244 | 41 | * A Handle identifies a given sensors. The handle is used to activate | ||
4245 | 42 | * and/or deactivate sensors. | ||
4246 | 43 | * In this version of the API there can only be 256 handles. | ||
4247 | 44 | */ | ||
4248 | 45 | #define SENSORS_HANDLE_BASE 0 | ||
4249 | 46 | #define SENSORS_HANDLE_BITS 8 | ||
4250 | 47 | #define SENSORS_HANDLE_COUNT (1<<SENSORS_HANDLE_BITS) | ||
4251 | 48 | |||
4252 | 49 | |||
4253 | 50 | /** | ||
4254 | 51 | * Sensor types | ||
4255 | 52 | */ | ||
4256 | 53 | #define SENSOR_TYPE_ACCELEROMETER 1 | ||
4257 | 54 | #define SENSOR_TYPE_MAGNETIC_FIELD 2 | ||
4258 | 55 | #define SENSOR_TYPE_ORIENTATION 3 | ||
4259 | 56 | #define SENSOR_TYPE_GYROSCOPE 4 | ||
4260 | 57 | #define SENSOR_TYPE_LIGHT 5 | ||
4261 | 58 | #define SENSOR_TYPE_PRESSURE 6 | ||
4262 | 59 | #define SENSOR_TYPE_TEMPERATURE 7 // deprecated | ||
4263 | 60 | #define SENSOR_TYPE_PROXIMITY 8 | ||
4264 | 61 | #define SENSOR_TYPE_GRAVITY 9 | ||
4265 | 62 | #define SENSOR_TYPE_LINEAR_ACCELERATION 10 | ||
4266 | 63 | #define SENSOR_TYPE_ROTATION_VECTOR 11 | ||
4267 | 64 | #define SENSOR_TYPE_RELATIVE_HUMIDITY 12 | ||
4268 | 65 | #define SENSOR_TYPE_AMBIENT_TEMPERATURE 13 | ||
4269 | 66 | |||
4270 | 67 | /** | ||
4271 | 68 | * Values returned by the accelerometer in various locations in the universe. | ||
4272 | 69 | * all values are in SI units (m/s^2) | ||
4273 | 70 | */ | ||
4274 | 71 | |||
4275 | 72 | #define GRAVITY_SUN (275.0f) | ||
4276 | 73 | #define GRAVITY_EARTH (9.80665f) | ||
4277 | 74 | |||
4278 | 75 | /** Maximum magnetic field on Earth's surface */ | ||
4279 | 76 | #define MAGNETIC_FIELD_EARTH_MAX (60.0f) | ||
4280 | 77 | |||
4281 | 78 | /** Minimum magnetic field on Earth's surface */ | ||
4282 | 79 | #define MAGNETIC_FIELD_EARTH_MIN (30.0f) | ||
4283 | 80 | |||
4284 | 81 | |||
4285 | 82 | /** | ||
4286 | 83 | * status of each sensor | ||
4287 | 84 | */ | ||
4288 | 85 | |||
4289 | 86 | #define SENSOR_STATUS_UNRELIABLE 0 | ||
4290 | 87 | #define SENSOR_STATUS_ACCURACY_LOW 1 | ||
4291 | 88 | #define SENSOR_STATUS_ACCURACY_MEDIUM 2 | ||
4292 | 89 | #define SENSOR_STATUS_ACCURACY_HIGH 3 | ||
4293 | 90 | |||
4294 | 91 | /** | ||
4295 | 92 | * Definition of the axis | ||
4296 | 93 | * ---------------------- | ||
4297 | 94 | * | ||
4298 | 95 | * This API is relative to the screen of the device in its default orientation, | ||
4299 | 96 | * that is, if the device can be used in portrait or landscape, this API | ||
4300 | 97 | * is only relative to the NATURAL orientation of the screen. In other words, | ||
4301 | 98 | * the axis are not swapped when the device's screen orientation changes. | ||
4302 | 99 | * Higher level services /may/ perform this transformation. | ||
4303 | 100 | * | ||
4304 | 101 | * x<0 x>0 | ||
4305 | 102 | * ^ | ||
4306 | 103 | * | | ||
4307 | 104 | * +-----------+--> y>0 | ||
4308 | 105 | * | | | ||
4309 | 106 | * | | | ||
4310 | 107 | * | | | ||
4311 | 108 | * | | / z<0 | ||
4312 | 109 | * | | / | ||
4313 | 110 | * | | / | ||
4314 | 111 | * O-----------+/ | ||
4315 | 112 | * |[] [ ] []/ | ||
4316 | 113 | * +----------/+ y<0 | ||
4317 | 114 | * / | ||
4318 | 115 | * / | ||
4319 | 116 | * |/ z>0 (toward the sky) | ||
4320 | 117 | * | ||
4321 | 118 | * O: Origin (x=0,y=0,z=0) | ||
4322 | 119 | * | ||
4323 | 120 | * | ||
4324 | 121 | * SENSOR_TYPE_ORIENTATION | ||
4325 | 122 | * ----------------------- | ||
4326 | 123 | * | ||
4327 | 124 | * All values are angles in degrees. | ||
4328 | 125 | * | ||
4329 | 126 | * Orientation sensors return sensor events for all 3 axes at a constant | ||
4330 | 127 | * rate defined by setDelay(). | ||
4331 | 128 | * | ||
4332 | 129 | * azimuth: angle between the magnetic north direction and the Y axis, around | ||
4333 | 130 | * the Z axis (0<=azimuth<360). | ||
4334 | 131 | * 0=North, 90=East, 180=South, 270=West | ||
4335 | 132 | * | ||
4336 | 133 | * pitch: Rotation around X axis (-180<=pitch<=180), with positive values when | ||
4337 | 134 | * the z-axis moves toward the y-axis. | ||
4338 | 135 | * | ||
4339 | 136 | * roll: Rotation around Y axis (-90<=roll<=90), with positive values when | ||
4340 | 137 | * the x-axis moves towards the z-axis. | ||
4341 | 138 | * | ||
4342 | 139 | * Note: For historical reasons the roll angle is positive in the clockwise | ||
4343 | 140 | * direction (mathematically speaking, it should be positive in the | ||
4344 | 141 | * counter-clockwise direction): | ||
4345 | 142 | * | ||
4346 | 143 | * Z | ||
4347 | 144 | * ^ | ||
4348 | 145 | * (+roll) .--> | | ||
4349 | 146 | * / | | ||
4350 | 147 | * | | roll: rotation around Y axis | ||
4351 | 148 | * X <-------(.) | ||
4352 | 149 | * Y | ||
4353 | 150 | * note that +Y == -roll | ||
4354 | 151 | * | ||
4355 | 152 | * | ||
4356 | 153 | * | ||
4357 | 154 | * Note: This definition is different from yaw, pitch and roll used in aviation | ||
4358 | 155 | * where the X axis is along the long side of the plane (tail to nose). | ||
4359 | 156 | * | ||
4360 | 157 | * | ||
4361 | 158 | * SENSOR_TYPE_ACCELEROMETER | ||
4362 | 159 | * ------------------------- | ||
4363 | 160 | * | ||
4364 | 161 | * All values are in SI units (m/s^2) and measure the acceleration of the | ||
4365 | 162 | * device minus the force of gravity. | ||
4366 | 163 | * | ||
4367 | 164 | * Acceleration sensors return sensor events for all 3 axes at a constant | ||
4368 | 165 | * rate defined by setDelay(). | ||
4369 | 166 | * | ||
4370 | 167 | * x: Acceleration minus Gx on the x-axis | ||
4371 | 168 | * y: Acceleration minus Gy on the y-axis | ||
4372 | 169 | * z: Acceleration minus Gz on the z-axis | ||
4373 | 170 | * | ||
4374 | 171 | * Examples: | ||
4375 | 172 | * When the device lies flat on a table and is pushed on its left side | ||
4376 | 173 | * toward the right, the x acceleration value is positive. | ||
4377 | 174 | * | ||
4378 | 175 | * When the device lies flat on a table, the acceleration value is +9.81, | ||
4379 | 176 | * which correspond to the acceleration of the device (0 m/s^2) minus the | ||
4380 | 177 | * force of gravity (-9.81 m/s^2). | ||
4381 | 178 | * | ||
4382 | 179 | * When the device lies flat on a table and is pushed toward the sky, the | ||
4383 | 180 | * acceleration value is greater than +9.81, which correspond to the | ||
4384 | 181 | * acceleration of the device (+A m/s^2) minus the force of | ||
4385 | 182 | * gravity (-9.81 m/s^2). | ||
4386 | 183 | * | ||
4387 | 184 | * | ||
4388 | 185 | * SENSOR_TYPE_MAGNETIC_FIELD | ||
4389 | 186 | * -------------------------- | ||
4390 | 187 | * | ||
4391 | 188 | * All values are in micro-Tesla (uT) and measure the ambient magnetic | ||
4392 | 189 | * field in the X, Y and Z axis. | ||
4393 | 190 | * | ||
4394 | 191 | * Magnetic Field sensors return sensor events for all 3 axes at a constant | ||
4395 | 192 | * rate defined by setDelay(). | ||
4396 | 193 | * | ||
4397 | 194 | * SENSOR_TYPE_GYROSCOPE | ||
4398 | 195 | * --------------------- | ||
4399 | 196 | * | ||
4400 | 197 | * All values are in radians/second and measure the rate of rotation | ||
4401 | 198 | * around the X, Y and Z axis. The coordinate system is the same as is | ||
4402 | 199 | * used for the acceleration sensor. Rotation is positive in the | ||
4403 | 200 | * counter-clockwise direction (right-hand rule). That is, an observer | ||
4404 | 201 | * looking from some positive location on the x, y or z axis at a device | ||
4405 | 202 | * positioned on the origin would report positive rotation if the device | ||
4406 | 203 | * appeared to be rotating counter clockwise. Note that this is the | ||
4407 | 204 | * standard mathematical definition of positive rotation and does not agree | ||
4408 | 205 | * with the definition of roll given earlier. | ||
4409 | 206 | * The range should at least be 17.45 rad/s (ie: ~1000 deg/s). | ||
4410 | 207 | * | ||
4411 | 208 | * SENSOR_TYPE_PROXIMITY | ||
4412 | 209 | * ---------------------- | ||
4413 | 210 | * | ||
4414 | 211 | * The distance value is measured in centimeters. Note that some proximity | ||
4415 | 212 | * sensors only support a binary "close" or "far" measurement. In this case, | ||
4416 | 213 | * the sensor should report its maxRange value in the "far" state and a value | ||
4417 | 214 | * less than maxRange in the "near" state. | ||
4418 | 215 | * | ||
4419 | 216 | * Proximity sensors report a value only when it changes and each time the | ||
4420 | 217 | * sensor is enabled. | ||
4421 | 218 | * | ||
4422 | 219 | * SENSOR_TYPE_LIGHT | ||
4423 | 220 | * ----------------- | ||
4424 | 221 | * | ||
4425 | 222 | * The light sensor value is returned in SI lux units. | ||
4426 | 223 | * | ||
4427 | 224 | * Light sensors report a value only when it changes and each time the | ||
4428 | 225 | * sensor is enabled. | ||
4429 | 226 | * | ||
4430 | 227 | * SENSOR_TYPE_PRESSURE | ||
4431 | 228 | * -------------------- | ||
4432 | 229 | * | ||
4433 | 230 | * The pressure sensor return the athmospheric pressure in hectopascal (hPa) | ||
4434 | 231 | * | ||
4435 | 232 | * Pressure sensors report events at a constant rate defined by setDelay(). | ||
4436 | 233 | * | ||
4437 | 234 | * SENSOR_TYPE_GRAVITY | ||
4438 | 235 | * ------------------- | ||
4439 | 236 | * | ||
4440 | 237 | * A gravity output indicates the direction of and magnitude of gravity in | ||
4441 | 238 | * the devices's coordinates. On Earth, the magnitude is 9.8 m/s^2. | ||
4442 | 239 | * Units are m/s^2. The coordinate system is the same as is used for the | ||
4443 | 240 | * acceleration sensor. When the device is at rest, the output of the | ||
4444 | 241 | * gravity sensor should be identical to that of the accelerometer. | ||
4445 | 242 | * | ||
4446 | 243 | * SENSOR_TYPE_LINEAR_ACCELERATION | ||
4447 | 244 | * -------------------------------- | ||
4448 | 245 | * | ||
4449 | 246 | * Indicates the linear acceleration of the device in device coordinates, | ||
4450 | 247 | * not including gravity. | ||
4451 | 248 | * This output is essentially Acceleration - Gravity. Units are m/s^2. | ||
4452 | 249 | * The coordinate system is the same as is used for the acceleration sensor. | ||
4453 | 250 | * | ||
4454 | 251 | * | ||
4455 | 252 | * SENSOR_TYPE_ROTATION_VECTOR | ||
4456 | 253 | * --------------------------- | ||
4457 | 254 | * | ||
4458 | 255 | * A rotation vector represents the orientation of the device as a combination | ||
4459 | 256 | * of an angle and an axis, in which the device has rotated through an angle | ||
4460 | 257 | * theta around an axis <x, y, z>. The three elements of the rotation vector | ||
4461 | 258 | * are <x*sin(theta/2), y*sin(theta/2), z*sin(theta/2)>, such that the magnitude | ||
4462 | 259 | * of the rotation vector is equal to sin(theta/2), and the direction of the | ||
4463 | 260 | * rotation vector is equal to the direction of the axis of rotation. The three | ||
4464 | 261 | * elements of the rotation vector are equal to the last three components of a | ||
4465 | 262 | * unit quaternion <cos(theta/2), x*sin(theta/2), y*sin(theta/2), z*sin(theta/2)>. | ||
4466 | 263 | * Elements of the rotation vector are unitless. The x, y, and z axis are defined | ||
4467 | 264 | * in the same was as for the acceleration sensor. | ||
4468 | 265 | * | ||
4469 | 266 | * The reference coordinate system is defined as a direct orthonormal basis, | ||
4470 | 267 | * where: | ||
4471 | 268 | * | ||
4472 | 269 | * - X is defined as the vector product Y.Z (It is tangential to | ||
4473 | 270 | * the ground at the device's current location and roughly points East). | ||
4474 | 271 | * | ||
4475 | 272 | * - Y is tangential to the ground at the device's current location and | ||
4476 | 273 | * points towards the magnetic North Pole. | ||
4477 | 274 | * | ||
4478 | 275 | * - Z points towards the sky and is perpendicular to the ground. | ||
4479 | 276 | * | ||
4480 | 277 | * | ||
4481 | 278 | * The rotation-vector is stored as: | ||
4482 | 279 | * | ||
4483 | 280 | * sensors_event_t.data[0] = x*sin(theta/2) | ||
4484 | 281 | * sensors_event_t.data[1] = y*sin(theta/2) | ||
4485 | 282 | * sensors_event_t.data[2] = z*sin(theta/2) | ||
4486 | 283 | * sensors_event_t.data[3] = cos(theta/2) | ||
4487 | 284 | * | ||
4488 | 285 | * | ||
4489 | 286 | * SENSOR_TYPE_RELATIVE_HUMIDITY | ||
4490 | 287 | * ------------------------------ | ||
4491 | 288 | * | ||
4492 | 289 | * A relative humidity sensor measures relative ambient air humidity and | ||
4493 | 290 | * returns a value in percent. | ||
4494 | 291 | * | ||
4495 | 292 | * Relative humidity sensors report a value only when it changes and each | ||
4496 | 293 | * time the sensor is enabled. | ||
4497 | 294 | * | ||
4498 | 295 | * | ||
4499 | 296 | * SENSOR_TYPE_AMBIENT_TEMPERATURE | ||
4500 | 297 | * ------------------------------- | ||
4501 | 298 | * | ||
4502 | 299 | * The ambient (room) temperature in degree Celsius. | ||
4503 | 300 | * | ||
4504 | 301 | * Temperature sensors report a value only when it changes and each time the | ||
4505 | 302 | * sensor is enabled. | ||
4506 | 303 | * | ||
4507 | 304 | */ | ||
4508 | 305 | |||
4509 | 306 | typedef struct { | ||
4510 | 307 | union { | ||
4511 | 308 | float v[3]; | ||
4512 | 309 | struct { | ||
4513 | 310 | float x; | ||
4514 | 311 | float y; | ||
4515 | 312 | float z; | ||
4516 | 313 | }; | ||
4517 | 314 | struct { | ||
4518 | 315 | float azimuth; | ||
4519 | 316 | float pitch; | ||
4520 | 317 | float roll; | ||
4521 | 318 | }; | ||
4522 | 319 | }; | ||
4523 | 320 | int8_t status; | ||
4524 | 321 | uint8_t reserved[3]; | ||
4525 | 322 | } sensors_vec_t; | ||
4526 | 323 | |||
4527 | 324 | /** | ||
4528 | 325 | * Union of the various types of sensor data | ||
4529 | 326 | * that can be returned. | ||
4530 | 327 | */ | ||
4531 | 328 | typedef struct sensors_event_t { | ||
4532 | 329 | /* must be sizeof(struct sensors_event_t) */ | ||
4533 | 330 | int32_t version; | ||
4534 | 331 | |||
4535 | 332 | /* sensor identifier */ | ||
4536 | 333 | int32_t sensor; | ||
4537 | 334 | |||
4538 | 335 | /* sensor type */ | ||
4539 | 336 | int32_t type; | ||
4540 | 337 | |||
4541 | 338 | /* reserved */ | ||
4542 | 339 | int32_t reserved0; | ||
4543 | 340 | |||
4544 | 341 | /* time is in nanosecond */ | ||
4545 | 342 | int64_t timestamp; | ||
4546 | 343 | |||
4547 | 344 | union { | ||
4548 | 345 | float data[16]; | ||
4549 | 346 | |||
4550 | 347 | /* acceleration values are in meter per second per second (m/s^2) */ | ||
4551 | 348 | sensors_vec_t acceleration; | ||
4552 | 349 | |||
4553 | 350 | /* magnetic vector values are in micro-Tesla (uT) */ | ||
4554 | 351 | sensors_vec_t magnetic; | ||
4555 | 352 | |||
4556 | 353 | /* orientation values are in degrees */ | ||
4557 | 354 | sensors_vec_t orientation; | ||
4558 | 355 | |||
4559 | 356 | /* gyroscope values are in rad/s */ | ||
4560 | 357 | sensors_vec_t gyro; | ||
4561 | 358 | |||
4562 | 359 | /* temperature is in degrees centigrade (Celsius) */ | ||
4563 | 360 | float temperature; | ||
4564 | 361 | |||
4565 | 362 | /* distance in centimeters */ | ||
4566 | 363 | float distance; | ||
4567 | 364 | |||
4568 | 365 | /* light in SI lux units */ | ||
4569 | 366 | float light; | ||
4570 | 367 | |||
4571 | 368 | /* pressure in hectopascal (hPa) */ | ||
4572 | 369 | float pressure; | ||
4573 | 370 | |||
4574 | 371 | /* relative humidity in percent */ | ||
4575 | 372 | float relative_humidity; | ||
4576 | 373 | }; | ||
4577 | 374 | uint32_t reserved1[4]; | ||
4578 | 375 | } sensors_event_t; | ||
4579 | 376 | |||
4580 | 377 | |||
4581 | 378 | |||
4582 | 379 | struct sensor_t; | ||
4583 | 380 | |||
4584 | 381 | /** | ||
4585 | 382 | * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM | ||
4586 | 383 | * and the fields of this data structure must begin with hw_module_t | ||
4587 | 384 | * followed by module specific information. | ||
4588 | 385 | */ | ||
4589 | 386 | struct sensors_module_t { | ||
4590 | 387 | struct hw_module_t common; | ||
4591 | 388 | |||
4592 | 389 | /** | ||
4593 | 390 | * Enumerate all available sensors. The list is returned in "list". | ||
4594 | 391 | * @return number of sensors in the list | ||
4595 | 392 | */ | ||
4596 | 393 | int (*get_sensors_list)(struct sensors_module_t* module, | ||
4597 | 394 | struct sensor_t const** list); | ||
4598 | 395 | }; | ||
4599 | 396 | |||
4600 | 397 | struct sensor_t { | ||
4601 | 398 | /* name of this sensors */ | ||
4602 | 399 | const char* name; | ||
4603 | 400 | /* vendor of the hardware part */ | ||
4604 | 401 | const char* vendor; | ||
4605 | 402 | /* version of the hardware part + driver. The value of this field | ||
4606 | 403 | * must increase when the driver is updated in a way that changes the | ||
4607 | 404 | * output of this sensor. This is important for fused sensors when the | ||
4608 | 405 | * fusion algorithm is updated. | ||
4609 | 406 | */ | ||
4610 | 407 | int version; | ||
4611 | 408 | /* handle that identifies this sensors. This handle is used to activate | ||
4612 | 409 | * and deactivate this sensor. The value of the handle must be 8 bits | ||
4613 | 410 | * in this version of the API. | ||
4614 | 411 | */ | ||
4615 | 412 | int handle; | ||
4616 | 413 | /* this sensor's type. */ | ||
4617 | 414 | int type; | ||
4618 | 415 | /* maximaum range of this sensor's value in SI units */ | ||
4619 | 416 | float maxRange; | ||
4620 | 417 | /* smallest difference between two values reported by this sensor */ | ||
4621 | 418 | float resolution; | ||
4622 | 419 | /* rough estimate of this sensor's power consumption in mA */ | ||
4623 | 420 | float power; | ||
4624 | 421 | /* minimum delay allowed between events in microseconds. A value of zero | ||
4625 | 422 | * means that this sensor doesn't report events at a constant rate, but | ||
4626 | 423 | * rather only when a new data is available */ | ||
4627 | 424 | int32_t minDelay; | ||
4628 | 425 | /* reserved fields, must be zero */ | ||
4629 | 426 | void* reserved[8]; | ||
4630 | 427 | }; | ||
4631 | 428 | |||
4632 | 429 | |||
4633 | 430 | /** | ||
4634 | 431 | * Every device data structure must begin with hw_device_t | ||
4635 | 432 | * followed by module specific public methods and attributes. | ||
4636 | 433 | */ | ||
4637 | 434 | struct sensors_poll_device_t { | ||
4638 | 435 | struct hw_device_t common; | ||
4639 | 436 | |||
4640 | 437 | /** Activate/deactivate one sensor. | ||
4641 | 438 | * | ||
4642 | 439 | * @param handle is the handle of the sensor to change. | ||
4643 | 440 | * @param enabled set to 1 to enable, or 0 to disable the sensor. | ||
4644 | 441 | * | ||
4645 | 442 | * @return 0 on success, negative errno code otherwise | ||
4646 | 443 | */ | ||
4647 | 444 | int (*activate)(struct sensors_poll_device_t *dev, | ||
4648 | 445 | int handle, int enabled); | ||
4649 | 446 | |||
4650 | 447 | /** | ||
4651 | 448 | * Set the delay between sensor events in nanoseconds for a given sensor. | ||
4652 | 449 | * | ||
4653 | 450 | * If the requested value is less than sensor_t::minDelay, then it's | ||
4654 | 451 | * silently clamped to sensor_t::minDelay unless sensor_t::minDelay is | ||
4655 | 452 | * 0, in which case it is clamped to >= 1ms. | ||
4656 | 453 | * | ||
4657 | 454 | * @return 0 if successful, < 0 on error | ||
4658 | 455 | */ | ||
4659 | 456 | int (*setDelay)(struct sensors_poll_device_t *dev, | ||
4660 | 457 | int handle, int64_t ns); | ||
4661 | 458 | |||
4662 | 459 | /** | ||
4663 | 460 | * Returns an array of sensor data. | ||
4664 | 461 | * This function must block until events are available. | ||
4665 | 462 | * | ||
4666 | 463 | * @return the number of events read on success, or -errno in case of an error. | ||
4667 | 464 | * This function should never return 0 (no event). | ||
4668 | 465 | * | ||
4669 | 466 | */ | ||
4670 | 467 | int (*poll)(struct sensors_poll_device_t *dev, | ||
4671 | 468 | sensors_event_t* data, int count); | ||
4672 | 469 | }; | ||
4673 | 470 | |||
4674 | 471 | /** convenience API for opening and closing a device */ | ||
4675 | 472 | |||
4676 | 473 | static inline int sensors_open(const struct hw_module_t* module, | ||
4677 | 474 | struct sensors_poll_device_t** device) { | ||
4678 | 475 | return module->methods->open(module, | ||
4679 | 476 | SENSORS_HARDWARE_POLL, (struct hw_device_t**)device); | ||
4680 | 477 | } | ||
4681 | 478 | |||
4682 | 479 | static inline int sensors_close(struct sensors_poll_device_t* device) { | ||
4683 | 480 | return device->common.close(&device->common); | ||
4684 | 481 | } | ||
4685 | 482 | |||
4686 | 483 | __END_DECLS | ||
4687 | 484 | |||
4688 | 485 | #endif // ANDROID_SENSORS_INTERFACE_H | ||
4689 | 486 | 0 | ||
4690 | === added directory '3rd_party/android-deps/sync' | |||
4691 | === added file '3rd_party/android-deps/sync/sync.h' | |||
4692 | --- 3rd_party/android-deps/sync/sync.h 1970-01-01 00:00:00 +0000 | |||
4693 | +++ 3rd_party/android-deps/sync/sync.h 2013-03-06 00:16:21 +0000 | |||
4694 | @@ -0,0 +1,62 @@ | |||
4695 | 1 | /* | ||
4696 | 2 | * sync.h | ||
4697 | 3 | * | ||
4698 | 4 | * Copyright 2012 Google, Inc | ||
4699 | 5 | * | ||
4700 | 6 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
4701 | 7 | * you may not use this file except in compliance with the License. | ||
4702 | 8 | * You may obtain a copy of the License at | ||
4703 | 9 | * | ||
4704 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
4705 | 11 | * | ||
4706 | 12 | * Unless required by applicable law or agreed to in writing, software | ||
4707 | 13 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
4708 | 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
4709 | 15 | * See the License for the specific language governing permissions and | ||
4710 | 16 | * limitations under the License. | ||
4711 | 17 | */ | ||
4712 | 18 | |||
4713 | 19 | #ifndef __SYS_CORE_SYNC_H | ||
4714 | 20 | #define __SYS_CORE_SYNC_H | ||
4715 | 21 | |||
4716 | 22 | #include <sys/cdefs.h> | ||
4717 | 23 | #include <stdint.h> | ||
4718 | 24 | |||
4719 | 25 | __BEGIN_DECLS | ||
4720 | 26 | |||
4721 | 27 | // XXX: These structs are copied from the header "linux/sync.h". | ||
4722 | 28 | struct sync_fence_info_data { | ||
4723 | 29 | uint32_t len; | ||
4724 | 30 | char name[32]; | ||
4725 | 31 | int32_t status; | ||
4726 | 32 | uint8_t pt_info[0]; | ||
4727 | 33 | }; | ||
4728 | 34 | |||
4729 | 35 | struct sync_pt_info { | ||
4730 | 36 | uint32_t len; | ||
4731 | 37 | char obj_name[32]; | ||
4732 | 38 | char driver_name[32]; | ||
4733 | 39 | int32_t status; | ||
4734 | 40 | uint64_t timestamp_ns; | ||
4735 | 41 | uint8_t driver_data[0]; | ||
4736 | 42 | }; | ||
4737 | 43 | |||
4738 | 44 | /* timeout in msecs */ | ||
4739 | 45 | int sync_wait(int fd, int timeout); | ||
4740 | 46 | int sync_merge(const char *name, int fd1, int fd2); | ||
4741 | 47 | struct sync_fence_info_data *sync_fence_info(int fd); | ||
4742 | 48 | struct sync_pt_info *sync_pt_info(struct sync_fence_info_data *info, | ||
4743 | 49 | struct sync_pt_info *itr); | ||
4744 | 50 | void sync_fence_info_free(struct sync_fence_info_data *info); | ||
4745 | 51 | |||
4746 | 52 | /* sw_sync is mainly inteded for testing and should not be complied into | ||
4747 | 53 | * production kernels | ||
4748 | 54 | */ | ||
4749 | 55 | |||
4750 | 56 | int sw_sync_timeline_create(void); | ||
4751 | 57 | int sw_sync_timeline_inc(int fd, unsigned count); | ||
4752 | 58 | int sw_sync_fence_create(int fd, const char *name, unsigned value); | ||
4753 | 59 | |||
4754 | 60 | __END_DECLS | ||
4755 | 61 | |||
4756 | 62 | #endif /* __SYS_CORE_SYNC_H */ | ||
4757 | 0 | 63 | ||
4758 | === modified file '3rd_party/android-deps/system/graphics.h' | |||
4759 | --- 3rd_party/android-deps/system/graphics.h 2013-03-05 09:47:57 +0000 | |||
4760 | +++ 3rd_party/android-deps/system/graphics.h 2013-03-06 00:16:21 +0000 | |||
4761 | @@ -109,10 +109,41 @@ | |||
4762 | 109 | */ | 109 | */ |
4763 | 110 | HAL_PIXEL_FORMAT_RAW_SENSOR = 0x20, | 110 | HAL_PIXEL_FORMAT_RAW_SENSOR = 0x20, |
4764 | 111 | 111 | ||
4765 | 112 | /* | ||
4766 | 113 | * Android binary blob graphics buffer format: | ||
4767 | 114 | * | ||
4768 | 115 | * This format is used to carry task-specific data which does not have a | ||
4769 | 116 | * standard image structure. The details of the format are left to the two | ||
4770 | 117 | * endpoints. | ||
4771 | 118 | * | ||
4772 | 119 | * A typical use case is for transporting JPEG-compressed images from the | ||
4773 | 120 | * Camera HAL to the framework or to applications. | ||
4774 | 121 | * | ||
4775 | 122 | * Buffers of this format must have a height of 1, and width equal to their | ||
4776 | 123 | * size in bytes. | ||
4777 | 124 | */ | ||
4778 | 125 | HAL_PIXEL_FORMAT_BLOB = 0x21, | ||
4779 | 126 | |||
4780 | 127 | /* | ||
4781 | 128 | * Android format indicating that the choice of format is entirely up to the | ||
4782 | 129 | * device-specific Gralloc implementation. | ||
4783 | 130 | * | ||
4784 | 131 | * The Gralloc implementation should examine the usage bits passed in when | ||
4785 | 132 | * allocating a buffer with this format, and it should derive the pixel | ||
4786 | 133 | * format from those usage flags. This format will never be used with any | ||
4787 | 134 | * of the GRALLOC_USAGE_SW_* usage flags. | ||
4788 | 135 | * | ||
4789 | 136 | * If a buffer of this format is to be used as an OpenGL ES texture, the | ||
4790 | 137 | * framework will assume that sampling the texture will always return an | ||
4791 | 138 | * alpha value of 1.0 (i.e. the buffer contains only opaque pixel values). | ||
4792 | 139 | * | ||
4793 | 140 | */ | ||
4794 | 141 | HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED = 0x22, | ||
4795 | 142 | |||
4796 | 112 | /* Legacy formats (deprecated), used by ImageFormat.java */ | 143 | /* Legacy formats (deprecated), used by ImageFormat.java */ |
4797 | 113 | HAL_PIXEL_FORMAT_YCbCr_422_SP = 0x10, // NV16 | 144 | HAL_PIXEL_FORMAT_YCbCr_422_SP = 0x10, // NV16 |
4798 | 114 | HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, // NV21 | 145 | HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, // NV21 |
4800 | 115 | HAL_PIXEL_FORMAT_YCbCr_422_I = 0x14 // YUY2 | 146 | HAL_PIXEL_FORMAT_YCbCr_422_I = 0x14, // YUY2 |
4801 | 116 | }; | 147 | }; |
4802 | 117 | 148 | ||
4803 | 118 | 149 | ||
4804 | @@ -134,7 +165,7 @@ | |||
4805 | 134 | /* rotate source image 180 degrees */ | 165 | /* rotate source image 180 degrees */ |
4806 | 135 | HAL_TRANSFORM_ROT_180 = 0x03, | 166 | HAL_TRANSFORM_ROT_180 = 0x03, |
4807 | 136 | /* rotate source image 270 degrees clockwise */ | 167 | /* rotate source image 270 degrees clockwise */ |
4809 | 137 | HAL_TRANSFORM_ROT_270 = 0x07 | 168 | HAL_TRANSFORM_ROT_270 = 0x07, |
4810 | 138 | }; | 169 | }; |
4811 | 139 | 170 | ||
4812 | 140 | #ifdef __cplusplus | 171 | #ifdef __cplusplus |
4813 | 141 | 172 | ||
4814 | === modified file '3rd_party/android-deps/system/window.h' | |||
4815 | --- 3rd_party/android-deps/system/window.h 2013-01-08 17:44:16 +0000 | |||
4816 | +++ 3rd_party/android-deps/system/window.h 2013-03-06 00:16:21 +0000 | |||
4817 | @@ -17,10 +17,15 @@ | |||
4818 | 17 | #ifndef SYSTEM_CORE_INCLUDE_ANDROID_WINDOW_H | 17 | #ifndef SYSTEM_CORE_INCLUDE_ANDROID_WINDOW_H |
4819 | 18 | #define SYSTEM_CORE_INCLUDE_ANDROID_WINDOW_H | 18 | #define SYSTEM_CORE_INCLUDE_ANDROID_WINDOW_H |
4820 | 19 | 19 | ||
4821 | 20 | #include <cutils/native_handle.h> | ||
4822 | 21 | #include <errno.h> | ||
4823 | 22 | #include <limits.h> | ||
4824 | 20 | #include <stdint.h> | 23 | #include <stdint.h> |
4825 | 24 | #include <string.h> | ||
4826 | 25 | #include <sync/sync.h> | ||
4827 | 21 | #include <sys/cdefs.h> | 26 | #include <sys/cdefs.h> |
4828 | 22 | #include <system/graphics.h> | 27 | #include <system/graphics.h> |
4830 | 23 | #include <cutils/native_handle.h> | 28 | #include <unistd.h> |
4831 | 24 | 29 | ||
4832 | 25 | #ifdef __cplusplus | 30 | #ifdef __cplusplus |
4833 | 26 | #include <string.h> | 31 | #include <string.h> |
4834 | @@ -41,6 +46,14 @@ | |||
4835 | 41 | 46 | ||
4836 | 42 | // --------------------------------------------------------------------------- | 47 | // --------------------------------------------------------------------------- |
4837 | 43 | 48 | ||
4838 | 49 | // This #define may be used to conditionally compile device-specific code to | ||
4839 | 50 | // support either the prior ANativeWindow interface, which did not pass libsync | ||
4840 | 51 | // fences around, or the new interface that does. This #define is only present | ||
4841 | 52 | // when the ANativeWindow interface does include libsync support. | ||
4842 | 53 | #define ANDROID_NATIVE_WINDOW_HAS_SYNC 1 | ||
4843 | 54 | |||
4844 | 55 | // --------------------------------------------------------------------------- | ||
4845 | 56 | |||
4846 | 44 | typedef const native_handle_t* buffer_handle_t; | 57 | typedef const native_handle_t* buffer_handle_t; |
4847 | 45 | 58 | ||
4848 | 46 | // --------------------------------------------------------------------------- | 59 | // --------------------------------------------------------------------------- |
4849 | @@ -160,9 +173,10 @@ | |||
4850 | 160 | 173 | ||
4851 | 161 | 174 | ||
4852 | 162 | /* | 175 | /* |
4856 | 163 | * Default width and height of the ANativeWindow, these are the dimensions | 176 | * Default width and height of ANativeWindow buffers, these are the |
4857 | 164 | * of the window irrespective of the NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS | 177 | * dimensions of the window buffers irrespective of the |
4858 | 165 | * call. | 178 | * NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS call and match the native window |
4859 | 179 | * size unless overridden by NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS. | ||
4860 | 166 | */ | 180 | */ |
4861 | 167 | NATIVE_WINDOW_DEFAULT_WIDTH = 6, | 181 | NATIVE_WINDOW_DEFAULT_WIDTH = 6, |
4862 | 168 | NATIVE_WINDOW_DEFAULT_HEIGHT = 7, | 182 | NATIVE_WINDOW_DEFAULT_HEIGHT = 7, |
4863 | @@ -215,25 +229,46 @@ | |||
4864 | 215 | * | 229 | * |
4865 | 216 | */ | 230 | */ |
4866 | 217 | NATIVE_WINDOW_TRANSFORM_HINT = 8, | 231 | NATIVE_WINDOW_TRANSFORM_HINT = 8, |
4867 | 232 | |||
4868 | 233 | /* | ||
4869 | 234 | * Boolean that indicates whether the consumer is running more than | ||
4870 | 235 | * one buffer behind the producer. | ||
4871 | 236 | */ | ||
4872 | 237 | NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND = 9 | ||
4873 | 218 | }; | 238 | }; |
4874 | 219 | 239 | ||
4876 | 220 | /* valid operations for the (*perform)() hook */ | 240 | /* Valid operations for the (*perform)() hook. |
4877 | 241 | * | ||
4878 | 242 | * Values marked as 'deprecated' are supported, but have been superceded by | ||
4879 | 243 | * other functionality. | ||
4880 | 244 | * | ||
4881 | 245 | * Values marked as 'private' should be considered private to the framework. | ||
4882 | 246 | * HAL implementation code with access to an ANativeWindow should not use these, | ||
4883 | 247 | * as it may not interact properly with the framework's use of the | ||
4884 | 248 | * ANativeWindow. | ||
4885 | 249 | */ | ||
4886 | 221 | enum { | 250 | enum { |
4887 | 222 | NATIVE_WINDOW_SET_USAGE = 0, | 251 | NATIVE_WINDOW_SET_USAGE = 0, |
4888 | 223 | NATIVE_WINDOW_CONNECT = 1, /* deprecated */ | 252 | NATIVE_WINDOW_CONNECT = 1, /* deprecated */ |
4889 | 224 | NATIVE_WINDOW_DISCONNECT = 2, /* deprecated */ | 253 | NATIVE_WINDOW_DISCONNECT = 2, /* deprecated */ |
4891 | 225 | NATIVE_WINDOW_SET_CROP = 3, | 254 | NATIVE_WINDOW_SET_CROP = 3, /* private */ |
4892 | 226 | NATIVE_WINDOW_SET_BUFFER_COUNT = 4, | 255 | NATIVE_WINDOW_SET_BUFFER_COUNT = 4, |
4893 | 227 | NATIVE_WINDOW_SET_BUFFERS_GEOMETRY = 5, /* deprecated */ | 256 | NATIVE_WINDOW_SET_BUFFERS_GEOMETRY = 5, /* deprecated */ |
4894 | 228 | NATIVE_WINDOW_SET_BUFFERS_TRANSFORM = 6, | 257 | NATIVE_WINDOW_SET_BUFFERS_TRANSFORM = 6, |
4895 | 229 | NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP = 7, | 258 | NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP = 7, |
4896 | 230 | NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS = 8, | 259 | NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS = 8, |
4897 | 231 | NATIVE_WINDOW_SET_BUFFERS_FORMAT = 9, | 260 | NATIVE_WINDOW_SET_BUFFERS_FORMAT = 9, |
4899 | 232 | NATIVE_WINDOW_SET_SCALING_MODE = 10, | 261 | NATIVE_WINDOW_SET_SCALING_MODE = 10, /* private */ |
4900 | 233 | NATIVE_WINDOW_LOCK = 11, /* private */ | 262 | NATIVE_WINDOW_LOCK = 11, /* private */ |
4901 | 234 | NATIVE_WINDOW_UNLOCK_AND_POST = 12, /* private */ | 263 | NATIVE_WINDOW_UNLOCK_AND_POST = 12, /* private */ |
4902 | 235 | NATIVE_WINDOW_API_CONNECT = 13, /* private */ | 264 | NATIVE_WINDOW_API_CONNECT = 13, /* private */ |
4903 | 236 | NATIVE_WINDOW_API_DISCONNECT = 14, /* private */ | 265 | NATIVE_WINDOW_API_DISCONNECT = 14, /* private */ |
4904 | 266 | NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS = 15, /* private */ | ||
4905 | 267 | NATIVE_WINDOW_SET_POST_TRANSFORM_CROP = 16, /* private */ | ||
4906 | 268 | NATIVE_WINDOW_SET_BUFFERS_SIZE = 17, /* private */ | ||
4907 | 269 | #ifdef QCOM_HARDWARE | ||
4908 | 270 | NATIVE_WINDOW_UPDATE_BUFFERS_GEOMETRY = 18, /* private */ | ||
4909 | 271 | #endif | ||
4910 | 237 | }; | 272 | }; |
4911 | 238 | 273 | ||
4912 | 239 | /* parameter for NATIVE_WINDOW_[API_][DIS]CONNECT */ | 274 | /* parameter for NATIVE_WINDOW_[API_][DIS]CONNECT */ |
4913 | @@ -279,6 +314,15 @@ | |||
4914 | 279 | NATIVE_WINDOW_SCALING_MODE_FREEZE = 0, | 314 | NATIVE_WINDOW_SCALING_MODE_FREEZE = 0, |
4915 | 280 | /* the buffer is scaled in both dimensions to match the window size */ | 315 | /* the buffer is scaled in both dimensions to match the window size */ |
4916 | 281 | NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW = 1, | 316 | NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW = 1, |
4917 | 317 | /* the buffer is scaled uniformly such that the smaller dimension | ||
4918 | 318 | * of the buffer matches the window size (cropping in the process) | ||
4919 | 319 | */ | ||
4920 | 320 | NATIVE_WINDOW_SCALING_MODE_SCALE_CROP = 2, | ||
4921 | 321 | /* the window is clipped to the size of the buffer's crop rectangle; pixels | ||
4922 | 322 | * outside the crop rectangle are treated as if they are completely | ||
4923 | 323 | * transparent. | ||
4924 | 324 | */ | ||
4925 | 325 | NATIVE_WINDOW_SCALING_MODE_NO_SCALE_CROP = 3, | ||
4926 | 282 | }; | 326 | }; |
4927 | 283 | 327 | ||
4928 | 284 | /* values returned by the NATIVE_WINDOW_CONCRETE_TYPE query */ | 328 | /* values returned by the NATIVE_WINDOW_CONCRETE_TYPE query */ |
4929 | @@ -355,8 +399,12 @@ | |||
4930 | 355 | * allowed if a specific buffer count has been set. | 399 | * allowed if a specific buffer count has been set. |
4931 | 356 | * | 400 | * |
4932 | 357 | * Returns 0 on success or -errno on error. | 401 | * Returns 0 on success or -errno on error. |
4933 | 402 | * | ||
4934 | 403 | * XXX: This function is deprecated. It will continue to work for some | ||
4935 | 404 | * time for binary compatibility, but the new dequeueBuffer function that | ||
4936 | 405 | * outputs a fence file descriptor should be used in its place. | ||
4937 | 358 | */ | 406 | */ |
4939 | 359 | int (*dequeueBuffer)(struct ANativeWindow* window, | 407 | int (*dequeueBuffer_DEPRECATED)(struct ANativeWindow* window, |
4940 | 360 | struct ANativeWindowBuffer** buffer); | 408 | struct ANativeWindowBuffer** buffer); |
4941 | 361 | 409 | ||
4942 | 362 | /* | 410 | /* |
4943 | @@ -365,9 +413,14 @@ | |||
4944 | 365 | * dequeueBuffer first. | 413 | * dequeueBuffer first. |
4945 | 366 | * | 414 | * |
4946 | 367 | * Returns 0 on success or -errno on error. | 415 | * Returns 0 on success or -errno on error. |
4947 | 416 | * | ||
4948 | 417 | * XXX: This function is deprecated. It will continue to work for some | ||
4949 | 418 | * time for binary compatibility, but it is essentially a no-op, and calls | ||
4950 | 419 | * to it should be removed. | ||
4951 | 368 | */ | 420 | */ |
4953 | 369 | int (*lockBuffer)(struct ANativeWindow* window, | 421 | int (*lockBuffer_DEPRECATED)(struct ANativeWindow* window, |
4954 | 370 | struct ANativeWindowBuffer* buffer); | 422 | struct ANativeWindowBuffer* buffer); |
4955 | 423 | |||
4956 | 371 | /* | 424 | /* |
4957 | 372 | * Hook called by EGL when modifications to the render buffer are done. | 425 | * Hook called by EGL when modifications to the render buffer are done. |
4958 | 373 | * This unlocks and post the buffer. | 426 | * This unlocks and post the buffer. |
4959 | @@ -381,8 +434,13 @@ | |||
4960 | 381 | * Buffers MUST be queued in the same order than they were dequeued. | 434 | * Buffers MUST be queued in the same order than they were dequeued. |
4961 | 382 | * | 435 | * |
4962 | 383 | * Returns 0 on success or -errno on error. | 436 | * Returns 0 on success or -errno on error. |
4963 | 437 | * | ||
4964 | 438 | * XXX: This function is deprecated. It will continue to work for some | ||
4965 | 439 | * time for binary compatibility, but the new queueBuffer function that | ||
4966 | 440 | * takes a fence file descriptor should be used in its place (pass a value | ||
4967 | 441 | * of -1 for the fence file descriptor if there is no valid one to pass). | ||
4968 | 384 | */ | 442 | */ |
4970 | 385 | int (*queueBuffer)(struct ANativeWindow* window, | 443 | int (*queueBuffer_DEPRECATED)(struct ANativeWindow* window, |
4971 | 386 | struct ANativeWindowBuffer* buffer); | 444 | struct ANativeWindowBuffer* buffer); |
4972 | 387 | 445 | ||
4973 | 388 | /* | 446 | /* |
4974 | @@ -408,18 +466,20 @@ | |||
4975 | 408 | * NATIVE_WINDOW_SET_USAGE | 466 | * NATIVE_WINDOW_SET_USAGE |
4976 | 409 | * NATIVE_WINDOW_CONNECT (deprecated) | 467 | * NATIVE_WINDOW_CONNECT (deprecated) |
4977 | 410 | * NATIVE_WINDOW_DISCONNECT (deprecated) | 468 | * NATIVE_WINDOW_DISCONNECT (deprecated) |
4979 | 411 | * NATIVE_WINDOW_SET_CROP | 469 | * NATIVE_WINDOW_SET_CROP (private) |
4980 | 412 | * NATIVE_WINDOW_SET_BUFFER_COUNT | 470 | * NATIVE_WINDOW_SET_BUFFER_COUNT |
4981 | 413 | * NATIVE_WINDOW_SET_BUFFERS_GEOMETRY (deprecated) | 471 | * NATIVE_WINDOW_SET_BUFFERS_GEOMETRY (deprecated) |
4982 | 414 | * NATIVE_WINDOW_SET_BUFFERS_TRANSFORM | 472 | * NATIVE_WINDOW_SET_BUFFERS_TRANSFORM |
4983 | 415 | * NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP | 473 | * NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP |
4984 | 416 | * NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS | 474 | * NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS |
4985 | 417 | * NATIVE_WINDOW_SET_BUFFERS_FORMAT | 475 | * NATIVE_WINDOW_SET_BUFFERS_FORMAT |
4987 | 418 | * NATIVE_WINDOW_SET_SCALING_MODE | 476 | * NATIVE_WINDOW_SET_SCALING_MODE (private) |
4988 | 419 | * NATIVE_WINDOW_LOCK (private) | 477 | * NATIVE_WINDOW_LOCK (private) |
4989 | 420 | * NATIVE_WINDOW_UNLOCK_AND_POST (private) | 478 | * NATIVE_WINDOW_UNLOCK_AND_POST (private) |
4990 | 421 | * NATIVE_WINDOW_API_CONNECT (private) | 479 | * NATIVE_WINDOW_API_CONNECT (private) |
4991 | 422 | * NATIVE_WINDOW_API_DISCONNECT (private) | 480 | * NATIVE_WINDOW_API_DISCONNECT (private) |
4992 | 481 | * NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS (private) | ||
4993 | 482 | * NATIVE_WINDOW_SET_POST_TRANSFORM_CROP (private) | ||
4994 | 423 | * | 483 | * |
4995 | 424 | */ | 484 | */ |
4996 | 425 | 485 | ||
4997 | @@ -437,12 +497,86 @@ | |||
4998 | 437 | * reference if they might use the buffer after queueing or canceling it. | 497 | * reference if they might use the buffer after queueing or canceling it. |
4999 | 438 | * Holding a reference to a buffer after queueing or canceling it is only | 498 | * Holding a reference to a buffer after queueing or canceling it is only |
5000 | 439 | * allowed if a specific buffer count has been set. | 499 | * allowed if a specific buffer count has been set. |
PASSED: Continuous integration, rev:467 jenkins. qa.ubuntu. com/job/ mir-ci/ 1141/ jenkins. qa.ubuntu. com/job/ mir-ci/ ./build= pbuilder, distribution= quantal, flavor= amd64/1141/ console
http://
Executed test runs:
SUCCESS: http://
Click here to trigger a rebuild: jenkins. qa.ubuntu. com/job/ mir-ci/ 1141//rebuild/?
http://