/*
 * 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;

import types;


/**
 * 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.
     */
     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.
     */
     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.
     */
     getDisplayState() generates (DisplayState state);


    /**
     * This call returns a handle to a frame buffer associated with the display.
     *
     * 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.
     */
    returnTargetBufferForDisplay(BufferDesc buffer) generates (EvsResult result);
};