blob: f23536cd2d911f00681388147e706a8b7a380eea [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,
51 };
52
53 /**
Dominik Laskowskice44a4b2019-09-19 15:50:09 -070054 * Supersedes {@link @2.1::IComposerClient.DisplayType}.
55 */
56 enum DisplayConnectionType : uint32_t {
57 /**
58 * Display is connected through internal port, e.g. DSI, eDP.
59 */
60 INTERNAL = 0,
61 /**
62 * Display is connected through external port, e.g. HDMI, DisplayPort.
63 */
64 EXTERNAL = 1,
65 };
66
67 /**
Ady Abraham7882ae62019-10-10 17:04:47 -070068 * Constraints for changing vsync period.
69 */
70 struct VsyncPeriodChangeConstraints {
71 /**
72 * Time in CLOCK_MONOTONIC after which the vsync period may change
73 * (i.e., the vsync period must not change before this time).
74 */
75 int64_t desiredTimeNanos;
Ady Abrahama1df7c32019-10-22 16:56:08 -070076
Ady Abraham7882ae62019-10-10 17:04:47 -070077 /**
78 * If true, requires that the vsync period change must happen seamlessly without
79 * a noticeable visual artifact.
80 */
81 bool seamlessRequired;
82 };
83
84 /**
85 * Provides a IComposerCallback object for the device to call.
86 *
87 * This function must be called only once.
88 *
89 * @param callback is the IComposerCallback object.
90 */
Ady Abraham7882ae62019-10-10 17:04:47 -070091 registerCallback_2_4(IComposerCallback callback);
92
93 /**
Peiyong Lin781d0bb2019-07-03 10:57:02 -070094 * Provides a list of supported capabilities (as described in the
95 * definition of DisplayCapability above). This list must not change after
96 * initialization.
97 *
98 * @return error is NONE upon success. Otherwise,
99 * BAD_DISPLAY when an invalid display handle was passed in.
100 * @return capabilities is a list of supported capabilities.
101 */
102 getDisplayCapabilities_2_4(Display display)
Dominik Laskowskice44a4b2019-09-19 15:50:09 -0700103 generates (Error error, vec<DisplayCapability> capabilities);
104
105 /**
106 * Returns whether the given physical display is internal or external.
107 *
108 * @return error is NONE upon success. Otherwise,
109 * BAD_DISPLAY when the given display is invalid or virtual.
110 * @return type is the connection type of the display.
111 */
112 getDisplayConnectionType(Display display) generates (Error error, DisplayConnectionType type);
Ady Abraham7882ae62019-10-10 17:04:47 -0700113
114 /**
Ady Abrahama1df7c32019-10-22 16:56:08 -0700115 * Returns a display attribute value for a particular display
116 * configuration.
Ady Abraham7882ae62019-10-10 17:04:47 -0700117 *
Ady Abrahama1df7c32019-10-22 16:56:08 -0700118 * @param display is the display to query.
119 * @param config is the display configuration for which to return
120 * attribute values.
Ady Abraham7882ae62019-10-10 17:04:47 -0700121 * @return error is NONE upon success. Otherwise,
Ady Abrahama1df7c32019-10-22 16:56:08 -0700122 * BAD_DISPLAY when an invalid display handle was passed in.
123 * BAD_CONFIG when config does not name a valid configuration for
124 * this display.
125 * BAD_PARAMETER when attribute is unrecognized.
126 * UNSUPPORTED when attribute cannot be queried for the config.
127 * @return value is the value of the attribute.
Ady Abraham7882ae62019-10-10 17:04:47 -0700128 */
Ady Abrahama1df7c32019-10-22 16:56:08 -0700129 getDisplayAttribute_2_4(Display display, Config config, Attribute attribute)
130 generates (Error error, int32_t value);
Ady Abraham7882ae62019-10-10 17:04:47 -0700131
132 /**
133 * Retrieves which vsync period the display is currently using.
134 *
135 * If no display configuration is currently active, this function must
136 * return BAD_CONFIG. If the vsync period is about to change due to a
Ady Abrahama1df7c32019-10-22 16:56:08 -0700137 * setActiveConfigWithConstraints call, this function must return the current vsync period
Ady Abraham7882ae62019-10-10 17:04:47 -0700138 * until the change takes place.
139 *
140 * @param display is the display for which the vsync period is queried.
141 * @return error is NONE upon success. Otherwise,
142 * BAD_DISPLAY when an invalid display handle was passed in.
143 * BAD_CONFIG when no configuration is currently active.
144 * @return vsyncPeriodNanos is the current vsync period of the display.
145 */
146 getDisplayVsyncPeriod(Display display)
147 generates (Error error, VsyncPeriodNanos vsyncPeriodNanos);
148
149 /**
150 * Sets the active configuration and the refresh rate for this display.
Ady Abrahama1df7c32019-10-22 16:56:08 -0700151 * If the new config shares the same config group as the current config,
152 * only the vsync period shall change.
Ady Abraham7882ae62019-10-10 17:04:47 -0700153 * Upon returning, the given display configuration, except vsync period, must be active and
154 * remain so until either this function is called again or the display is disconnected.
155 * When the display starts to refresh at the new vsync period, onVsync_2_4 callback must be
156 * called with the new vsync period.
157 *
158 * @param display is the display for which the active config is set.
159 * @param config is the new display configuration.
Ady Abraham7882ae62019-10-10 17:04:47 -0700160 * @param vsyncPeriodChangeConstraints are the constraints required for changing vsync period.
161 *
162 * @return error is NONE upon success. Otherwise,
163 * BAD_DISPLAY when an invalid display handle was passed in.
164 * BAD_CONFIG when the configuration handle passed in is not valid
165 * for this display.
Ady Abrahama1df7c32019-10-22 16:56:08 -0700166 * SEAMLESS_NOT_ALLOWED when seamlessRequired was true but config provided doesn't
167 * share the same config group as the current config.
Ady Abraham7882ae62019-10-10 17:04:47 -0700168 * SEAMLESS_NOT_POSSIBLE when seamlessRequired was true but the display cannot achieve
169 * the vsync period change without a noticeable visual artifact.
Ady Abrahama1df7c32019-10-22 16:56:08 -0700170 * @return timeline is the timeline for the vsync period change.
Ady Abraham7882ae62019-10-10 17:04:47 -0700171 */
Ady Abrahama1df7c32019-10-22 16:56:08 -0700172 setActiveConfigWithConstraints(Display display, Config config,
Ady Abraham7882ae62019-10-10 17:04:47 -0700173 VsyncPeriodChangeConstraints vsyncPeriodChangeConstraints)
Ady Abrahama1df7c32019-10-22 16:56:08 -0700174 generates (Error error, VsyncPeriodChangeTimeline timeline);
Peiyong Lin781d0bb2019-07-03 10:57:02 -0700175};