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

Commit 1ddb2fe4 authored by Jerome Gaillard's avatar Jerome Gaillard Committed by Android (Google) Code Review
Browse files

Merge "Implement RenderThread for host" into main

parents a7997c13 87ef5240
Loading
Loading
Loading
Loading
+35 −6
Original line number Diff line number Diff line
@@ -155,6 +155,7 @@ cc_defaults {
        host: {
            static_libs: [
                "libandroidfw",
                "libhostgraphics",
                "libutils",
            ],
        },
@@ -501,6 +502,17 @@ cc_library_headers {
    ],
    header_libs: ["android_graphics_jni_headers"],
    export_header_lib_headers: ["android_graphics_jni_headers"],
    target: {
        android: {
            export_include_dirs: ["platform/android"],
        },
        host: {
            export_include_dirs: ["platform/host"],
        },
        windows: {
            enabled: true,
        },
    },
}

cc_defaults {
@@ -538,6 +550,7 @@ cc_defaults {
        "utils/Blur.cpp",
        "utils/Color.cpp",
        "utils/LinearAllocator.cpp",
        "utils/StringUtils.cpp",
        "utils/TypefaceUtils.cpp",
        "utils/VectorDrawableUtils.cpp",
        "AnimationContext.cpp",
@@ -552,6 +565,7 @@ cc_defaults {
        "Mesh.cpp",
        "MemoryPolicy.cpp",
        "PathParser.cpp",
        "ProfileData.cpp",
        "Properties.cpp",
        "PropertyValuesAnimatorSet.cpp",
        "PropertyValuesHolder.cpp",
@@ -569,12 +583,13 @@ cc_defaults {
        export_proto_headers: true,
    },

    header_libs: ["libandroid_headers_private"],

    target: {
        android: {
            header_libs: [
                "libandroid_headers_private",
                "libtonemap_headers",
            ],
            header_libs: ["libtonemap_headers"],

            local_include_dirs: ["platform/android"],

            srcs: [
                "hwui/AnimatedImageThread.cpp",
@@ -605,7 +620,6 @@ cc_defaults {
                "thread/CommonPool.cpp",
                "utils/GLUtils.cpp",
                "utils/NdkUtils.cpp",
                "utils/StringUtils.cpp",
                "AutoBackendTextureRelease.cpp",
                "DeferredLayerUpdater.cpp",
                "DeviceInfo.cpp",
@@ -617,7 +631,6 @@ cc_defaults {
                "FrameMetricsReporter.cpp",
                "Layer.cpp",
                "LayerUpdateQueue.cpp",
                "ProfileData.cpp",
                "ProfileDataContainer.cpp",
                "Readback.cpp",
                "TreeInfo.cpp",
@@ -628,6 +641,21 @@ cc_defaults {
            // Allow implicit fallthroughs in HardwareBitmapUploader.cpp until they are fixed.
            cflags: ["-Wno-implicit-fallthrough"],
        },
        host: {
            header_libs: ["libnativebase_headers"],

            local_include_dirs: ["platform/host"],

            srcs: [
                "platform/host/renderthread/CacheManager.cpp",
                "platform/host/renderthread/RenderThread.cpp",
                "platform/host/ProfileDataContainer.cpp",
                "platform/host/Readback.cpp",
                "platform/host/WebViewFunctorManager.cpp",
            ],

            cflags: ["-Wno-unused-private-field"],
        },
    },
}

@@ -663,6 +691,7 @@ cc_defaults {
    header_libs: ["libandroid_headers_private"],
    target: {
        android: {
            local_include_dirs: ["platform/android"],
            shared_libs: [
                "libgui",
                "libui",
+2 −0
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@ void ProfileData::mergeWith(const ProfileData& other) {
}

void ProfileData::dump(int fd) const {
#ifdef __ANDROID__
    dprintf(fd, "\nStats since: %" PRIu64 "ns", mStatStartTime);
    dprintf(fd, "\nTotal frames rendered: %u", mTotalFrameCount);
    dprintf(fd, "\nJanky frames: %u (%.2f%%)", mJankFrameCount,
@@ -138,6 +139,7 @@ void ProfileData::dump(int fd) const {
        dprintf(fd, " %ums=%u", entry.renderTimeMs, entry.frameCount);
    });
    dprintf(fd, "\n");
#endif
}

uint32_t ProfileData::findPercentile(int percentile) const {
+3 −3
Original line number Diff line number Diff line
@@ -17,14 +17,14 @@
#ifndef HWUI_THREADBASE_H
#define HWUI_THREADBASE_H

#include "WorkQueue.h"
#include "utils/Macros.h"

#include <utils/Looper.h>
#include <utils/Thread.h>

#include <algorithm>

#include "thread/WorkQueue.h"
#include "utils/Macros.h"

namespace android::uirenderer {

class ThreadBase : public Thread {
+40 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 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.
 */

#include "ProfileDataContainer.h"

#include <log/log.h>

namespace android {
namespace uirenderer {

void ProfileDataContainer::freeData() REQUIRES(mJankDataMutex) {
    delete mData;
    mIsMapped = false;
    mData = nullptr;
}

void ProfileDataContainer::rotateStorage() {
    std::lock_guard lock(mJankDataMutex);
    mData->reset();
}

void ProfileDataContainer::switchStorageToAshmem(int ashmemfd) {
    ALOGE("Ashmem is not supported for non-Android configurations");
}

} /* namespace uirenderer */
} /* namespace android */
+50 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 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.
 */

#include "Readback.h"

using namespace android::uirenderer::renderthread;

namespace android {
namespace uirenderer {

void Readback::copySurfaceInto(ANativeWindow* window, const std::shared_ptr<CopyRequest>& request) {
}

CopyResult Readback::copyHWBitmapInto(Bitmap* hwBitmap, SkBitmap* bitmap) {
    return CopyResult::UnknownError;
}

CopyResult Readback::copyLayerInto(DeferredLayerUpdater* deferredLayer, SkBitmap* bitmap) {
    return CopyResult::UnknownError;
}

CopyResult Readback::copyImageInto(const sk_sp<SkImage>& image, SkBitmap* bitmap) {
    return CopyResult::UnknownError;
}

CopyResult Readback::copyImageInto(const sk_sp<SkImage>& image, const Rect& srcRect,
                                   SkBitmap* bitmap) {
    return CopyResult::UnknownError;
}

bool Readback::copyLayerInto(Layer* layer, const SkRect* srcRect, const SkRect* dstRect,
                             SkBitmap* bitmap) {
    return false;
}

} /* namespace uirenderer */
} /* namespace android */
Loading