/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.automotive.evs@1.0;


/**
 * Represents a single camera and is the primary interface for capturing images.
 */
interface IEvsDisplay {

    /**
     * Returns basic information about the EVS display provided by the system.
     *
     * See the description of the DisplayDesc structure for details.
     *
     * @return info The description of this display.  Please see the description
     *              of the DisplayDesc structure for details.
     */
     getDisplayInfo() generates (DisplayDesc info);


    /**
     * Clients may set the display state to express their desired state.
     *
     * The HAL implementation must gracefully accept a request for any state while in
     * any other state, although the response may be to defer or ignore the request. The display
     * is defined to start in the NOT_VISIBLE state upon initialization. The client is
     * then expected to request the VISIBLE_ON_NEXT_FRAME state, and then begin providing
     * video. When the display is no longer required, the client is expected to request
     * the NOT_VISIBLE state after passing the last video frame.
     * Returns INVALID_ARG if the requested state is not a recognized value.
     *
     * @param  state  Desired new DisplayState.
     * @return result EvsResult::OK is returned if this call is successful.
     */
     setDisplayState(DisplayState state) generates (EvsResult result);


    /**
     * This call requests the current state of the display
     *
     * The HAL implementation should report the actual current state, which might
     * transiently differ from the most recently requested state. Note, however, that
     * the logic responsible for changing display states should generally live above
     * the device layer, making it undesirable for the HAL implementation to spontaneously
     * change display states.
     *
     * @return state Current DisplayState of this Display.
     */
     getDisplayState() generates (DisplayState state);


    /**
     * This call returns a handle to a frame buffer associated with the display.
     *
     * @return buffer A handle to a frame buffer.  The returned buffer may be
     *                locked and written to by software and/or GL.  This buffer
     *                must be returned via a call to
     *                returnTargetBufferForDisplay() even if the display is no
     *                longer visible.
     */
     getTargetBuffer() generates (BufferDesc buffer);


    /**
     * This call tells the display that the buffer is ready for display.
     *
     * The buffer is no longer valid for use by the client after this call.
     * There is no maximum time the caller may hold onto the buffer before making this
     * call. The buffer may be returned at any time and in any DisplayState, but all
     * buffers are expected to be returned before the IEvsDisplay interface is destroyed.
     *
     * @param  buffer A buffer handle to the frame that is ready for display.
     * @return result EvsResult::OK is returned if this call is successful.
     */
    returnTargetBufferForDisplay(BufferDesc buffer) generates (EvsResult result);
};
