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

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

Snap for 4807121 from ca175ee1 to pi-release

Change-Id: I766c990434e23ba9c195318e386e072bd01515b6
parents 9ba99577 ca175ee1
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -309,7 +309,9 @@ static void run_dex2oat(int zip_fd, int oat_fd, int input_vdex_fd, int output_vd
    // If the runtime was requested to use libartd.so, we'll run dex2oatd, otherwise dex2oat.
    const char* dex2oat_bin = "/system/bin/dex2oat";
    constexpr const char* kDex2oatDebugPath = "/system/bin/dex2oatd";
    if (is_debug_runtime() || (background_job_compile && is_debuggable_build())) {
    // Do not use dex2oatd for release candidates (give dex2oat more soak time).
    bool is_release = android::base::GetProperty("ro.build.version.codename", "") == "REL";
    if (is_debug_runtime() || (background_job_compile && is_debuggable_build() && !is_release)) {
        if (access(kDex2oatDebugPath, X_OK) == 0) {
            dex2oat_bin = kDex2oatDebugPath;
        }
+25 −28
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ uint32_t BpBinder::sBinderProxyCountHighWatermark = 2500;
uint32_t BpBinder::sBinderProxyCountLowWatermark = 2000;

enum {
    CALLBACK_TRIGGERED_MASK = 0x80000000,   // A flag denoting that the callback has been called
    LIMIT_REACHED_MASK = 0x80000000,        // A flag denoting that the limit has been reached
    COUNTING_VALUE_MASK = 0x7FFFFFFF,       // A mask of the remaining bits for the count value
};

@@ -109,36 +109,31 @@ void BpBinder::ObjectManager::kill()
BpBinder* BpBinder::create(int32_t handle) {
    int32_t trackedUid = -1;
    if (sCountByUidEnabled) {
        BpBinder* out;
        trackedUid = IPCThreadState::self()->getCallingUid();
        AutoMutex _l(sTrackingLock);
        if ((sTrackingMap[trackedUid] & COUNTING_VALUE_MASK) >= sBinderProxyCountHighWatermark) {
            ALOGE("Too many binder proxy objects sent to uid %d from uid %d (over %d proxies held)",
                   getuid(), trackedUid, sBinderProxyCountHighWatermark);

        uint32_t trackedValue = sTrackingMap[trackedUid];
        if (CC_UNLIKELY(trackedValue & LIMIT_REACHED_MASK)) {
            if (sBinderProxyThrottleCreate) {
                ALOGE("Returning Null Binder Proxy Object to uid %d", trackedUid);
                out = nullptr;
                return nullptr;
            }
        } else {
                // increment and construct here in case callback has an async kill causing a race
                sTrackingMap[trackedUid]++;
                out = new BpBinder(handle, trackedUid);
            if ((trackedValue & COUNTING_VALUE_MASK) >= sBinderProxyCountHighWatermark) {
                ALOGE("Too many binder proxy objects sent to uid %d from uid %d (%d proxies held)",
                      getuid(), trackedUid, trackedValue);
                sTrackingMap[trackedUid] |= LIMIT_REACHED_MASK;
                if (sLimitCallback) sLimitCallback(trackedUid);
                if (sBinderProxyThrottleCreate) {
                    ALOGI("Throttling binder proxy creates from uid %d in uid %d until binder proxy"
                          " count drops below %d",
                          trackedUid, getuid(), sBinderProxyCountLowWatermark);
                    return nullptr;
                }
            }

            if (sLimitCallback && !(sTrackingMap[trackedUid] & CALLBACK_TRIGGERED_MASK)) {
                sTrackingMap[trackedUid] |= CALLBACK_TRIGGERED_MASK;
                sLimitCallback(trackedUid);
        }
        } else {
        sTrackingMap[trackedUid]++;
            out = new BpBinder(handle, trackedUid);
    }

        return out;
    } else {
    return new BpBinder(handle, trackedUid);
}
}

BpBinder::BpBinder(int32_t handle, int32_t trackedUid)
    : mHandle(handle)
@@ -371,15 +366,17 @@ BpBinder::~BpBinder()

    if (mTrackedUid >= 0) {
        AutoMutex _l(sTrackingLock);
        if (CC_UNLIKELY(sTrackingMap[mTrackedUid] == 0)) {
        uint32_t trackedValue = sTrackingMap[mTrackedUid];
        if (CC_UNLIKELY((trackedValue & COUNTING_VALUE_MASK) == 0)) {
            ALOGE("Unexpected Binder Proxy tracking decrement in %p handle %d\n", this, mHandle);
        } else {
            if (CC_UNLIKELY(
                (sTrackingMap[mTrackedUid] & CALLBACK_TRIGGERED_MASK) &&
                ((sTrackingMap[mTrackedUid] & COUNTING_VALUE_MASK) <= sBinderProxyCountLowWatermark)
                (trackedValue & LIMIT_REACHED_MASK) &&
                ((trackedValue & COUNTING_VALUE_MASK) <= sBinderProxyCountLowWatermark)
                )) {
                // Clear the Callback Triggered bit when crossing below the low watermark
                sTrackingMap[mTrackedUid] &= ~CALLBACK_TRIGGERED_MASK;
                ALOGI("Limit reached bit reset for uid %d (fewer than %d proxies from uid %d held)",
                                   getuid(), mTrackedUid, sBinderProxyCountLowWatermark);
                sTrackingMap[mTrackedUid] &= ~LIMIT_REACHED_MASK;
            }
            if (--sTrackingMap[mTrackedUid] == 0) {
                sTrackingMap.erase(mTrackedUid);
+38 −3
Original line number Diff line number Diff line
@@ -345,11 +345,46 @@ void ProgramCache::generateToneMappingProcess(Formatter& fs, const Key& needs) {
            }
            break;
        default:
            // TODO(73825729) We need to revert the tone mapping in
            // hardware composer properly.
            // inverse tone map; the output luminance can be up to maxOutLumi.
            fs << R"__SHADER__(
                highp vec3 ToneMap(highp vec3 color) {
                    return color;
                    const float maxOutLumi = 3000.0;

                    const float x0 = 5.0;
                    const float y0 = 2.5;
                    float x1 = displayMaxLuminance * 0.7;
                    float y1 = maxOutLumi * 0.15;
                    float x2 = displayMaxLuminance * 0.9;
                    float y2 = maxOutLumi * 0.45;
                    float x3 = displayMaxLuminance;
                    float y3 = maxOutLumi;

                    float c1 = y1 / 3.0;
                    float c2 = y2 / 2.0;
                    float c3 = y3 / 1.5;

                    float nits = color.y;

                    float scale;
                    if (nits <= x0) {
                        // scale [0.0, x0] to [0.0, y0] linearly
                        const float slope = y0 / x0;
                        nits *= slope;
                    } else if (nits <= x1) {
                        // scale [x0, x1] to [y0, y1] using a curve
                        float t = (nits - x0) / (x1 - x0);
                        nits = (1.0 - t) * (1.0 - t) * y0 + 2.0 * (1.0 - t) * t * c1 + t * t * y1;
                    } else if (nits <= x2) {
                        // scale [x1, x2] to [y1, y2] using a curve
                        float t = (nits - x1) / (x2 - x1);
                        nits = (1.0 - t) * (1.0 - t) * y1 + 2.0 * (1.0 - t) * t * c2 + t * t * y2;
                    } else {
                        // scale [x2, x3] to [y2, y3] using a curve
                        float t = (nits - x2) / (x3 - x2);
                        nits = (1.0 - t) * (1.0 - t) * y2 + 2.0 * (1.0 - t) * t * c3 + t * t * y3;
                    }

                    return color * (nits / max(1e-6, color.y));
                }
            )__SHADER__";
            break;