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

Commit bbf362d2 authored by Melody Hsu's avatar Melody Hsu
Browse files

Delete border rendering code from SurfaceFlinger.

Removed code is never used and drawing borders is done instead
by Window Manager Service. Changes revert ag/16980603 and
ag/17496275.

Bug: b/227656283
Test: presubmit
Test: SurfaceFlinger_test
Change-Id: Ib5c8bf74ad6764d65536dc60cc3c458edde86b3f
parent 00853e59
Loading
Loading
Loading
Loading
+0 −25
Original line number Diff line number Diff line
@@ -90,7 +90,6 @@ layer_state_t::layer_state_t()
        fixedTransformHint(ui::Transform::ROT_INVALID),
        autoRefresh(false),
        isTrustedOverlay(false),
        borderEnabled(false),
        bufferCrop(Rect::INVALID_RECT),
        destinationFrame(Rect::INVALID_RECT),
        dropInputMode(gui::DropInputMode::NONE) {
@@ -122,12 +121,6 @@ status_t layer_state_t::write(Parcel& output) const
    SAFE_PARCEL(output.write, transparentRegion);
    SAFE_PARCEL(output.writeUint32, bufferTransform);
    SAFE_PARCEL(output.writeBool, transformToDisplayInverse);
    SAFE_PARCEL(output.writeBool, borderEnabled);
    SAFE_PARCEL(output.writeFloat, borderWidth);
    SAFE_PARCEL(output.writeFloat, borderColor.r);
    SAFE_PARCEL(output.writeFloat, borderColor.g);
    SAFE_PARCEL(output.writeFloat, borderColor.b);
    SAFE_PARCEL(output.writeFloat, borderColor.a);
    SAFE_PARCEL(output.writeUint32, static_cast<uint32_t>(dataspace));
    SAFE_PARCEL(output.write, hdrMetadata);
    SAFE_PARCEL(output.write, surfaceDamageRegion);
@@ -238,17 +231,6 @@ status_t layer_state_t::read(const Parcel& input)
    SAFE_PARCEL(input.read, transparentRegion);
    SAFE_PARCEL(input.readUint32, &bufferTransform);
    SAFE_PARCEL(input.readBool, &transformToDisplayInverse);
    SAFE_PARCEL(input.readBool, &borderEnabled);
    SAFE_PARCEL(input.readFloat, &tmpFloat);
    borderWidth = tmpFloat;
    SAFE_PARCEL(input.readFloat, &tmpFloat);
    borderColor.r = tmpFloat;
    SAFE_PARCEL(input.readFloat, &tmpFloat);
    borderColor.g = tmpFloat;
    SAFE_PARCEL(input.readFloat, &tmpFloat);
    borderColor.b = tmpFloat;
    SAFE_PARCEL(input.readFloat, &tmpFloat);
    borderColor.a = tmpFloat;

    uint32_t tmpUint32 = 0;
    SAFE_PARCEL(input.readUint32, &tmpUint32);
@@ -659,12 +641,6 @@ void layer_state_t::merge(const layer_state_t& other) {
        what |= eShadowRadiusChanged;
        shadowRadius = other.shadowRadius;
    }
    if (other.what & eRenderBorderChanged) {
        what |= eRenderBorderChanged;
        borderEnabled = other.borderEnabled;
        borderWidth = other.borderWidth;
        borderColor = other.borderColor;
    }
    if (other.what & eDefaultFrameRateCompatibilityChanged) {
        what |= eDefaultFrameRateCompatibilityChanged;
        defaultFrameRateCompatibility = other.defaultFrameRateCompatibility;
@@ -794,7 +770,6 @@ uint64_t layer_state_t::diff(const layer_state_t& other) const {
    CHECK_DIFF2(diff, eBackgroundColorChanged, other, bgColor, bgColorDataspace);
    if (other.what & eMetadataChanged) diff |= eMetadataChanged;
    CHECK_DIFF(diff, eShadowRadiusChanged, other, shadowRadius);
    CHECK_DIFF3(diff, eRenderBorderChanged, other, borderEnabled, borderWidth, borderColor);
    CHECK_DIFF(diff, eDefaultFrameRateCompatibilityChanged, other, defaultFrameRateCompatibility);
    CHECK_DIFF(diff, eFrameRateSelectionPriority, other, frameRateSelectionPriority);
    CHECK_DIFF3(diff, eFrameRateChanged, other, frameRate, frameRateCompatibility,
+0 −17
Original line number Diff line number Diff line
@@ -2250,23 +2250,6 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setDropI
    return *this;
}

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::enableBorder(
        const sp<SurfaceControl>& sc, bool shouldEnable, float width, const half4& color) {
    layer_state_t* s = getLayerState(sc);
    if (!s) {
        mStatus = BAD_INDEX;
        return *this;
    }

    s->what |= layer_state_t::eRenderBorderChanged;
    s->borderEnabled = shouldEnable;
    s->borderWidth = width;
    s->borderColor = color;

    registerSurfaceControlForCallback(sc);
    return *this;
}

// ---------------------------------------------------------------------------

DisplayState& SurfaceComposerClient::Transaction::getDisplayState(const sp<IBinder>& token) {
+2 −8
Original line number Diff line number Diff line
@@ -179,7 +179,6 @@ struct layer_state_t {
        eCachingHintChanged = 0x00000200,
        eDimmingEnabledChanged = 0x00000400,
        eShadowRadiusChanged = 0x00000800,
        eRenderBorderChanged = 0x00001000,
        eBufferCropChanged = 0x00002000,
        eRelativeLayerChanged = 0x00004000,
        eReparent = 0x00008000,
@@ -258,8 +257,8 @@ struct layer_state_t {
            layer_state_t::eBlurRegionsChanged | layer_state_t::eColorChanged |
            layer_state_t::eColorSpaceAgnosticChanged | layer_state_t::eColorTransformChanged |
            layer_state_t::eCornerRadiusChanged | layer_state_t::eDimmingEnabledChanged |
            layer_state_t::eHdrMetadataChanged | layer_state_t::eRenderBorderChanged |
            layer_state_t::eShadowRadiusChanged | layer_state_t::eStretchChanged;
            layer_state_t::eHdrMetadataChanged | layer_state_t::eShadowRadiusChanged |
            layer_state_t::eStretchChanged;

    // Changes which invalidates the layer's visible region in CE.
    static constexpr uint64_t CONTENT_DIRTY = layer_state_t::CONTENT_CHANGES |
@@ -388,11 +387,6 @@ struct layer_state_t {
    // should be trusted for input occlusion detection purposes
    bool isTrustedOverlay;

    // Flag to indicate if border needs to be enabled on the layer
    bool borderEnabled;
    float borderWidth;
    half4 borderColor;

    // Stretch effect to be applied to this layer
    StretchEffect stretchEffect;

+0 −3
Original line number Diff line number Diff line
@@ -744,9 +744,6 @@ public:
                                         const Rect& destinationFrame);
        Transaction& setDropInputMode(const sp<SurfaceControl>& sc, gui::DropInputMode mode);

        Transaction& enableBorder(const sp<SurfaceControl>& sc, bool shouldEnable, float width,
                                  const half4& color);

        status_t setDisplaySurface(const sp<IBinder>& token,
                const sp<IGraphicBufferProducer>& bufferProducer);

+0 −36
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.
 */

#pragma once
#include <math/mat4.h>
#include <ui/Region.h>

namespace android {
namespace renderengine {

struct BorderRenderInfo {
    float width = 0;
    half4 color;
    Region combinedRegion;

    bool operator==(const BorderRenderInfo& rhs) const {
        return (width == rhs.width && color == rhs.color &&
                combinedRegion.hasSameRects(rhs.combinedRegion));
    }
};

} // namespace renderengine
} // namespace android
 No newline at end of file
Loading