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

Commit 49b17b96 authored by Alec Mouri's avatar Alec Mouri Committed by Automerger Merge Worker
Browse files

Merge "Add CachingHint into SurfaceFlinger" into udc-dev am: daa009f0

parents 17603f5c daa009f0
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -189,6 +189,7 @@ status_t layer_state_t::write(Parcel& output) const
    SAFE_PARCEL(output.writeParcelable, trustedPresentationListener);
    SAFE_PARCEL(output.writeFloat, currentSdrHdrRatio);
    SAFE_PARCEL(output.writeFloat, desiredSdrHdrRatio);
    SAFE_PARCEL(output.writeInt32, static_cast<int32_t>(cachingHint))
    return NO_ERROR;
}

@@ -328,6 +329,10 @@ status_t layer_state_t::read(const Parcel& input)
    SAFE_PARCEL(input.readFloat, &tmpFloat);
    desiredSdrHdrRatio = tmpFloat;

    int32_t tmpInt32;
    SAFE_PARCEL(input.readInt32, &tmpInt32);
    cachingHint = static_cast<gui::CachingHint>(tmpInt32);

    return NO_ERROR;
}

@@ -580,6 +585,10 @@ void layer_state_t::merge(const layer_state_t& other) {
        desiredSdrHdrRatio = other.desiredSdrHdrRatio;
        currentSdrHdrRatio = other.currentSdrHdrRatio;
    }
    if (other.what & eCachingHintChanged) {
        what |= eCachingHintChanged;
        cachingHint = other.cachingHint;
    }
    if (other.what & eHdrMetadataChanged) {
        what |= eHdrMetadataChanged;
        hdrMetadata = other.hdrMetadata;
@@ -731,6 +740,7 @@ uint64_t layer_state_t::diff(const layer_state_t& other) const {
    CHECK_DIFF(diff, eDataspaceChanged, other, dataspace);
    CHECK_DIFF2(diff, eExtendedRangeBrightnessChanged, other, currentSdrHdrRatio,
                desiredSdrHdrRatio);
    CHECK_DIFF(diff, eCachingHintChanged, other, cachingHint);
    CHECK_DIFF(diff, eHdrMetadataChanged, other, hdrMetadata);
    if (other.what & eSurfaceDamageRegionChanged &&
        (!surfaceDamageRegion.hasSameRects(other.surfaceDamageRegion))) {
+14 −0
Original line number Diff line number Diff line
@@ -1729,6 +1729,20 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setExten
    return *this;
}

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setCachingHint(
        const sp<SurfaceControl>& sc, gui::CachingHint cachingHint) {
    layer_state_t* s = getLayerState(sc);
    if (!s) {
        mStatus = BAD_INDEX;
        return *this;
    }
    s->what |= layer_state_t::eCachingHintChanged;
    s->cachingHint = cachingHint;

    registerSurfaceControlForCallback(sc);
    return *this;
}

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setHdrMetadata(
        const sp<SurfaceControl>& sc, const HdrMetadata& hdrMetadata) {
    layer_state_t* s = getLayerState(sc);
+30 −0
Original line number Diff line number Diff line
/*
 * Copyright 2022 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.
 */

package android.gui;

/*
 * Hint for configuring caching behavior for a layer
 * @hide
 */
@Backing(type="int")
enum CachingHint {
    // Caching is disabled. A layer may explicitly disable caching for
    // improving image quality for some scenes.
    Disabled = 0,
    // Caching is enabled. A layer is cacheable by default.
    Enabled = 1
}
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

#pragma once

#include <android/gui/CachingHint.h>
#include <android/gui/DisplayBrightness.h>
#include <android/gui/FrameTimelineInfo.h>
#include <android/gui/IDisplayEventConnection.h>
+5 −2
Original line number Diff line number Diff line
@@ -172,7 +172,7 @@ struct layer_state_t {
        eFlagsChanged = 0x00000040,
        eLayerStackChanged = 0x00000080,
        eFlushJankData = 0x00000100,
        /* unused = 0x00000200, */
        eCachingHintChanged = 0x00000200,
        eDimmingEnabledChanged = 0x00000400,
        eShadowRadiusChanged = 0x00000800,
        eRenderBorderChanged = 0x00001000,
@@ -211,7 +211,8 @@ struct layer_state_t {
        eStretchChanged = 0x2000'00000000,
        eTrustedOverlayChanged = 0x4000'00000000,
        eDropInputModeChanged = 0x8000'00000000,
        eExtendedRangeBrightnessChanged = 0x10000'00000000
        eExtendedRangeBrightnessChanged = 0x10000'00000000,

    };

    layer_state_t();
@@ -391,6 +392,8 @@ struct layer_state_t {
    float currentSdrHdrRatio = 1.f;
    float desiredSdrHdrRatio = 1.f;

    gui::CachingHint cachingHint = gui::CachingHint::Enabled;

    TrustedPresentationThresholds trustedPresentationThresholds;
    TrustedPresentationListener trustedPresentationListener;
};
Loading