Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6bdb811f authored by Haoxiang Li's avatar Haoxiang Li
Browse files

[SV HIDL] Adds HAL interfaces for surround view.

Bug: 148618804

Test: Build passed.

Change-Id: Ie5d8540258d456408394e9ac4256db764f6b3cd7
parent fe31a4df
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
// This file is autogenerated by hidl-gen -Landroidbp.

hidl_interface {
    name: "android.hardware.automotive.sv@1.0",
    root: "android.hardware",
    vndk: {
        enabled: true,
    },
    srcs: [
        "types.hal",
        "ISurroundViewStream.hal",
        "ISurroundViewSession.hal",
        "ISurroundView2dSession.hal",
        "ISurroundView3dSession.hal",
        "ISurroundViewService.hal",
    ],
    interfaces: [
        "android.hidl.base@1.0",
        "android.hardware.graphics.common@1.0",
        "android.hardware.graphics.common@1.1",
        "android.hardware.graphics.common@1.2",
    ],
    gen_java: true,
}
+84 −0
Original line number Diff line number Diff line
/*
 * Copyright 2020 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.sv@1.0;

import ISurroundViewSession;

/**
 * Interface representing a surround view 2d session.
 *
 * Surround view 2d provides a top/bird's eye view of the car and its surroundings.
 */
interface ISurroundView2dSession extends ISurroundViewSession {

    /**
     * Gets mapping information for 2d surround view.
     *
     * Mapping information maps the output frame of 2d surround view to actual dimensions
     * covered on the ground. Mapping information is fixed for a car and is based upon its camera
     * coverage. Mapping information can be used for doing overlays of objects in 3d space
     * onto the surround view 2d output frame.
     *
     * @param sv2dConfig Configuration to set.
     * @return sv2dMappingInfo mapping information of the 2d surround view.
     */
    get2dMappingInfo() generates (Sv2dMappingInfo sv2dMappingInfo);

    /**
     * Sets the configuration of 2d surround view.
     *
     * Configuration is used for supported different target use-cases of the surround view eg.
     * fullscreen or preview. Default configuration is FULLSCREEN.
     * A set config call can be performed at any time (before or after startStream) of the session.
     * Once config change is complete, a CONFIG_CHANGED event is sent, after which
     * all frames received will be of the updated config.
     *
     * @param sv2dConfig Configuration to set.
     * @return svResult  Returns OK if successful, appropriate error result otherwise.
     */
    set2dConfig(Sv2dConfig sv2dConfig) generates (SvResult svResult);

    /**
     * Gets the current configuration of the 2d surround view.
     *
     * Configuration is used for supported different target use-cases of the surround view eg.
     * fullscreen view or preview. Use setConfig call to set a configuration.
     *
     * @return sv2dConfig the active current configuration of the 2d session.
     */
    get2dConfig() generates (Sv2dConfig sv2dConfig);

    /**
     * Projects points on camera image to surround view 2d image.
     *
     * Useful for mapping points detected on individual camera frames onto the surround view 2d
     * output frame.
     *
     * @param cameraPoints  List of camera pixel points to be projected in range including (0, 0)
     *                      and (width - 1, height -1) of camera frame. If point is outside camera
                            frame INVALID_ARG error is returned.
     * @param cameraId      Id of the EvsCamera to use for projecting points. Id must be one of the
     *                      cameras as returned by getCameraIds() else INVALID_ARG error is returned
     * @return points2d     Returns a list of 2d pixel points projecting into surround view 2d
     *                      frame in the same order as cameraPoints. Point projected maybe outside
     *                      surround view frame i.e. outside (0, 0) and
     *                      (sv_width - 1, sv_height - 1). Points that do not project to ground
     *                      plane are set with inValid true.
     */
    projectCameraPoints(vec<Point2dInt> cameraPoints, string cameraId) generates (
            vec<Point2dFloat> points2d);
};
+113 −0
Original line number Diff line number Diff line
/*
 * Copyright 2020 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.sv@1.0;

import ISurroundViewSession;

/**
 * Interface representing a surround view 3d session.
 *
 * Surround view 3d provides a virtual view from any desired position in the 3d space around the
 * car. Surround view 3d creates an approximate 3d surface around the car to match the surrounds
 * and provides a virtual view as seen on this surface.
 */
interface ISurroundView3dSession extends ISurroundViewSession {

    /**
     * Sets the desired views of surround view 3d.
     *
     * Surround view 3d takes a list of desired virtual view points and provides an output frame
     * for each view. Default view list is a single view from behind the car front facing in the
     * front direction.
     * A call to setViews() results in the views set by a previous call to be discarded.
     * Each view set is identified by an Id which is returned with the corresponding output frame
     * of that view.
     * Clients can call setViews() at any stage of the session (before/after startStream). Client
     * may continue to receive frames of previous views after setViews() call for a while and can
     * identify updated set of views once effective using the view Id provided in the updated
     * views frames.
     *
     * @param views     List of desired views to generate output frames.
     * @return svResult Returns OK if successful, appropriate error result otherwise.
     */
    setViews(vec<View3d> views) generates (SvResult svResult);

    /**
     * Sets the configuration of 3d surround view.
     *
     * Configuration is used for supported different target use-cases of the surround view eg.
     * fullscreen view or preview. A set config call can be performed at anytime (before or after
     * startStream) of the session.
     * Once config change is complete, a CONFIG_CHANGED event is sent, after which
     * all frames received will be of the updated config.
     *
     * @param sv3dConfig Configuration to set.
     * @return svResult  Returns OK if successful, appropriate error result otherwise.
     */
    set3dConfig(Sv3dConfig sv3dConfig) generates (SvResult svResult);

