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

Commit b4e77913 authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

audiohal: Remove timeouts in eventflag waits

Having a timeout is causing issues on hal driver thread startup.
If thread startup is delayed, then eventflag wait exits with
timeout. This leaves fmqs in an intermediate state, and a pending
wakeup for the server enables the client and the server to run
in parallel, causing races.

The legacy HAL interface didn't have any timeouts for read / write
operations, so there is no good reason for having them in
the wrapping interface.

The only difference with legacy HAL is that Treble HAL can be in
a separate process, and can crash, but this is handled separately.

Test: Check logs on startup, must be no fmq read / write errors
Bug: 35346610
Change-Id: Id3f79d31305afab194a4543bfb4501665518a27b
parent 2d6140b8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ status_t EffectHalHidl::processImpl(uint32_t mqFlag) {
    uint32_t efState = 0;
retry:
    status_t ret = mEfGroup->wait(
            static_cast<uint32_t>(MessageQueueFlagBits::DONE_PROCESSING), &efState, NS_PER_SEC);
            static_cast<uint32_t>(MessageQueueFlagBits::DONE_PROCESSING), &efState);
    if (efState & static_cast<uint32_t>(MessageQueueFlagBits::DONE_PROCESSING)) {
        Result retval = Result::NOT_INITIALIZED;
        mStatusMQ->read(&retval);
+2 −4
Original line number Diff line number Diff line
@@ -338,8 +338,7 @@ status_t StreamOutHalHidl::callWriterThread(
    // TODO: Remove manual event flag handling once blocking MQ is implemented. b/33815422
    uint32_t efState = 0;
retry:
    status_t ret = mEfGroup->wait(
            static_cast<uint32_t>(MessageQueueFlagBits::NOT_FULL), &efState, NS_PER_SEC);
    status_t ret = mEfGroup->wait(static_cast<uint32_t>(MessageQueueFlagBits::NOT_FULL), &efState);
    if (efState & static_cast<uint32_t>(MessageQueueFlagBits::NOT_FULL)) {
        WriteStatus writeStatus;
        writeStatus.retval = Result::NOT_INITIALIZED;
@@ -597,8 +596,7 @@ status_t StreamInHalHidl::callReaderThread(
    // TODO: Remove manual event flag handling once blocking MQ is implemented. b/33815422
    uint32_t efState = 0;
retry:
    status_t ret = mEfGroup->wait(
            static_cast<uint32_t>(MessageQueueFlagBits::NOT_EMPTY), &efState, NS_PER_SEC);
    status_t ret = mEfGroup->wait(static_cast<uint32_t>(MessageQueueFlagBits::NOT_EMPTY), &efState);
    if (efState & static_cast<uint32_t>(MessageQueueFlagBits::NOT_EMPTY)) {
        ReadStatus readStatus;
        readStatus.retval = Result::NOT_INITIALIZED;