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

Commit 92f89fa2 authored by Alec Mouri's avatar Alec Mouri
Browse files

Reduce number of copies into unmapExternalTextureBuffer

Make unmapExternalTextureBuffer take in an rvalue of sp<GraphicBuffer>,
which reduces the number sp copies.

Bug: 215661436
Test: builds
Change-Id: I4f9b6e3d6863ce6815810fdda038dc9e730f0b44
parent f625f0b6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ ExternalTexture::ExternalTexture(const sp<GraphicBuffer>& buffer,
}

ExternalTexture::~ExternalTexture() {
    mRenderEngine.unmapExternalTextureBuffer(mBuffer);
    mRenderEngine.unmapExternalTextureBuffer(std::move(mBuffer));
}

} // namespace android::renderengine::impl
+2 −2
Original line number Diff line number Diff line
@@ -800,7 +800,7 @@ status_t GLESRenderEngine::cacheExternalTextureBufferInternal(const sp<GraphicBu
    return NO_ERROR;
}

void GLESRenderEngine::unmapExternalTextureBuffer(const sp<GraphicBuffer>& buffer) {
void GLESRenderEngine::unmapExternalTextureBuffer(sp<GraphicBuffer>&& buffer) {
    mImageManager->releaseAsync(buffer->getId(), nullptr);
}

@@ -1262,7 +1262,7 @@ void GLESRenderEngine::drawLayersInternal(

            // Do not cache protected EGLImage, protected memory is limited.
            if (gBuf->getUsage() & GRALLOC_USAGE_PROTECTED) {
                unmapExternalTextureBuffer(gBuf);
                unmapExternalTextureBuffer(std::move(gBuf));
            }
        }

+1 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ protected:
    size_t getMaxViewportDims() const override;
    void mapExternalTextureBuffer(const sp<GraphicBuffer>& buffer, bool isRenderable)
            EXCLUDES(mRenderingMutex);
    void unmapExternalTextureBuffer(const sp<GraphicBuffer>& buffer) EXCLUDES(mRenderingMutex);
    void unmapExternalTextureBuffer(sp<GraphicBuffer>&& buffer) EXCLUDES(mRenderingMutex);
    bool canSkipPostRenderCleanup() const override;
    void drawLayersInternal(const std::shared_ptr<std::promise<FenceResult>>&& resultPromise,
                            const DisplaySettings& display,
+1 −1
Original line number Diff line number Diff line
@@ -231,7 +231,7 @@ protected:
    // asynchronously, but the caller can expect that map/unmap calls are performed in a manner
    // that's conflict serializable, i.e. unmap a buffer should never occur before binding the
    // buffer if the caller called mapExternalTextureBuffer before calling unmap.
    virtual void unmapExternalTextureBuffer(const sp<GraphicBuffer>& buffer) = 0;
    virtual void unmapExternalTextureBuffer(sp<GraphicBuffer>&& buffer) = 0;

    // A thread safe query to determine if any post rendering cleanup is necessary.  Returning true
    // is a signal that calling the postRenderCleanup method would be a no-op and that callers can
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ public:
protected:
    // mock renderengine still needs to implement these, but callers should never need to call them.
    void mapExternalTextureBuffer(const sp<GraphicBuffer>&, bool) {}
    void unmapExternalTextureBuffer(const sp<GraphicBuffer>&) {}
    void unmapExternalTextureBuffer(sp<GraphicBuffer>&&) {}
};

} // namespace mock
Loading