blob: d9280540a6fb5aa93c25344d0f1f5d36aa44a7cf [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 Cross38fccf42012-07-12 17:54:59 -070088 *
89 * returns 0 on success, negative on error.
90 */
Jesse Hallf9d6cd72012-07-31 14:29:00 -070091 int (*blank)(struct hwc_composer_device_1* dev, int dpy, int blank);
Colin Cross38fccf42012-07-12 17:54:59 -070092
Jesse Halld479ad22012-06-05 23:41:37 -070093} hwc_methods_1_t;
Mathias Agopianb08d45d2012-03-24 15:56:29 -070094
Mathias Agopian5d3de302010-08-05 15:24:35 -070095typedef struct hwc_rect {
96 int left;
97 int top;
98 int right;
99 int bottom;
100} hwc_rect_t;
101
102typedef struct hwc_region {
103 size_t numRects;
104 hwc_rect_t const* rects;
105} hwc_region_t;
106
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800107typedef struct hwc_color {
108 uint8_t r;
109 uint8_t g;
110 uint8_t b;
111 uint8_t a;
112} hwc_color_t;
113
Jesse Halld479ad22012-06-05 23:41:37 -0700114typedef struct hwc_layer_1 {
Mathias Agopian5d3de302010-08-05 15:24:35 -0700115 /*
Jesse Halld18c83f2012-08-16 16:21:13 -0700116 * Initially set to HWC_FRAMEBUFFER, HWC_BACKGROUND, or
117 * HWC_FRAMEBUFFER_TARGET.
118 *
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800119 * HWC_FRAMEBUFFER
Jesse Halld18c83f2012-08-16 16:21:13 -0700120 * Indicates the layer will be drawn into the framebuffer
121 * using OpenGL ES. The HWC can toggle this value to HWC_OVERLAY to
122 * indicate it will handle the layer.
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800123 *
124 * HWC_BACKGROUND
Jesse Halld18c83f2012-08-16 16:21:13 -0700125 * Indicates this is a special "background" layer. The only valid field
126 * is backgroundColor. The HWC can toggle this value to HWC_FRAMEBUFFER
127 * to indicate it CANNOT handle the background color.
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800128 *
Jesse Halld18c83f2012-08-16 16:21:13 -0700129 * HWC_FRAMEBUFFER_TARGET
130 * Indicates this layer is the framebuffer surface used as the target of
131 * OpenGL ES composition. If the HWC sets all other layers to HWC_OVERLAY
132 * or HWC_BACKGROUND, then no OpenGL ES composition will be done, and
133 * this layer should be ignored during set(); the HWC_SKIP_LAYER flag
134 * will indicate this case.
135 *
136 * This flag (and the framebuffer surface layer) will only be used if the
137 * HWC version is HWC_DEVICE_API_VERSION_1_1 or higher. In older versions,
138 * the OpenGL ES target surface is communicated by the (dpy, sur) fields
139 * in hwc_compositor_device_1_t.
Mathias Agopian5d3de302010-08-05 15:24:35 -0700140 */
141 int32_t compositionType;
142
143 /* see hwc_layer_t::hints above */
144 uint32_t hints;
145
146 /* see hwc_layer_t::flags above */
147 uint32_t flags;
148
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800149 union {
150 /* color of the background. hwc_color_t.a is ignored */
151 hwc_color_t backgroundColor;
Mathias Agopian5d3de302010-08-05 15:24:35 -0700152
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800153 struct {
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800154 /* handle of buffer to compose. This handle is guaranteed to have been
155 * allocated from gralloc using the GRALLOC_USAGE_HW_COMPOSER usage flag. If
156 * the layer's handle is unchanged across two consecutive prepare calls and
157 * the HWC_GEOMETRY_CHANGED flag is not set for the second call then the
158 * HWComposer implementation may assume that the contents of the buffer have
159 * not changed. */
160 buffer_handle_t handle;
Mathias Agopian5d3de302010-08-05 15:24:35 -0700161
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800162 /* transformation to apply to the buffer during composition */
163 uint32_t transform;
Mathias Agopian5d3de302010-08-05 15:24:35 -0700164
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800165 /* blending to apply during composition */
166 int32_t blending;
Mathias Agopian5d3de302010-08-05 15:24:35 -0700167
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800168 /* area of the source to consider, the origin is the top-left corner of
169 * the buffer */
170 hwc_rect_t sourceCrop;
171
172 /* where to composite the sourceCrop onto the display. The sourceCrop
173 * is scaled using linear filtering to the displayFrame. The origin is the
174 * top-left corner of the screen.
175 */
176 hwc_rect_t displayFrame;
177
178 /* visible region in screen space. The origin is the
179 * top-left corner of the screen.
180 * The visible region INCLUDES areas overlapped by a translucent layer.
181 */
182 hwc_region_t visibleRegionScreen;
Jesse Halld479ad22012-06-05 23:41:37 -0700183
184 /* Sync fence object that will be signaled when the buffer's
185 * contents are available. May be -1 if the contents are already
186 * available. This field is only valid during set(), and should be
187 * ignored during prepare(). The set() call must not wait for the
188 * fence to be signaled before returning, but the HWC must wait for
189 * all buffers to be signaled before reading from them.
190 *
191 * The HWC takes ownership of the acquireFenceFd and is responsible
192 * for closing it when no longer needed.
193 */
194 int acquireFenceFd;
195
196 /* During set() the HWC must set this field to a file descriptor for
197 * a sync fence object that will signal after the HWC has finished
198 * reading from the buffer. The field is ignored by prepare(). Each
199 * layer should have a unique file descriptor, even if more than one
200 * refer to the same underlying fence object; this allows each to be
201 * closed independently.
202 *
203 * If buffer reads can complete at significantly different times,
204 * then using independent fences is preferred. For example, if the
205 * HWC handles some layers with a blit engine and others with
206 * overlays, then the blit layers can be reused immediately after
207 * the blit completes, but the overlay layers can't be reused until
208 * a subsequent frame has been displayed.
209 *
210 * The HWC client taks ownership of the releaseFenceFd and is
211 * responsible for closing it when no longer needed.
212 */
213 int releaseFenceFd;
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800214 };
215 };
Mathias Agopian5d3de302010-08-05 15:24:35 -0700216
Jesse Halld479ad22012-06-05 23:41:37 -0700217 /* Allow for expansion w/o breaking binary compatibility.
218 * Pad layer to 96 bytes, assuming 32-bit pointers.
219 */
220 int32_t reserved[24 - 18];
221
222} hwc_layer_1_t;
Mathias Agopian5d3de302010-08-05 15:24:35 -0700223
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700224/* This represents a display, typically an EGLDisplay object */
225typedef void* hwc_display_t;
226
227/* This represents a surface, typically an EGLSurface object */
228typedef void* hwc_surface_t;
229
Mathias Agopian5d3de302010-08-05 15:24:35 -0700230/*
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700231 * hwc_display_contents_1_t::flags values
Mathias Agopian5d3de302010-08-05 15:24:35 -0700232 */
233enum {
234 /*
235 * HWC_GEOMETRY_CHANGED is set by SurfaceFlinger to indicate that the list
Jesse Halld479ad22012-06-05 23:41:37 -0700236 * passed to (*prepare)() has changed by more than just the buffer handles
237 * and acquire fences.
Mathias Agopian5d3de302010-08-05 15:24:35 -0700238 */
239 HWC_GEOMETRY_CHANGED = 0x00000001,
240};
241
Louis Huemiller871815b2010-10-25 17:00:52 -0700242/*
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700243 * Description of the contents to output on a display.
244 *
245 * This is the top-level structure passed to the prepare and set calls to
246 * negotiate and commit the composition of a display image.
Louis Huemiller871815b2010-10-25 17:00:52 -0700247 */
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700248typedef struct hwc_display_contents_1 {
249 /* File descriptor referring to a Sync HAL fence object which will signal
250 * when this display image is no longer visible, i.e. when the following
251 * set() takes effect. The fence object is created and returned by the set
252 * call; this field will be -1 on entry to prepare and set. SurfaceFlinger
253 * will close the returned file descriptor.
254 */
255 int flipFenceFd;
256
Jesse Halld18c83f2012-08-16 16:21:13 -0700257 /* (dpy, sur) is the target of SurfaceFlinger's OpenGL ES composition for
258 * HWC versions before HWC_DEVICE_VERSION_1_1. They aren't relevant to
259 * prepare. The set call should commit this surface atomically to the
260 * display along with any overlay layers.
261 *
262 * For HWC_DEVICE_VERSION_1_1 and later, these will always be set to
263 * EGL_NO_DISPLAY and EGL_NO_SURFACE.
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700264 */
265 hwc_display_t dpy;
266 hwc_surface_t sur;
267
268 /* List of layers that will be composed on the display. The buffer handles
Jesse Hallac3f7e12012-07-31 15:18:32 -0700269 * in the list will be unique. If numHwLayers is 0, all composition will be
270 * performed by SurfaceFlinger.
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700271 */
Mathias Agopian5d3de302010-08-05 15:24:35 -0700272 uint32_t flags;
273 size_t numHwLayers;
Jesse Halld479ad22012-06-05 23:41:37 -0700274 hwc_layer_1_t hwLayers[0];
Mathias Agopian5d3de302010-08-05 15:24:35 -0700275
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700276} hwc_display_contents_1_t;
Mathias Agopian5d3de302010-08-05 15:24:35 -0700277
Mathias Agopiand6afef62011-08-01 16:34:42 -0700278/* see hwc_composer_device::registerProcs()
279 * Any of the callbacks can be NULL, in which case the corresponding
280 * functionality is not supported.
281 */
282typedef struct hwc_procs {
283 /*
284 * (*invalidate)() triggers a screen refresh, in particular prepare and set
285 * will be called shortly after this call is made. Note that there is
286 * NO GUARANTEE that the screen refresh will happen after invalidate()
287 * returns (in particular, it could happen before).
288 * invalidate() is GUARANTEED TO NOT CALL BACK into the h/w composer HAL and
289 * it is safe to call invalidate() from any of hwc_composer_device
290 * hooks, unless noted otherwise.
291 */
292 void (*invalidate)(struct hwc_procs* procs);
Mathias Agopianb08d45d2012-03-24 15:56:29 -0700293
294 /*
295 * (*vsync)() is called by the h/w composer HAL when a vsync event is
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700296 * received and HWC_EVENT_VSYNC is enabled on a display
297 * (see: hwc_event_control).
Mathias Agopianb08d45d2012-03-24 15:56:29 -0700298 *
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700299 * the "dpy" parameter indicates which display the vsync event is for.
Jamie Gennis6b7adef2012-04-30 12:57:11 -0700300 * the "timestamp" parameter is the system monotonic clock timestamp in
301 * nanosecond of when the vsync event happened.
Mathias Agopianb08d45d2012-03-24 15:56:29 -0700302 *
303 * vsync() is GUARANTEED TO NOT CALL BACK into the h/w composer HAL.
304 *
305 * It is expected that vsync() is called from a thread of at least
Mathias Agopianeb671602012-04-24 15:42:37 -0700306 * HAL_PRIORITY_URGENT_DISPLAY with as little latency as possible,
Mathias Agopianb08d45d2012-03-24 15:56:29 -0700307 * typically less than 0.5 ms.
308 *
Mathias Agopian6d3fec72012-04-10 21:22:28 -0700309 * It is a (silent) error to have HWC_EVENT_VSYNC enabled when calling
310 * hwc_composer_device.set(..., 0, 0, 0) (screen off). The implementation
311 * can either stop or continue to process VSYNC events, but must not
312 * crash or cause other problems.
Mathias Agopianb08d45d2012-03-24 15:56:29 -0700313 */
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700314 void (*vsync)(struct hwc_procs* procs, int dpy, int64_t timestamp);
Mathias Agopiand6afef62011-08-01 16:34:42 -0700315} hwc_procs_t;
316
317
318/*****************************************************************************/
Mathias Agopian5d3de302010-08-05 15:24:35 -0700319
320typedef struct hwc_module {
321 struct hw_module_t common;
322} hwc_module_t;
323
Jesse Halld479ad22012-06-05 23:41:37 -0700324typedef struct hwc_composer_device_1 {
Mathias Agopian5d3de302010-08-05 15:24:35 -0700325 struct hw_device_t common;
326
327 /*
328 * (*prepare)() is called for each frame before composition and is used by
329 * SurfaceFlinger to determine what composition steps the HWC can handle.
330 *
331 * (*prepare)() can be called more than once, the last call prevails.
332 *
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700333 * The HWC responds by setting the compositionType field in each layer to
334 * either HWC_FRAMEBUFFER or HWC_OVERLAY. In the former case, the
335 * composition for the layer is handled by SurfaceFlinger with OpenGL ES,
336 * in the later case, the HWC will have to handle the layer's composition.
Mathias Agopian5d3de302010-08-05 15:24:35 -0700337 *
338 * (*prepare)() is called with HWC_GEOMETRY_CHANGED to indicate that the
339 * list's geometry has changed, that is, when more than just the buffer's
340 * handles have been updated. Typically this happens (but is not limited to)
341 * when a window is added, removed, resized or moved.
342 *
Jesse Hallac3f7e12012-07-31 15:18:32 -0700343 * The numDisplays parameter will always be greater than zero, displays
344 * will be non-NULL, and the array entries will be non-NULL.
345 *
Mathias Agopian5d3de302010-08-05 15:24:35 -0700346 * returns: 0 on success. An negative error code on error. If an error is
347 * returned, SurfaceFlinger will assume that none of the layer will be
348 * handled by the HWC.
349 */
Jesse Halld479ad22012-06-05 23:41:37 -0700350 int (*prepare)(struct hwc_composer_device_1 *dev,
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700351 size_t numDisplays, hwc_display_contents_1_t** displays);
Mathias Agopian5d3de302010-08-05 15:24:35 -0700352
353 /*
354 * (*set)() is used in place of eglSwapBuffers(), and assumes the same
355 * functionality, except it also commits the work list atomically with
356 * the actual eglSwapBuffers().
357 *
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700358 * The layer lists are guaranteed to be the same as the ones returned from
359 * the last call to (*prepare)().
Mathias Agopian5d3de302010-08-05 15:24:35 -0700360 *
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700361 * When this call returns the caller assumes that the displays will be
362 * updated in the near future with the content of their work lists, without
363 * artifacts during the transition from the previous frame.
Mathias Agopian5d3de302010-08-05 15:24:35 -0700364 *
Jesse Hallac3f7e12012-07-31 15:18:32 -0700365 * A display with zero layers indicates that the entire composition has
366 * been handled by SurfaceFlinger with OpenGL ES. In this case, (*set)()
367 * behaves just like eglSwapBuffers().
Mathias Agopian5d3de302010-08-05 15:24:35 -0700368 *
Jesse Hallac3f7e12012-07-31 15:18:32 -0700369 * The numDisplays parameter will always be greater than zero, displays
370 * will be non-NULL, and the array entries will be non-NULL.
Mathias Agopian71212e32011-11-21 17:35:15 -0800371 *
Mathias Agopianfb410362011-11-15 21:27:52 -0800372 * IMPORTANT NOTE: there is an implicit layer containing opaque black
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700373 * pixels behind all the layers in the list. It is the responsibility of
374 * the hwcomposer module to make sure black pixels are output (or blended
375 * from).
Mathias Agopianfb410362011-11-15 21:27:52 -0800376 *
Mathias Agopian5d3de302010-08-05 15:24:35 -0700377 * returns: 0 on success. An negative error code on error:
378 * HWC_EGL_ERROR: eglGetError() will provide the proper error code
379 * Another code for non EGL errors.
Mathias Agopian5d3de302010-08-05 15:24:35 -0700380 */
Jesse Halld479ad22012-06-05 23:41:37 -0700381 int (*set)(struct hwc_composer_device_1 *dev,
Jesse Hallf9d6cd72012-07-31 14:29:00 -0700382 size_t numDisplays, hwc_display_contents_1_t** displays);
Jesse Halld479ad22012-06-05 23:41:37 -0700383
Erik Gilling158549c2010-12-01 16:34:08 -0800384 /*
Mathias Agopianb08d45d2012-03-24 15:56:29 -0700385 * This field is OPTIONAL and can be NULL.
Erik Gilling158549c2010-12-01 16:34:08 -0800386 *
Mathias Agopiand6afef62011-08-01 16:34:42 -0700387 * If non NULL it will be called by SurfaceFlinger on dumpsys
Erik Gilling158549c2010-12-01 16:34:08 -0800388 */
Jesse Halld479ad22012-06-05 23:41:37 -0700389 void (*dump)(struct hwc_composer_device_1* dev, char *buff, int buff_len);
Mathias Agopian5d3de302010-08-05 15:24:35 -0700390
Mathias Agopiand6afef62011-08-01 16:34:42 -0700391 /*
Mathias Agopianb08d45d2012-03-24 15:56:29 -0700392 * This field is OPTIONAL and can be NULL.
Mathias Agopiand6afef62011-08-01 16:34:42 -0700393 *
394 * (*registerProcs)() registers a set of callbacks the h/w composer HAL
395 * can later use. It is FORBIDDEN to call any of the callbacks from
396 * within registerProcs(). registerProcs() must save the hwc_procs_t pointer
397 * which is needed when calling a registered callback.
398 * Each call to registerProcs replaces the previous set of callbacks.
399 * registerProcs is called with NULL to unregister all callbacks.
400 *
401 * Any of the callbacks can be NULL, in which case the corresponding
402 * functionality is not supported.
403 */
Jesse Halld479ad22012-06-05 23:41:37 -0700404 void (*registerProcs)(struct hwc_composer_device_1* dev,
Mathias Agopiand6afef62011-08-01 16:34:42 -0700405 hwc_procs_t const* procs);
406
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800407 /*
Mathias Agopianb08d45d2012-03-24 15:56:29 -0700408 * This field is OPTIONAL and can be NULL.
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800409 *
410 * Used to retrieve information about the h/w composer
411 *
412 * Returns 0 on success or -errno on error.
413 */
Jesse Halld479ad22012-06-05 23:41:37 -0700414 int (*query)(struct hwc_composer_device_1* dev, int what, int* value);
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800415
Mathias Agopianb08d45d2012-03-24 15:56:29 -0700416 /*
417 * Reserved for future use. Must be NULL.
418 */
419 void* reserved_proc[4];
Mathias Agopianeb8fb502012-02-03 15:54:11 -0800420
Mathias Agopianb08d45d2012-03-24 15:56:29 -0700421 /*
Jesse Hallac3f7e12012-07-31 15:18:32 -0700422 * This field is REQUIRED and must not be NULL.
Mathias Agopianb08d45d2012-03-24 15:56:29 -0700423 */
Jesse Halld479ad22012-06-05 23:41:37 -0700424 hwc_methods_1_t const *methods;
Erik Gillinge9952042010-12-07 18:46:04 -0800425
Jesse Halld479ad22012-06-05 23:41:37 -0700426} hwc_composer_device_1_t;
Mathias Agopian5d3de302010-08-05 15:24:35 -0700427
428/** convenience API for opening and closing a device */
429
Jesse Halld479ad22012-06-05 23:41:37 -0700430static inline int hwc_open_1(const struct hw_module_t* module,
431 hwc_composer_device_1_t** device) {
Mathias Agopian5d3de302010-08-05 15:24:35 -0700432 return module->methods->open(module,
433 HWC_HARDWARE_COMPOSER, (struct hw_device_t**)device);
434}
435
Jesse Halld479ad22012-06-05 23:41:37 -0700436static inline int hwc_close_1(hwc_composer_device_1_t* device) {
Mathias Agopian5d3de302010-08-05 15:24:35 -0700437 return device->common.close(&device->common);
438}
439
Mathias Agopian5d3de302010-08-05 15:24:35 -0700440/*****************************************************************************/
441
Jesse Halld479ad22012-06-05 23:41:37 -0700442#if !HWC_REMOVE_DEPRECATED_VERSIONS
443#include <hardware/hwcomposer_v0.h>
444#endif
445
Mathias Agopian5d3de302010-08-05 15:24:35 -0700446__END_DECLS
447
448#endif /* ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_H */