blob: 7e0c33ce97b2369d1763d859ae57356ca7ae47a6 [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
Peiyong Linbc51e082020-01-08 15:33:30 -080019import android.hardware.graphics.common@1.2::PixelFormat;
20import android.hardware.graphics.common@1.2::Dataspace;
21import android.hardware.graphics.composer@2.1::IComposerClient.Command;
Ady Abraham7882ae62019-10-10 17:04:47 -070022import IComposerCallback;
23import @2.1::Config;
Peiyong Lin781d0bb2019-07-03 10:57:02 -070024import @2.1::Display;
25import @2.1::Error;
Ady Abrahama1df7c32019-10-22 16:56:08 -070026import @2.1::IComposerClient;
Peiyong Lin781d0bb2019-07-03 10:57:02 -070027import @2.3::IComposerClient;
28
29interface IComposerClient extends @2.3::IComposerClient {
Peiyong Lin781d0bb2019-07-03 10:57:02 -070030 /**
Ady Abrahama1df7c32019-10-22 16:56:08 -070031 * Display attributes queryable through getDisplayAttribute_2_4.
32 */
33 enum Attribute : @2.1::IComposerClient.Attribute {
34 /**
35 * The configuration group ID (as int32_t) this config is associated to.
36 * Switching between configurations within the same group may be done seamlessly
37 * in some conditions via setActiveConfigWithConstraints.
38 */
39 CONFIG_GROUP = 7,
40 };
41
42 /**
Peiyong Lin781d0bb2019-07-03 10:57:02 -070043 * Required capabilities which are supported by the display. The
44 * particular set of supported capabilities for a given display may be
45 * retrieved using getDisplayCapabilities.
46 */
Dominik Laskowskice44a4b2019-09-19 15:50:09 -070047 enum DisplayCapability : @2.3::IComposerClient.DisplayCapability {
Peiyong Lin781d0bb2019-07-03 10:57:02 -070048 /**
49 * Indicates that the display supports protected contents.
50 * When returned, hardware composer must be able to accept client target
51 * with protected buffers.
52 */
53 PROTECTED_CONTENTS = 4,
Galia Peychevaa0973452019-11-01 11:04:42 +010054
55 /**
56 * Indicates that both the composer HAL implementation and the given display
57 * support a low latency mode, such as HDMI 2.1 Auto Low Latency Mode.
58 */
59 AUTO_LOW_LATENCY_MODE = 5,
Peiyong Lin781d0bb2019-07-03 10:57:02 -070060 };
61
Peiyong Linbc51e082020-01-08 15:33:30 -080062 enum Command : @2.3::IComposerClient.Command {
63 /**
64 * SET_CLIENT_TARGET_PROPERTY has this pseudo prototype
65 *
66 * This command has the following binary layout in bytes:
67 *
68 * 0 - 3: clientTargetProperty.pixelFormat
69 * 4 - 7: clientTargetProperty.dataspace
70 *
71 * setClientTargetProperty(ClientTargetProperty clientTargetProperty);
72 */
73 SET_CLIENT_TARGET_PROPERTY = 0x105 << @2.1::IComposerClient.Command:OPCODE_SHIFT,
74 };
75
Peiyong Lin781d0bb2019-07-03 10:57:02 -070076 /**
Dominik Laskowskice44a4b2019-09-19 15:50:09 -070077 * Supersedes {@link @2.1::IComposerClient.DisplayType}.
78 */
79 enum DisplayConnectionType : uint32_t {
80 /**
81 * Display is connected through internal port, e.g. DSI, eDP.
82 */
83 INTERNAL = 0,
84 /**
85 * Display is connected through external port, e.g. HDMI, DisplayPort.
86 */
87 EXTERNAL = 1,
88 };
89
Galia Peychevaa0973452019-11-01 11:04:42 +010090 enum ContentType : uint32_t {
91 NONE = 0,
92
93 /**
94 * These modes correspond to those found in the HDMI 1.4 specification.
95 */
96 GRAPHICS = 1,
97 PHOTO = 2,
98 CINEMA = 3,
99 GAME = 4,
100 };
101
Dominik Laskowskice44a4b2019-09-19 15:50:09 -0700102 /**
Ady Abraham7882ae62019-10-10 17:04:47 -0700103 * Constraints for changing vsync period.
104 */
105 struct VsyncPeriodChangeConstraints {
106 /**
107 * Time in CLOCK_MONOTONIC after which the vsync period may change
108 * (i.e., the vsync period must not change before this time).
109 */
110 int64_t desiredTimeNanos;
Ady Abrahama1df7c32019-10-22 16:56:08 -0700111
Ady Abraham7882ae62019-10-10 17:04:47 -0700112 /**
113 * If true, requires that the vsync period change must happen seamlessly without
114 * a noticeable visual artifact.
115 */
116 bool seamlessRequired;
117 };
118
Peiyong Linbc51e082020-01-08 15:33:30 -0800119 struct ClientTargetProperty {
120 PixelFormat pixelFormat;
121 Dataspace dataspace;
122 };
123
Ady Abraham7882ae62019-10-10 17:04:47 -0700124 /**
125 * Provides a IComposerCallback object for the device to call.
126 *
127 * This function must be called only once.
128 *
129 * @param callback is the IComposerCallback object.
130 */
Ady Abraham7882ae62019-10-10 17:04:47 -0700131 registerCallback_2_4(IComposerCallback callback);
132
133 /**
Peiyong Lin781d0bb2019-07-03 10:57:02 -0700134 * Provides a list of supported capabilities (as described in the
135 * definition of DisplayCapability above). This list must not change after
136 * initialization.
137 *
138 * @return error is NONE upon success. Otherwise,
139 * BAD_DISPLAY when an invalid display handle was passed in.
140 * @return capabilities is a list of supported capabilities.
141 */
142 getDisplayCapabilities_2_4(Display display)
Dominik Laskowskice44a4b2019-09-19 15:50:09 -0700143 generates (Error error, vec<DisplayCapability> capabilities);
144
145 /**
146 * Returns whether the given physical display is internal or external.
147 *
148 * @return error is NONE upon success. Otherwise,
149 * BAD_DISPLAY when the given display is invalid or virtual.
150 * @return type is the connection type of the display.
151 */
152 getDisplayConnectionType(Display display) generates (Error error, DisplayConnectionType type);
Ady Abraham7882ae62019-10-10 17:04:47 -0700153
154 /**
Ady Abrahama1df7c32019-10-22 16:56:08 -0700155 * Returns a display attribute value for a particular display
156 * configuration.
Ady Abraham7882ae62019-10-10 17:04:47 -0700157 *
Ady Abrahama1df7c32019-10-22 16:56:08 -0700158 * @param display is the display to query.
159 * @param config is the display configuration for which to return
160 * attribute values.
Ady Abraham7882ae62019-10-10 17:04:47 -0700161 * @return error is NONE upon success. Otherwise,
Ady Abrahama1df7c32019-10-22 16:56:08 -0700162 * BAD_DISPLAY when an invalid display handle was passed in.
163 * BAD_CONFIG when config does not name a valid configuration for
164 * this display.
165 * BAD_PARAMETER when attribute is unrecognized.
166 * UNSUPPORTED when attribute cannot be queried for the config.
167 * @return value is the value of the attribute.
Ady Abraham7882ae62019-10-10 17:04:47 -0700168 */
Ady Abrahama1df7c32019-10-22 16:56:08 -0700169 getDisplayAttribute_2_4(Display display, Config config, Attribute attribute)
170 generates (Error error, int32_t value);
Ady Abraham7882ae62019-10-10 17:04:47 -0700171
172 /**
173 * Retrieves which vsync period the display is currently using.
174 *
175 * If no display configuration is currently active, this function must
176 * return BAD_CONFIG. If the vsync period is about to change due to a
Ady Abrahama1df7c32019-10-22 16:56:08 -0700177 * setActiveConfigWithConstraints call, this function must return the current vsync period
Ady Abraham7882ae62019-10-10 17:04:47 -0700178 * until the change takes place.
179 *
180 * @param display is the display for which the vsync period is queried.
181 * @return error is NONE upon success. Otherwise,
182 * BAD_DISPLAY when an invalid display handle was passed in.
183 * BAD_CONFIG when no configuration is currently active.
184 * @return vsyncPeriodNanos is the current vsync period of the display.
185 */
186 getDisplayVsyncPeriod(Display display)
187 generates (Error error, VsyncPeriodNanos vsyncPeriodNanos);
188
189 /**
190 * Sets the active configuration and the refresh rate for this display.
Ady Abrahama1df7c32019-10-22 16:56:08 -0700191 * If the new config shares the same config group as the current config,
192 * only the vsync period shall change.
Ady Abraham7882ae62019-10-10 17:04:47 -0700193 * Upon returning, the given display configuration, except vsync period, must be active and
194 * remain so until either this function is called again or the display is disconnected.
195 * When the display starts to refresh at the new vsync period, onVsync_2_4 callback must be
196 * called with the new vsync period.
197 *
198 * @param display is the display for which the active config is set.
199 * @param config is the new display configuration.
Ady Abraham7882ae62019-10-10 17:04:47 -0700200 * @param vsyncPeriodChangeConstraints are the constraints required for changing vsync period.
201 *
202 * @return error is NONE upon success. Otherwise,
203 * BAD_DISPLAY when an invalid display handle was passed in.
204 * BAD_CONFIG when the configuration handle passed in is not valid
205 * for this display.
Ady Abrahama1df7c32019-10-22 16:56:08 -0700206 * SEAMLESS_NOT_ALLOWED when seamlessRequired was true but config provided doesn't
207 * share the same config group as the current config.
Ady Abraham7882ae62019-10-10 17:04:47 -0700208 * SEAMLESS_NOT_POSSIBLE when seamlessRequired was true but the display cannot achieve
209 * the vsync period change without a noticeable visual artifact.
Ady Abraham30d818e2019-12-30 12:59:08 -0800210 * When the conditions change and it may be possible to change
211 * the vsync period seamlessly, onSeamlessPossible callback
212 * must be called to indicate that caller should retry.
Ady Abrahama1df7c32019-10-22 16:56:08 -0700213 * @return timeline is the timeline for the vsync period change.
Ady Abraham7882ae62019-10-10 17:04:47 -0700214 */
Ady Abrahama1df7c32019-10-22 16:56:08 -0700215 setActiveConfigWithConstraints(Display display, Config config,
Ady Abraham7882ae62019-10-10 17:04:47 -0700216 VsyncPeriodChangeConstraints vsyncPeriodChangeConstraints)
Ady Abrahama1df7c32019-10-22 16:56:08 -0700217 generates (Error error, VsyncPeriodChangeTimeline timeline);
Galia Peychevaa0973452019-11-01 11:04:42 +0100218
219 /**
220 * Requests the display to enable/disable its low latency mode.
221 *
222 * If the display is connected via HDMI 2.1, then Auto Low Latency Mode should be triggered. If
223 * the display is internally connected and a custom low latency mode is available, that should
224 * be triggered.
225 *
226 * This function should only be called if the display reports support for
227 * DisplayCapability::AUTO_LOW_LATENCY_MODE from getDisplayCapabilities_2_4.
228 *
229 * @return error is NONE upon success. Otherwise,
230 * BAD_DISPLAY when an invalid display handle was passed in.
231 * UNSUPPORTED when AUTO_LOW_LATENCY_MODE is not supported by the composer
232 * implementation or the given display
233 */
234 setAutoLowLatencyMode(Display display, bool on)
235 generates (Error error);
236
237 /**
238 * Provides a list of all the content types supported by this display (any of
239 * ContentType::{GRAPHICS, PHOTO, CINEMA, GAME}). This list must not change after
240 * initialization.
241 *
242 * Content types are introduced in HDMI 1.4 and supporting them is optional. The
243 * ContentType::NONE is always supported and will not be returned by this method..
244 *
245 * @return error is NONE upon success. Otherwise,
246 * BAD_DISPLAY when an invalid display handle was passed in.
247 * @return supportedContentTypes is a list of supported content types.
248 */
249 getSupportedContentTypes(Display display)
250 generates(Error error, vec<ContentType> supportedContentTypes);
251
252 /**
253 * Instructs the connected display that the content being shown is of the given type - one of
254 * GRAPHICS, PHOTO, CINEMA, GAME.
255 *
256 * Content types are introduced in HDMI 1.4 and supporting them is optional. If they are
257 * supported, this signal should switch the display to a mode that is optimal for the given
258 * type of content. See HDMI 1.4 specification for more information.
259 *
260 * If the display is internally connected (not through HDMI), and such modes are available,
261 * this method should trigger them.
262 *
263 * This function should only be called if the display reports support for the corresponding
264 * content type (ContentType::{GRAPHICS, PHOTO, CINEMA, GAME}) from getSupportedContentTypes.
265 * ContentType::NONE is supported by default and can always be set.
266 *
267 * @return error is NONE upon success. Otherwise,
268 * BAD_DISPLAY when an invalid display handle was passed in.
269 * UNSUPPORTED when the given content type is not supported by the composer
270 * implementation or the given display
271 */
272 setContentType(Display display, ContentType type)
273 generates (Error error);
Peiyong Lin781d0bb2019-07-03 10:57:02 -0700274};