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

Commit 07e33212 authored by Lloyd Pique's avatar Lloyd Pique
Browse files

SF: Move management of HWC layers to compositionengine::OutputLayer

OutputLayer creates a HWC layer (if appropriate) on initialization, and
the HWC layer is destroyed with the OutputLayer.

Removes all explicit calls to create/destroy the HWC layers from the front-end
Layer code, and a few other places.

A call is also added to destroy all OutputLayers before switching in or
out of VrComposer mode. This change already marked the geometry as dirty
-- this just ensures all the HWC layers are recreated.

Test: atest libsurfaceflinger_unittest libcompositionengine_test
Test: atest dvr_display-test
Test: atest CtsViewTestCases
Bug: 121291683
Bug: 124537779
Change-Id: Ib7aec9e998ed5481d2753d19b061ba922e54bfe0
parent 35d58247
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -69,13 +69,6 @@ BufferLayer::BufferLayer(const LayerCreationArgs& args)

BufferLayer::~BufferLayer() {
    mFlinger->deleteTextureAsync(mTextureName);

    if (destroyAllHwcLayersPlusChildren()) {
        ALOGE("Found stale hardware composer layers when destroying "
              "surface flinger layer %s",
              mName.string());
    }

    mFlinger->mTimeStats->onDestroy(getSequence());
}

+4 −0
Original line number Diff line number Diff line
@@ -36,6 +36,10 @@ namespace android::compositionengine {
 * Used by LayerFE::getCompositionState
 */
struct LayerFECompositionState {
    // TODO(lpique): b/121291683 Remove this one we are sure we don't need the
    // value recomputed / set every frame.
    Region geomVisibleRegion;

    /*
     * Presentation
     */
+5 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#pragma once

#include <cstdint>
#include <optional>
#include <string>

#include <math/mat4.h>
@@ -25,6 +26,8 @@
#include <ui/Transform.h>
#include <utils/StrongPointer.h>

#include "DisplayHardware/DisplayIdentification.h"

namespace android::compositionengine {

class DisplayColorProfile;
@@ -117,7 +120,8 @@ public:
    // Gets the OutputLayer corresponding to the input Layer instance from the
    // current ordered set of output layers. If there is no such layer, a new
    // one is created and returned.
    virtual std::unique_ptr<OutputLayer> getOrCreateOutputLayer(std::shared_ptr<Layer>,
    virtual std::unique_ptr<OutputLayer> getOrCreateOutputLayer(std::optional<DisplayId>,
                                                                std::shared_ptr<Layer>,
                                                                sp<LayerFE>) = 0;

    // Sets the new ordered set of output layers for this output
+4 −0
Original line number Diff line number Diff line
@@ -16,14 +16,18 @@

#pragma once

#include <optional>
#include <string>

#include <utils/StrongPointer.h>

#include "DisplayHardware/DisplayIdentification.h"

namespace android {

namespace compositionengine {

class CompositionEngine;
class Output;
class Layer;
class LayerFE;
+2 −1
Original line number Diff line number Diff line
@@ -67,7 +67,8 @@ public:
    compositionengine::OutputLayer* getOutputLayerForLayer(
            compositionengine::Layer*) const override;
    std::unique_ptr<compositionengine::OutputLayer> getOrCreateOutputLayer(
            std::shared_ptr<compositionengine::Layer>, sp<LayerFE>) override;
            std::optional<DisplayId>, std::shared_ptr<compositionengine::Layer>,
            sp<LayerFE>) override;
    void setOutputLayersOrderedByZ(OutputLayers&&) override;
    const OutputLayers& getOutputLayersOrderedByZ() const override;

Loading