blob: 1b8170beb5e9ff6a5afc0d685439c09fd5a5fbe8 [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;
Ady Abrahama1df7c32019-10-22 16:56:08 -070023import @2.1::IComposerClient;
Peiyong Lin781d0bb2019-07-03 10:57:02 -070024import @2.3::IComposerClient;
25
26interface IComposerClient extends @2.3::IComposerClient {
Peiyong Lin781d0bb2019-07-03 10:57:02 -070027 /**
Ady Abrahama1df7c32019-10-22 16:56:08 -070028 * Display attributes queryable through getDisplayAttribute_2_4.
29 */
30 enum Attribute : @2.1::IComposerClient.Attribute {
31 /**
32 * The configuration group ID (as int32_t) this config is associated to.
33 * Switching between configurations within the same group may be done seamlessly
34 * in some conditions via setActiveConfigWithConstraints.
35 */
36 CONFIG_GROUP = 7,
37 };
38
39 /**
Peiyong Lin781d0bb2019-07-03 10:57:02 -070040 * Required capabilities which are supported by the display. The
41 * particular set of supported capabilities for a given display may be
42 * retrieved using getDisplayCapabilities.
43 */
Dominik Laskowskice44a4b2019-09-19 15:50:09 -070044 enum DisplayCapability : @2.3::IComposerClient.DisplayCapability {
Peiyong Lin781d0bb2019-07-03 10:57:02 -070045 /**
46 * Indicates that the display supports protected contents.
47 * When returned, hardware composer must be able to accept client target
48 * with protected buffers.
49 */
50 PROTECTED_CONTENTS = 4,
Galia Peychevaa0973452019-11-01 11:04:42 +010051
52 /**
53 * Indicates that both the composer HAL implementation and the given display
54 * support a low latency mode, such as HDMI 2.1 Auto Low Latency Mode.
55 */
56 AUTO_LOW_LATENCY_MODE = 5,
Peiyong Lin781d0bb2019-07-03 10:57:02 -070057 };
58
59 /**
Dominik Laskowskice44a4b2019-09-19 15:50:09 -070060 * Supersedes {@link @2.1::IComposerClient.DisplayType}.
61 */
62 enum DisplayConnectionType : uint32_t {
63 /**
64 * Display is connected through internal port, e.g. DSI, eDP.
65 */
66 INTERNAL = 0,
67 /**
68 * Display is connected through external port, e.g. HDMI, DisplayPort.
69 */
70 EXTERNAL = 1,
71 };
72
Galia Peychevaa0973452019-11-01 11:04:42 +010073 enum ContentType : uint32_t {
74 NONE = 0,
75
76 /**
77 * These modes correspond to those found in the HDMI 1.4 specification.
78 */
79 GRAPHICS = 1,
80 PHOTO = 2,
81 CINEMA = 3,
82 GAME = 4,
83 };
84
Dominik Laskowskice44a4b2019-09-19 15:50:09 -070085 /**
Ady Abraham7882ae62019-10-10 17:04:47 -070086 * Constraints for changing vsync period.
87 */
88 struct VsyncPeriodChangeConstraints {
89 /**
90 * Time in CLOCK_MONOTONIC after which the vsync period may change
91 * (i.e., the vsync period must not change before this time).
92 */
93 int64_t desiredTimeNanos;
Ady Abrahama1df7c32019-10-22 16:56:08 -070094
Ady Abraham7882ae62019-10-10 17:04:47 -070095 /**
96 * If true, requires that the vsync period change must happen seamlessly without
97 * a noticeable visual artifact.
98 */
99 bool seamlessRequired;
100 };
101
102 /**
103 * Provides a IComposerCallback object for the device to call.
104 *
105 * This function must be called only once.
106 *
107 * @param callback is the IComposerCallback object.
108 */
Ady Abraham7882ae62019-10-10 17:04:47 -0700109 registerCallback_2_4(IComposerCallback callback);
110
111 /**
Peiyong Lin781d0bb2019-07-03 10:57:02 -0700112 * Provides a list of supported capabilities (as described in the
113 * definition of DisplayCapability above). This list must not change after
114 * initialization.
115 *
116 * @return error is NONE upon success. Otherwise,
117 * BAD_DISPLAY when an invalid display handle was passed in.
118 * @return capabilities is a list of supported capabilities.
119 */
120 getDisplayCapabilities_2_4(Display display)
Dominik Laskowskice44a4b2019-09-19 15:50:09 -0700121 generates (Error error, vec<DisplayCapability> capabilities);
122
123 /**
124 * Returns whether the given physical display is internal or external.
125 *
126 * @return error is NONE upon success. Otherwise,
127 * BAD_DISPLAY when the given display is invalid or virtual.
128 * @return type is the connection type of the display.
129 */
130 getDisplayConnectionType(Display display) generates (Error error, DisplayConnectionType type);
Ady Abraham7882ae62019-10-10 17:04:47 -0700131
132 /**
Ady Abrahama1df7c32019-10-22 16:56:08 -0700133 * Returns a display attribute value for a particular display
134 * configuration.
Ady Abraham7882ae62019-10-10 17:04:47 -0700135 *
Ady Abrahama1df7c32019-10-22 16:56:08 -0700136 * @param display is the display to query.
137 * @param config is the display configuration for which to return
138 * attribute values.
Ady Abraham7882ae62019-10-10 17:04:47 -0700139 * @return error is NONE upon success. Otherwise,
Ady Abrahama1df7c32019-10-22 16:56:08 -0700140 * BAD_DISPLAY when an invalid display handle was passed in.
141 * BAD_CONFIG when config does not name a valid configuration for
142 * this display.
143 * BAD_PARAMETER when attribute is unrecognized.
144 * UNSUPPORTED when attribute cannot be queried for the config.
145 * @return value is the value of the attribute.
Ady Abraham7882ae62019-10-10 17:04:47 -0700146 */
Ady Abrahama1df7c32019-10-22 16:56:08 -0700147 getDisplayAttribute_2_4(Display display, Config config, Attribute attribute)
148 generates (Error error, int32_t value);
Ady Abraham7882ae62019-10-10 17:04:47 -0700149
150 /**
151 * Retrieves which vsync period the display is currently using.
152 *
153 * If no display configuration is currently active, this function must
154 * return BAD_CONFIG. If the vsync period is about to change due to a
Ady Abrahama1df7c32019-10-22 16:56:08 -0700155 * setActiveConfigWithConstraints call, this function must return the current vsync period
Ady Abraham7882ae62019-10-10 17:04:47 -0700156 * until the change takes place.
157 *
158 * @param display is the display for which the vsync period is queried.
159 * @return error is NONE upon success. Otherwise,
160 * BAD_DISPLAY when an invalid display handle was passed in.
161 * BAD_CONFIG when no configuration is currently active.
162 * @return vsyncPeriodNanos is the current vsync period of the display.
163 */
164 getDisplayVsyncPeriod(Display display)
165 generates (Error error, VsyncPeriodNanos vsyncPeriodNanos);
166
167 /**
168 * Sets the active configuration and the refresh rate for this display.
Ady Abrahama1df7c32019-10-22 16:56:08 -0700169 * If the new config shares the same config group as the current config,
170 * only the vsync period shall change.
Ady Abraham7882ae62019-10-10 17:04:47 -0700171 * Upon returning, the given display configuration, except vsync period, must be active and
172 * remain so until either this function is called again or the display is disconnected.
173 * When the display starts to refresh at the new vsync period, onVsync_2_4 callback must be
174 * called with the new vsync period.
175 *
176 * @param display is the display for which the active config is set.
177 * @param config is the new display configuration.
Ady Abraham7882ae62019-10-10 17:04:47 -0700178 * @param vsyncPeriodChangeConstraints are the constraints required for changing vsync period.
179 *
180 * @return error is NONE upon success. Otherwise,
181 * BAD_DISPLAY when an invalid display handle was passed in.
182 * BAD_CONFIG when the configuration handle passed in is not valid
183 * for this display.
Ady Abrahama1df7c32019-10-22 16:56:08 -0700184 * SEAMLESS_NOT_ALLOWED when seamlessRequired was true but config provided doesn't
185 * share the same config group as the current config.
Ady Abraham7882ae62019-10-10 17:04:47 -0700186 * SEAMLESS_NOT_POSSIBLE when seamlessRequired was true but the display cannot achieve
187 * the vsync period change without a noticeable visual artifact.
Ady Abraham30d818e2019-12-30 12:59:08 -0800188 * When the conditions change and it may be possible to change
189 * the vsync period seamlessly, onSeamlessPossible callback
190 * must be called to indicate that caller should retry.
Ady Abrahama1df7c32019-10-22 16:56:08 -0700191 * @return timeline is the timeline for the vsync period change.
Ady Abraham7882ae62019-10-10 17:04:47 -0700192 */
Ady Abrahama1df7c32019-10-22 16:56:08 -0700193 setActiveConfigWithConstraints(Display display, Config config,
Ady Abraham7882ae62019-10-10 17:04:47 -0700194 VsyncPeriodChangeConstraints vsyncPeriodChangeConstraints)
Ady Abrahama1df7c32019-10-22 16:56:08 -0700195 generates (Error error, VsyncPeriodChangeTimeline timeline);
Galia Peychevaa0973452019-11-01 11:04:42 +0100196
197 /**
198 * Requests the display to enable/disable its low latency mode.
199 *
200 * If the display is connected via HDMI 2.1, then Auto Low Latency Mode should be triggered. If
201 * the display is internally connected and a custom low latency mode is available, that should
202 * be triggered.
203 *
204 * This function should only be called if the display reports support for
205 * DisplayCapability::AUTO_LOW_LATENCY_MODE from getDisplayCapabilities_2_4.
206 *
207 * @return error is NONE upon success. Otherwise,
208 * BAD_DISPLAY when an invalid display handle was passed in.
209 * UNSUPPORTED when AUTO_LOW_LATENCY_MODE is not supported by the composer
210 * implementation or the given display
211 */
212 setAutoLowLatencyMode(Display display, bool on)
213 generates (Error error);
214
215 /**
216 * Provides a list of all the content types supported by this display (any of
217 * ContentType::{GRAPHICS, PHOTO, CINEMA, GAME}). This list must not change after
218 * initialization.
219 *
220 * Content types are introduced in HDMI 1.4 and supporting them is optional. The
221 * ContentType::NONE is always supported and will not be returned by this method..
222 *
223 * @return error is NONE upon success. Otherwise,
224 * BAD_DISPLAY when an invalid display handle was passed in.
225 * @return supportedContentTypes is a list of supported content types.
226 */
227 getSupportedContentTypes(Display display)
228 generates(Error error, vec<ContentType> supportedContentTypes);
229
230 /**
231 * Instructs the connected display that the content being shown is of the given type - one of
232 * GRAPHICS, PHOTO, CINEMA, GAME.
233 *
234 * Content types are introduced in HDMI 1.4 and supporting them is optional. If they are
235 * supported, this signal should switch the display to a mode that is optimal for the given
236 * type of content. See HDMI 1.4 specification for more information.
237 *
238 * If the display is internally connected (not through HDMI), and such modes are available,
239 * this method should trigger them.
240 *
241 * This function should only be called if the display reports support for the corresponding
242 * content type (ContentType::{GRAPHICS, PHOTO, CINEMA, GAME}) from getSupportedContentTypes.
243 * ContentType::NONE is supported by default and can always be set.
244 *
245 * @return error is NONE upon success. Otherwise,
246 * BAD_DISPLAY when an invalid display handle was passed in.
247 * UNSUPPORTED when the given content type is not supported by the composer
248 * implementation or the given display
249 */
250 setContentType(Display display, ContentType type)
251 generates (Error error);
Peiyong Lin781d0bb2019-07-03 10:57:02 -0700252};