1/*
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
23        /** The display has been connected */
24        CONNECTED = 1,
25        /** The display has been disconnected */
26        DISCONNECTED = 2,
27    };
28
29    /**
30     * 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     */
47    @callflow(next="*")
48    onHotplug(Display display, Connection connected);
49
50    /**
51     * 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     */
61    @callflow(next="*")
62    oneway onRefresh(Display display);
63
64    /**
65     * 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     */
73    @callflow(next="*")
74    oneway onVsync(Display display, int64_t timestamp);
75};
76