Peiyong Lin | 781d0bb | 2019-07-03 10:57:02 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package android.hardware.graphics.composer@2.4; |
| 18 | |
Ady Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 19 | import IComposerCallback; |
| 20 | import @2.1::Config; |
Peiyong Lin | 781d0bb | 2019-07-03 10:57:02 -0700 | [diff] [blame] | 21 | import @2.1::Display; |
| 22 | import @2.1::Error; |
Ady Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 23 | import @2.1::IComposerClient; |
Peiyong Lin | 781d0bb | 2019-07-03 10:57:02 -0700 | [diff] [blame] | 24 | import @2.3::IComposerClient; |
| 25 | |
| 26 | interface IComposerClient extends @2.3::IComposerClient { |
Peiyong Lin | 781d0bb | 2019-07-03 10:57:02 -0700 | [diff] [blame] | 27 | /** |
Ady Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 28 | * 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 Lin | 781d0bb | 2019-07-03 10:57:02 -0700 | [diff] [blame] | 40 | * 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 Laskowski | ce44a4b | 2019-09-19 15:50:09 -0700 | [diff] [blame] | 44 | enum DisplayCapability : @2.3::IComposerClient.DisplayCapability { |
Peiyong Lin | 781d0bb | 2019-07-03 10:57:02 -0700 | [diff] [blame] | 45 | /** |
| 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 Peycheva | a097345 | 2019-11-01 11:04:42 +0100 | [diff] [blame] | 51 | |
| 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 Lin | 781d0bb | 2019-07-03 10:57:02 -0700 | [diff] [blame] | 57 | }; |
| 58 | |
| 59 | /** |
Dominik Laskowski | ce44a4b | 2019-09-19 15:50:09 -0700 | [diff] [blame] | 60 | * 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 Peycheva | a097345 | 2019-11-01 11:04:42 +0100 | [diff] [blame] | 73 | 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 Laskowski | ce44a4b | 2019-09-19 15:50:09 -0700 | [diff] [blame] | 85 | /** |
Ady Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 86 | * 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 Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 94 | |
Ady Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 95 | /** |
| 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 Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 109 | registerCallback_2_4(IComposerCallback callback); |
| 110 | |
| 111 | /** |
Peiyong Lin | 781d0bb | 2019-07-03 10:57:02 -0700 | [diff] [blame] | 112 | * 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 Laskowski | ce44a4b | 2019-09-19 15:50:09 -0700 | [diff] [blame] | 121 | 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 Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 131 | |
| 132 | /** |
Ady Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 133 | * Returns a display attribute value for a particular display |
| 134 | * configuration. |
Ady Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 135 | * |
Ady Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 136 | * @param display is the display to query. |
| 137 | * @param config is the display configuration for which to return |
| 138 | * attribute values. |
Ady Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 139 | * @return error is NONE upon success. Otherwise, |
Ady Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 140 | * 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 Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 146 | */ |
Ady Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 147 | getDisplayAttribute_2_4(Display display, Config config, Attribute attribute) |
| 148 | generates (Error error, int32_t value); |
Ady Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 149 | |
| 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 Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 155 | * setActiveConfigWithConstraints call, this function must return the current vsync period |
Ady Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 156 | * 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 Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 169 | * If the new config shares the same config group as the current config, |
| 170 | * only the vsync period shall change. |
Ady Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 171 | * 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 Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 178 | * @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 Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 184 | * SEAMLESS_NOT_ALLOWED when seamlessRequired was true but config provided doesn't |
| 185 | * share the same config group as the current config. |
Ady Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 186 | * SEAMLESS_NOT_POSSIBLE when seamlessRequired was true but the display cannot achieve |
| 187 | * the vsync period change without a noticeable visual artifact. |
Ady Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 188 | * @return timeline is the timeline for the vsync period change. |
Ady Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 189 | */ |
Ady Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 190 | setActiveConfigWithConstraints(Display display, Config config, |
Ady Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 191 | VsyncPeriodChangeConstraints vsyncPeriodChangeConstraints) |
Ady Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 192 | generates (Error error, VsyncPeriodChangeTimeline timeline); |
Galia Peycheva | a097345 | 2019-11-01 11:04:42 +0100 | [diff] [blame] | 193 | |
| 194 | /** |
| 195 | * Requests the display to enable/disable its low latency mode. |
| 196 | * |
| 197 | * If the display is connected via HDMI 2.1, then Auto Low Latency Mode should be triggered. If |
| 198 | * the display is internally connected and a custom low latency mode is available, that should |
| 199 | * be triggered. |
| 200 | * |
| 201 | * This function should only be called if the display reports support for |
| 202 | * DisplayCapability::AUTO_LOW_LATENCY_MODE from getDisplayCapabilities_2_4. |
| 203 | * |
| 204 | * @return error is NONE upon success. Otherwise, |
| 205 | * BAD_DISPLAY when an invalid display handle was passed in. |
| 206 | * UNSUPPORTED when AUTO_LOW_LATENCY_MODE is not supported by the composer |
| 207 | * implementation or the given display |
| 208 | */ |
| 209 | setAutoLowLatencyMode(Display display, bool on) |
| 210 | generates (Error error); |
| 211 | |
| 212 | /** |
| 213 | * Provides a list of all the content types supported by this display (any of |
| 214 | * ContentType::{GRAPHICS, PHOTO, CINEMA, GAME}). This list must not change after |
| 215 | * initialization. |
| 216 | * |
| 217 | * Content types are introduced in HDMI 1.4 and supporting them is optional. The |
| 218 | * ContentType::NONE is always supported and will not be returned by this method.. |
| 219 | * |
| 220 | * @return error is NONE upon success. Otherwise, |
| 221 | * BAD_DISPLAY when an invalid display handle was passed in. |
| 222 | * @return supportedContentTypes is a list of supported content types. |
| 223 | */ |
| 224 | getSupportedContentTypes(Display display) |
| 225 | generates(Error error, vec<ContentType> supportedContentTypes); |
| 226 | |
| 227 | /** |
| 228 | * Instructs the connected display that the content being shown is of the given type - one of |
| 229 | * GRAPHICS, PHOTO, CINEMA, GAME. |
| 230 | * |
| 231 | * Content types are introduced in HDMI 1.4 and supporting them is optional. If they are |
| 232 | * supported, this signal should switch the display to a mode that is optimal for the given |
| 233 | * type of content. See HDMI 1.4 specification for more information. |
| 234 | * |
| 235 | * If the display is internally connected (not through HDMI), and such modes are available, |
| 236 | * this method should trigger them. |
| 237 | * |
| 238 | * This function should only be called if the display reports support for the corresponding |
| 239 | * content type (ContentType::{GRAPHICS, PHOTO, CINEMA, GAME}) from getSupportedContentTypes. |
| 240 | * ContentType::NONE is supported by default and can always be set. |
| 241 | * |
| 242 | * @return error is NONE upon success. Otherwise, |
| 243 | * BAD_DISPLAY when an invalid display handle was passed in. |
| 244 | * UNSUPPORTED when the given content type is not supported by the composer |
| 245 | * implementation or the given display |
| 246 | */ |
| 247 | setContentType(Display display, ContentType type) |
| 248 | generates (Error error); |
Peiyong Lin | 781d0bb | 2019-07-03 10:57:02 -0700 | [diff] [blame] | 249 | }; |