    /**
     * Gets the current configuration of the 3d surround view.
     *
     * Configuration is used for supported different target use-cases of the surround view eg.
     * fullscreen view or preview. Use setConfig call to set a configuration.
     *
     * @return sv3dConfig The current active configuration of the 3d session.
     */
    get3dConfig() generates (Sv3dConfig sv3dConfig);

    /**
     * Updates 3d overlays in scene.
     *
     * updateOverlays() provides a way to set a 3d overlay object in the scene. An overlay is an
     * 3d object in the scene which can be a visual indicator to provide additional information eg.
     * parking sensor distance indicators or overlays for objects in scene.
     *
     * An overlay object is defined by a set of points (forming triangles) with some color and
     * transparency values and each overlay is identified by an overlay Id.
     * When an overlay with a new Id is passed, a new overlay is added to the scene.
     * When an overlay with previous id is passed, its vertices/color are updated with passed data.
     * If the overlay data is empty, the overlay is removed from the scene.
     *
     * @param overlaysData   Object with shared memory containing overlays to add/update in the
     *                       scene. Refer to OverlaysData structure for layout in shared memory.
     * @return svResult      Returns OK if successful, appropriate error result otherwise.
     */
    updateOverlays(OverlaysData overlaysData) generates (SvResult svResult);

    /**
     * Projects points on camera image to surround view 3D surface.
     *
     * Useful for mapping points detected on individual camera frames onto the surround view 3D
     * surface, these 3d points can then be used to set overlays using the updateOverlays() for
     * the detected objects in the scene.
     * Note:
     * 3d points returned are projected on an approximate 3d surface and do not provide the exact
     * 3d location.
     *
     * @param cameraPoints  List of camera pixel points to be projected in range including (0, 0)
     *                      and (width - 1, height -1) of camera frame. If point is outside camera
                            frame INVALID_ARG error is returned.
     * @param cameraId      Id of the EvsCamera to use for projecting points. Id must be one of the
     *                      cameras as returned by getCameraIds() else INVALID_ARG error is returned
     * @return points3d     Returns a list of 3d points on the approximate 3d surface in the
     *                      automotive coordinate system in the same order as cameraPoints.
     *                      Points that do not project to 3d surface are set with inValid true.
     */
    projectCameraPointsTo3dSurface(vec<Point2dInt> cameraPoints, string cameraId) generates (
            vec<Point3dFloat> points3d);
};
+71 −0
Original line number Diff line number Diff line
/*
 * Copyright 2020 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.sv@1.0;

import ISurroundView2dSession;
import ISurroundView3dSession;

/**
 * Interface representing entry point for surround view.
 *
 * Surround view service has two types of sessions 2d and 3d. Refer to their respective interface
 * for more details.
 */
interface ISurroundViewService {

    /**
     * Gets a list of camera ids that are used for generating surround view.
     * For 4 camera configuration, the cameras ids are ordered in clockwise direction
     * when viewed from top of the car starting with the front camera. i.e. FRONT, RIGHT, REAR and
     * LEFT. All other configurations must follow clockwise order.
     *
     * @result cameraIds List of camera ids that matching the Id of EVS Cameras used by service.
     */
    getCameraIds() generates (vec<string> cameraIds);

    /**
     * Starts a surround view 2d session.
     *
     * @result sv2dSession Returns a new 2d session that was created.
     *         result      Returns OK if successful, appropriate error result otherwise.
     */
    start2dSession() generates (ISurroundView2dSession sv2dSession, SvResult result);

    /**
     * Stops a surround view 2d session.
     *
     * @param sv2dSession Valid 2d session to be stopped.
     * @return svResult   Returns OK if successful, appropriate error result otherwise.
     */
    stop2dSession(ISurroundView2dSession sv2dSession) generates (SvResult result);

    /**
     * Starts a surround view 3d session.
     *
     * @result sv3dSession Returns a new 3d session that was created.
     *         result      Returns OK if successful, appropriate error result otherwise.
     */
    start3dSession() generates (ISurroundView3dSession sv3dSession, SvResult result);

    /**
     * Stops a surround view 2d session.
     *
     * @param sv2dSession Valid 2d session to be stopped.
     * @return svResult  Returns OK if successful, appropriate error result otherwise.
     */
    stop3dSession(ISurroundView3dSession sv3dSession) generates (SvResult result);
};
+51 −0
Original line number Diff line number Diff line
/*
 * Copyright 2020 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.sv@1.0;

import ISurroundViewStream;

/**
 * Common interface for surround view session extended by surround view 2d and 3d
 * session.
 */
interface ISurroundViewSession {
    /**
     * Requests to start receiving surround view frames.
     *
     * For surround view 3d, setViews() must be set before calling startStream().
     *
     * @param stream     Stream to receiving callbacks for the session.
     * @return svResult  Returns OK if successful, returns VIEW_NOT_SET if setViews() is not
     *                   called for surround view 3d, appropriate error results otherwise.
     */
    startStream(ISurroundViewStream stream) generates (SvResult svResult);

    /**
     * Requests to stop stream.
     *
     * Frames may continue to arrive after call returns. Each must be returned until
     * the closure of the stream is signaled by the ISurroundViewStream.
     */
    stopStream();

    /**
     * Signal from client that a frame, which was delivered by the stream, has been consumed.
     *
     * @param  svFramesDesc Descriptor to signal done with frame.
     */
    oneway doneWithFrames(SvFramesDesc svFramesDesc);
};
Loading