Loading libs/gui/include/gui/LayerState.h +5 −0 Original line number Diff line number Diff line Loading @@ -302,6 +302,11 @@ struct layer_state_t { static constexpr uint64_t VISIBLE_REGION_CHANGES = layer_state_t::GEOMETRY_CHANGES | layer_state_t::HIERARCHY_CHANGES | layer_state_t::eAlphaChanged; // Changes that force GPU composition. static constexpr uint64_t COMPOSITION_EFFECTS = layer_state_t::eBackgroundBlurRadiusChanged | layer_state_t::eBlurRegionsChanged | layer_state_t::eCornerRadiusChanged | layer_state_t::eShadowRadiusChanged | layer_state_t::eStretchChanged; bool hasValidBuffer() const; void sanitize(int32_t permissions); Loading services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h +9 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,10 @@ #include <utils/RefBase.h> #include <utils/Timers.h> namespace aidl::android::hardware::graphics::composer3 { enum class Composition; } namespace android { class Fence; Loading Loading @@ -176,6 +180,11 @@ public: // Whether the layer should be rendered with rounded corners. virtual bool hasRoundedCorners() const = 0; virtual void setWasClientComposed(const sp<Fence>&) {} virtual void setHwcCompositionType( aidl::android::hardware::graphics::composer3::Composition) = 0; virtual aidl::android::hardware::graphics::composer3::Composition getHwcCompositionType() const = 0; virtual const gui::LayerMetadata* getMetadata() const = 0; virtual const gui::LayerMetadata* getRelativeMetadata() const = 0; }; Loading services/surfaceflinger/CompositionEngine/include/compositionengine/mock/LayerFE.h +4 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,10 @@ public: MOCK_CONST_METHOD0(getMetadata, gui::LayerMetadata*()); MOCK_CONST_METHOD0(getRelativeMetadata, gui::LayerMetadata*()); MOCK_METHOD0(onPictureProfileCommitted, void()); MOCK_METHOD(void, setHwcCompositionType, (aidl::android::hardware::graphics::composer3::Composition), (override)); MOCK_METHOD(aidl::android::hardware::graphics::composer3::Composition, getHwcCompositionType, (), (const, override)); }; } // namespace android::compositionengine::mock services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -867,6 +867,7 @@ void OutputLayer::writeCompositionTypeToHWC(HWC2::Layer* hwcLayer, if (outputDependentState.hwc->hwcCompositionType != requestedCompositionType || (outputDependentState.hwc->layerSkipped && !skipLayer)) { outputDependentState.hwc->hwcCompositionType = requestedCompositionType; getLayerFE().setHwcCompositionType(requestedCompositionType); if (auto error = hwcLayer->setCompositionType(requestedCompositionType); error != hal::Error::NONE) { Loading Loading @@ -964,6 +965,7 @@ void OutputLayer::applyDeviceCompositionTypeChange(Composition compositionType) } hwcState.hwcCompositionType = compositionType; getLayerFE().setHwcCompositionType(compositionType); } void OutputLayer::prepareForDeviceLayerRequests() { Loading services/surfaceflinger/FrontEnd/LayerSnapshot.cpp +51 −1 Original line number Diff line number Diff line Loading @@ -18,12 +18,17 @@ #undef LOG_TAG #define LOG_TAG "SurfaceFlinger" #include "LayerSnapshot.h" #include <PowerAdvisor/Workload.h> #include <aidl/android/hardware/graphics/composer3/Composition.h> #include <gui/LayerState.h> #include "Layer.h" #include "LayerSnapshot.h" namespace android::surfaceflinger::frontend { using namespace ftl::flag_operators; using namespace aidl::android::hardware::graphics::composer3; namespace { Loading Loading @@ -532,4 +537,49 @@ void LayerSnapshot::merge(const RequestedLayerState& requested, bool forceUpdate } } char LayerSnapshot::classifyCompositionForDebug(Composition compositionType) const { if (!isVisible) { return '.'; } switch (compositionType) { case Composition::INVALID: return 'i'; case Composition::SOLID_COLOR: return 'c'; case Composition::CURSOR: return 'u'; case Composition::SIDEBAND: return 'd'; case Composition::DISPLAY_DECORATION: return 'a'; case Composition::REFRESH_RATE_INDICATOR: return 'r'; case Composition::CLIENT: case Composition::DEVICE: break; } char code = '.'; // Default to invisible if (hasBufferOrSidebandStream()) { code = 'b'; } else if (fillsColor()) { code = 'c'; // Solid color } else if (hasBlur()) { code = 'l'; // Blur } else if (hasProtectedContent) { code = 'p'; // Protected content } else if (drawShadows()) { code = 's'; // Shadow } else if (roundedCorner.hasRoundedCorners()) { code = 'r'; // Rounded corners } if (compositionType == Composition::CLIENT) { return static_cast<char>(std::toupper(code)); } else { return code; } } } // namespace android::surfaceflinger::frontend Loading
libs/gui/include/gui/LayerState.h +5 −0 Original line number Diff line number Diff line Loading @@ -302,6 +302,11 @@ struct layer_state_t { static constexpr uint64_t VISIBLE_REGION_CHANGES = layer_state_t::GEOMETRY_CHANGES | layer_state_t::HIERARCHY_CHANGES | layer_state_t::eAlphaChanged; // Changes that force GPU composition. static constexpr uint64_t COMPOSITION_EFFECTS = layer_state_t::eBackgroundBlurRadiusChanged | layer_state_t::eBlurRegionsChanged | layer_state_t::eCornerRadiusChanged | layer_state_t::eShadowRadiusChanged | layer_state_t::eStretchChanged; bool hasValidBuffer() const; void sanitize(int32_t permissions); Loading
services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h +9 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,10 @@ #include <utils/RefBase.h> #include <utils/Timers.h> namespace aidl::android::hardware::graphics::composer3 { enum class Composition; } namespace android { class Fence; Loading Loading @@ -176,6 +180,11 @@ public: // Whether the layer should be rendered with rounded corners. virtual bool hasRoundedCorners() const = 0; virtual void setWasClientComposed(const sp<Fence>&) {} virtual void setHwcCompositionType( aidl::android::hardware::graphics::composer3::Composition) = 0; virtual aidl::android::hardware::graphics::composer3::Composition getHwcCompositionType() const = 0; virtual const gui::LayerMetadata* getMetadata() const = 0; virtual const gui::LayerMetadata* getRelativeMetadata() const = 0; }; Loading
services/surfaceflinger/CompositionEngine/include/compositionengine/mock/LayerFE.h +4 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,10 @@ public: MOCK_CONST_METHOD0(getMetadata, gui::LayerMetadata*()); MOCK_CONST_METHOD0(getRelativeMetadata, gui::LayerMetadata*()); MOCK_METHOD0(onPictureProfileCommitted, void()); MOCK_METHOD(void, setHwcCompositionType, (aidl::android::hardware::graphics::composer3::Composition), (override)); MOCK_METHOD(aidl::android::hardware::graphics::composer3::Composition, getHwcCompositionType, (), (const, override)); }; } // namespace android::compositionengine::mock
services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -867,6 +867,7 @@ void OutputLayer::writeCompositionTypeToHWC(HWC2::Layer* hwcLayer, if (outputDependentState.hwc->hwcCompositionType != requestedCompositionType || (outputDependentState.hwc->layerSkipped && !skipLayer)) { outputDependentState.hwc->hwcCompositionType = requestedCompositionType; getLayerFE().setHwcCompositionType(requestedCompositionType); if (auto error = hwcLayer->setCompositionType(requestedCompositionType); error != hal::Error::NONE) { Loading Loading @@ -964,6 +965,7 @@ void OutputLayer::applyDeviceCompositionTypeChange(Composition compositionType) } hwcState.hwcCompositionType = compositionType; getLayerFE().setHwcCompositionType(compositionType); } void OutputLayer::prepareForDeviceLayerRequests() { Loading
services/surfaceflinger/FrontEnd/LayerSnapshot.cpp +51 −1 Original line number Diff line number Diff line Loading @@ -18,12 +18,17 @@ #undef LOG_TAG #define LOG_TAG "SurfaceFlinger" #include "LayerSnapshot.h" #include <PowerAdvisor/Workload.h> #include <aidl/android/hardware/graphics/composer3/Composition.h> #include <gui/LayerState.h> #include "Layer.h" #include "LayerSnapshot.h" namespace android::surfaceflinger::frontend { using namespace ftl::flag_operators; using namespace aidl::android::hardware::graphics::composer3; namespace { Loading Loading @@ -532,4 +537,49 @@ void LayerSnapshot::merge(const RequestedLayerState& requested, bool forceUpdate } } char LayerSnapshot::classifyCompositionForDebug(Composition compositionType) const { if (!isVisible) { return '.'; } switch (compositionType) { case Composition::INVALID: return 'i'; case Composition::SOLID_COLOR: return 'c'; case Composition::CURSOR: return 'u'; case Composition::SIDEBAND: return 'd'; case Composition::DISPLAY_DECORATION: return 'a'; case Composition::REFRESH_RATE_INDICATOR: return 'r'; case Composition::CLIENT: case Composition::DEVICE: break; } char code = '.'; // Default to invisible if (hasBufferOrSidebandStream()) { code = 'b'; } else if (fillsColor()) { code = 'c'; // Solid color } else if (hasBlur()) { code = 'l'; // Blur } else if (hasProtectedContent) { code = 'p'; // Protected content } else if (drawShadows()) { code = 's'; // Shadow } else if (roundedCorner.hasRoundedCorners()) { code = 'r'; // Rounded corners } if (compositionType == Composition::CLIENT) { return static_cast<char>(std::toupper(code)); } else { return code; } } } // namespace android::surfaceflinger::frontend