blob: a6358e4351f57b512d4407f3e5b7ffaa9245983e [file] [log] [blame]
Mathias Agopian5d3de302010-08-05 15:24:35 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_H
18#define ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_H
19
20#include <stdint.h>
21#include <sys/cdefs.h>
22
Louis Huemiller45e23712010-12-01 12:25:00 -080023#include <hardware/gralloc.h>
Mathias Agopian5d3de302010-08-05 15:24:35 -070024#include <hardware/hardware.h>
25#include <cutils/native_handle.h>
26
Mathias Agopiane291f712012-05-13 22:49:06 -070027#include <hardware/hwcomposer_defs.h>
28
Mathias Agopian5d3de302010-08-05 15:24:35 -070029__BEGIN_DECLS
30
31/*****************************************************************************/
Erik Gillinge9952042010-12-07 18:46:04 -080032
Jesse Halld479ad22012-06-05 23:41:37 -070033/* for compatibility */
Mathias Agopianb08d45d2012-03-24 15:56:29 -070034#define HWC_MODULE_API_VERSION HWC_MODULE_API_VERSION_0_1
35#define HWC_DEVICE_API_VERSION HWC_DEVICE_API_VERSION_0_1
Mathias Agopian81c323d2012-03-25 01:09:35 -070036#define HWC_API_VERSION HWC_DEVICE_API_VERSION
Erik Gillinge9952042010-12-07 18:46:04 -080037
Jesse Halld479ad22012-06-05 23:41:37 -070038/* Users of this header can define HWC_REMOVE_DEPRECATED_VERSIONS to test that
39 * they still work with just the current version declared, before the
40 * deprecated versions are actually removed.
41 *
42 * To find code that still depends on the old versions, set the #define to 1
43 * here. Code that explicitly sets it to zero (rather than simply not defining
44 * it) will still see the old versions.
45 */
46#if !defined(HWC_REMOVE_DEPRECATED_VERSIONS)
47#define HWC_REMOVE_DEPRECATED_VERSIONS 0
48#endif
49
50/*****************************************************************************/
51
Mathias Agopian5d3de302010-08-05 15:24:35 -070052/**
53 * The id of this module
54 */
55#define HWC_HARDWARE_MODULE_ID "hwcomposer"
56
57/**
58 * Name of the sensors device to open
59 */
60#define HWC_HARDWARE_COMPOSER "composer"
61
Jesse Halld479ad22012-06-05 23:41:37 -070062struct hwc_composer_device_1;
63typedef struct hwc_methods_1 {
Mathias Agopianb08d45d2012-03-24 15:56:29 -070064
65 /*
66 * eventControl(..., event, enabled)
Jesse Hallf9d6cd72012-07-31 14:29:00 -070067 * Enables or disables h/w composer events for a display.
Mathias Agopianb08d45d2012-03-24 15:56:29 -070068 *
69 * eventControl can be called from any thread and takes effect
70 * immediately.
71 *
72 * Supported events are:
73 * HWC_EVENT_VSYNC
74 *
75 * returns -EINVAL if the "event" parameter is not one of the value above
76 * or if the "enabled" parameter is not 0 or 1.
77 */
Mathias Agopianb08d45d2012-03-24 15:56:29 -070078 int (*eventControl)(
Jesse Hallf9d6cd72012-07-31 14:29:00 -070079 struct hwc_composer_device_1* dev, int dpy,
80 int event, int enabled);
Mathias Agopianb08d45d2012-03-24 15:56:29 -070081
Colin Cross38fccf42012-07-12 17:54:59 -070082 /*
Colin Cross38fccf42012-07-12 17:54:59 -070083 * blank(..., blank)
Jesse Hallf9d6cd72012-07-31 14:29:00 -070084 * Blanks or unblanks a display's screen.
Colin Cross38fccf42012-07-12 17:54:59 -070085 *
86 * Turns the screen off when blank is nonzero, on when blank is zero.
Jesse Hallac3f7e12012-07-31 15:18:32 -070087 * Multiple sequential calls with the same blank value must be supported.
Colin Cross705d2912012-08-16 14:45:06 -070088 * The screen state transition must be be complete when the function
89 * returns.
Colin Cross38fccf42012-07-12 17:54:59 -070090 *
91 * returns 0 on success, negative on error.
92 */
Jesse Hallf9d6cd72012-07-31 14:29:00 -070093 int (*blank)(struct hwc_composer_device_1* dev, int dpy, int blank);
Colin Cross38fccf42012-07-12 17:54:59 -070094
Jesse Halld479ad22012-06-05 23:41:37 -070095} hwc_methods_1_t;
Mathias Agopianb08d45d2012-03-24 15:56:29 -070096
Mathias Agopian5d3de302010-08-05 15:24:35 -070097typedef struct hwc_rect {
98 int left;
99 int top;
100 int right;
101 int bottom;
102} hwc_rect_t;
103
104typedef struct hwc_region {
105 size_t numRects;
106 hwc_rect_t const* rects;
107} hwc_region_t;
108
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800109typedef struct hwc_color {
110 uint8_t r;
111 uint8_t g;
112 uint8_t b;
113 uint8_t a;
114} hwc_color_t;
115
Jesse Halld479ad22012-06-05 23:41:37 -0700116typedef struct hwc_layer_1 {
Mathias Agopian5d3de302010-08-05 15:24:35 -0700117 /*
Jesse Halld18c83f2012-08-16 16:21:13 -0700118 * Initially set to HWC_FRAMEBUFFER, HWC_BACKGROUND, or
119 * HWC_FRAMEBUFFER_TARGET.
120 *
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800121 * HWC_FRAMEBUFFER
Jesse Halld18c83f2012-08-16 16:21:13 -0700122 * Indicates the layer will be drawn into the framebuffer
123 * using OpenGL ES. The HWC can toggle this value to HWC_OVERLAY to
124 * indicate it will handle the layer.
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800125 *
126 * HWC_BACKGROUND
Jesse Halld18c83f2012-08-16 16:21:13 -0700127 * Indicates this is a special "background" layer. The only valid field
128 * is backgroundColor. The HWC can toggle this value to HWC_FRAMEBUFFER
129 * to indicate it CANNOT handle the background color.
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800130 *
Jesse Halld18c83f2012-08-16 16:21:13 -0700131 * HWC_FRAMEBUFFER_TARGET
132 * Indicates this layer is the framebuffer surface used as the target of
133 * OpenGL ES composition. If the HWC sets all other layers to HWC_OVERLAY
134 * or HWC_BACKGROUND, then no OpenGL ES composition will be done, and
135 * this layer should be ignored during set(); the HWC_SKIP_LAYER flag
136 * will indicate this case.
137 *
138 * This flag (and the framebuffer surface layer) will only be used if the
139 * HWC version is HWC_DEVICE_API_VERSION_1_1 or higher. In older versions,
140 * the OpenGL ES target surface is communicated by the (dpy, sur) fields
141 * in hwc_compositor_device_1_t.
Mathias Agopian5d3de302010-08-05 15:24:35 -0700142 */
143 int32_t compositionType;
144
145 /* see hwc_layer_t::hints above */
146 uint32_t hints;
147
148 /* see hwc_layer_t::flags above */
149 uint32_t flags;
150
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800151 union {
152 /* color of the background. hwc_color_t.a is ignored */
153 hwc_color_t backgroundColor;
Mathias Agopian5d3de302010-08-05 15:24:35 -0700154
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800155 struct {
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800156 /* handle of buffer to compose. This handle is guaranteed to have been
157 * allocated from gralloc using the GRALLOC_USAGE_HW_COMPOSER usage flag. If
158 * the layer's handle is unchanged across two consecutive prepare calls and
159 * the HWC_GEOMETRY_CHANGED flag is not set for the second call then the
160 * HWComposer implementation may assume that the contents of the buffer have
161 * not changed. */
162 buffer_handle_t handle;
Mathias Agopian5d3de302010-08-05 15:24:35 -0700163
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800164 /* transformation to apply to the buffer during composition */
165 uint32_t transform;
Mathias Agopian5d3de302010-08-05 15:24:35 -0700166
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800167 /* blending to apply during composition */
168 int32_t blending;
Mathias Agopian5d3de302010-08-05 15:24:35 -0700169
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800170 /* area of the source to consider, the origin is the top-left corner of
171 * the buffer */
172 hwc_rect_t sourceCrop;
173
174 /* where to composite the sourceCrop onto the display. The sourceCrop
175 * is scaled using linear filtering to the displayFrame. The origin is the
176 * top-left corner of the screen.
177 */
178 hwc_rect_t displayFrame;
179
180 /* visible region in screen space. The origin is the
181 * top-left corner of the screen.
182 * The visible region INCLUDES areas overlapped by a translucent layer.
183 */
184 hwc_region_t visibleRegionScreen;
Jesse Halld479ad22012-06-05 23:41:37 -0700185
186 /* Sync fence object that will be signaled when the buffer's
187 * contents are available. May be -1 if the contents are already
188 * available. This field is only valid during set(), and should be
189 * ignored during prepare(). The set() call must not wait for the
190 * fence to be signaled before returning, but the HWC must wait for
191 * all buffers to be signaled before reading from them.
192 *
193 * The HWC takes ownership of the acquireFenceFd and is responsible
194 * for closing it when no longer needed.
195 */
196 int acquireFenceFd;
197
198 /* During set() the HWC must set this field to a file descriptor for
199 * a sync fence object that will signal after the HWC has finished
200 * reading from the buffer. The field is ignored by prepare(). Each
201 * layer should have a unique file descriptor, even if more than one
202 * refer to the same underlying fence object; this allows each to be
203 * closed independently.
204 *
205 * If buffer reads can complete at significantly different times,
206 * then using independent fences is preferred. For example, if the
207 * HWC handles some layers with a blit engine and others with
208 * overlays, then the blit layers can be reused immediately after
209 * the blit completes, but the overlay layers can't be reused until
210 * a subsequent frame has been displayed.
211 *
212 * The HWC client taks ownership of the releaseFenceFd and is
213 * responsible for closing it when no longer needed.
214 */
215 int releaseFenceFd;
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800216 };
217 };
Mathias Agopian5d3de302010-08-05 15:24:35 -0700218
Jesse Halld479ad22012-06-05 23:41:37 -0700219 /* Allow for expansion w/o breaking binary compatibility.
220 * Pad layer to 96 bytes, assuming 32-bit pointers.
221 */
222 int32_t reserved[24 - 18];
223
224} hwc_layer_1_t;
Mathias Agopian5d3de302010-08-05 15:24:35 -0700225
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700226/* This represents a display, typically an EGLDisplay object */
227typedef void* hwc_display_t;
228
229/* This represents a surface, typically an EGLSurface object */
230typedef void* hwc_surface_t;
231
Mathias Agopian5d3de302010-08-05 15:24:35 -0700232/*
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700233 * hwc_display_contents_1_t::flags values
Mathias Agopian5d3de302010-08-05 15:24:35 -0700234 */
235enum {
236 /*
237 * HWC_GEOMETRY_CHANGED is set by SurfaceFlinger to indicate that the list
Jesse Halld479ad22012-06-05 23:41:37 -0700238 * passed to (*prepare)() has changed by more than just the buffer handles
239 * and acquire fences.
Mathias Agopian5d3de302010-08-05 15:24:35 -0700240 */
241 HWC_GEOMETRY_CHANGED = 0x00000001,
242};
243
Louis Huemiller871815b2010-10-25 17:00:52 -0700244/*
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700245 * Description of the contents to output on a display.
246 *
247 * This is the top-level structure passed to the prepare and set calls to
248 * negotiate and commit the composition of a display image.
Louis Huemiller871815b2010-10-25 17:00:52 -0700249 */
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700250typedef struct hwc_display_contents_1 {
251 /* File descriptor referring to a Sync HAL fence object which will signal
252 * when this display image is no longer visible, i.e. when the following
253 * set() takes effect. The fence object is created and returned by the set
254 * call; this field will be -1 on entry to prepare and set. SurfaceFlinger
255 * will close the returned file descriptor.
256 */
257 int flipFenceFd;
258
Jesse Halld18c83f2012-08-16 16:21:13 -0700259 /* (dpy, sur) is the target of SurfaceFlinger's OpenGL ES composition for
260 * HWC versions before HWC_DEVICE_VERSION_1_1. They aren't relevant to
261 * prepare. The set call should commit this surface atomically to the
262 * display along with any overlay layers.
263 *
264 * For HWC_DEVICE_VERSION_1_1 and later, these will always be set to
265 * EGL_NO_DISPLAY and EGL_NO_SURFACE.
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700266 */
267 hwc_display_t dpy;
268 hwc_surface_t sur;
269
270 /* List of layers that will be composed on the display. The buffer handles
Jesse Hallac3f7e12012-07-31 15:18:32 -0700271 * in the list will be unique. If numHwLayers is 0, all composition will be
272 * performed by SurfaceFlinger.
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700273 */
Mathias Agopian5d3de302010-08-05 15:24:35 -0700274 uint32_t flags;
275 size_t numHwLayers;
Jesse Halld479ad22012-06-05 23:41:37 -0700276 hwc_layer_1_t hwLayers[0];
Mathias Agopian5d3de302010-08-05 15:24:35 -0700277
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700278} hwc_display_contents_1_t;
Mathias Agopian5d3de302010-08-05 15:24:35 -0700279
Mathias Agopiand6afef62011-08-01 16:34:42 -0700280/* see hwc_composer_device::registerProcs()
281 * Any of the callbacks can be NULL, in which case the corresponding
282 * functionality is not supported.
283 */
284typedef struct hwc_procs {
285 /*
286 * (*invalidate)() triggers a screen refresh, in particular prepare and set
287 * will be called shortly after this call is made. Note that there is
288 * NO GUARANTEE that the screen refresh will happen after invalidate()
289 * returns (in particular, it could happen before).
290 * invalidate() is GUARANTEED TO NOT CALL BACK into the h/w composer HAL and
291 * it is safe to call invalidate() from any of hwc_composer_device
292 * hooks, unless noted otherwise.
293 */
294 void (*invalidate)(struct hwc_procs* procs);
Mathias Agopianb08d45d2012-03-24 15:56:29 -0700295
296 /*
297 * (*vsync)() is called by the h/w composer HAL when a vsync event is
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700298 * received and HWC_EVENT_VSYNC is enabled on a display
299 * (see: hwc_event_control).
Mathias Agopianb08d45d2012-03-24 15:56:29 -0700300 *
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700301 * the "dpy" parameter indicates which display the vsync event is for.
Jamie Gennis6b7adef2012-04-30 12:57:11 -0700302 * the "timestamp" parameter is the system monotonic clock timestamp in
303 * nanosecond of when the vsync event happened.
Mathias Agopianb08d45d2012-03-24 15:56:29 -0700304 *
305 * vsync() is GUARANTEED TO NOT CALL BACK into the h/w composer HAL.
306 *
307 * It is expected that vsync() is called from a thread of at least
Mathias Agopianeb671602012-04-24 15:42:37 -0700308 * HAL_PRIORITY_URGENT_DISPLAY with as little latency as possible,
Mathias Agopianb08d45d2012-03-24 15:56:29 -0700309 * typically less than 0.5 ms.
310 *
Mathias Agopian6d3fec72012-04-10 21:22:28 -0700311 * It is a (silent) error to have HWC_EVENT_VSYNC enabled when calling
312 * hwc_composer_device.set(..., 0, 0, 0) (screen off). The implementation
313 * can either stop or continue to process VSYNC events, but must not
314 * crash or cause other problems.
Mathias Agopianb08d45d2012-03-24 15:56:29 -0700315 */
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700316 void (*vsync)(struct hwc_procs* procs, int dpy, int64_t timestamp);
Mathias Agopiand6afef62011-08-01 16:34:42 -0700317} hwc_procs_t;
318
319
320/*****************************************************************************/
Mathias Agopian5d3de302010-08-05 15:24:35 -0700321
322typedef struct hwc_module {
323 struct hw_module_t common;
324} hwc_module_t;
325
Jesse Halld479ad22012-06-05 23:41:37 -0700326typedef struct hwc_composer_device_1 {
Mathias Agopian5d3de302010-08-05 15:24:35 -0700327 struct hw_device_t common;
328
329 /*
330 * (*prepare)() is called for each frame before composition and is used by
331 * SurfaceFlinger to determine what composition steps the HWC can handle.
332 *
333 * (*prepare)() can be called more than once, the last call prevails.
334 *
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700335 * The HWC responds by setting the compositionType field in each layer to
336 * either HWC_FRAMEBUFFER or HWC_OVERLAY. In the former case, the
337 * composition for the layer is handled by SurfaceFlinger with OpenGL ES,
338 * in the later case, the HWC will have to handle the layer's composition.
Mathias Agopian5d3de302010-08-05 15:24:35 -0700339 *
340 * (*prepare)() is called with HWC_GEOMETRY_CHANGED to indicate that the
341 * list's geometry has changed, that is, when more than just the buffer's
342 * handles have been updated. Typically this happens (but is not limited to)
343 * when a window is added, removed, resized or moved.
344 *
Jesse Hall43b51d92012-08-22 11:42:57 -0700345 * For HWC 1.0, numDisplays will always be one, and displays[0] will be
346 * non-NULL.
347 *
348 * For HWC 1.1, numDisplays will always be HWC_NUM_DISPLAY_TYPES. Entries
349 * for unsupported or disabled/disconnected display types will be NULL.
350 *
351 * For HWC 1.2 and later, numDisplays will be HWC_NUM_DISPLAY_TYPES or more.
352 * The extra entries correspond to enabled virtual displays, and will be
353 * non-NULL. In HWC 1.2, support for one virtual display is required, and
354 * no more than one will be used. Future HWC versions might require more.
Jesse Hallac3f7e12012-07-31 15:18:32 -0700355 *
Mathias Agopian5d3de302010-08-05 15:24:35 -0700356 * returns: 0 on success. An negative error code on error. If an error is
357 * returned, SurfaceFlinger will assume that none of the layer will be
358 * handled by the HWC.
359 */
Jesse Halld479ad22012-06-05 23:41:37 -0700360 int (*prepare)(struct hwc_composer_device_1 *dev,
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700361 size_t numDisplays, hwc_display_contents_1_t** displays);
Mathias Agopian5d3de302010-08-05 15:24:35 -0700362
363 /*
364 * (*set)() is used in place of eglSwapBuffers(), and assumes the same
365 * functionality, except it also commits the work list atomically with
366 * the actual eglSwapBuffers().
367 *
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700368 * The layer lists are guaranteed to be the same as the ones returned from
369 * the last call to (*prepare)().
Mathias Agopian5d3de302010-08-05 15:24:35 -0700370 *
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700371 * When this call returns the caller assumes that the displays will be
372 * updated in the near future with the content of their work lists, without
373 * artifacts during the transition from the previous frame.
Mathias Agopian5d3de302010-08-05 15:24:35 -0700374 *
Jesse Hallac3f7e12012-07-31 15:18:32 -0700375 * A display with zero layers indicates that the entire composition has
376 * been handled by SurfaceFlinger with OpenGL ES. In this case, (*set)()
377 * behaves just like eglSwapBuffers().
Mathias Agopian5d3de302010-08-05 15:24:35 -0700378 *
Jesse Hall43b51d92012-08-22 11:42:57 -0700379 * For HWC 1.0, numDisplays will always be one, and displays[0] will be
380 * non-NULL.
381 *
382 * For HWC 1.1, numDisplays will always be HWC_NUM_DISPLAY_TYPES. Entries
383 * for unsupported or disabled/disconnected display types will be NULL.
384 *
385 * For HWC 1.2 and later, numDisplays will be HWC_NUM_DISPLAY_TYPES or more.
386 * The extra entries correspond to enabled virtual displays, and will be
387 * non-NULL. In HWC 1.2, support for one virtual display is required, and
388 * no more than one will be used. Future HWC versions might require more.
Mathias Agopian71212e32011-11-21 17:35:15 -0800389 *
Mathias Agopianfb410362011-11-15 21:27:52 -0800390 * IMPORTANT NOTE: there is an implicit layer containing opaque black
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700391 * pixels behind all the layers in the list. It is the responsibility of
392 * the hwcomposer module to make sure black pixels are output (or blended
393 * from).
Mathias Agopianfb410362011-11-15 21:27:52 -0800394 *
Mathias Agopian5d3de302010-08-05 15:24:35 -0700395 * returns: 0 on success. An negative error code on error:
396 * HWC_EGL_ERROR: eglGetError() will provide the proper error code
397 * Another code for non EGL errors.
Mathias Agopian5d3de302010-08-05 15:24:35 -0700398 */
Jesse Halld479ad22012-06-05 23:41:37 -0700399 int (*set)(struct hwc_composer_device_1 *dev,
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700400 size_t numDisplays, hwc_display_contents_1_t** displays);
Jesse Halld479ad22012-06-05 23:41:37 -0700401
Erik Gilling158549c2010-12-01 16:34:08 -0800402 /*
Mathias Agopianb08d45d2012-03-24 15:56:29 -0700403 * This field is OPTIONAL and can be NULL.
Erik Gilling158549c2010-12-01 16:34:08 -0800404 *
Mathias Agopiand6afef62011-08-01 16:34:42 -0700405 * If non NULL it will be called by SurfaceFlinger on dumpsys
Erik Gilling158549c2010-12-01 16:34:08 -0800406 */
Jesse Halld479ad22012-06-05 23:41:37 -0700407 void (*dump)(struct hwc_composer_device_1* dev, char *buff, int buff_len);
Mathias Agopian5d3de302010-08-05 15:24:35 -0700408
Mathias Agopiand6afef62011-08-01 16:34:42 -0700409 /*
Mathias Agopianb08d45d2012-03-24 15:56:29 -0700410 * This field is OPTIONAL and can be NULL.
Mathias Agopiand6afef62011-08-01 16:34:42 -0700411 *
412 * (*registerProcs)() registers a set of callbacks the h/w composer HAL
413 * can later use. It is FORBIDDEN to call any of the callbacks from
414 * within registerProcs(). registerProcs() must save the hwc_procs_t pointer
415 * which is needed when calling a registered callback.
416 * Each call to registerProcs replaces the previous set of callbacks.
417 * registerProcs is called with NULL to unregister all callbacks.
418 *
419 * Any of the callbacks can be NULL, in which case the corresponding
420 * functionality is not supported.
421 */
Jesse Halld479ad22012-06-05 23:41:37 -0700422 void (*registerProcs)(struct hwc_composer_device_1* dev,
Mathias Agopiand6afef62011-08-01 16:34:42 -0700423 hwc_procs_t const* procs);
424
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800425 /*
Mathias Agopianb08d45d2012-03-24 15:56:29 -0700426 * This field is OPTIONAL and can be NULL.
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800427 *
428 * Used to retrieve information about the h/w composer
429 *
430 * Returns 0 on success or -errno on error.
431 */
Jesse Halld479ad22012-06-05 23:41:37 -0700432 int (*query)(struct hwc_composer_device_1* dev, int what, int* value);
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800433
Mathias Agopianb08d45d2012-03-24 15:56:29 -0700434 /*
435 * Reserved for future use. Must be NULL.
436 */
437 void* reserved_proc[4];
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800438
Mathias Agopianb08d45d2012-03-24 15:56:29 -0700439 /*
Jesse Hallac3f7e12012-07-31 15:18:32 -0700440 * This field is REQUIRED and must not be NULL.
Mathias Agopianb08d45d2012-03-24 15:56:29 -0700441 */
Jesse Halld479ad22012-06-05 23:41:37 -0700442 hwc_methods_1_t const *methods;
Erik Gillinge9952042010-12-07 18:46:04 -0800443
Jesse Halld479ad22012-06-05 23:41:37 -0700444} hwc_composer_device_1_t;
Mathias Agopian5d3de302010-08-05 15:24:35 -0700445
446/** convenience API for opening and closing a device */
447
Jesse Halld479ad22012-06-05 23:41:37 -0700448static inline int hwc_open_1(const struct hw_module_t* module,
449 hwc_composer_device_1_t** device) {
Mathias Agopian5d3de302010-08-05 15:24:35 -0700450 return module->methods->open(module,
451 HWC_HARDWARE_COMPOSER, (struct hw_device_t**)device);
452}
453
Jesse Halld479ad22012-06-05 23:41:37 -0700454static inline int hwc_close_1(hwc_composer_device_1_t* device) {
Mathias Agopian5d3de302010-08-05 15:24:35 -0700455 return device->common.close(&device->common);
456}
457
Mathias Agopian5d3de302010-08-05 15:24:35 -0700458/*****************************************************************************/
459
Jesse Halld479ad22012-06-05 23:41:37 -0700460#if !HWC_REMOVE_DEPRECATED_VERSIONS
461#include <hardware/hwcomposer_v0.h>
462#endif
463
Mathias Agopian5d3de302010-08-05 15:24:35 -0700464__END_DECLS
465
466#endif /* ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_H */