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

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

release-request-0ddf2eab-ecaa-4014-951f-9236b1e43859-for-git_oc-release-407559...

release-request-0ddf2eab-ecaa-4014-951f-9236b1e43859-for-git_oc-release-4075595 snap-temp-L43000000071370789

Change-Id: I348deab4450a01990513429f1d1e1469c90255bf
parents 4438ad47 89ed7072
Loading
Loading
Loading
Loading
+38 −3
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ static constexpr uint64_t ALL_APPS = UINT64_C(0xFFFFFFFFFFFFFFFF);
Contexthub::Contexthub()
        : mInitCheck(NO_INIT),
          mContextHubModule(nullptr),
          mDeathRecipient(new DeathRecipient(this)),
          mIsTransactionPending(false) {
    const hw_module_t *module;

@@ -96,7 +97,7 @@ Return<void> Contexthub::getHubs(getHubs_cb _hidl_cb) {
            c.stoppedPowerDrawMw = hubArray[i].stopped_power_draw_mw;
            c.sleepPowerDrawMw = hubArray[i].sleep_power_draw_mw;

            info.callBack = nullptr;
            info.callback = nullptr;
            info.osAppName = hubArray[i].os_app_name;
            mCachedHubInfo[hubArray[i].hub_id] = info;

@@ -110,6 +111,16 @@ Return<void> Contexthub::getHubs(getHubs_cb _hidl_cb) {
    return Void();
}

Contexthub::DeathRecipient::DeathRecipient(sp<Contexthub> contexthub)
        : mContexthub(contexthub) {}

void Contexthub::DeathRecipient::serviceDied(
        uint64_t cookie,
        const wp<::android::hidl::base::V1_0::IBase>& /*who*/) {
    uint32_t hubId = static_cast<uint32_t>(cookie);
    mContexthub->handleServiceDeath(hubId);
}

bool Contexthub::isValidHubId(uint32_t hubId) {
    if (!mCachedHubInfo.count(hubId)) {
        ALOGW("Hub information not found for hubId %" PRIu32, hubId);
@@ -123,7 +134,7 @@ sp<IContexthubCallback> Contexthub::getCallBackForHubId(uint32_t hubId) {
    if (!isValidHubId(hubId)) {
        return nullptr;
    } else {
        return mCachedHubInfo[hubId].callBack;
        return mCachedHubInfo[hubId].callback;
    }
}

@@ -193,8 +204,22 @@ Return<Result> Contexthub::registerCallback(uint32_t hubId,
                                                     contextHubCb,
                                                     this) == 0) {
        // Initialized && valid hub && subscription successful
        if (mCachedHubInfo[hubId].callback != nullptr) {
            ALOGD("Modifying callback for hubId %" PRIu32, hubId);
            mCachedHubInfo[hubId].callback->unlinkToDeath(mDeathRecipient);
        }

        mCachedHubInfo[hubId].callback = cb;
        if (cb != nullptr) {
            Return<bool> linkResult = cb->linkToDeath(mDeathRecipient, hubId);
            bool linkSuccess = linkResult.isOk() ?
                static_cast<bool>(linkResult) : false;
            if (!linkSuccess) {
                ALOGW("Couldn't link death recipient for hubId %" PRIu32,
                      hubId);
            }
        }
        retVal = Result::OK;
        mCachedHubInfo[hubId].callBack = cb;
    } else {
        // Initalized && valid hubId - but subscription unsuccessful
        // This is likely an internal error in the HAL implementation, but we
@@ -309,6 +334,16 @@ int Contexthub::handleOsMessage(sp<IContexthubCallback> cb,
      return retVal;
}

void Contexthub::handleServiceDeath(uint32_t hubId) {
    ALOGI("Callback/service died for hubId %" PRIu32, hubId);
    int ret = mContextHubModule->subscribe_messages(hubId, nullptr, nullptr);
    if (ret != 0) {
        ALOGW("Failed to unregister callback from hubId %" PRIu32 ": %d",
              hubId, ret);
    }
    mCachedHubInfo[hubId].callback.clear();
}

int Contexthub::contextHubCb(uint32_t hubId,
                             const struct hub_message_t *rxMsg,
                             void *cookie) {
+17 −2
Original line number Diff line number Diff line
@@ -65,14 +65,26 @@ private:

    struct CachedHubInformation{
        struct hub_app_name_t osAppName;
        sp<IContexthubCallback> callBack;
        sp<IContexthubCallback> callback;
    };

    class DeathRecipient : public hidl_death_recipient {
    public:
        DeathRecipient(const sp<Contexthub> contexthub);

        void serviceDied(
                uint64_t cookie,
                const wp<::android::hidl::base::V1_0::IBase>& who) override;

    private:
        sp<Contexthub> mContexthub;
    };

    status_t mInitCheck;
    const struct context_hub_module_t *mContextHubModule;
    std::unordered_map<uint32_t, CachedHubInformation> mCachedHubInfo;

    sp<IContexthubCallback> mCb;
    sp<DeathRecipient> mDeathRecipient;
    bool mIsTransactionPending;
    uint32_t mTransactionId;

@@ -85,6 +97,9 @@ private:
                        const uint8_t *msg,
                        int msgLen);

    // Handle the case where the callback registered for the given hub ID dies
    void handleServiceDeath(uint32_t hubId);

    static int contextHubCb(uint32_t hubId,
                            const struct hub_message_t *rxMsg,
                            void *cookie);
+2 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ Functionality of master is to enumerate all the omx components (and the roles it
usage: VtsHalMediaOmxV1\_0TargetMasterTest -I default

#### component :
This folder includes test fixtures that tests aspects common to all omx compatible components. For instance, port enabling/disabling, enumerating port formats, state transitions, flush, ..., stay common to all components irrespective of the service they offer. Test fixtures are directed towards testing the omx core. Every standard OMX compatible component is expected to pass these tests.
This folder includes test fixtures that tests aspects common to all omx compatible components. For instance, port enabling/disabling, enumerating port formats, state transitions, flush, ..., stay common to all components irrespective of the service they offer. Test fixtures here are directed towards testing these (omx core). Every standard OMX compatible component is expected to pass these tests.

usage: VtsHalMediaOmxV1\_0TargetComponentTest -I default -C <comp name> -R <comp role>

@@ -31,3 +31,4 @@ VtsHalMediaOmxV1\_0TargetVideoDecTest -I default -C <comp name> -R video_decoder

VtsHalMediaOmxV1\_0TargetVideoEncTest -I default -C <comp name> -R video_encoder.<comp class> -P /sdcard/media/

While tesing audio/video encoder, decoder components, test fixtures require input files. These input are files are present in the folder 'res'. Before running the tests all the files in 'res' have to be placed in '/media/sdcard/' or a path of your choice and this path needs to be provided as an argument to the test application
 No newline at end of file
+9 −2
Original line number Diff line number Diff line
@@ -425,8 +425,15 @@ void testEOS(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
        Message msg;
        status =
            observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
        EXPECT_EQ(status,
                  android::hardware::media::omx::V1_0::Status::TIMED_OUT);
        if (status == android::hardware::media::omx::V1_0::Status::OK) {
            if (msg.data.eventData.event == OMX_EventBufferFlag) {
                // soft omx components donot send this, we will just ignore it
                // for now
            } else {
                // something unexpected happened
                EXPECT_TRUE(false);
            }
        }
        if (eosFlag == true) break;
    }
    // test for flag
+24 −6
Original line number Diff line number Diff line
@@ -214,7 +214,7 @@ class VideoDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
                               strlen(gEnv->getComponent().c_str()) - suffixLen,
                           ".secure");
        if (isSecure) disableTest = true;
        if (disableTest) std::cerr << "[          ] Warning !  Test Disabled\n";
        if (disableTest) std::cout << "[          ] Warning !  Test Disabled\n";
    }

    virtual void TearDown() override {
@@ -257,7 +257,7 @@ class VideoDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
                            EXPECT_EQ(tsHit, true)
                                << "TimeStamp not recognized";
                        } else {
                            std::cerr
                            std::cout
                                << "[          ] Warning ! Received non-zero "
                                   "output / TimeStamp not recognized \n";
                        }
@@ -478,7 +478,8 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,

    if (msg.data.eventData.event == OMX_EventPortSettingsChanged) {
        ASSERT_EQ(msg.data.eventData.data1, kPortIndexOutput);
        if (msg.data.eventData.data2 == 0) {
        if (msg.data.eventData.data2 == OMX_IndexParamPortDefinition ||
            msg.data.eventData.data2 == 0) {
            status = omxNode->sendCommand(
                toRawCommandType(OMX_CommandPortDisable), kPortIndexOutput);
            ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
@@ -532,6 +533,20 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,

                allocatePortBuffers(omxNode, oBuffer, kPortIndexOutput,
                                    oPortMode);
                if (oPortMode != PortMode::PRESET_BYTE_BUFFER) {
                    OMX_PARAM_PORTDEFINITIONTYPE portDef;

                    status = getPortParam(omxNode, OMX_IndexParamPortDefinition,
                                          kPortIndexOutput, &portDef);
                    ASSERT_EQ(
                        status,
                        ::android::hardware::media::omx::V1_0::Status::OK);
                    allocateGraphicBuffers(omxNode, kPortIndexOutput, oBuffer,
                                           portDef.format.video.nFrameWidth,
                                           portDef.format.video.nFrameHeight,
                                           &portDef.format.video.nStride,
                                           portDef.nBufferCountActual);
                }
                status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT,
                                                  iBuffer, oBuffer);
                ASSERT_EQ(status,
@@ -549,16 +564,19 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
            }
        } else if (msg.data.eventData.data2 ==
                   OMX_IndexConfigCommonOutputCrop) {
            std::cerr << "[          ] Warning ! OMX_EventPortSettingsChanged/ "
            std::cout << "[          ] Warning ! OMX_EventPortSettingsChanged/ "
                         "OMX_IndexConfigCommonOutputCrop not handled \n";
        } else if (msg.data.eventData.data2 == OMX_IndexVendorStartUnused + 3) {
            std::cerr << "[          ] Warning ! OMX_EventPortSettingsChanged/ "
            std::cout << "[          ] Warning ! OMX_EventPortSettingsChanged/ "
                         "kDescribeColorAspectsIndex not handled \n";
        }
    } else if (msg.data.eventData.event == OMX_EventError) {
        std::cerr << "[          ] Warning ! OMX_EventError/ "
        std::cout << "[          ] Warning ! OMX_EventError/ "
                     "Decode Frame Call might be failed \n";
        return;
    } else if (msg.data.eventData.event == OMX_EventBufferFlag) {
        // soft omx components donot send this, we will just ignore it
        // for now
    } else {
        // something unexpected happened
        ASSERT_TRUE(false);
Loading