Loading services/surfaceflinger/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,7 @@ filegroup { "HwcSlotGenerator.cpp", "WindowInfosListenerInvoker.cpp", "Layer.cpp", "LayerFE.cpp", "LayerProtoHelper.cpp", "LayerRenderArea.cpp", "LayerVector.cpp", Loading services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h +3 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,9 @@ public: // Requested white point of the layer in nits const float whitePointNits; // True if layers with 170M dataspace should be overridden to sRGB. const bool treat170mAsSrgb; }; // A superset of LayerSettings required by RenderEngine to compose a layer Loading services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/LayerState.h +10 −5 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ enum class LayerStateField : uint32_t { SolidColor = 1u << 16, BackgroundBlurRadius = 1u << 17, BlurRegions = 1u << 18, HasProtectedContent = 1u << 19, }; // clang-format on Loading Loading @@ -245,9 +246,9 @@ public: ui::Dataspace getDataspace() const { return mOutputDataspace.get(); } bool isProtected() const { return getOutputLayer()->getLayerFE().getCompositionState()->hasProtectedContent; } wp<GraphicBuffer> getBuffer() const { return mBuffer.get(); } bool isProtected() const { return mIsProtected.get(); } bool hasSolidColorCompositionType() const { return getOutputLayer()->getLayerFE().getCompositionState()->compositionType == Loading Loading @@ -482,7 +483,11 @@ private: return hash; }}; static const constexpr size_t kNumNonUniqueFields = 17; OutputLayerState<bool, LayerStateField::HasProtectedContent> mIsProtected{[](auto layer) { return layer->getLayerFE().getCompositionState()->hasProtectedContent; }}; static const constexpr size_t kNumNonUniqueFields = 18; std::array<StateInterface*, kNumNonUniqueFields> getNonUniqueFields() { std::array<const StateInterface*, kNumNonUniqueFields> constFields = Loading @@ -501,7 +506,7 @@ private: &mAlpha, &mLayerMetadata, &mVisibleRegion, &mOutputDataspace, &mPixelFormat, &mColorTransform, &mCompositionType, &mSidebandStream, &mBuffer, &mSolidColor, &mBackgroundBlurRadius, &mBlurRegions, &mFrameNumber, &mFrameNumber, &mIsProtected, }; } }; Loading services/surfaceflinger/CompositionEngine/src/Output.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -900,6 +900,13 @@ ui::Dataspace Output::getBestDataspace(ui::Dataspace* outHdrDataSpace, ui::Dataspace bestDataSpace = ui::Dataspace::V0_SRGB; *outHdrDataSpace = ui::Dataspace::UNKNOWN; // An Output's layers may be stale when it is disabled. As a consequence, the layers returned by // getOutputLayersOrderedByZ may not be in a valid state and it is not safe to access their // properties. Return a default dataspace value in this case. if (!getState().isEnabled) { return ui::Dataspace::V0_SRGB; } for (const auto* layer : getOutputLayersOrderedByZ()) { switch (layer->getLayerFE().getCompositionState()->dataspace) { case ui::Dataspace::V0_SCRGB: Loading Loading @@ -1420,7 +1427,8 @@ std::vector<LayerFE::LayerSettings> Output::generateClientCompositionRequests( .realContentIsVisible = realContentIsVisible, .clearContent = !clientComposition, .blurSetting = blurSetting, .whitePointNits = layerState.whitePointNits}; .whitePointNits = layerState.whitePointNits, .treat170mAsSrgb = outputState.treat170mAsSrgb}; if (auto clientCompositionSettings = layerFE.prepareClientComposition(targetSettings)) { clientCompositionLayers.push_back(std::move(*clientCompositionSettings)); Loading services/surfaceflinger/CompositionEngine/src/planner/CachedSet.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -411,8 +411,8 @@ void CachedSet::dump(std::string& result) const { if (mLayers.size() == 1) { base::StringAppendF(&result, " Layer [%s]\n", mLayers[0].getName().c_str()); if (auto* buffer = mLayers[0].getBuffer().get()) { base::StringAppendF(&result, " Buffer %p", buffer); if (const sp<GraphicBuffer> buffer = mLayers[0].getState()->getBuffer().promote()) { base::StringAppendF(&result, " Buffer %p", buffer.get()); base::StringAppendF(&result, " Format %s", decodePixelFormat(buffer->getPixelFormat()).c_str()); } Loading @@ -422,8 +422,8 @@ void CachedSet::dump(std::string& result) const { result.append(" Cached set of:\n"); for (const Layer& layer : mLayers) { base::StringAppendF(&result, " Layer [%s]\n", layer.getName().c_str()); if (auto* buffer = layer.getBuffer().get()) { base::StringAppendF(&result, " Buffer %p", buffer); if (const sp<GraphicBuffer> buffer = layer.getState()->getBuffer().promote()) { base::StringAppendF(&result, " Buffer %p", buffer.get()); base::StringAppendF(&result, " Format[%s]", decodePixelFormat(buffer->getPixelFormat()).c_str()); } Loading Loading
services/surfaceflinger/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,7 @@ filegroup { "HwcSlotGenerator.cpp", "WindowInfosListenerInvoker.cpp", "Layer.cpp", "LayerFE.cpp", "LayerProtoHelper.cpp", "LayerRenderArea.cpp", "LayerVector.cpp", Loading
services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h +3 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,9 @@ public: // Requested white point of the layer in nits const float whitePointNits; // True if layers with 170M dataspace should be overridden to sRGB. const bool treat170mAsSrgb; }; // A superset of LayerSettings required by RenderEngine to compose a layer Loading
services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/LayerState.h +10 −5 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ enum class LayerStateField : uint32_t { SolidColor = 1u << 16, BackgroundBlurRadius = 1u << 17, BlurRegions = 1u << 18, HasProtectedContent = 1u << 19, }; // clang-format on Loading Loading @@ -245,9 +246,9 @@ public: ui::Dataspace getDataspace() const { return mOutputDataspace.get(); } bool isProtected() const { return getOutputLayer()->getLayerFE().getCompositionState()->hasProtectedContent; } wp<GraphicBuffer> getBuffer() const { return mBuffer.get(); } bool isProtected() const { return mIsProtected.get(); } bool hasSolidColorCompositionType() const { return getOutputLayer()->getLayerFE().getCompositionState()->compositionType == Loading Loading @@ -482,7 +483,11 @@ private: return hash; }}; static const constexpr size_t kNumNonUniqueFields = 17; OutputLayerState<bool, LayerStateField::HasProtectedContent> mIsProtected{[](auto layer) { return layer->getLayerFE().getCompositionState()->hasProtectedContent; }}; static const constexpr size_t kNumNonUniqueFields = 18; std::array<StateInterface*, kNumNonUniqueFields> getNonUniqueFields() { std::array<const StateInterface*, kNumNonUniqueFields> constFields = Loading @@ -501,7 +506,7 @@ private: &mAlpha, &mLayerMetadata, &mVisibleRegion, &mOutputDataspace, &mPixelFormat, &mColorTransform, &mCompositionType, &mSidebandStream, &mBuffer, &mSolidColor, &mBackgroundBlurRadius, &mBlurRegions, &mFrameNumber, &mFrameNumber, &mIsProtected, }; } }; Loading
services/surfaceflinger/CompositionEngine/src/Output.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -900,6 +900,13 @@ ui::Dataspace Output::getBestDataspace(ui::Dataspace* outHdrDataSpace, ui::Dataspace bestDataSpace = ui::Dataspace::V0_SRGB; *outHdrDataSpace = ui::Dataspace::UNKNOWN; // An Output's layers may be stale when it is disabled. As a consequence, the layers returned by // getOutputLayersOrderedByZ may not be in a valid state and it is not safe to access their // properties. Return a default dataspace value in this case. if (!getState().isEnabled) { return ui::Dataspace::V0_SRGB; } for (const auto* layer : getOutputLayersOrderedByZ()) { switch (layer->getLayerFE().getCompositionState()->dataspace) { case ui::Dataspace::V0_SCRGB: Loading Loading @@ -1420,7 +1427,8 @@ std::vector<LayerFE::LayerSettings> Output::generateClientCompositionRequests( .realContentIsVisible = realContentIsVisible, .clearContent = !clientComposition, .blurSetting = blurSetting, .whitePointNits = layerState.whitePointNits}; .whitePointNits = layerState.whitePointNits, .treat170mAsSrgb = outputState.treat170mAsSrgb}; if (auto clientCompositionSettings = layerFE.prepareClientComposition(targetSettings)) { clientCompositionLayers.push_back(std::move(*clientCompositionSettings)); Loading
services/surfaceflinger/CompositionEngine/src/planner/CachedSet.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -411,8 +411,8 @@ void CachedSet::dump(std::string& result) const { if (mLayers.size() == 1) { base::StringAppendF(&result, " Layer [%s]\n", mLayers[0].getName().c_str()); if (auto* buffer = mLayers[0].getBuffer().get()) { base::StringAppendF(&result, " Buffer %p", buffer); if (const sp<GraphicBuffer> buffer = mLayers[0].getState()->getBuffer().promote()) { base::StringAppendF(&result, " Buffer %p", buffer.get()); base::StringAppendF(&result, " Format %s", decodePixelFormat(buffer->getPixelFormat()).c_str()); } Loading @@ -422,8 +422,8 @@ void CachedSet::dump(std::string& result) const { result.append(" Cached set of:\n"); for (const Layer& layer : mLayers) { base::StringAppendF(&result, " Layer [%s]\n", layer.getName().c_str()); if (auto* buffer = layer.getBuffer().get()) { base::StringAppendF(&result, " Buffer %p", buffer); if (const sp<GraphicBuffer> buffer = layer.getState()->getBuffer().promote()) { base::StringAppendF(&result, " Buffer %p", buffer.get()); base::StringAppendF(&result, " Format[%s]", decodePixelFormat(buffer->getPixelFormat()).c_str()); } Loading