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; |
| 23 | import @2.3::IComposerClient; |
| 24 | |
| 25 | interface IComposerClient extends @2.3::IComposerClient { |
Peiyong Lin | 781d0bb | 2019-07-03 10:57:02 -0700 | [diff] [blame] | 26 | /** |
| 27 | * Required capabilities which are supported by the display. The |
| 28 | * particular set of supported capabilities for a given display may be |
| 29 | * retrieved using getDisplayCapabilities. |
| 30 | */ |
Dominik Laskowski | ce44a4b | 2019-09-19 15:50:09 -0700 | [diff] [blame] | 31 | enum DisplayCapability : @2.3::IComposerClient.DisplayCapability { |
Peiyong Lin | 781d0bb | 2019-07-03 10:57:02 -0700 | [diff] [blame] | 32 | /** |
| 33 | * Indicates that the display supports protected contents. |
| 34 | * When returned, hardware composer must be able to accept client target |
| 35 | * with protected buffers. |
| 36 | */ |
| 37 | PROTECTED_CONTENTS = 4, |
| 38 | }; |
| 39 | |
| 40 | /** |
Dominik Laskowski | ce44a4b | 2019-09-19 15:50:09 -0700 | [diff] [blame] | 41 | * Supersedes {@link @2.1::IComposerClient.DisplayType}. |
| 42 | */ |
| 43 | enum DisplayConnectionType : uint32_t { |
| 44 | /** |
| 45 | * Display is connected through internal port, e.g. DSI, eDP. |
| 46 | */ |
| 47 | INTERNAL = 0, |
| 48 | /** |
| 49 | * Display is connected through external port, e.g. HDMI, DisplayPort. |
| 50 | */ |
| 51 | EXTERNAL = 1, |
| 52 | }; |
| 53 | |
| 54 | /** |
Ady Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 55 | * Constraints for changing vsync period. |
| 56 | */ |
| 57 | struct VsyncPeriodChangeConstraints { |
| 58 | /** |
| 59 | * Time in CLOCK_MONOTONIC after which the vsync period may change |
| 60 | * (i.e., the vsync period must not change before this time). |
| 61 | */ |
| 62 | int64_t desiredTimeNanos; |
| 63 | /** |
| 64 | * If true, requires that the vsync period change must happen seamlessly without |
| 65 | * a noticeable visual artifact. |
| 66 | */ |
| 67 | bool seamlessRequired; |
| 68 | }; |
| 69 | |
| 70 | /** |
| 71 | * Provides a IComposerCallback object for the device to call. |
| 72 | * |
| 73 | * This function must be called only once. |
| 74 | * |
| 75 | * @param callback is the IComposerCallback object. |
| 76 | */ |
| 77 | @entry |
| 78 | registerCallback_2_4(IComposerCallback callback); |
| 79 | |
| 80 | /** |
Peiyong Lin | 781d0bb | 2019-07-03 10:57:02 -0700 | [diff] [blame] | 81 | * Provides a list of supported capabilities (as described in the |
| 82 | * definition of DisplayCapability above). This list must not change after |
| 83 | * initialization. |
| 84 | * |
| 85 | * @return error is NONE upon success. Otherwise, |
| 86 | * BAD_DISPLAY when an invalid display handle was passed in. |
| 87 | * @return capabilities is a list of supported capabilities. |
| 88 | */ |
| 89 | getDisplayCapabilities_2_4(Display display) |
Dominik Laskowski | ce44a4b | 2019-09-19 15:50:09 -0700 | [diff] [blame] | 90 | generates (Error error, vec<DisplayCapability> capabilities); |
| 91 | |
| 92 | /** |
| 93 | * Returns whether the given physical display is internal or external. |
| 94 | * |
| 95 | * @return error is NONE upon success. Otherwise, |
| 96 | * BAD_DISPLAY when the given display is invalid or virtual. |
| 97 | * @return type is the connection type of the display. |
| 98 | */ |
| 99 | getDisplayConnectionType(Display display) generates (Error error, DisplayConnectionType type); |
Ady Abraham | 7882ae6 | 2019-10-10 17:04:47 -0700 | [diff] [blame] | 100 | |
| 101 | /** |
| 102 | * Provides a list of the vsync periods supported by the display in the given configuration |
| 103 | * |
| 104 | * @param display is the display for which the vsync periods are queried. |
| 105 | * @param config is the display configuration for which the vsync periods are queried. |
| 106 | * |
| 107 | * @return error is NONE upon success. Otherwise, |
| 108 | * BAD_DISPLAY when an invalid display handle was passed in. |
| 109 | * BAD_CONFIG when an invalid config handle was passed in. |
| 110 | * @return supportedVsyncPeriods is a list of supported vsync periods. |
| 111 | */ |
| 112 | getSupportedDisplayVsyncPeriods(Display display, Config config) |
| 113 | generates (Error error, vec<VsyncPeriodNanos> supportedVsyncPeriods); |
| 114 | |
| 115 | /** |
| 116 | * Retrieves which vsync period the display is currently using. |
| 117 | * |
| 118 | * If no display configuration is currently active, this function must |
| 119 | * return BAD_CONFIG. If the vsync period is about to change due to a |
| 120 | * setActiveConfigAndVsyncPeriod call, this function must return the current vsync period |
| 121 | * until the change takes place. |
| 122 | * |
| 123 | * @param display is the display for which the vsync period is queried. |
| 124 | * @return error is NONE upon success. Otherwise, |
| 125 | * BAD_DISPLAY when an invalid display handle was passed in. |
| 126 | * BAD_CONFIG when no configuration is currently active. |
| 127 | * @return vsyncPeriodNanos is the current vsync period of the display. |
| 128 | */ |
| 129 | getDisplayVsyncPeriod(Display display) |
| 130 | generates (Error error, VsyncPeriodNanos vsyncPeriodNanos); |
| 131 | |
| 132 | /** |
| 133 | * Sets the active configuration and the refresh rate for this display. |
| 134 | * If the config is the same as the current config, only the vsync period shall change. |
| 135 | * Upon returning, the given display configuration, except vsync period, must be active and |
| 136 | * remain so until either this function is called again or the display is disconnected. |
| 137 | * When the display starts to refresh at the new vsync period, onVsync_2_4 callback must be |
| 138 | * called with the new vsync period. |
| 139 | * |
| 140 | * @param display is the display for which the active config is set. |
| 141 | * @param config is the new display configuration. |
| 142 | * @param vsyncPeriodNanos is the new display vsync period. |
| 143 | * @param vsyncPeriodChangeConstraints are the constraints required for changing vsync period. |
| 144 | * |
| 145 | * @return error is NONE upon success. Otherwise, |
| 146 | * BAD_DISPLAY when an invalid display handle was passed in. |
| 147 | * BAD_CONFIG when the configuration handle passed in is not valid |
| 148 | * for this display. |
| 149 | * BAD_VSYNC_PERIOD when an invalid vsync period is passed in. |
| 150 | * SEAMLESS_NOT_POSSIBLE when seamlessRequired was true but the display cannot achieve |
| 151 | * the vsync period change without a noticeable visual artifact. |
| 152 | * @return newVsyncAppliedTime is the time in CLOCK_MONOTONIC when the new display will start to |
| 153 | * refresh at the new vsync period. |
| 154 | */ |
| 155 | setActiveConfigAndVsyncPeriod(Display display, Config config, |
| 156 | VsyncPeriodNanos vsyncPeriodNanos, |
| 157 | VsyncPeriodChangeConstraints vsyncPeriodChangeConstraints) |
| 158 | generates (Error error, int64_t newVsyncAppliedTime); |
Peiyong Lin | 781d0bb | 2019-07-03 10:57:02 -0700 | [diff] [blame] | 159 | }; |