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

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

Snap for 7450397 from 9c187a35 to sc-d1-release

Change-Id: I2929a2df6e0ce1257fc4ba3b2670539f35dfcf2a
parents ba33942a 9c187a35
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@
#include <SkSurface.h>
#include <android-base/stringprintf.h>
#include <gl/GrGLInterface.h>
#include <gui/TraceUtils.h>
#include <sync/sync.h>
#include <ui/BlurRegion.h>
#include <ui/DebugUtils.h>
@@ -792,7 +793,7 @@ status_t SkiaGLRenderEngine::drawLayers(const DisplaySettings& display,
    }

    for (const auto& layer : layers) {
        ATRACE_NAME("DrawLayer");
        ATRACE_FORMAT("DrawLayer: %s", layer->name.c_str());

        if (kPrintLayerSettings) {
            std::stringstream ls;
+19 −11
Original line number Diff line number Diff line
@@ -48,11 +48,8 @@ RenderEngineThreaded::RenderEngineThreaded(CreateInstanceFactory factory, Render
}

RenderEngineThreaded::~RenderEngineThreaded() {
    {
        std::lock_guard lock(mThreadMutex);
    mRunning = false;
    mCondition.notify_one();
    }

    if (mThread.joinable()) {
        mThread.join();
@@ -71,21 +68,32 @@ void RenderEngineThreaded::threadMain(CreateInstanceFactory factory) NO_THREAD_S

    mRenderEngine = factory();

    std::unique_lock<std::mutex> lock(mThreadMutex);
    pthread_setname_np(pthread_self(), mThreadName);

    {
        std::unique_lock<std::mutex> lock(mInitializedMutex);
        std::scoped_lock lock(mInitializedMutex);
        mIsInitialized = true;
    }
    mInitializedCondition.notify_all();

    while (mRunning) {
        const auto getNextTask = [this]() -> std::optional<Work> {
            std::scoped_lock lock(mThreadMutex);
            if (!mFunctionCalls.empty()) {
            auto task = mFunctionCalls.front();
                Work task = mFunctionCalls.front();
                mFunctionCalls.pop();
            task(*mRenderEngine);
                return std::make_optional<Work>(task);
            }
            return std::nullopt;
        };

        const auto task = getNextTask();

        if (task) {
            (*task)(*mRenderEngine);
        }

        std::unique_lock<std::mutex> lock(mThreadMutex);
        mCondition.wait(lock, [this]() REQUIRES(mThreadMutex) {
            return !mRunning || !mFunctionCalls.empty();
        });
+4 −3
Original line number Diff line number Diff line
@@ -82,9 +82,10 @@ private:
    // Protects the creation and destruction of mThread.
    mutable std::mutex mThreadMutex;
    std::thread mThread GUARDED_BY(mThreadMutex);
    bool mRunning GUARDED_BY(mThreadMutex) = true;
    mutable std::queue<std::function<void(renderengine::RenderEngine& instance)>> mFunctionCalls
            GUARDED_BY(mThreadMutex);
    std::atomic<bool> mRunning = true;

    using Work = std::function<void(renderengine::RenderEngine&)>;
    mutable std::queue<Work> mFunctionCalls GUARDED_BY(mThreadMutex);
    mutable std::condition_variable mCondition;

    // Used to allow select thread safe methods to be accessed without requiring the
+3 −2
Original line number Diff line number Diff line
@@ -73,10 +73,11 @@ private:
    void writeOutputIndependentGeometryStateToHWC(HWC2::Layer*, const LayerFECompositionState&,
                                                  bool skipLayer);
    void writeOutputDependentPerFrameStateToHWC(HWC2::Layer*);
    void writeOutputIndependentPerFrameStateToHWC(HWC2::Layer*, const LayerFECompositionState&);
    void writeOutputIndependentPerFrameStateToHWC(HWC2::Layer*, const LayerFECompositionState&,
                                                  bool skipLayer);
    void writeSolidColorStateToHWC(HWC2::Layer*, const LayerFECompositionState&);
    void writeSidebandStateToHWC(HWC2::Layer*, const LayerFECompositionState&);
    void writeBufferStateToHWC(HWC2::Layer*, const LayerFECompositionState&);
    void writeBufferStateToHWC(HWC2::Layer*, const LayerFECompositionState&, bool skipLayer);
    void writeCompositionTypeToHWC(HWC2::Layer*, Hwc2::IComposerClient::Composition,
                                   bool isPeekingThrough, bool skipLayer);
    void detectDisallowedCompositionTypeChange(Hwc2::IComposerClient::Composition from,
+7 −5
Original line number Diff line number Diff line
@@ -349,7 +349,7 @@ void OutputLayer::writeStateToHWC(bool includeGeometry, bool skipLayer, uint32_t
    }

    writeOutputDependentPerFrameStateToHWC(hwcLayer.get());
    writeOutputIndependentPerFrameStateToHWC(hwcLayer.get(), *outputIndependentState);
    writeOutputIndependentPerFrameStateToHWC(hwcLayer.get(), *outputIndependentState, skipLayer);

    writeCompositionTypeToHWC(hwcLayer.get(), requestedCompositionType, isPeekingThrough,
                              skipLayer);
@@ -471,7 +471,8 @@ void OutputLayer::writeOutputDependentPerFrameStateToHWC(HWC2::Layer* hwcLayer)
}

void OutputLayer::writeOutputIndependentPerFrameStateToHWC(
        HWC2::Layer* hwcLayer, const LayerFECompositionState& outputIndependentState) {
        HWC2::Layer* hwcLayer, const LayerFECompositionState& outputIndependentState,
        bool skipLayer) {
    switch (auto error = hwcLayer->setColorTransform(outputIndependentState.colorTransform)) {
        case hal::Error::NONE:
            break;
@@ -504,7 +505,7 @@ void OutputLayer::writeOutputIndependentPerFrameStateToHWC(
            break;
        case hal::Composition::CURSOR:
        case hal::Composition::DEVICE:
            writeBufferStateToHWC(hwcLayer, outputIndependentState);
            writeBufferStateToHWC(hwcLayer, outputIndependentState, skipLayer);
            break;
        case hal::Composition::INVALID:
        case hal::Composition::CLIENT:
@@ -541,7 +542,8 @@ void OutputLayer::writeSidebandStateToHWC(HWC2::Layer* hwcLayer,
}

void OutputLayer::writeBufferStateToHWC(HWC2::Layer* hwcLayer,
                                        const LayerFECompositionState& outputIndependentState) {
                                        const LayerFECompositionState& outputIndependentState,
                                        bool skipLayer) {
    auto supportedPerFrameMetadata =
            getOutput().getDisplayColorProfile()->getSupportedPerFrameMetadata();
    if (auto error = hwcLayer->setPerFrameMetadata(supportedPerFrameMetadata,
@@ -554,7 +556,7 @@ void OutputLayer::writeBufferStateToHWC(HWC2::Layer* hwcLayer,
    sp<GraphicBuffer> buffer = outputIndependentState.buffer;
    sp<Fence> acquireFence = outputIndependentState.acquireFence;
    int slot = outputIndependentState.bufferSlot;
    if (getState().overrideInfo.buffer != nullptr) {
    if (getState().overrideInfo.buffer != nullptr && !skipLayer) {
        buffer = getState().overrideInfo.buffer->getBuffer();
        acquireFence = getState().overrideInfo.acquireFence;
        slot = HwcBufferCache::FLATTENER_CACHING_SLOT;
Loading