15d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian/*
25d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian * Copyright (C) 2010 The Android Open Source Project
35d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian *
45d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian * Licensed under the Apache License, Version 2.0 (the "License");
55d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian * you may not use this file except in compliance with the License.
65d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian * You may obtain a copy of the License at
75d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian *
85d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian *      http://www.apache.org/licenses/LICENSE-2.0
95d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian *
105d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian * Unless required by applicable law or agreed to in writing, software
115d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian * distributed under the License is distributed on an "AS IS" BASIS,
125d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
135d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian * See the License for the specific language governing permissions and
145d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian * limitations under the License.
155d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian */
165d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
175d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian#ifndef ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_H
185d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian#define ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_H
195d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
205d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian#include <stdint.h>
215d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian#include <sys/cdefs.h>
225d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
2345e2371cb954a8f8e0aee16d1ee8bec7eae9b897Louis Huemiller#include <hardware/gralloc.h>
245d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian#include <hardware/hardware.h>
255d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian#include <cutils/native_handle.h>
265d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
27e291f71e0a25ac9bb39fb754c599b710ab8f59d5Mathias Agopian#include <hardware/hwcomposer_defs.h>
28e291f71e0a25ac9bb39fb754c599b710ab8f59d5Mathias Agopian
295d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian__BEGIN_DECLS
305d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
315d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian/*****************************************************************************/
32e99520400f228e45b1feff28eb4105b8e5599196Erik Gilling
33d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall/* for compatibility */
34b08d45dff634673e6dc5901a65f4c04bfdabf76eMathias Agopian#define HWC_MODULE_API_VERSION      HWC_MODULE_API_VERSION_0_1
35b08d45dff634673e6dc5901a65f4c04bfdabf76eMathias Agopian#define HWC_DEVICE_API_VERSION      HWC_DEVICE_API_VERSION_0_1
3681c323dd54d5f0ea1e75ab392187608049b2326cMathias Agopian#define HWC_API_VERSION             HWC_DEVICE_API_VERSION
37e99520400f228e45b1feff28eb4105b8e5599196Erik Gilling
38d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall/*****************************************************************************/
39d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall
405d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian/**
415d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian * The id of this module
425d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian */
435d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian#define HWC_HARDWARE_MODULE_ID "hwcomposer"
445d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
455d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian/**
465d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian * Name of the sensors device to open
475d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian */
485d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian#define HWC_HARDWARE_COMPOSER   "composer"
495d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
505d3de309f44f6a72f2a46db792f3865088897039Mathias Agopiantypedef struct hwc_rect {
515d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian    int left;
525d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian    int top;
535d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian    int right;
545d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian    int bottom;
555d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian} hwc_rect_t;
565d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
573b4732c9d5462daf52a2ee1a42410bb0220fd28fMathias Agopiantypedef struct hwc_frect {
583b4732c9d5462daf52a2ee1a42410bb0220fd28fMathias Agopian    float left;
593b4732c9d5462daf52a2ee1a42410bb0220fd28fMathias Agopian    float top;
603b4732c9d5462daf52a2ee1a42410bb0220fd28fMathias Agopian    float right;
613b4732c9d5462daf52a2ee1a42410bb0220fd28fMathias Agopian    float bottom;
623b4732c9d5462daf52a2ee1a42410bb0220fd28fMathias Agopian} hwc_frect_t;
633b4732c9d5462daf52a2ee1a42410bb0220fd28fMathias Agopian
645d3de309f44f6a72f2a46db792f3865088897039Mathias Agopiantypedef struct hwc_region {
655d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian    size_t numRects;
665d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian    hwc_rect_t const* rects;
675d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian} hwc_region_t;
685d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
69eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopiantypedef struct hwc_color {
70eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian    uint8_t r;
71eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian    uint8_t g;
72eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian    uint8_t b;
73eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian    uint8_t a;
74eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian} hwc_color_t;
75eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian
76d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Halltypedef struct hwc_layer_1 {
775d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian    /*
7848697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     * compositionType is used to specify this layer's type and is set by either
7948697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     * the hardware composer implementation, or by the caller (see below).
80d18c83fc044a5f1d74ebe59bea7763b75c4d00d7Jesse Hall     *
8148697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *  This field is always reset to HWC_BACKGROUND or HWC_FRAMEBUFFER
8248697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *  before (*prepare)() is called when the HWC_GEOMETRY_CHANGED flag is
8348697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *  also set, otherwise, this field is preserved between (*prepare)()
8448697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *  calls.
85eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian     *
86eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian     * HWC_BACKGROUND
8748697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *   Always set by the caller before calling (*prepare)(), this value
8848697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *   indicates this is a special "background" layer. The only valid field
8948697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *   is backgroundColor.
9048697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *   The HWC can toggle this value to HWC_FRAMEBUFFER to indicate it CANNOT
9148697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *   handle the background color.
9248697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *
93d18c83fc044a5f1d74ebe59bea7763b75c4d00d7Jesse Hall     *
94d18c83fc044a5f1d74ebe59bea7763b75c4d00d7Jesse Hall     * HWC_FRAMEBUFFER_TARGET
9548697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *   Always set by the caller before calling (*prepare)(), this value
9648697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *   indicates this layer is the framebuffer surface used as the target of
97d18c83fc044a5f1d74ebe59bea7763b75c4d00d7Jesse Hall     *   OpenGL ES composition. If the HWC sets all other layers to HWC_OVERLAY
98d18c83fc044a5f1d74ebe59bea7763b75c4d00d7Jesse Hall     *   or HWC_BACKGROUND, then no OpenGL ES composition will be done, and
996b01e2eaf7fb7f167730c0bde1b55ae7ac928060Jesse Hall     *   this layer should be ignored during set().
100eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian     *
101d18c83fc044a5f1d74ebe59bea7763b75c4d00d7Jesse Hall     *   This flag (and the framebuffer surface layer) will only be used if the
102d18c83fc044a5f1d74ebe59bea7763b75c4d00d7Jesse Hall     *   HWC version is HWC_DEVICE_API_VERSION_1_1 or higher. In older versions,
103d18c83fc044a5f1d74ebe59bea7763b75c4d00d7Jesse Hall     *   the OpenGL ES target surface is communicated by the (dpy, sur) fields
104d18c83fc044a5f1d74ebe59bea7763b75c4d00d7Jesse Hall     *   in hwc_compositor_device_1_t.
10548697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *
10648697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *   This value cannot be set by the HWC implementation.
10748697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *
10848697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *
10948697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     * HWC_FRAMEBUFFER
11048697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *   Set by the caller before calling (*prepare)() ONLY when the
11148697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *   HWC_GEOMETRY_CHANGED flag is also set.
11248697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *
11348697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *   Set by the HWC implementation during (*prepare)(), this indicates
11448697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *   that the layer will be drawn into the framebuffer using OpenGL ES.
11548697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *   The HWC can toggle this value to HWC_OVERLAY to indicate it will
11648697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *   handle the layer.
11748697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *
11848697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *
11948697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     * HWC_OVERLAY
12048697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *   Set by the HWC implementation during (*prepare)(), this indicates
12148697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *   that the layer will be handled by the HWC (ie: it must not be
12248697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *   composited with OpenGL ES).
12348697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *
1245d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     */
1255d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian    int32_t compositionType;
1265d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
12748697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian    /*
12848697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     * hints is bit mask set by the HWC implementation during (*prepare)().
12948697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     * It is preserved between (*prepare)() calls, unless the
13048697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     * HWC_GEOMETRY_CHANGED flag is set, in which case it is reset to 0.
13148697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     *
13248697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     * see hwc_layer_t::hints
13348697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     */
1345d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian    uint32_t hints;
1355d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
13648697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian    /* see hwc_layer_t::flags */
1375d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian    uint32_t flags;
1385d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
139eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian    union {
140eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian        /* color of the background.  hwc_color_t.a is ignored */
141eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian        hwc_color_t backgroundColor;
142eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian
143eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian        struct {
144eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian            /* handle of buffer to compose. This handle is guaranteed to have been
145eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian             * allocated from gralloc using the GRALLOC_USAGE_HW_COMPOSER usage flag. If
146eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian             * the layer's handle is unchanged across two consecutive prepare calls and
147eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian             * the HWC_GEOMETRY_CHANGED flag is not set for the second call then the
148eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian             * HWComposer implementation may assume that the contents of the buffer have
149eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian             * not changed. */
150eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian            buffer_handle_t handle;
151eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian
152eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian            /* transformation to apply to the buffer during composition */
153eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian            uint32_t transform;
154eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian
155eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian            /* blending to apply during composition */
156eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian            int32_t blending;
157eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian
158eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian            /* area of the source to consider, the origin is the top-left corner of
1593b4732c9d5462daf52a2ee1a42410bb0220fd28fMathias Agopian             * the buffer. As of HWC_DEVICE_API_VERSION_1_3, sourceRect uses floats.
1603b4732c9d5462daf52a2ee1a42410bb0220fd28fMathias Agopian             * If the h/w can't support a non-integer source crop rectangle, it should
1613b4732c9d5462daf52a2ee1a42410bb0220fd28fMathias Agopian             * punt to OpenGL ES composition.
1623b4732c9d5462daf52a2ee1a42410bb0220fd28fMathias Agopian             */
1633b4732c9d5462daf52a2ee1a42410bb0220fd28fMathias Agopian            union {
1643b4732c9d5462daf52a2ee1a42410bb0220fd28fMathias Agopian                // crop rectangle in integer (pre HWC_DEVICE_API_VERSION_1_3)
1653b4732c9d5462daf52a2ee1a42410bb0220fd28fMathias Agopian                hwc_rect_t sourceCropi;
1663b4732c9d5462daf52a2ee1a42410bb0220fd28fMathias Agopian                hwc_rect_t sourceCrop; // just for source compatibility
1673b4732c9d5462daf52a2ee1a42410bb0220fd28fMathias Agopian                // crop rectangle in floats (as of HWC_DEVICE_API_VERSION_1_3)
1683b4732c9d5462daf52a2ee1a42410bb0220fd28fMathias Agopian                hwc_frect_t sourceCropf;
1693b4732c9d5462daf52a2ee1a42410bb0220fd28fMathias Agopian            };
170eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian
171eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian            /* where to composite the sourceCrop onto the display. The sourceCrop
172eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian             * is scaled using linear filtering to the displayFrame. The origin is the
173eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian             * top-left corner of the screen.
174eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian             */
175eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian            hwc_rect_t displayFrame;
176eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian
177eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian            /* visible region in screen space. The origin is the
178eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian             * top-left corner of the screen.
179eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian             * The visible region INCLUDES areas overlapped by a translucent layer.
180eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian             */
181eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian            hwc_region_t visibleRegionScreen;
182d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall
183d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall            /* Sync fence object that will be signaled when the buffer's
184d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             * contents are available. May be -1 if the contents are already
185d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             * available. This field is only valid during set(), and should be
186d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             * ignored during prepare(). The set() call must not wait for the
187d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             * fence to be signaled before returning, but the HWC must wait for
188d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             * all buffers to be signaled before reading from them.
189d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             *
1900a0a41653d82552e601980c8793fcb07e3863044Jesse Hall             * HWC_FRAMEBUFFER layers will never have an acquire fence, since
1910a0a41653d82552e601980c8793fcb07e3863044Jesse Hall             * reads from them are complete before the framebuffer is ready for
1920a0a41653d82552e601980c8793fcb07e3863044Jesse Hall             * display.
1930a0a41653d82552e601980c8793fcb07e3863044Jesse Hall             *
194d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             * The HWC takes ownership of the acquireFenceFd and is responsible
195d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             * for closing it when no longer needed.
196d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             */
197d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall            int acquireFenceFd;
198d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall
199d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall            /* During set() the HWC must set this field to a file descriptor for
200d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             * a sync fence object that will signal after the HWC has finished
201d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             * reading from the buffer. The field is ignored by prepare(). Each
202d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             * layer should have a unique file descriptor, even if more than one
203d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             * refer to the same underlying fence object; this allows each to be
204d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             * closed independently.
205d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             *
206d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             * If buffer reads can complete at significantly different times,
207d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             * then using independent fences is preferred. For example, if the
208d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             * HWC handles some layers with a blit engine and others with
209d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             * overlays, then the blit layers can be reused immediately after
210d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             * the blit completes, but the overlay layers can't be reused until
211d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             * a subsequent frame has been displayed.
212d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             *
2130a0a41653d82552e601980c8793fcb07e3863044Jesse Hall             * Since HWC doesn't read from HWC_FRAMEBUFFER layers, it shouldn't
2140a0a41653d82552e601980c8793fcb07e3863044Jesse Hall             * produce a release fence for them. The releaseFenceFd will be -1
2150a0a41653d82552e601980c8793fcb07e3863044Jesse Hall             * for these layers when set() is called.
2160a0a41653d82552e601980c8793fcb07e3863044Jesse Hall             *
217d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             * The HWC client taks ownership of the releaseFenceFd and is
218d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             * responsible for closing it when no longer needed.
219d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall             */
220d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall            int releaseFenceFd;
221e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian
222e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian            /*
223e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             * Availability: HWC_DEVICE_API_VERSION_1_2
224e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             *
225e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             * Alpha value applied to the whole layer. The effective
226e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             * value of each pixel is computed as:
227e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             *
228e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             *   if (blending == HWC_BLENDING_PREMULT)
229e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             *      pixel.rgb = pixel.rgb * planeAlpha / 255
230e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             *   pixel.a = pixel.a * planeAlpha / 255
231e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             *
232e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             * Then blending proceeds as usual according to the "blending"
233e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             * field above.
234e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             *
235e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             * NOTE: planeAlpha applies to YUV layers as well:
236e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             *
237e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             *   pixel.rgb = yuv_to_rgb(pixel.yuv)
238e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             *   if (blending == HWC_BLENDING_PREMULT)
239e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             *      pixel.rgb = pixel.rgb * planeAlpha / 255
240e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             *   pixel.a = planeAlpha
241e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             *
242e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             *
243e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             * IMPLEMENTATION NOTE:
244e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             *
245e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             * If the source image doesn't have an alpha channel, then
246e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             * the h/w can use the HWC_BLENDING_COVERAGE equations instead of
247e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             * HWC_BLENDING_PREMULT and simply set the alpha channel to
248e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             * planeAlpha.
249e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             *
250e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             * e.g.:
251e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             *
252e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             *   if (blending == HWC_BLENDING_PREMULT)
253e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             *      blending = HWC_BLENDING_COVERAGE;
254e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             *   pixel.a = planeAlpha;
255e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             *
256e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian             */
257e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian            uint8_t planeAlpha;
258e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian
259e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian            /* reserved for future use */
260e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian            uint8_t _pad[3];
261eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian        };
262eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian    };
2635d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
264d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall    /* Allow for expansion w/o breaking binary compatibility.
265d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall     * Pad layer to 96 bytes, assuming 32-bit pointers.
266d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall     */
267e3e0a570a85ea40ce215e80679ba4ae1b014664fMathias Agopian    int32_t reserved[24 - 19];
268d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall
269d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall} hwc_layer_1_t;
2705d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
271f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall/* This represents a display, typically an EGLDisplay object */
272f9d6cd7dee62789b220033c926c87deab8991bdeJesse Halltypedef void* hwc_display_t;
273f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall
274f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall/* This represents a surface, typically an EGLSurface object  */
275f9d6cd7dee62789b220033c926c87deab8991bdeJesse Halltypedef void* hwc_surface_t;
276f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall
2775d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian/*
278f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall * hwc_display_contents_1_t::flags values
2795d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian */
2805d3de309f44f6a72f2a46db792f3865088897039Mathias Agopianenum {
2815d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian    /*
2825d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     * HWC_GEOMETRY_CHANGED is set by SurfaceFlinger to indicate that the list
283d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall     * passed to (*prepare)() has changed by more than just the buffer handles
284d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall     * and acquire fences.
2855d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     */
2865d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian    HWC_GEOMETRY_CHANGED = 0x00000001,
2875d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian};
2885d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
289871815b5f144048b63a18ef764f82e89394899faLouis Huemiller/*
290f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall * Description of the contents to output on a display.
291f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall *
292f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall * This is the top-level structure passed to the prepare and set calls to
293f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall * negotiate and commit the composition of a display image.
294871815b5f144048b63a18ef764f82e89394899faLouis Huemiller */
295f9d6cd7dee62789b220033c926c87deab8991bdeJesse Halltypedef struct hwc_display_contents_1 {
296f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall    /* File descriptor referring to a Sync HAL fence object which will signal
2977cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall     * when this composition is retired. For a physical display, a composition
2987cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall     * is retired when it has been replaced on-screen by a subsequent set. For
2997cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall     * a virtual display, the composition is retired when the writes to
3007cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall     * outputBuffer are complete and can be read. The fence object is created
3017cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall     * and returned by the set call; this field will be -1 on entry to prepare
3027cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall     * and set. SurfaceFlinger will close the returned file descriptor.
303f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall     */
3047cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall    int retireFenceFd;
305f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall
3067cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall    union {
3077cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall        /* Fields only relevant for HWC_DEVICE_VERSION_1_0. */
3087cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall        struct {
3097cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall            /* (dpy, sur) is the target of SurfaceFlinger's OpenGL ES
3107cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall             * composition for HWC_DEVICE_VERSION_1_0. They aren't relevant to
3117cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall             * prepare. The set call should commit this surface atomically to
3127cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall             * the display along with any overlay layers.
3137cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall             */
3147cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall            hwc_display_t dpy;
3157cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall            hwc_surface_t sur;
3167cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall        };
3177cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall
3187ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall        /* These fields are used for virtual displays when the h/w composer
3197ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall         * version is at least HWC_DEVICE_VERSION_1_3. */
3207cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall        struct {
3217cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall            /* outbuf is the buffer that receives the composed image for
3227cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall             * virtual displays. Writes to the outbuf must wait until
3237cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall             * outbufAcquireFenceFd signals. A fence that will signal when
3247cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall             * writes to outbuf are complete should be returned in
3257cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall             * retireFenceFd.
3267cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall             *
3277ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall             * This field is set before prepare(), so properties of the buffer
3287ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall             * can be used to decide which layers can be handled by h/w
3297ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall             * composer.
330380f45dade4a917e6e72c4ce756a20f6242f14fdJesse Hall             *
3317ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall             * If prepare() sets all layers to FRAMEBUFFER, then GLES
3327ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall             * composition will happen directly to the output buffer. In this
3337ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall             * case, both outbuf and the FRAMEBUFFER_TARGET layer's buffer will
3347ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall             * be the same, and set() has no work to do besides managing fences.
3357ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall             *
3367ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall             * If the TARGET_FORCE_HWC_FOR_VIRTUAL_DISPLAYS board config
3377ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall             * variable is defined (not the default), then this behavior is
3387ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall             * changed: if all layers are marked for FRAMEBUFFER, GLES
3397ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall             * composition will take place to a scratch framebuffer, and
3407ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall             * h/w composer must copy it to the output buffer. This allows the
3417ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall             * h/w composer to do format conversion if there are cases where
3427ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall             * that is more desirable than doing it in the GLES driver or at the
3437ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall             * virtual display consumer.
3447ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall             *
3457ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall             * If some or all layers are marked OVERLAY, then the framebuffer
3467ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall             * and output buffer will be different. As with physical displays,
3477ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall             * the framebuffer handle will not change between frames if all
3487ccf148f5066ceb1a161f0d7a7d66f75c6e8d420Jesse Hall             * layers are marked for OVERLAY.
3497cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall             */
3507cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall            buffer_handle_t outbuf;
3517cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall
3527cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall            /* File descriptor for a fence that will signal when outbuf is
3537cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall             * ready to be written. The h/w composer is responsible for closing
3547cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall             * this when no longer needed.
3557cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall             *
3567cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall             * Will be -1 whenever outbuf is NULL, or when the outbuf can be
3577cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall             * written immediately.
3587cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall             */
3597cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall            int outbufAcquireFenceFd;
3607cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall        };
3617cb03d79b3040d9b43ffc81414e9853e8a57adb1Jesse Hall    };
362f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall
363f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall    /* List of layers that will be composed on the display. The buffer handles
364ac3f7e195cadcf1f826340976a228fd5bbcdb807Jesse Hall     * in the list will be unique. If numHwLayers is 0, all composition will be
365ac3f7e195cadcf1f826340976a228fd5bbcdb807Jesse Hall     * performed by SurfaceFlinger.
366f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall     */
3675d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian    uint32_t flags;
3685d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian    size_t numHwLayers;
369d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall    hwc_layer_1_t hwLayers[0];
3705d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
371f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall} hwc_display_contents_1_t;
3725d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
373d6afef62ff8ea1fde3a060ac5c5d887c7523b359Mathias Agopian/* see hwc_composer_device::registerProcs()
3740a0a41653d82552e601980c8793fcb07e3863044Jesse Hall * All of the callbacks are required and non-NULL unless otherwise noted.
375d6afef62ff8ea1fde3a060ac5c5d887c7523b359Mathias Agopian */
376d6afef62ff8ea1fde3a060ac5c5d887c7523b359Mathias Agopiantypedef struct hwc_procs {
377d6afef62ff8ea1fde3a060ac5c5d887c7523b359Mathias Agopian    /*
378d6afef62ff8ea1fde3a060ac5c5d887c7523b359Mathias Agopian     * (*invalidate)() triggers a screen refresh, in particular prepare and set
379d6afef62ff8ea1fde3a060ac5c5d887c7523b359Mathias Agopian     * will be called shortly after this call is made. Note that there is
380d6afef62ff8ea1fde3a060ac5c5d887c7523b359Mathias Agopian     * NO GUARANTEE that the screen refresh will happen after invalidate()
381d6afef62ff8ea1fde3a060ac5c5d887c7523b359Mathias Agopian     * returns (in particular, it could happen before).
382d6afef62ff8ea1fde3a060ac5c5d887c7523b359Mathias Agopian     * invalidate() is GUARANTEED TO NOT CALL BACK into the h/w composer HAL and
383d6afef62ff8ea1fde3a060ac5c5d887c7523b359Mathias Agopian     * it is safe to call invalidate() from any of hwc_composer_device
384d6afef62ff8ea1fde3a060ac5c5d887c7523b359Mathias Agopian     * hooks, unless noted otherwise.
385d6afef62ff8ea1fde3a060ac5c5d887c7523b359Mathias Agopian     */
3860a0a41653d82552e601980c8793fcb07e3863044Jesse Hall    void (*invalidate)(const struct hwc_procs* procs);
387b08d45dff634673e6dc5901a65f4c04bfdabf76eMathias Agopian
388b08d45dff634673e6dc5901a65f4c04bfdabf76eMathias Agopian    /*
389b08d45dff634673e6dc5901a65f4c04bfdabf76eMathias Agopian     * (*vsync)() is called by the h/w composer HAL when a vsync event is
390f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall     * received and HWC_EVENT_VSYNC is enabled on a display
391f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall     * (see: hwc_event_control).
392b08d45dff634673e6dc5901a65f4c04bfdabf76eMathias Agopian     *
3932c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * the "disp" parameter indicates which display the vsync event is for.
3946b7adef0ef38f568099eab38d6865f402c92235bJamie Gennis     * the "timestamp" parameter is the system monotonic clock timestamp in
3956b7adef0ef38f568099eab38d6865f402c92235bJamie Gennis     *   nanosecond of when the vsync event happened.
396b08d45dff634673e6dc5901a65f4c04bfdabf76eMathias Agopian     *
397b08d45dff634673e6dc5901a65f4c04bfdabf76eMathias Agopian     * vsync() is GUARANTEED TO NOT CALL BACK into the h/w composer HAL.
398b08d45dff634673e6dc5901a65f4c04bfdabf76eMathias Agopian     *
399b08d45dff634673e6dc5901a65f4c04bfdabf76eMathias Agopian     * It is expected that vsync() is called from a thread of at least
400eb67160b995a504dd70a8f29d228ec837341eb07Mathias Agopian     * HAL_PRIORITY_URGENT_DISPLAY with as little latency as possible,
401b08d45dff634673e6dc5901a65f4c04bfdabf76eMathias Agopian     * typically less than 0.5 ms.
402b08d45dff634673e6dc5901a65f4c04bfdabf76eMathias Agopian     *
4036d3fec70d86fe8e8fb71b233d2de727fee3f6f3fMathias Agopian     * It is a (silent) error to have HWC_EVENT_VSYNC enabled when calling
4046d3fec70d86fe8e8fb71b233d2de727fee3f6f3fMathias Agopian     * hwc_composer_device.set(..., 0, 0, 0) (screen off). The implementation
4056d3fec70d86fe8e8fb71b233d2de727fee3f6f3fMathias Agopian     * can either stop or continue to process VSYNC events, but must not
4066d3fec70d86fe8e8fb71b233d2de727fee3f6f3fMathias Agopian     * crash or cause other problems.
407b08d45dff634673e6dc5901a65f4c04bfdabf76eMathias Agopian     */
4082c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall    void (*vsync)(const struct hwc_procs* procs, int disp, int64_t timestamp);
4092c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall
4102c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall    /*
4112c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * (*hotplug)() is called by the h/w composer HAL when a display is
4122c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * connected or disconnected. The PRIMARY display is always connected and
4132c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * the hotplug callback should not be called for it.
4142c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     *
4152c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * The disp parameter indicates which display type this event is for.
4162c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * The connected parameter indicates whether the display has just been
4172c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     *   connected (1) or disconnected (0).
4182c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     *
4192c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * The hotplug() callback may call back into the h/w composer on the same
4202c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * thread to query refresh rate and dpi for the display. Additionally,
4212c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * other threads may be calling into the h/w composer while the callback
4222c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * is in progress.
4232c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     *
424d91697ab8fee9b4c55170230f355f5a25eceefafJesse Hall     * The h/w composer must serialize calls to the hotplug callback; only
425d91697ab8fee9b4c55170230f355f5a25eceefafJesse Hall     * one thread may call it at a time.
426d91697ab8fee9b4c55170230f355f5a25eceefafJesse Hall     *
4272c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * This callback will be NULL if the h/w composer is using
4282c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * HWC_DEVICE_API_VERSION_1_0.
4292c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     */
4302c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall    void (*hotplug)(const struct hwc_procs* procs, int disp, int connected);
4312c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall
432d6afef62ff8ea1fde3a060ac5c5d887c7523b359Mathias Agopian} hwc_procs_t;
433d6afef62ff8ea1fde3a060ac5c5d887c7523b359Mathias Agopian
434d6afef62ff8ea1fde3a060ac5c5d887c7523b359Mathias Agopian
435d6afef62ff8ea1fde3a060ac5c5d887c7523b359Mathias Agopian/*****************************************************************************/
4365d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
4375d3de309f44f6a72f2a46db792f3865088897039Mathias Agopiantypedef struct hwc_module {
4385d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian    struct hw_module_t common;
4395d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian} hwc_module_t;
4405d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
441d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Halltypedef struct hwc_composer_device_1 {
4425d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian    struct hw_device_t common;
4435d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
4445d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian    /*
4455d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     * (*prepare)() is called for each frame before composition and is used by
4465d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     * SurfaceFlinger to determine what composition steps the HWC can handle.
4475d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     *
4485d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     * (*prepare)() can be called more than once, the last call prevails.
4495d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     *
450f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall     * The HWC responds by setting the compositionType field in each layer to
451f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall     * either HWC_FRAMEBUFFER or HWC_OVERLAY. In the former case, the
452f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall     * composition for the layer is handled by SurfaceFlinger with OpenGL ES,
453f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall     * in the later case, the HWC will have to handle the layer's composition.
45448697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     * compositionType and hints are preserved between (*prepare)() calles
45548697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     * unless the HWC_GEOMETRY_CHANGED flag is set.
4565d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     *
4575d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     * (*prepare)() is called with HWC_GEOMETRY_CHANGED to indicate that the
4585d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     * list's geometry has changed, that is, when more than just the buffer's
4595d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     * handles have been updated. Typically this happens (but is not limited to)
46048697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     * when a window is added, removed, resized or moved. In this case
46148697f6dc249d1238243677de77d3a0eb6a17b3fMathias Agopian     * compositionType and hints are reset to their default value.
4625d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     *
46343b51d9fdd7a447c9de7bf30960a1963c93ff5c3Jesse Hall     * For HWC 1.0, numDisplays will always be one, and displays[0] will be
46443b51d9fdd7a447c9de7bf30960a1963c93ff5c3Jesse Hall     * non-NULL.
46543b51d9fdd7a447c9de7bf30960a1963c93ff5c3Jesse Hall     *
466fc0ff2a8700eb11aef7a961b279d846c8a1c04c5Jesse Hall     * For HWC 1.1, numDisplays will always be HWC_NUM_PHYSICAL_DISPLAY_TYPES.
467fc0ff2a8700eb11aef7a961b279d846c8a1c04c5Jesse Hall     * Entries for unsupported or disabled/disconnected display types will be
468fc0ff2a8700eb11aef7a961b279d846c8a1c04c5Jesse Hall     * NULL.
46943b51d9fdd7a447c9de7bf30960a1963c93ff5c3Jesse Hall     *
470fc0ff2a8700eb11aef7a961b279d846c8a1c04c5Jesse Hall     * In HWC 1.3, numDisplays may be up to HWC_NUM_DISPLAY_TYPES. The extra
471fc0ff2a8700eb11aef7a961b279d846c8a1c04c5Jesse Hall     * entries correspond to enabled virtual displays, and will be non-NULL.
472ac3f7e195cadcf1f826340976a228fd5bbcdb807Jesse Hall     *
4735d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     * returns: 0 on success. An negative error code on error. If an error is
4745d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     * returned, SurfaceFlinger will assume that none of the layer will be
4755d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     * handled by the HWC.
4765d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     */
477d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall    int (*prepare)(struct hwc_composer_device_1 *dev,
478f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall                    size_t numDisplays, hwc_display_contents_1_t** displays);
4795d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
4805d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian    /*
4815d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     * (*set)() is used in place of eglSwapBuffers(), and assumes the same
4825d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     * functionality, except it also commits the work list atomically with
4835d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     * the actual eglSwapBuffers().
4845d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     *
485f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall     * The layer lists are guaranteed to be the same as the ones returned from
486f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall     * the last call to (*prepare)().
4875d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     *
488f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall     * When this call returns the caller assumes that the displays will be
489f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall     * updated in the near future with the content of their work lists, without
490f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall     * artifacts during the transition from the previous frame.
4915d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     *
492ac3f7e195cadcf1f826340976a228fd5bbcdb807Jesse Hall     * A display with zero layers indicates that the entire composition has
493ac3f7e195cadcf1f826340976a228fd5bbcdb807Jesse Hall     * been handled by SurfaceFlinger with OpenGL ES. In this case, (*set)()
494ac3f7e195cadcf1f826340976a228fd5bbcdb807Jesse Hall     * behaves just like eglSwapBuffers().
4955d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     *
49643b51d9fdd7a447c9de7bf30960a1963c93ff5c3Jesse Hall     * For HWC 1.0, numDisplays will always be one, and displays[0] will be
49743b51d9fdd7a447c9de7bf30960a1963c93ff5c3Jesse Hall     * non-NULL.
49843b51d9fdd7a447c9de7bf30960a1963c93ff5c3Jesse Hall     *
499fc0ff2a8700eb11aef7a961b279d846c8a1c04c5Jesse Hall     * For HWC 1.1, numDisplays will always be HWC_NUM_PHYSICAL_DISPLAY_TYPES.
500fc0ff2a8700eb11aef7a961b279d846c8a1c04c5Jesse Hall     * Entries for unsupported or disabled/disconnected display types will be
501fc0ff2a8700eb11aef7a961b279d846c8a1c04c5Jesse Hall     * NULL.
50243b51d9fdd7a447c9de7bf30960a1963c93ff5c3Jesse Hall     *
503fc0ff2a8700eb11aef7a961b279d846c8a1c04c5Jesse Hall     * In HWC 1.3, numDisplays may be up to HWC_NUM_DISPLAY_TYPES. The extra
504fc0ff2a8700eb11aef7a961b279d846c8a1c04c5Jesse Hall     * entries correspond to enabled virtual displays, and will be non-NULL.
50571212e3fca328630aba1ebfa1299a8719b80f476Mathias Agopian     *
506c7545189c8b260bbaf09653407450418a3d1860bJamie Gennis     * IMPORTANT NOTE: There is an implicit layer containing opaque black
507f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall     * pixels behind all the layers in the list. It is the responsibility of
508f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall     * the hwcomposer module to make sure black pixels are output (or blended
509f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall     * from).
510fb410365ca67d36d4c81d7826712c6a05437612fMathias Agopian     *
511c7545189c8b260bbaf09653407450418a3d1860bJamie Gennis     * IMPORTANT NOTE: In the event of an error this call *MUST* still cause
512c7545189c8b260bbaf09653407450418a3d1860bJamie Gennis     * any fences returned in the previous call to set to eventually become
513c7545189c8b260bbaf09653407450418a3d1860bJamie Gennis     * signaled.  The caller may have already issued wait commands on these
514c7545189c8b260bbaf09653407450418a3d1860bJamie Gennis     * fences, and having set return without causing those fences to signal
515c7545189c8b260bbaf09653407450418a3d1860bJamie Gennis     * will likely result in a deadlock.
516c7545189c8b260bbaf09653407450418a3d1860bJamie Gennis     *
517c7545189c8b260bbaf09653407450418a3d1860bJamie Gennis     * returns: 0 on success. A negative error code on error:
518c7545189c8b260bbaf09653407450418a3d1860bJamie Gennis     *    HWC_EGL_ERROR: eglGetError() will provide the proper error code (only
519c7545189c8b260bbaf09653407450418a3d1860bJamie Gennis     *        allowed prior to HWComposer 1.1)
5205d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     *    Another code for non EGL errors.
5215d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian     */
522d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall    int (*set)(struct hwc_composer_device_1 *dev,
523f9d6cd7dee62789b220033c926c87deab8991bdeJesse Hall                size_t numDisplays, hwc_display_contents_1_t** displays);
524d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall
525158549c89405186d9ecaefd3811cfae3949056eeErik Gilling    /*
5260a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     * eventControl(..., event, enabled)
5270a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     * Enables or disables h/w composer events for a display.
528158549c89405186d9ecaefd3811cfae3949056eeErik Gilling     *
5290a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     * eventControl can be called from any thread and takes effect
5300a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     * immediately.
5310a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     *
5320a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     *  Supported events are:
5330a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     *      HWC_EVENT_VSYNC
5340a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     *
5350a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     * returns -EINVAL if the "event" parameter is not one of the value above
5360a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     * or if the "enabled" parameter is not 0 or 1.
537158549c89405186d9ecaefd3811cfae3949056eeErik Gilling     */
5382c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall    int (*eventControl)(struct hwc_composer_device_1* dev, int disp,
5390a0a41653d82552e601980c8793fcb07e3863044Jesse Hall            int event, int enabled);
5405d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
541d6afef62ff8ea1fde3a060ac5c5d887c7523b359Mathias Agopian    /*
5420a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     * blank(..., blank)
5430a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     * Blanks or unblanks a display's screen.
544d6afef62ff8ea1fde3a060ac5c5d887c7523b359Mathias Agopian     *
5450a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     * Turns the screen off when blank is nonzero, on when blank is zero.
5460a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     * Multiple sequential calls with the same blank value must be supported.
5470a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     * The screen state transition must be be complete when the function
5480a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     * returns.
549d6afef62ff8ea1fde3a060ac5c5d887c7523b359Mathias Agopian     *
5500a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     * returns 0 on success, negative on error.
551d6afef62ff8ea1fde3a060ac5c5d887c7523b359Mathias Agopian     */
5522c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall    int (*blank)(struct hwc_composer_device_1* dev, int disp, int blank);
553d6afef62ff8ea1fde3a060ac5c5d887c7523b359Mathias Agopian
554eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian    /*
555eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian     * Used to retrieve information about the h/w composer
556eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian     *
557eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian     * Returns 0 on success or -errno on error.
558eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian     */
559d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall    int (*query)(struct hwc_composer_device_1* dev, int what, int* value);
560eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian
561b08d45dff634673e6dc5901a65f4c04bfdabf76eMathias Agopian    /*
5620a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     * (*registerProcs)() registers callbacks that the h/w composer HAL can
5630a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     * later use. It will be called immediately after the composer device is
5640a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     * opened with non-NULL procs. It is FORBIDDEN to call any of the callbacks
5650a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     * from within registerProcs(). registerProcs() must save the hwc_procs_t
5660a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     * pointer which is needed when calling a registered callback.
567b08d45dff634673e6dc5901a65f4c04bfdabf76eMathias Agopian     */
5680a0a41653d82552e601980c8793fcb07e3863044Jesse Hall    void (*registerProcs)(struct hwc_composer_device_1* dev,
5690a0a41653d82552e601980c8793fcb07e3863044Jesse Hall            hwc_procs_t const* procs);
570eb8fb508148d809166a30783a14e186fda0e31c9Mathias Agopian
571b08d45dff634673e6dc5901a65f4c04bfdabf76eMathias Agopian    /*
5720a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     * This field is OPTIONAL and can be NULL.
5730a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     *
5740a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     * If non NULL it will be called by SurfaceFlinger on dumpsys
575b08d45dff634673e6dc5901a65f4c04bfdabf76eMathias Agopian     */
5760a0a41653d82552e601980c8793fcb07e3863044Jesse Hall    void (*dump)(struct hwc_composer_device_1* dev, char *buff, int buff_len);
5770a0a41653d82552e601980c8793fcb07e3863044Jesse Hall
5780a0a41653d82552e601980c8793fcb07e3863044Jesse Hall    /*
5792c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * (*getDisplayConfigs)() returns handles for the configurations available
5802c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * on the connected display. These handles must remain valid as long as the
5812c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * display is connected.
5822c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     *
5832c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * Configuration handles are written to configs. The number of entries
5842c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * allocated by the caller is passed in *numConfigs; getDisplayConfigs must
5852c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * not try to write more than this number of config handles. On return, the
5862c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * total number of configurations available for the display is returned in
5872c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * *numConfigs. If *numConfigs is zero on entry, then configs may be NULL.
5882c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     *
5892c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * HWC_DEVICE_API_VERSION_1_1 does not provide a way to choose a config.
5902c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * For displays that support multiple configurations, the h/w composer
5912c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * implementation should choose one and report it as the first config in
5922c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * the list. Reporting the not-chosen configs is not required.
5932c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     *
594d91697ab8fee9b4c55170230f355f5a25eceefafJesse Hall     * Returns 0 on success or -errno on error. If disp is a hotpluggable
595d91697ab8fee9b4c55170230f355f5a25eceefafJesse Hall     * display type and no display is connected, an error should be returned.
5962c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     *
5972c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * This field is REQUIRED for HWC_DEVICE_API_VERSION_1_1 and later.
5982c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * It should be NULL for previous versions.
5992c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     */
6002c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall    int (*getDisplayConfigs)(struct hwc_composer_device_1* dev, int disp,
6012c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall            uint32_t* configs, size_t* numConfigs);
6022c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall
6032c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall    /*
6042c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * (*getDisplayAttributes)() returns attributes for a specific config of a
6052c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * connected display. The config parameter is one of the config handles
6062c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * returned by getDisplayConfigs.
6072c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     *
6082c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * The list of attributes to return is provided in the attributes
6092c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * parameter, terminated by HWC_DISPLAY_NO_ATTRIBUTE. The value for each
6102c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * requested attribute is written in order to the values array. The
6112c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * HWC_DISPLAY_NO_ATTRIBUTE attribute does not have a value, so the values
6122c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * array will have one less value than the attributes array.
6132c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     *
6142c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * This field is REQUIRED for HWC_DEVICE_API_VERSION_1_1 and later.
6152c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     * It should be NULL for previous versions.
616d91697ab8fee9b4c55170230f355f5a25eceefafJesse Hall     *
617d91697ab8fee9b4c55170230f355f5a25eceefafJesse Hall     * If disp is a hotpluggable display type and no display is connected,
618d91697ab8fee9b4c55170230f355f5a25eceefafJesse Hall     * or if config is not a valid configuration for the display, a negative
619d91697ab8fee9b4c55170230f355f5a25eceefafJesse Hall     * value should be returned.
6202c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall     */
621d91697ab8fee9b4c55170230f355f5a25eceefafJesse Hall    int (*getDisplayAttributes)(struct hwc_composer_device_1* dev, int disp,
6222c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall            uint32_t config, const uint32_t* attributes, int32_t* values);
6232c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall
6242c13759c61dd111efc9509ddf37330f50f706f64Jesse Hall    /*
6250a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     * Reserved for future use. Must be NULL.
6260a0a41653d82552e601980c8793fcb07e3863044Jesse Hall     */
6270a0a41653d82552e601980c8793fcb07e3863044Jesse Hall    void* reserved_proc[4];
6285d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
629d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall} hwc_composer_device_1_t;
6305d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
6315d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian/** convenience API for opening and closing a device */
6325d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
633d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hallstatic inline int hwc_open_1(const struct hw_module_t* module,
634d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hall        hwc_composer_device_1_t** device) {
6355d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian    return module->methods->open(module,
6365d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian            HWC_HARDWARE_COMPOSER, (struct hw_device_t**)device);
6375d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian}
6385d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
639d479ad22a0254fa0b5358fe82fa404e3e96c631aJesse Hallstatic inline int hwc_close_1(hwc_composer_device_1_t* device) {
6405d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian    return device->common.close(&device->common);
6415d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian}
6425d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
6435d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian/*****************************************************************************/
6445d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
6455d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian__END_DECLS
6465d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian
6475d3de309f44f6a72f2a46db792f3865088897039Mathias Agopian#endif /* ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_H */
648