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

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

Rename invalid LayerStacks to "unassigned"

"Invalid" can be confusing since this LayerStack value
is actually valid and can be used to represent offscreen
layers.

Bug: b/397775142
Test: atest SurfaceFlinger_test
Flag: EXEMPT, renaming
Change-Id: I1432107ae4a088aecc5baefad7db54e49cdc7bbf
parent 2dc2afe2
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@
namespace android::ui {

// A LayerStack identifies a Z-ordered group of layers. A layer can only be associated to a single
// LayerStack, but a LayerStack can be associated to multiple displays, mirroring the same content.
// LayerStack, and a LayerStack should be unique to each display in the composition target.
struct LayerStack {
    uint32_t id = UINT32_MAX;

@@ -40,7 +40,9 @@ struct LayerStack {
    }
};

constexpr LayerStack INVALID_LAYER_STACK;
// An unassigned LayerStack can indicate that a layer is offscreen and will not be
// rendered onto a display. Multiple displays are allowed to have unassigned LayerStacks.
constexpr LayerStack UNASSIGNED_LAYER_STACK;
constexpr LayerStack DEFAULT_LAYER_STACK{0u};

inline bool operator==(LayerStack lhs, LayerStack rhs) {
@@ -70,7 +72,7 @@ struct LayerFilter {
    // Returns true if the input filter can be output to this filter.
    bool includes(LayerFilter other) const {
        // The layer stacks must match.
        if (other.layerStack == INVALID_LAYER_STACK || other.layerStack != layerStack) {
        if (other.layerStack == UNASSIGNED_LAYER_STACK || other.layerStack != layerStack) {
            return false;
        }

+3 −3
Original line number Diff line number Diff line
@@ -302,7 +302,7 @@ TEST_F(DisplaySetConfigurationTest, configuresPhysicalDisplay) {
    EXPECT_FALSE(mDisplay->isValid());

    const auto& filter = mDisplay->getState().layerFilter;
    EXPECT_EQ(ui::INVALID_LAYER_STACK, filter.layerStack);
    EXPECT_EQ(ui::UNASSIGNED_LAYER_STACK, filter.layerStack);
    EXPECT_FALSE(filter.toInternalDisplay);
}

@@ -322,7 +322,7 @@ TEST_F(DisplaySetConfigurationTest, configuresHalVirtualDisplay) {
    EXPECT_FALSE(mDisplay->isValid());

    const auto& filter = mDisplay->getState().layerFilter;
    EXPECT_EQ(ui::INVALID_LAYER_STACK, filter.layerStack);
    EXPECT_EQ(ui::UNASSIGNED_LAYER_STACK, filter.layerStack);
    EXPECT_FALSE(filter.toInternalDisplay);
}

@@ -342,7 +342,7 @@ TEST_F(DisplaySetConfigurationTest, configuresGpuVirtualDisplay) {
    EXPECT_FALSE(mDisplay->isValid());

    const auto& filter = mDisplay->getState().layerFilter;
    EXPECT_EQ(ui::INVALID_LAYER_STACK, filter.layerStack);
    EXPECT_EQ(ui::UNASSIGNED_LAYER_STACK, filter.layerStack);
    EXPECT_FALSE(filter.toInternalDisplay);
}

+4 −4
Original line number Diff line number Diff line
@@ -646,8 +646,8 @@ TEST_F(OutputTest, layerFiltering) {
    mOutput->setLayerFilter({layerStack1, true});

    // It excludes layers with no layer stack, internal-only or not.
    EXPECT_FALSE(mOutput->includesLayer({ui::INVALID_LAYER_STACK, false}));
    EXPECT_FALSE(mOutput->includesLayer({ui::INVALID_LAYER_STACK, true}));
    EXPECT_FALSE(mOutput->includesLayer({ui::UNASSIGNED_LAYER_STACK, false}));
    EXPECT_FALSE(mOutput->includesLayer({ui::UNASSIGNED_LAYER_STACK, true}));

    // It includes layers on layerStack1, internal-only or not.
    EXPECT_TRUE(mOutput->includesLayer({layerStack1, false}));
@@ -685,10 +685,10 @@ TEST_F(OutputTest, layerFilteringWithCompositionState) {
    mOutput->setLayerFilter({layerStack1, true});

    // It excludes layers with no layer stack, internal-only or not.
    layer.layerFEState.outputFilter = {ui::INVALID_LAYER_STACK, false};
    layer.layerFEState.outputFilter = {ui::UNASSIGNED_LAYER_STACK, false};
    EXPECT_FALSE(mOutput->includesLayer(layerFE));

    layer.layerFEState.outputFilter = {ui::INVALID_LAYER_STACK, true};
    layer.layerFEState.outputFilter = {ui::UNASSIGNED_LAYER_STACK, true};
    EXPECT_FALSE(mOutput->includesLayer(layerFE));

    // It includes layers on layerStack1, internal-only or not.
+1 −1
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ std::string LayerCreationArgs::getDebugString() const {
    if (layerIdToMirror != UNASSIGNED_LAYER_ID) {
        stream << " layerIdToMirror=" << layerIdToMirror;
    }
    if (layerStackToMirror != ui::INVALID_LAYER_STACK) {
    if (layerStackToMirror != ui::UNASSIGNED_LAYER_STACK) {
        stream << " layerStackToMirror=" << layerStackToMirror.id;
    }
    return stream.str();
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ struct LayerCreationArgs {
    bool addToRoot = true;
    wp<IBinder> parentHandle = nullptr;
    wp<IBinder> mirrorLayerHandle = nullptr;
    ui::LayerStack layerStackToMirror = ui::INVALID_LAYER_STACK;
    ui::LayerStack layerStackToMirror = ui::UNASSIGNED_LAYER_STACK;
    uint32_t parentId = UNASSIGNED_LAYER_ID;
    uint32_t layerIdToMirror = UNASSIGNED_LAYER_ID;
    std::atomic<int32_t>* pendingBuffers = 0;
Loading