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

Commit 07196db2 authored by Alec Mouri's avatar Alec Mouri
Browse files

Don't import GPU inaccessible buffers in RenderEngine

SurfaceFlinger already rejects those buffers from being added to
drawLayers, but mapExternalTextureBuffer() is still called for all
buffers arriving into SurfaceFlinger. Let's not trigger undefined
behavior.

Bug: 300155347
Test: builds, boots
Change-Id: I3ced5f11f47af6fdcd2c1575cbbbac99075588b8
parent ce9c53fe
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -399,7 +399,10 @@ void SkiaRenderEngine::mapExternalTextureBuffer(const sp<GraphicBuffer>& buffer,
    // simply match the existing behavior for protected buffers.)  We also never cache any
    // buffers while in a protected context.
    const bool isProtectedBuffer = buffer->getUsage() & GRALLOC_USAGE_PROTECTED;
    if (isProtectedBuffer || isProtected()) {
    // Don't attempt to map buffers if we're not gpu sampleable. Callers shouldn't send a buffer
    // over to RenderEngine.
    const bool isGpuSampleable = buffer->getUsage() & GRALLOC_USAGE_HW_TEXTURE;
    if (isProtectedBuffer || isProtected() || !isGpuSampleable) {
        return;
    }
    ATRACE_CALL();