From b153bab27d07608ba68f7af129fffbad461bcb16 Mon Sep 17 00:00:00 2001 From: Valerie Hau Date: Tue, 5 Mar 2019 10:47:28 -0800 Subject: [PATCH] Plumb dataspace for color layers Bug: 123634023 Test: build, boot Change-Id: Ifad7508a88b2b70f13ec2b7e43903db23e681bb3 --- services/surfaceflinger/ColorLayer.cpp | 17 +++++++++++++++++ services/surfaceflinger/ColorLayer.h | 4 ++++ services/surfaceflinger/Layer.h | 6 ++++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/services/surfaceflinger/ColorLayer.cpp b/services/surfaceflinger/ColorLayer.cpp index 2aeece7756..347cee3fd4 100644 --- a/services/surfaceflinger/ColorLayer.cpp +++ b/services/surfaceflinger/ColorLayer.cpp @@ -79,6 +79,18 @@ bool ColorLayer::setColor(const half3& color) { return true; } +bool ColorLayer::setDataspace(ui::Dataspace dataspace) { + if (mCurrentState.dataspace == dataspace) { + return false; + } + + mCurrentState.sequence++; + mCurrentState.dataspace = dataspace; + mCurrentState.modified = true; + setTransactionFlags(eTransactionNeeded); + return true; +} + void ColorLayer::setPerFrameData(const sp& display, const ui::Transform& transform, const Rect& viewport, int32_t /* supportedPerFrameMetadata */) { @@ -146,6 +158,11 @@ void ColorLayer::setPerFrameData(const sp& display, layerCompositionState.surfaceDamage = surfaceDamageRegion; } +void ColorLayer::commitTransaction(const State& stateToCommit) { + Layer::commitTransaction(stateToCommit); + mCurrentDataSpace = mDrawingState.dataspace; +} + std::shared_ptr ColorLayer::getCompositionLayer() const { return mCompositionLayer; } diff --git a/services/surfaceflinger/ColorLayer.h b/services/surfaceflinger/ColorLayer.h index 9786419796..948c609e41 100644 --- a/services/surfaceflinger/ColorLayer.h +++ b/services/surfaceflinger/ColorLayer.h @@ -35,9 +35,13 @@ public: bool setColor(const half3& color) override; + bool setDataspace(ui::Dataspace dataspace) override; + void setPerFrameData(const sp& display, const ui::Transform& transform, const Rect& viewport, int32_t supportedPerFrameMetadata) override; + void commitTransaction(const State& stateToCommit) override; + bool onPreComposition(nsecs_t /*refreshStartTime*/) override { return false; } protected: diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index 046482cb6f..5c3542c30e 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -182,6 +182,9 @@ public: bool inputInfoChanged; InputWindowInfo inputInfo; + // dataspace is only used by BufferStateLayer and ColorLayer + ui::Dataspace dataspace; + // The fields below this point are only used by BufferStateLayer Geometry active; @@ -193,7 +196,6 @@ public: sp buffer; sp acquireFence; - ui::Dataspace dataspace; HdrMetadata hdrMetadata; Region surfaceDamageRegion; int32_t api; @@ -687,7 +689,7 @@ protected: // For unit tests friend class TestableSurfaceFlinger; - void commitTransaction(const State& stateToCommit); + virtual void commitTransaction(const State& stateToCommit); uint32_t getEffectiveUsage(uint32_t usage) const; -- 2.11.0