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

Commit b4c44c73 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

release-request-b4448e78-a682-4bc1-b691-b70e74fef19f-for-git_pi-release-431447...

release-request-b4448e78-a682-4bc1-b691-b70e74fef19f-for-git_pi-release-4314474 snap-temp-L95500000099150132

Change-Id: Ie3c6c1dd68bbc9f225d810da4ba9fd0d7d1d7559
parents b0d8cbc0 2c6477de
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -716,7 +716,7 @@ TEST_F(AudioDecHidlTest, SetRole) {
}

// port format enumeration
TEST_F(AudioDecHidlTest, DISABLED_EnumeratePortFormat) {
TEST_F(AudioDecHidlTest, EnumeratePortFormat) {
    description("Test Component on Mandatory Port Parameters (Port Format)");
    if (disableTest) return;
    android::hardware::media::omx::V1_0::Status status;
@@ -765,7 +765,7 @@ TEST_F(AudioDecHidlTest, DecodeTest) {
    int bytesCount = 0;
    uint32_t flags = 0;
    uint32_t timestamp = 0;
    timestampDevTest = true;
    timestampDevTest = false;
    while (1) {
        if (!(eleInfo >> bytesCount)) break;
        eleInfo >> flags;
@@ -822,11 +822,7 @@ TEST_F(AudioDecHidlTest, DecodeTest) {
}

// end of sequence test
// SPECIAL CASE; Sending Empty input EOS buffer is not supported across all
// components. For instance soft vorbis and soft opus expects CSD buffers at
// the start. Disabling this test for now. We shall revisit this at a later
// stage
TEST_F(AudioDecHidlTest, DISABLED_EOSTest_M) {
TEST_F(AudioDecHidlTest, EOSTest_M) {
    description("Test end of stream monkeying");
    if (disableTest) return;
    android::hardware::media::omx::V1_0::Status status;
+1 −1
Original line number Diff line number Diff line
@@ -454,7 +454,7 @@ TEST_F(AudioEncHidlTest, SetRole) {
}

// port format enumeration
TEST_F(AudioEncHidlTest, DISABLED_EnumeratePortFormat) {
TEST_F(AudioEncHidlTest, EnumeratePortFormat) {
    description("Test Component on Mandatory Port Parameters (Port Format)");
    if (disableTest) return;
    android::hardware::media::omx::V1_0::Status status;
+93 −5
Original line number Diff line number Diff line
@@ -290,7 +290,7 @@ TEST_F(ComponentHidlTest, DISABLED_GetPortIndices) {
}

// port format enumeration
TEST_F(ComponentHidlTest, DISABLED_EnumeratePortFormat) {
TEST_F(ComponentHidlTest, EnumeratePortFormat) {
    description("Test Component on Mandatory Port Parameters (Port Format)");
    if (disableTest) return;
    android::hardware::media::omx::V1_0::Status status;
@@ -350,7 +350,7 @@ TEST_F(ComponentHidlTest, DISABLED_EnumeratePortFormat) {
}

// get/set default port settings of a component
TEST_F(ComponentHidlTest, DISABLED_SetDefaultPortParams) {
TEST_F(ComponentHidlTest, SetDefaultPortParams) {
    description(
        "Test Component on Mandatory Port Parameters (Port Definition)");
    if (disableTest) return;
@@ -371,7 +371,7 @@ TEST_F(ComponentHidlTest, DISABLED_SetDefaultPortParams) {
        kPortIndexOutput = kPortIndexInput + 1;
    }

    for (size_t i = kPortIndexInput; i < kPortIndexOutput; i++) {
    for (size_t i = kPortIndexInput; i <= kPortIndexOutput; i++) {
        OMX_PARAM_PORTDEFINITIONTYPE portDef;
        status =
            getPortParam(omxNode, OMX_IndexParamPortDefinition, i, &portDef);
@@ -406,10 +406,32 @@ TEST_F(ComponentHidlTest, DISABLED_SetDefaultPortParams) {
            setPortParam(omxNode, OMX_IndexParamPortDefinition, i, &mirror);

            portDef = mirror;
            portDef.nBufferSize >>= 1;
            OMX_U32 nBufferSize = portDef.nBufferSize >> 1;
            if (nBufferSize != 0) {
                if (!strncmp(gEnv->getComponent().c_str(), "OMX.google.", 11)) {
                    portDef.nBufferSize = nBufferSize;
                } else {
                    // Probable alignment requirements of vendor component
                    portDef.nBufferSize = ALIGN_POWER_OF_TWO(nBufferSize, 12);
                    nBufferSize = portDef.nBufferSize;
                }
            } else {
                ASSERT_TRUE(false) << "Unexpected buffer size";
            }
            setPortParam(omxNode, OMX_IndexParamPortDefinition, i, &portDef);
            getPortParam(omxNode, OMX_IndexParamPortDefinition, i, &portDef);
            // SPECIAL CASE: For video decoder, allow configuration of input
            // buffer size even if it is less than minimum requirement and
            // similarly for encoder allow configuration of output port buffer
            // size.
            if ((compClass == video_encoder && i == kPortIndexOutput) ||
                (compClass == video_decoder && i == kPortIndexInput)) {
                double dev = (portDef.nBufferSize / (double)nBufferSize);
                dev -= 1;
                if (dev < 0 || dev > 0.1) EXPECT_TRUE(false);
            } else {
                EXPECT_EQ(portDef.nBufferSize, mirror.nBufferSize);
            }
            setPortParam(omxNode, OMX_IndexParamPortDefinition, i, &mirror);

            portDef = mirror;
@@ -467,6 +489,11 @@ TEST_F(ComponentHidlTest, DISABLED_PopulatePort) {
        portBase = params.nStartPortNumber;
    }

    // set state to idle
    status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
                                  OMX_StateIdle);
    ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);

    OMX_PARAM_PORTDEFINITIONTYPE portDef;
    status =
        getPortParam(omxNode, OMX_IndexParamPortDefinition, portBase, &portDef);
@@ -556,6 +583,67 @@ TEST_F(ComponentHidlTest, Flush) {
                            kPortIndexInput, kPortIndexOutput);
}

// test port mode configuration when the component is in various states
TEST_F(ComponentHidlTest, PortModeConfig) {
    description("Test Port Mode Configuration");
    if (disableTest) return;
    android::hardware::media::omx::V1_0::Status status;
    uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
    Message msg;

    status = setRole(omxNode, gEnv->getRole().c_str());
    ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
    OMX_PORT_PARAM_TYPE params;
    if (compClass == audio_decoder || compClass == audio_encoder) {
        status = getParam(omxNode, OMX_IndexParamAudioInit, &params);
    } else {
        status = getParam(omxNode, OMX_IndexParamVideoInit, &params);
    }
    if (status == ::android::hardware::media::omx::V1_0::Status::OK) {
        ASSERT_EQ(params.nPorts, 2U);
        kPortIndexInput = params.nStartPortNumber;
        kPortIndexOutput = kPortIndexInput + 1;
    }

    android::Vector<BufferInfo> iBuffer, oBuffer;

    // set port mode
    PortMode portMode[2];
    initPortMode(portMode, isSecure, compClass);
    status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
    EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
    status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
    EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);

    // set state to idle
    changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
                            kPortIndexInput, kPortIndexOutput, portMode);
    // Only Allow Port Mode configuration in loaded state
    status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
    EXPECT_NE(status, ::android::hardware::media::omx::V1_0::Status::OK);
    status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
    EXPECT_NE(status, ::android::hardware::media::omx::V1_0::Status::OK);

    // set state to executing
    changeStateIdletoExecute(omxNode, observer);
    // Only Allow Port Mode configuration in loaded state
    status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
    EXPECT_NE(status, ::android::hardware::media::omx::V1_0::Status::OK);
    status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
    EXPECT_NE(status, ::android::hardware::media::omx::V1_0::Status::OK);

    // set state to idle
    changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
    // set state to loaded
    changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
                            kPortIndexInput, kPortIndexOutput);

    status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
    EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
    status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
    EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
}

// state transitions test
TEST_F(ComponentHidlTest, StateTransitions) {
    description("Test State Transitions Loaded<->Idle<->Execute");
+7 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ filegroup {
    srcs: [
        "types.hal",
        "IDevice.hal",
        "IEvent.hal",
        "IPreparedModel.hal",
    ],
}
@@ -19,6 +20,7 @@ genrule {
    out: [
        "android/hardware/neuralnetworks/1.0/types.cpp",
        "android/hardware/neuralnetworks/1.0/DeviceAll.cpp",
        "android/hardware/neuralnetworks/1.0/EventAll.cpp",
        "android/hardware/neuralnetworks/1.0/PreparedModelAll.cpp",
    ],
}
@@ -38,6 +40,11 @@ genrule {
        "android/hardware/neuralnetworks/1.0/BnHwDevice.h",
        "android/hardware/neuralnetworks/1.0/BpHwDevice.h",
        "android/hardware/neuralnetworks/1.0/BsDevice.h",
        "android/hardware/neuralnetworks/1.0/IEvent.h",
        "android/hardware/neuralnetworks/1.0/IHwEvent.h",
        "android/hardware/neuralnetworks/1.0/BnHwEvent.h",
        "android/hardware/neuralnetworks/1.0/BpHwEvent.h",
        "android/hardware/neuralnetworks/1.0/BsEvent.h",
        "android/hardware/neuralnetworks/1.0/IPreparedModel.h",
        "android/hardware/neuralnetworks/1.0/IHwPreparedModel.h",
        "android/hardware/neuralnetworks/1.0/BnHwPreparedModel.h",
+49 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 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.
 */

/* This HAL is a work in progress */

package android.hardware.neuralnetworks@1.0;

/**
 * The IEvent interface is a callback object passed by the
 * Neuralnetworks runtime to the vendor service. It is used as a
 * synchronization primitive between one or more runtime threads and a
 * single asynchronous vendor thread.  An event object is passed as an
 * argument to a HIDL call that is expected to take a non-trivial
 * amount of time. When the asynchronous execution thread has
 * completed its computation, it must call "notify" on the event to
 * indicate to the Neuralnetworks runtime whether the computation was
 * successful or not, and that the corresponding output is ready to be
 * consumed if the execution was successful.
 *
 * TODO: Mention that "notify" is also called by a runtime thread
 * during CPU fallback execution? Depends on whether the HIDL comments
 * are strictly for vendors or not.
 */
interface IEvent {

    /**
     * IEvent::notify is called by the server thread (i.e. the thread doing the
     * work) to mark the event as completed so that any threads requiring the
     * corresponding resources can continue executing.
     *
     * @param status Status of the execution associated with the Event.
     *               Should be SUCCESS or ERROR.
     */
    oneway notify(Status status);

};
Loading