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

Commit 64dbbf51 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 7227300 from fa8dc0f6 to sc-release

Change-Id: I79aca073f9b430a4eba3ff97d64c11730cd5c014
parents 67c6d438 fa8dc0f6
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -130,8 +130,7 @@ void BLASTBufferItemConsumer::onSidebandStreamChanged() {
}

BLASTBufferQueue::BLASTBufferQueue(const std::string& name, const sp<SurfaceControl>& surface,
                                   int width, int height, int32_t format,
                                   bool enableTripleBuffering)
                                   int width, int height, int32_t format)
      : mName(name),
        mSurfaceControl(surface),
        mSize(width, height),
@@ -143,9 +142,8 @@ BLASTBufferQueue::BLASTBufferQueue(const std::string& name, const sp<SurfaceCont
    // explicitly so that dequeueBuffer will block
    mProducer->setDequeueTimeout(std::numeric_limits<int64_t>::max());

    if (enableTripleBuffering) {
    // safe default, most producers are expected to override this
    mProducer->setMaxDequeuedBufferCount(2);
    }
    mBufferItemConsumer = new BLASTBufferItemConsumer(mConsumer,
                                                      GraphicBuffer::USAGE_HW_COMPOSER |
                                                              GraphicBuffer::USAGE_HW_TEXTURE,
+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ class BLASTBufferQueue
{
public:
    BLASTBufferQueue(const std::string& name, const sp<SurfaceControl>& surface, int width,
                     int height, int32_t format, bool enableTripleBuffering = true);
                     int height, int32_t format);

    sp<IGraphicBufferProducer> getIGraphicBufferProducer() const {
        return mProducer;
+17 −6
Original line number Diff line number Diff line
@@ -298,11 +298,9 @@ SkiaGLRenderEngine::SkiaGLRenderEngine(const RenderEngineCreationArgs& args, EGL
}

SkiaGLRenderEngine::~SkiaGLRenderEngine() {
    std::lock_guard<std::mutex> lock(mRenderingMutex);
    mRuntimeEffects.clear();
    mProtectedTextureCache.clear();
    mTextureCache.clear();
    cleanFramebufferCache();

    std::lock_guard<std::mutex> lock(mRenderingMutex);
    if (mBlurFilter) {
        delete mBlurFilter;
    }
@@ -797,6 +795,8 @@ status_t SkiaGLRenderEngine::drawLayers(const DisplaySettings& display,
            const auto rect = layer->geometry.roundedCornersRadius > 0
                    ? getSkRect(layer->geometry.roundedCornersCrop)
                    : bounds;
            // This would require a new parameter/flag to SkShadowUtils::DrawShadow
            LOG_ALWAYS_FATAL_IF(layer->disableBlending, "Cannot disableBlending with a shadow");
            drawShadow(canvas, rect, layer->geometry.roundedCornersRadius, layer->shadow);
            continue;
        }
@@ -806,7 +806,7 @@ status_t SkiaGLRenderEngine::drawLayers(const DisplaySettings& display,
                 needsToneMapping(layer->sourceDataspace, display.outputDataspace));

        // quick abort from drawing the remaining portion of the layer
        if (layer->alpha == 0 && !requiresLinearEffect &&
        if (layer->alpha == 0 && !requiresLinearEffect && !layer->disableBlending &&
            (!displayColorTransform || displayColorTransform->isAlphaUnchanged())) {
            continue;
        }
@@ -912,6 +912,10 @@ status_t SkiaGLRenderEngine::drawLayers(const DisplaySettings& display,
                                                      requiresLinearEffect));
        }

        if (layer->disableBlending) {
            paint.setBlendMode(SkBlendMode::kSrc);
        }

        paint.setColorFilter(displayColorTransform);

        if (layer->geometry.roundedCornersRadius > 0) {
@@ -1137,7 +1141,14 @@ EGLSurface SkiaGLRenderEngine::createPlaceholderEglPbufferSurface(EGLDisplay dis
    return eglCreatePbufferSurface(display, placeholderConfig, attributes.data());
}

void SkiaGLRenderEngine::cleanFramebufferCache() {}
void SkiaGLRenderEngine::cleanFramebufferCache() {
    // TODO(b/180767535) Remove this method and use b/180767535 instead, which would allow
    // SF to control texture lifecycle more tightly rather than through custom hooks into RE.
    std::lock_guard<std::mutex> lock(mRenderingMutex);
    mRuntimeEffects.clear();
    mProtectedTextureCache.clear();
    mTextureCache.clear();
}

int SkiaGLRenderEngine::getContextPriority() {
    int value;
+77 −0
Original line number Diff line number Diff line
@@ -1920,6 +1920,83 @@ TEST_P(RenderEngineTest, testRoundedCornersCrop) {
                      0, 255, 0, 255);
}

TEST_P(RenderEngineTest, testClear) {
    initializeRenderEngine();

    const auto rect = fullscreenRect();
    const renderengine::DisplaySettings display{
            .physicalDisplay = rect,
            .clip = rect,
    };

    const renderengine::LayerSettings redLayer{
            .geometry.boundaries = rect.toFloatRect(),
            .source.solidColor = half3(1.0f, 0.0f, 0.0f),
            .alpha = 1.0f,
    };

    // This mimics prepareClearClientComposition. This layer should overwrite
    // the redLayer, so that the buffer is transparent, rather than red.
    const renderengine::LayerSettings clearLayer{
            .geometry.boundaries = rect.toFloatRect(),
            .source.solidColor = half3(0.0f, 0.0f, 0.0f),
            .alpha = 0.0f,
            .disableBlending = true,
    };

    std::vector<const renderengine::LayerSettings*> layers{&redLayer, &clearLayer};
    invokeDraw(display, layers);
    expectBufferColor(rect, 0, 0, 0, 0);
}

TEST_P(RenderEngineTest, testDisableBlendingBuffer) {
    initializeRenderEngine();

    const auto rect = Rect(0, 0, 1, 1);
    const renderengine::DisplaySettings display{
            .physicalDisplay = rect,
            .clip = rect,
    };

    const renderengine::LayerSettings redLayer{
            .geometry.boundaries = rect.toFloatRect(),
            .source.solidColor = half3(1.0f, 0.0f, 0.0f),
            .alpha = 1.0f,
    };

    // The next layer will overwrite redLayer with a GraphicBuffer that is green
    // applied with a translucent alpha.
    auto buf = allocateSourceBuffer(1, 1);
    {
        uint8_t* pixels;
        buf->lock(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN,
                  reinterpret_cast<void**>(&pixels));
        pixels[0] = 0;
        pixels[1] = 255;
        pixels[2] = 0;
        pixels[3] = 255;
        buf->unlock();
    }

    const renderengine::LayerSettings greenLayer{
            .geometry.boundaries = rect.toFloatRect(),
            .source =
                    renderengine::PixelSource{
                            .buffer =
                                    renderengine::Buffer{
                                            .buffer = buf,
                                            .usePremultipliedAlpha = true,
                                    },
                    },
            .alpha = 0.5f,
            .disableBlending = true,
    };

    std::vector<const renderengine::LayerSettings*> layers{&redLayer, &greenLayer};
    invokeDraw(display, layers);
    expectBufferColor(rect, 0, 128, 0, 128);
}

} // namespace android

// TODO(b/129481165): remove the #pragma below and fix conversion issues
+1 −4
Original line number Diff line number Diff line
@@ -521,11 +521,8 @@ void BufferQueueLayer::onFirstRef() {
    mConsumer->setContentsChangedListener(mContentsChangedListener);
    mConsumer->setName(String8(mName.data(), mName.size()));

    // BufferQueueCore::mMaxDequeuedBufferCount is default to 1
    if (!mFlinger->isLayerTripleBufferingDisabled()) {
    mProducer->setMaxDequeuedBufferCount(2);
}
}

status_t BufferQueueLayer::setDefaultBufferProperties(uint32_t w, uint32_t h, PixelFormat format) {
    uint32_t const maxSurfaceDims =
Loading