blob: c2102d5f53deda47db632db32b4775ff8e33d7c2 [file] [log] [blame]
Peiyong Lin781d0bb2019-07-03 10:57:02 -07001/*
2 * Copyright 2019 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
17package android.hardware.graphics.composer@2.4;
18
Ady Abraham7882ae62019-10-10 17:04:47 -070019import IComposerCallback;
20import @2.1::Config;
Peiyong Lin781d0bb2019-07-03 10:57:02 -070021import @2.1::Display;
22import @2.1::Error;
23import @2.3::IComposerClient;
24
25interface IComposerClient extends @2.3::IComposerClient {
Peiyong Lin781d0bb2019-07-03 10:57:02 -070026 /**
27 * Required capabilities which are supported by the display. The
28 * particular set of supported capabilities for a given display may be
29 * retrieved using getDisplayCapabilities.
30 */
Dominik Laskowskice44a4b2019-09-19 15:50:09 -070031 enum DisplayCapability : @2.3::IComposerClient.DisplayCapability {
Peiyong Lin781d0bb2019-07-03 10:57:02 -070032 /**
33 * Indicates that the display supports protected contents.
34 * When returned, hardware composer must be able to accept client target
35 * with protected buffers.
36 */
37 PROTECTED_CONTENTS = 4,
38 };
39
40 /**
Dominik Laskowskice44a4b2019-09-19 15:50:09 -070041 * Supersedes {@link @2.1::IComposerClient.DisplayType}.
42 */
43 enum DisplayConnectionType : uint32_t {
44 /**
45 * Display is connected through internal port, e.g. DSI, eDP.
46 */
47 INTERNAL = 0,
48 /**
49 * Display is connected through external port, e.g. HDMI, DisplayPort.
50 */
51 EXTERNAL = 1,
52 };
53
54 /**
Ady Abraham7882ae62019-10-10 17:04:47 -070055 * Constraints for changing vsync period.
56 */
57 struct VsyncPeriodChangeConstraints {
58 /**
59 * Time in CLOCK_MONOTONIC after which the vsync period may change
60 * (i.e., the vsync period must not change before this time).
61 */
62 int64_t desiredTimeNanos;
63 /**
64 * If true, requires that the vsync period change must happen seamlessly without
65 * a noticeable visual artifact.
66 */
67 bool seamlessRequired;
68 };
69
70 /**
71 * Provides a IComposerCallback object for the device to call.
72 *
73 * This function must be called only once.
74 *
75 * @param callback is the IComposerCallback object.
76 */
77 @entry
78 registerCallback_2_4(IComposerCallback callback);
79
80 /**
Peiyong Lin781d0bb2019-07-03 10:57:02 -070081 * Provides a list of supported capabilities (as described in the
82 * definition of DisplayCapability above). This list must not change after
83 * initialization.
84 *
85 * @return error is NONE upon success. Otherwise,
86 * BAD_DISPLAY when an invalid display handle was passed in.
87 * @return capabilities is a list of supported capabilities.
88 */
89 getDisplayCapabilities_2_4(Display display)
Dominik Laskowskice44a4b2019-09-19 15:50:09 -070090 generates (Error error, vec<DisplayCapability> capabilities);
91
92 /**
93 * Returns whether the given physical display is internal or external.
94 *
95 * @return error is NONE upon success. Otherwise,
96 * BAD_DISPLAY when the given display is invalid or virtual.
97 * @return type is the connection type of the display.
98 */
99 getDisplayConnectionType(Display display) generates (Error error, DisplayConnectionType type);
Ady Abraham7882ae62019-10-10 17:04:47 -0700100
101 /**
102 * Provides a list of the vsync periods supported by the display in the given configuration
103 *
104 * @param display is the display for which the vsync periods are queried.
105 * @param config is the display configuration for which the vsync periods are queried.
106 *
107 * @return error is NONE upon success. Otherwise,
108 * BAD_DISPLAY when an invalid display handle was passed in.
109 * BAD_CONFIG when an invalid config handle was passed in.
110 * @return supportedVsyncPeriods is a list of supported vsync periods.
111 */
112 getSupportedDisplayVsyncPeriods(Display display, Config config)
113 generates (Error error, vec<VsyncPeriodNanos> supportedVsyncPeriods);
114
115 /**
116 * Retrieves which vsync period the display is currently using.
117 *
118 * If no display configuration is currently active, this function must
119 * return BAD_CONFIG. If the vsync period is about to change due to a
120 * setActiveConfigAndVsyncPeriod call, this function must return the current vsync period
121 * until the change takes place.
122 *
123 * @param display is the display for which the vsync period is queried.
124 * @return error is NONE upon success. Otherwise,
125 * BAD_DISPLAY when an invalid display handle was passed in.
126 * BAD_CONFIG when no configuration is currently active.
127 * @return vsyncPeriodNanos is the current vsync period of the display.
128 */
129 getDisplayVsyncPeriod(Display display)
130 generates (Error error, VsyncPeriodNanos vsyncPeriodNanos);
131
132 /**
133 * Sets the active configuration and the refresh rate for this display.
134 * If the config is the same as the current config, only the vsync period shall change.
135 * Upon returning, the given display configuration, except vsync period, must be active and
136 * remain so until either this function is called again or the display is disconnected.
137 * When the display starts to refresh at the new vsync period, onVsync_2_4 callback must be
138 * called with the new vsync period.
139 *
140 * @param display is the display for which the active config is set.
141 * @param config is the new display configuration.
142 * @param vsyncPeriodNanos is the new display vsync period.
143 * @param vsyncPeriodChangeConstraints are the constraints required for changing vsync period.
144 *
145 * @return error is NONE upon success. Otherwise,
146 * BAD_DISPLAY when an invalid display handle was passed in.
147 * BAD_CONFIG when the configuration handle passed in is not valid
148 * for this display.
149 * BAD_VSYNC_PERIOD when an invalid vsync period is passed in.
150 * SEAMLESS_NOT_POSSIBLE when seamlessRequired was true but the display cannot achieve
151 * the vsync period change without a noticeable visual artifact.
152 * @return newVsyncAppliedTime is the time in CLOCK_MONOTONIC when the new display will start to
153 * refresh at the new vsync period.
154 */
155 setActiveConfigAndVsyncPeriod(Display display, Config config,
156 VsyncPeriodNanos vsyncPeriodNanos,
157 VsyncPeriodChangeConstraints vsyncPeriodChangeConstraints)
158 generates (Error error, int64_t newVsyncAppliedTime);
Peiyong Lin781d0bb2019-07-03 10:57:02 -0700159};