blob: ab74c301821095f629997d5ec90b61af35c691bb [file] [log] [blame]
Chia-I Wuacce6992016-09-20 06:52:43 +08001/*
2 * Copyright (C) 2016 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.1;
18
19interface IComposerCallback {
20 enum Connection : int32_t {
21 INVALID = 0,
22
Andreas Huber40d3a9b2017-03-28 16:19:16 -070023 /** The display has been connected */
Chia-I Wuacce6992016-09-20 06:52:43 +080024 CONNECTED = 1,
Andreas Huber40d3a9b2017-03-28 16:19:16 -070025 /** The display has been disconnected */
Chia-I Wuacce6992016-09-20 06:52:43 +080026 DISCONNECTED = 2,
27 };
28
Andreas Huber40d3a9b2017-03-28 16:19:16 -070029 /**
Chia-I Wuacce6992016-09-20 06:52:43 +080030 * Notifies the client that the given display has either been connected or
31 * disconnected. Every active display (even a built-in physical display)
32 * must trigger at least one hotplug notification, even if it only occurs
33 * immediately after callback registration.
34 *
35 * Displays which have been connected are assumed to be in PowerMode::OFF,
36 * and the onVsync callback should not be called for a display until vsync
37 * has been enabled with setVsyncEnabled.
38 *
39 * The client may call back into the device while the callback is in
40 * progress. The device must serialize calls to this callback such that
41 * only one thread is calling it at a time.
42 *
43 * @param display is the display that triggers the hotplug event.
44 * @param connected indicates whether the display is connected or
45 * disconnected.
46 */
Chia-I Wub00f59d2017-01-13 14:47:23 +080047 @callflow(next="*")
Chia-I Wuacce6992016-09-20 06:52:43 +080048 onHotplug(Display display, Connection connected);
49
Andreas Huber40d3a9b2017-03-28 16:19:16 -070050 /**
Chia-I Wuacce6992016-09-20 06:52:43 +080051 * Notifies the client to trigger a screen refresh. This forces all layer
52 * state for this display to be resent, and the display to be validated
53 * and presented, even if there have been no changes.
54
55 * This refresh will occur some time after the callback is initiated, but
56 * not necessarily before it returns. It is safe to trigger this callback
57 * from other functions which call into the device.
58 *
59 * @param display is the display to refresh.
60 */
Chia-I Wub00f59d2017-01-13 14:47:23 +080061 @callflow(next="*")
Chia-I Wuacce6992016-09-20 06:52:43 +080062 oneway onRefresh(Display display);
63
Andreas Huber40d3a9b2017-03-28 16:19:16 -070064 /**
Chia-I Wuacce6992016-09-20 06:52:43 +080065 * Notifies the client that a vsync event has occurred. This callback must
66 * only be triggered when vsync is enabled for this display (through
67 * setVsyncEnabled).
68 *
69 * @param display is the display which has received a vsync event
70 * @param timestamp is the CLOCK_MONOTONIC time at which the vsync event
71 * occurred, in nanoseconds.
72 */
Chia-I Wub00f59d2017-01-13 14:47:23 +080073 @callflow(next="*")
Chia-I Wuacce6992016-09-20 06:52:43 +080074 oneway onVsync(Display display, int64_t timestamp);
75};