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

Commit d1e31885 authored by Lajos Molnar's avatar Lajos Molnar Committed by Eino-Ville Talvala
Browse files

omx: collapse unpopulated slot messages in GraphicBufferSource

Print one message per onBuffersReleased instead of one per each
slot.

Bug: 64452834
Change-Id: I2d849415ca05303926eb79904f00a176d5ddab32
parent 16f2c155
Loading
Loading
Loading
Loading
+19 −7
Original line number Diff line number Diff line
@@ -954,28 +954,40 @@ void GraphicBufferSource::onBuffersReleased() {
    Mutex::Autolock lock(mMutex);

    uint64_t slotMask;
    if (mConsumer->getReleasedBuffers(&slotMask) != NO_ERROR) {
        ALOGW("onBuffersReleased: unable to get released buffer set");
    uint64_t releaseMask;
    if (mConsumer->getReleasedBuffers(&releaseMask) != NO_ERROR) {
        slotMask = 0xffffffffffffffffULL;
    }

        ALOGW("onBuffersReleased: unable to get released buffer set");
    } else {
        slotMask = releaseMask;
        ALOGV("onBuffersReleased: 0x%016" PRIx64, slotMask);
    }

    AString unpopulated;
    for (int i = 0; i < BufferQueue::NUM_BUFFER_SLOTS; i++) {
        if ((slotMask & 0x01) != 0) {
            discardBufferInSlot_l(i);
            if (!discardBufferInSlot_l(i)) {
                if (!unpopulated.empty()) {
                    unpopulated.append(", ");
                }
                unpopulated.append(i);
            }
        }
        slotMask >>= 1;
    }
    if (!unpopulated.empty()) {
        ALOGW("released unpopulated slots: [%s]", unpopulated.c_str());
    }
}

void GraphicBufferSource::discardBufferInSlot_l(GraphicBufferSource::slot_id i) {
bool GraphicBufferSource::discardBufferInSlot_l(GraphicBufferSource::slot_id i) {
    ssize_t bsi = mBufferSlots.indexOfKey(i);
    if (bsi < 0) {
        ALOGW("releasing an unpopulated slot: %d", i);
        return false;
    } else {
        discardBufferAtSlotIndex_l(bsi);
        mBufferSlots.removeItemsAt(bsi);
        return true;
    }
}

+2 −2
Original line number Diff line number Diff line
@@ -257,8 +257,8 @@ private:
    void onBufferAcquired_l(const VideoBuffer &buffer);

    // marks the buffer at the slot no longer cached, and accounts for the outstanding
    // acquire count
    void discardBufferInSlot_l(slot_id i);
    // acquire count. Returns true if the slot was populated; otherwise, false.
    bool discardBufferInSlot_l(slot_id i);

    // marks the buffer at the slot index no longer cached, and accounts for the outstanding
    // acquire count