surfaceflinger: use layer drawing dataspace
Layer::getDataSpace returns the current (as opposed to drawing)
dataspace, which we almost never want and is racy. Remove the
helper and access the dataspace directly.
Bug: 79210409
Test: boots, Photos
Change-Id: Ifec7055cf0a1f2d84da7ad58e27be2c01082e6e9
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 9043234..2077598 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -1337,10 +1337,6 @@
return true;
}
-ui::Dataspace Layer::getDataSpace() const {
- return mCurrentState.dataSpace;
-}
-
uint32_t Layer::getLayerStack() const {
auto p = mDrawingParent.promote();
if (p == nullptr) {
@@ -1433,7 +1429,7 @@
info.mColor = ds.color;
info.mFlags = ds.flags;
info.mPixelFormat = getPixelFormat();
- info.mDataSpace = static_cast<android_dataspace>(getDataSpace());
+ info.mDataSpace = static_cast<android_dataspace>(ds.dataSpace);
info.mMatrix[0][0] = ds.active.transform[0][0];
info.mMatrix[0][1] = ds.active.transform[0][1];
info.mMatrix[1][0] = ds.active.transform[1][0];
@@ -1960,7 +1956,7 @@
layerInfo->set_is_opaque(isOpaque(state));
layerInfo->set_invalidate(contentDirty);
- layerInfo->set_dataspace(dataspaceDetails(static_cast<android_dataspace>(getDataSpace())));
+ layerInfo->set_dataspace(dataspaceDetails(static_cast<android_dataspace>(state.dataSpace)));
layerInfo->set_pixel_format(decodePixelFormat(getPixelFormat()));
LayerProtoHelper::writeToProto(getColor(), layerInfo->mutable_color());
LayerProtoHelper::writeToProto(state.color, layerInfo->mutable_requested_color());