Plumb dataspace for color layers
Bug: 123634023
Test: build, boot
Change-Id: Ifad7508a88b2b70f13ec2b7e43903db23e681bb3
diff --git a/services/surfaceflinger/ColorLayer.cpp b/services/surfaceflinger/ColorLayer.cpp
index 2aeece7..347cee3 100644
--- a/services/surfaceflinger/ColorLayer.cpp
+++ b/services/surfaceflinger/ColorLayer.cpp
@@ -79,6 +79,18 @@
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<const DisplayDevice>& display,
const ui::Transform& transform, const Rect& viewport,
int32_t /* supportedPerFrameMetadata */) {
@@ -146,6 +158,11 @@
layerCompositionState.surfaceDamage = surfaceDamageRegion;
}
+void ColorLayer::commitTransaction(const State& stateToCommit) {
+ Layer::commitTransaction(stateToCommit);
+ mCurrentDataSpace = mDrawingState.dataspace;
+}
+
std::shared_ptr<compositionengine::Layer> ColorLayer::getCompositionLayer() const {
return mCompositionLayer;
}
diff --git a/services/surfaceflinger/ColorLayer.h b/services/surfaceflinger/ColorLayer.h
index 9786419..948c609 100644
--- a/services/surfaceflinger/ColorLayer.h
+++ b/services/surfaceflinger/ColorLayer.h
@@ -35,9 +35,13 @@
bool setColor(const half3& color) override;
+ bool setDataspace(ui::Dataspace dataspace) override;
+
void setPerFrameData(const sp<const DisplayDevice>& 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 046482c..5c3542c 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -182,6 +182,9 @@
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 @@
sp<GraphicBuffer> buffer;
sp<Fence> acquireFence;
- ui::Dataspace dataspace;
HdrMetadata hdrMetadata;
Region surfaceDamageRegion;
int32_t api;
@@ -687,7 +689,7 @@
// For unit tests
friend class TestableSurfaceFlinger;
- void commitTransaction(const State& stateToCommit);
+ virtual void commitTransaction(const State& stateToCommit);
uint32_t getEffectiveUsage(uint32_t usage) const;