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

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

Merge "Use libbase API to access system properties in libhwui"

parents f8099d96 a02a12d7
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -54,6 +54,7 @@ cc_defaults {
    shared_libs: [
    shared_libs: [
        "liblog",
        "liblog",
        "libcutils",
        "libcutils",
        "libbase",
        "libstatslog",
        "libstatslog",
        "libutils",
        "libutils",
        "libEGL",
        "libEGL",
+23 −34
Original line number Original line Diff line number Diff line
@@ -23,8 +23,8 @@
#include <algorithm>
#include <algorithm>
#include <cstdlib>
#include <cstdlib>


#include <android-base/properties.h>
#include <cutils/compiler.h>
#include <cutils/compiler.h>
#include <cutils/properties.h>
#include <log/log.h>
#include <log/log.h>


namespace android {
namespace android {
@@ -67,64 +67,54 @@ bool Properties::isolatedProcess = false;
int Properties::contextPriority = 0;
int Properties::contextPriority = 0;
int Properties::defaultRenderAhead = -1;
int Properties::defaultRenderAhead = -1;


static int property_get_int(const char* key, int defaultValue) {
    char buf[PROPERTY_VALUE_MAX] = {
            '\0',
    };

    if (property_get(key, buf, "") > 0) {
        return atoi(buf);
    }
    return defaultValue;
}

bool Properties::load() {
bool Properties::load() {
    char property[PROPERTY_VALUE_MAX];
    bool prevDebugLayersUpdates = debugLayersUpdates;
    bool prevDebugLayersUpdates = debugLayersUpdates;
    bool prevDebugOverdraw = debugOverdraw;
    bool prevDebugOverdraw = debugOverdraw;


    debugOverdraw = false;
    debugOverdraw = false;
    if (property_get(PROPERTY_DEBUG_OVERDRAW, property, nullptr) > 0) {
    std::string debugOverdrawProperty = base::GetProperty(PROPERTY_DEBUG_OVERDRAW, "");
        INIT_LOGD("  Overdraw debug enabled: %s", property);
    if (debugOverdrawProperty != "") {
        if (!strcmp(property, "show")) {
        INIT_LOGD("  Overdraw debug enabled: %s", debugOverdrawProperty);
        if (debugOverdrawProperty == "show") {
            debugOverdraw = true;
            debugOverdraw = true;
            overdrawColorSet = OverdrawColorSet::Default;
            overdrawColorSet = OverdrawColorSet::Default;
        } else if (!strcmp(property, "show_deuteranomaly")) {
        } else if (debugOverdrawProperty == "show_deuteranomaly") {
            debugOverdraw = true;
            debugOverdraw = true;
            overdrawColorSet = OverdrawColorSet::Deuteranomaly;
            overdrawColorSet = OverdrawColorSet::Deuteranomaly;
        }
        }
    }
    }


    sProfileType = ProfileType::None;
    sProfileType = ProfileType::None;
    if (property_get(PROPERTY_PROFILE, property, "") > 0) {
    std::string profileProperty = base::GetProperty(PROPERTY_PROFILE, "");
        if (!strcmp(property, PROPERTY_PROFILE_VISUALIZE_BARS)) {
    if (profileProperty != "") {
        if (profileProperty == PROPERTY_PROFILE_VISUALIZE_BARS) {
            sProfileType = ProfileType::Bars;
            sProfileType = ProfileType::Bars;
        } else if (!strcmp(property, "true")) {
        } else if (profileProperty == "true") {
            sProfileType = ProfileType::Console;
            sProfileType = ProfileType::Console;
        }
        }
    }
    }


    debugLayersUpdates = property_get_bool(PROPERTY_DEBUG_LAYERS_UPDATES, false);
    debugLayersUpdates = base::GetBoolProperty(PROPERTY_DEBUG_LAYERS_UPDATES, false);
    INIT_LOGD("  Layers updates debug enabled: %d", debugLayersUpdates);
    INIT_LOGD("  Layers updates debug enabled: %d", debugLayersUpdates);


    showDirtyRegions = property_get_bool(PROPERTY_DEBUG_SHOW_DIRTY_REGIONS, false);
    showDirtyRegions = base::GetBoolProperty(PROPERTY_DEBUG_SHOW_DIRTY_REGIONS, false);


    debugLevel = (DebugLevel)property_get_int(PROPERTY_DEBUG, kDebugDisabled);
    debugLevel = (DebugLevel)base::GetIntProperty(PROPERTY_DEBUG, (int)kDebugDisabled);


    skipEmptyFrames = property_get_bool(PROPERTY_SKIP_EMPTY_DAMAGE, true);
    skipEmptyFrames = base::GetBoolProperty(PROPERTY_SKIP_EMPTY_DAMAGE, true);
    useBufferAge = property_get_bool(PROPERTY_USE_BUFFER_AGE, true);
    useBufferAge = base::GetBoolProperty(PROPERTY_USE_BUFFER_AGE, true);
    enablePartialUpdates = property_get_bool(PROPERTY_ENABLE_PARTIAL_UPDATES, true);
    enablePartialUpdates = base::GetBoolProperty(PROPERTY_ENABLE_PARTIAL_UPDATES, true);


    filterOutTestOverhead = property_get_bool(PROPERTY_FILTER_TEST_OVERHEAD, false);
    filterOutTestOverhead = base::GetBoolProperty(PROPERTY_FILTER_TEST_OVERHEAD, false);


    skpCaptureEnabled = debuggingEnabled && property_get_bool(PROPERTY_CAPTURE_SKP_ENABLED, false);
    skpCaptureEnabled = debuggingEnabled && base::GetBoolProperty(PROPERTY_CAPTURE_SKP_ENABLED, false);


    SkAndroidFrameworkTraceUtil::setEnableTracing(
    SkAndroidFrameworkTraceUtil::setEnableTracing(
            property_get_bool(PROPERTY_SKIA_ATRACE_ENABLED, false));
            base::GetBoolProperty(PROPERTY_SKIA_ATRACE_ENABLED, false));


    runningInEmulator = property_get_bool(PROPERTY_QEMU_KERNEL, false);
    runningInEmulator = base::GetBoolProperty(PROPERTY_QEMU_KERNEL, false);


    defaultRenderAhead = std::max(-1, std::min(2, property_get_int(PROPERTY_RENDERAHEAD,
    defaultRenderAhead = std::max(-1, std::min(2, base::GetIntProperty(PROPERTY_RENDERAHEAD,
            render_ahead().value_or(0))));
            render_ahead().value_or(0))));


    return (prevDebugLayersUpdates != debugLayersUpdates) || (prevDebugOverdraw != debugOverdraw);
    return (prevDebugLayersUpdates != debugLayersUpdates) || (prevDebugOverdraw != debugOverdraw);
@@ -175,9 +165,8 @@ RenderPipelineType Properties::peekRenderPipelineType() {
        return sRenderPipelineType;
        return sRenderPipelineType;
    }
    }
    bool useVulkan = use_vulkan().value_or(false);
    bool useVulkan = use_vulkan().value_or(false);
    char prop[PROPERTY_VALUE_MAX];
    std::string rendererProperty = base::GetProperty(PROPERTY_RENDERER, useVulkan ? "skiavk" : "skiagl");
    property_get(PROPERTY_RENDERER, prop, useVulkan ? "skiavk" : "skiagl");
    if (rendererProperty == "skiavk") {
    if (!strcmp(prop, "skiavk")) {
        return RenderPipelineType::SkiaVulkan;
        return RenderPipelineType::SkiaVulkan;
    }
    }
    return RenderPipelineType::SkiaGL;
    return RenderPipelineType::SkiaGL;
+0 −1
Original line number Original line Diff line number Diff line
@@ -18,7 +18,6 @@
#define ANDROID_HWUI_PROPERTIES_H
#define ANDROID_HWUI_PROPERTIES_H


#include <cutils/compiler.h>
#include <cutils/compiler.h>
#include <cutils/properties.h>


/**
/**
 * This file contains the list of system properties used to configure libhwui.
 * This file contains the list of system properties used to configure libhwui.
+4 −3
Original line number Original line Diff line number Diff line
@@ -30,6 +30,8 @@


#include <unistd.h>
#include <unistd.h>


#include <android-base/properties.h>

using namespace android::uirenderer::renderthread;
using namespace android::uirenderer::renderthread;


namespace android {
namespace android {
@@ -240,12 +242,11 @@ static void savePictureAsync(const sk_sp<SkData>& data, const std::string& filen


SkCanvas* SkiaPipeline::tryCapture(SkSurface* surface) {
SkCanvas* SkiaPipeline::tryCapture(SkSurface* surface) {
    if (CC_UNLIKELY(Properties::skpCaptureEnabled)) {
    if (CC_UNLIKELY(Properties::skpCaptureEnabled)) {
        char prop[PROPERTY_VALUE_MAX] = {'\0'};
        if (mCaptureSequence <= 0) {
        if (mCaptureSequence <= 0) {
            property_get(PROPERTY_CAPTURE_SKP_FILENAME, prop, "0");
            std::string prop = base::GetProperty(PROPERTY_CAPTURE_SKP_FILENAME, "0");
            if (prop[0] != '0' && mCapturedFile != prop) {
            if (prop[0] != '0' && mCapturedFile != prop) {
                mCapturedFile = prop;
                mCapturedFile = prop;
                mCaptureSequence = property_get_int32(PROPERTY_CAPTURE_SKP_FRAMES, 1);
                mCaptureSequence = base::GetIntProperty(PROPERTY_CAPTURE_SKP_FRAMES, 1);
            }
            }
        }
        }
        if (mCaptureSequence > 0 || mPictureCapturedCallback) {
        if (mCaptureSequence > 0 || mPictureCapturedCallback) {