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, |
| 51 | }; |
| 52 | |
| 53 | /** |
Dominik Laskowski | ce44a4b | 2019-09-19 15:50:09 -0700 | [diff] [blame] | 54 | * 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 Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 68 | * 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 Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 76 | |
Ady Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 77 | /** |
| 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 Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 91 | registerCallback_2_4(IComposerCallback callback); |
| 92 | |
| 93 | /** |
Peiyong Lin | 781d0bb | 2019-07-03 10:57:02 -0700 | [diff] [blame] | 94 | * 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 Laskowski | ce44a4b | 2019-09-19 15:50:09 -0700 | [diff] [blame] | 103 | 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 Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 113 | |
| 114 | /** |
Ady Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 115 | * Returns a display attribute value for a particular display |
| 116 | * configuration. |
Ady Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 117 | * |
Ady Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 118 | * @param display is the display to query. |
| 119 | * @param config is the display configuration for which to return |
| 120 | * attribute values. |
Ady Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 121 | * @return error is NONE upon success. Otherwise, |
Ady Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 122 | * 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 Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 128 | */ |
Ady Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 129 | getDisplayAttribute_2_4(Display display, Config config, Attribute attribute) |
| 130 | generates (Error error, int32_t value); |
Ady Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 131 | |
| 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 Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 137 | * setActiveConfigWithConstraints call, this function must return the current vsync period |
Ady Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 138 | * 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 Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 151 | * If the new config shares the same config group as the current config, |
| 152 | * only the vsync period shall change. |
Ady Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 153 | * 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 Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 160 | * @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 Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 166 | * SEAMLESS_NOT_ALLOWED when seamlessRequired was true but config provided doesn't |
| 167 | * share the same config group as the current config. |
Ady Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 168 | * SEAMLESS_NOT_POSSIBLE when seamlessRequired was true but the display cannot achieve |
| 169 | * the vsync period change without a noticeable visual artifact. |
Ady Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 170 | * @return timeline is the timeline for the vsync period change. |
Ady Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 171 | */ |
Ady Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 172 | setActiveConfigWithConstraints(Display display, Config config, |
Ady Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 173 | VsyncPeriodChangeConstraints vsyncPeriodChangeConstraints) |
Ady Abraham | a1df7c3 | 2019-10-22 16:56:08 -0700 | [diff] [blame] | 174 | generates (Error error, VsyncPeriodChangeTimeline timeline); |
Peiyong Lin | 781d0bb | 2019-07-03 10:57:02 -0700 | [diff] [blame] | 175 | }; |