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.automotive.evs@1.0;
18
19
20/**
21 * Represents a single camera and is the primary interface for capturing images.
22 */
23interface IEvsDisplay {
24
25    /**
26     * Returns basic information about the EVS display provided by the system.
27     *
28     * See the description of the DisplayDesc structure for details.
29     *
30     * @return info The description of this display.  Please see the description
31     *              of the DisplayDesc structure for details.
32     */
33     getDisplayInfo() generates (DisplayDesc info);
34
35
36    /**
37     * Clients may set the display state to express their desired state.
38     *
39     * The HAL implementation must gracefully accept a request for any state while in
40     * any other state, although the response may be to defer or ignore the request. The display
41     * is defined to start in the NOT_VISIBLE state upon initialization. The client is
42     * then expected to request the VISIBLE_ON_NEXT_FRAME state, and then begin providing
43     * video. When the display is no longer required, the client is expected to request
44     * the NOT_VISIBLE state after passing the last video frame.
45     * Returns INVALID_ARG if the requested state is not a recognized value.
46     *
47     * @param  state  Desired new DisplayState.
48     * @return result EvsResult::OK is returned if this call is successful.
49     */
50     setDisplayState(DisplayState state) generates (EvsResult result);
51
52
53    /**
54     * This call requests the current state of the display
55     *
56     * The HAL implementation should report the actual current state, which might
57     * transiently differ from the most recently requested state. Note, however, that
58     * the logic responsible for changing display states should generally live above
59     * the device layer, making it undesirable for the HAL implementation to spontaneously
60     * change display states.
61     *
62     * @return state Current DisplayState of this Display.
63     */
64     getDisplayState() generates (DisplayState state);
65
66
67    /**
68     * This call returns a handle to a frame buffer associated with the display.
69     *
70     * @return buffer A handle to a frame buffer.  The returned buffer may be
71     *                locked and written to by software and/or GL.  This buffer
72     *                must be returned via a call to
73     *                returnTargetBufferForDisplay() even if the display is no
74     *                longer visible.
75     */
76     getTargetBuffer() generates (BufferDesc buffer);
77
78
79    /**
80     * This call tells the display that the buffer is ready for display.
81     *
82     * The buffer is no longer valid for use by the client after this call.
83     * There is no maximum time the caller may hold onto the buffer before making this
84     * call. The buffer may be returned at any time and in any DisplayState, but all
85     * buffers are expected to be returned before the IEvsDisplay interface is destroyed.
86     *
87     * @param  buffer A buffer handle to the frame that is ready for display.
88     * @return result EvsResult::OK is returned if this call is successful.
89     */
90    returnTargetBufferForDisplay(BufferDesc buffer) generates (EvsResult result);
91};
92