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

Commit 11f2a9b7 authored by Chia-I Wu's avatar Chia-I Wu
Browse files

surfaceflinger: defer EGLImage creation

Do not create EGLImage in
BufferLayerConsumer::updateAndReleaseLocked.  This effectively
defers EGLImage creation from BufferLayer::latchBuffer to
BufferLayer::onDraw, and makes sure we do not create EGLImage
unnecessarily.

Bug: 71361234
Test: screen rotation & force GL composition
Change-Id: Ia1d85e2974b27731ff2e716699ce0677d141034c
parent 4d85b8c0
Loading
Loading
Loading
Loading
+0 −13
Original line number Original line Diff line number Diff line
@@ -292,19 +292,6 @@ status_t BufferLayerConsumer::updateAndReleaseLocked(const BufferItem& item,


    int slot = item.mSlot;
    int slot = item.mSlot;


    // Ensure we have a valid EglImageKHR for the slot, creating an EglImage
    // if nessessary, for the gralloc buffer currently in the slot in
    // ConsumerBase.
    // We may have to do this even when item.mGraphicBuffer == NULL (which
    // means the buffer was previously acquired).
    const Rect& imageCrop = canUseImageCrop(item.mCrop) ? item.mCrop : Rect::EMPTY_RECT;
    err = mImages[slot]->createIfNeeded(imageCrop);
    if (err != NO_ERROR) {
        BLC_LOGW("updateAndRelease: unable to createImage on slot=%d", slot);
        releaseBufferLocked(slot, mSlots[slot].mGraphicBuffer);
        return UNKNOWN_ERROR;
    }

    // Do whatever sync ops we need to do before releasing the old slot.
    // Do whatever sync ops we need to do before releasing the old slot.
    if (slot != mCurrentTexture) {
    if (slot != mCurrentTexture) {
        err = syncForReleaseLocked();
        err = syncForReleaseLocked();