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

Commit f8441e65 authored by John Reck's avatar John Reck
Browse files

Switch to a fancy new queue

Test: unit tests & benchmarks pass/faster

Change-Id: I9521432172d6dd6039c5280b1265479a36a86247
parent 68533018
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ cc_library_shared {
    ],

    cppflags: ["-Wno-conversion-null"],
    cpp_std: "c++17",

    srcs: [
        "AndroidRuntime.cpp",
+4 −1
Original line number Diff line number Diff line
@@ -7,6 +7,8 @@ cc_defaults {
        //"hwui_compile_for_perf",
    ],

    cpp_std: "c++17",

    cflags: [
        "-DEGL_EGLEXT_PROTOTYPES",
        "-DGL_GLEXT_PROTOTYPES",
@@ -354,6 +356,7 @@ cc_test {
        "tests/unit/TestUtilsTests.cpp",
        "tests/unit/TextDropShadowCacheTests.cpp",
        "tests/unit/TextureCacheTests.cpp",
        "tests/unit/ThreadBaseTests.cpp",
        "tests/unit/TypefaceTests.cpp",
        "tests/unit/VectorDrawableTests.cpp",
        "tests/unit/VectorDrawableAtlasTests.cpp",
+33 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef HWUI_SWAPBEHAVIOR_H
#define HWUI_SWAPBEHAVIOR_H

namespace android {
namespace uirenderer {
namespace renderthread {

enum class SwapBehavior {
    kSwap_default,
    kSwap_discardBuffer,
};

} // namespace renderthread
} //namespace uirenderer
} // namespace android

#endif //HWUI_SWAPBEHAVIOR_H
+1 −15
Original line number Diff line number Diff line
@@ -236,25 +236,11 @@ void RenderState::destroyLayersInUpdater() {
    std::for_each(mActiveLayerUpdaters.begin(), mActiveLayerUpdaters.end(), destroyLayerInUpdater);
}

class DecStrongTask : public renderthread::RenderTask {
public:
    explicit DecStrongTask(VirtualLightRefBase* object) : mObject(object) {}

    virtual void run() override {
        mObject->decStrong(nullptr);
        mObject = nullptr;
        delete this;
    }

private:
    VirtualLightRefBase* mObject;
};

void RenderState::postDecStrong(VirtualLightRefBase* object) {
    if (pthread_equal(mThreadId, pthread_self())) {
        object->decStrong(nullptr);
    } else {
        mRenderThread.queue(new DecStrongTask(object));
        mRenderThread.queue().post([object]() { object->decStrong(nullptr); });
    }
}

+4 −12
Original line number Diff line number Diff line
@@ -181,13 +181,13 @@ void CanvasContext::destroy() {
    mAnimationContext->destroy();
}

void CanvasContext::setSurface(Surface* surface) {
void CanvasContext::setSurface(sp<Surface>&& surface) {
    ATRACE_CALL();

    mNativeSurface = surface;
    mNativeSurface = std::move(surface);

    ColorMode colorMode = mWideColorGamut ? ColorMode::WideColorGamut : ColorMode::Srgb;
    bool hasSurface = mRenderPipeline->setSurface(surface, mSwapBehavior, colorMode);
    bool hasSurface = mRenderPipeline->setSurface(mNativeSurface.get(), mSwapBehavior, colorMode);

    mFrameNumber = -1;

@@ -203,15 +203,7 @@ void CanvasContext::setSwapBehavior(SwapBehavior swapBehavior) {
    mSwapBehavior = swapBehavior;
}

void CanvasContext::initialize(Surface* surface) {
    setSurface(surface);
}

void CanvasContext::updateSurface(Surface* surface) {
    setSurface(surface);
}

bool CanvasContext::pauseSurface(Surface* surface) {
bool CanvasContext::pauseSurface() {
    return mRenderThread.removeFrameCallback(this);
}

Loading