summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alec Mouri <alecmouri@google.com> 2023-08-04 21:50:55 +0000
committer Alec Mouri <alecmouri@google.com> 2023-08-07 14:18:29 +0000
commit994761f2ddc1b266158f72ef3d15c153bceeb9f1 (patch)
tree905d8526bcad96654ac1d7298d994c2095ac5dce
parent142f9c55ffef6b5ace98b7c58e357725c720a251 (diff)
Remove Y410 fields from SurfaceFlinger
Ever since RenderEngine started to use skia this was never used. It will have been three releases since then, so finish cleaning this up. Bug: 130025362 Test: builds Change-Id: Ib0328903e04d754e08b6960949898b282e3d529b
-rw-r--r--libs/renderengine/gl/GLESRenderEngine.cpp6
-rw-r--r--libs/renderengine/gl/GLESRenderEngine.h1
-rw-r--r--libs/renderengine/gl/ProgramCache.cpp32
-rw-r--r--libs/renderengine/gl/ProgramCache.h6
-rw-r--r--libs/renderengine/include/renderengine/LayerSettings.h7
-rw-r--r--libs/renderengine/include/renderengine/private/Description.h3
-rw-r--r--services/surfaceflinger/CompositionEngine/src/ClientCompositionRequestCache.cpp3
-rw-r--r--services/surfaceflinger/FrontEnd/LayerSnapshot.cpp12
-rw-r--r--services/surfaceflinger/FrontEnd/LayerSnapshot.h1
-rw-r--r--services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp4
-rw-r--r--services/surfaceflinger/Layer.cpp10
-rw-r--r--services/surfaceflinger/Layer.h2
-rw-r--r--services/surfaceflinger/LayerFE.cpp1
-rw-r--r--services/surfaceflinger/tests/unittests/CompositionTest.cpp1
14 files changed, 10 insertions, 79 deletions
diff --git a/libs/renderengine/gl/GLESRenderEngine.cpp b/libs/renderengine/gl/GLESRenderEngine.cpp
index 0d7df101f4..e7a2c7a411 100644
--- a/libs/renderengine/gl/GLESRenderEngine.cpp
+++ b/libs/renderengine/gl/GLESRenderEngine.cpp
@@ -1251,7 +1251,6 @@ void GLESRenderEngine::drawLayersInternal(
texture.setFiltering(layer.source.buffer.useTextureFiltering);
texture.setDimensions(gBuf->getWidth(), gBuf->getHeight());
- setSourceY410BT2020(layer.source.buffer.isY410BT2020);
renderengine::Mesh::VertexArray<vec2> texCoords(mesh.getTexCoordArray<vec2>());
texCoords[0] = vec2(0.0, 0.0);
@@ -1294,7 +1293,6 @@ void GLESRenderEngine::drawLayersInternal(
// Cleanup if there's a buffer source
if (layer.source.buffer.buffer != nullptr) {
disableBlending();
- setSourceY410BT2020(false);
disableTexturing();
}
}
@@ -1357,10 +1355,6 @@ void GLESRenderEngine::setupLayerBlending(bool premultipliedAlpha, bool opaque,
}
}
-void GLESRenderEngine::setSourceY410BT2020(bool enable) {
- mState.isY410BT2020 = enable;
-}
-
void GLESRenderEngine::setSourceDataSpace(Dataspace source) {
mDataSpace = source;
}
diff --git a/libs/renderengine/gl/GLESRenderEngine.h b/libs/renderengine/gl/GLESRenderEngine.h
index 402ff529d7..ea75e215cd 100644
--- a/libs/renderengine/gl/GLESRenderEngine.h
+++ b/libs/renderengine/gl/GLESRenderEngine.h
@@ -183,7 +183,6 @@ private:
void setupCornerRadiusCropSize(float width, float height);
// HDR and color management related functions and state
- void setSourceY410BT2020(bool enable);
void setSourceDataSpace(ui::Dataspace source);
void setOutputDataSpace(ui::Dataspace dataspace);
void setDisplayMaxLuminance(const float maxLuminance);
diff --git a/libs/renderengine/gl/ProgramCache.cpp b/libs/renderengine/gl/ProgramCache.cpp
index f7f2d54515..812dda04fa 100644
--- a/libs/renderengine/gl/ProgramCache.cpp
+++ b/libs/renderengine/gl/ProgramCache.cpp
@@ -98,9 +98,6 @@ void ProgramCache::primeCache(
shaderKey.set(Key::INPUT_TF_MASK, (i & 1) ?
Key::INPUT_TF_HLG : Key::INPUT_TF_ST2084);
- // Cache Y410 input on or off
- shaderKey.set(Key::Y410_BT2020_MASK, (i & 2) ?
- Key::Y410_BT2020_ON : Key::Y410_BT2020_OFF);
if (cache.count(shaderKey) == 0) {
cache.emplace(shaderKey, generateProgram(shaderKey));
shaderCount++;
@@ -161,13 +158,11 @@ void ProgramCache::primeCache(
ProgramCache::Key ProgramCache::computeKey(const Description& description) {
Key needs;
needs.set(Key::TEXTURE_MASK,
- !description.textureEnabled
- ? Key::TEXTURE_OFF
+ !description.textureEnabled ? Key::TEXTURE_OFF
: description.texture.getTextureTarget() == GL_TEXTURE_EXTERNAL_OES
- ? Key::TEXTURE_EXT
- : description.texture.getTextureTarget() == GL_TEXTURE_2D
- ? Key::TEXTURE_2D
- : Key::TEXTURE_OFF)
+ ? Key::TEXTURE_EXT
+ : description.texture.getTextureTarget() == GL_TEXTURE_2D ? Key::TEXTURE_2D
+ : Key::TEXTURE_OFF)
.set(Key::ALPHA_MASK, (description.color.a < 1) ? Key::ALPHA_LT_ONE : Key::ALPHA_EQ_ONE)
.set(Key::BLEND_MASK,
description.isPremultipliedAlpha ? Key::BLEND_PREMULT : Key::BLEND_NORMAL)
@@ -186,8 +181,6 @@ ProgramCache::Key ProgramCache::computeKey(const Description& description) {
.set(Key::ROUNDED_CORNERS_MASK,
description.cornerRadius > 0 ? Key::ROUNDED_CORNERS_ON : Key::ROUNDED_CORNERS_OFF)
.set(Key::SHADOW_MASK, description.drawShadows ? Key::SHADOW_ON : Key::SHADOW_OFF);
- needs.set(Key::Y410_BT2020_MASK,
- description.isY410BT2020 ? Key::Y410_BT2020_ON : Key::Y410_BT2020_OFF);
if (needs.hasTransformMatrix() ||
(description.inputTransferFunction != description.outputTransferFunction)) {
@@ -650,20 +643,6 @@ String8 ProgramCache::generateFragmentShader(const Key& needs) {
fs << "uniform vec4 color;";
}
- if (needs.isY410BT2020()) {
- fs << R"__SHADER__(
- vec3 convertY410BT2020(const vec3 color) {
- const vec3 offset = vec3(0.0625, 0.5, 0.5);
- const mat3 transform = mat3(
- vec3(1.1678, 1.1678, 1.1678),
- vec3( 0.0, -0.1878, 2.1481),
- vec3(1.6836, -0.6523, 0.0));
- // Y is in G, U is in R, and V is in B
- return clamp(transform * (color.grb - offset), 0.0, 1.0);
- }
- )__SHADER__";
- }
-
if (needs.hasTransformMatrix() || (needs.getInputTF() != needs.getOutputTF()) ||
needs.hasDisplayColorMatrix()) {
if (needs.needsToneMapping()) {
@@ -730,9 +709,6 @@ String8 ProgramCache::generateFragmentShader(const Key& needs) {
} else {
if (needs.isTexturing()) {
fs << "gl_FragColor = texture2D(sampler, outTexCoords);";
- if (needs.isY410BT2020()) {
- fs << "gl_FragColor.rgb = convertY410BT2020(gl_FragColor.rgb);";
- }
} else {
fs << "gl_FragColor.rgb = color.rgb;";
fs << "gl_FragColor.a = 1.0;";
diff --git a/libs/renderengine/gl/ProgramCache.h b/libs/renderengine/gl/ProgramCache.h
index 535d21cd52..b18914fd5e 100644
--- a/libs/renderengine/gl/ProgramCache.h
+++ b/libs/renderengine/gl/ProgramCache.h
@@ -108,11 +108,6 @@ public:
OUTPUT_TF_ST2084 = 2 << OUTPUT_TF_SHIFT,
OUTPUT_TF_HLG = 3 << OUTPUT_TF_SHIFT,
- Y410_BT2020_SHIFT = 12,
- Y410_BT2020_MASK = 1 << Y410_BT2020_SHIFT,
- Y410_BT2020_OFF = 0 << Y410_BT2020_SHIFT,
- Y410_BT2020_ON = 1 << Y410_BT2020_SHIFT,
-
SHADOW_SHIFT = 13,
SHADOW_MASK = 1 << SHADOW_SHIFT,
SHADOW_OFF = 0 << SHADOW_SHIFT,
@@ -180,7 +175,6 @@ public:
outputTF >>= Key::OUTPUT_TF_SHIFT;
return inputTF != outputTF;
}
- inline bool isY410BT2020() const { return (mKey & Y410_BT2020_MASK) == Y410_BT2020_ON; }
// for use by std::unordered_map
diff --git a/libs/renderengine/include/renderengine/LayerSettings.h b/libs/renderengine/include/renderengine/LayerSettings.h
index b3a617c04b..b501c4074b 100644
--- a/libs/renderengine/include/renderengine/LayerSettings.h
+++ b/libs/renderengine/include/renderengine/LayerSettings.h
@@ -64,9 +64,6 @@ struct Buffer {
// overrides the alpha channel of the buffer.
bool isOpaque = false;
- // HDR color-space setting for Y410.
- bool isY410BT2020 = false;
-
float maxLuminanceNits = 0.0;
};
@@ -189,8 +186,7 @@ static inline bool operator==(const Buffer& lhs, const Buffer& rhs) {
lhs.useTextureFiltering == rhs.useTextureFiltering &&
lhs.textureTransform == rhs.textureTransform &&
lhs.usePremultipliedAlpha == rhs.usePremultipliedAlpha &&
- lhs.isOpaque == rhs.isOpaque && lhs.isY410BT2020 == rhs.isY410BT2020 &&
- lhs.maxLuminanceNits == rhs.maxLuminanceNits;
+ lhs.isOpaque == rhs.isOpaque && lhs.maxLuminanceNits == rhs.maxLuminanceNits;
}
static inline bool operator==(const Geometry& lhs, const Geometry& rhs) {
@@ -247,7 +243,6 @@ static inline void PrintTo(const Buffer& settings, ::std::ostream* os) {
PrintMatrix(settings.textureTransform, os);
*os << "\n .usePremultipliedAlpha = " << settings.usePremultipliedAlpha;
*os << "\n .isOpaque = " << settings.isOpaque;
- *os << "\n .isY410BT2020 = " << settings.isY410BT2020;
*os << "\n .maxLuminanceNits = " << settings.maxLuminanceNits;
*os << "\n}";
}
diff --git a/libs/renderengine/include/renderengine/private/Description.h b/libs/renderengine/include/renderengine/private/Description.h
index fa6ec10b6e..2873ad7148 100644
--- a/libs/renderengine/include/renderengine/private/Description.h
+++ b/libs/renderengine/include/renderengine/private/Description.h
@@ -64,9 +64,6 @@ struct Description {
// color used when texturing is disabled or when setting alpha.
half4 color;
- // true if the sampled pixel values are in Y410/BT2020 rather than RGBA
- bool isY410BT2020 = false;
-
// transfer functions for the input/output
TransferFunction inputTransferFunction = TransferFunction::LINEAR;
TransferFunction outputTransferFunction = TransferFunction::LINEAR;
diff --git a/services/surfaceflinger/CompositionEngine/src/ClientCompositionRequestCache.cpp b/services/surfaceflinger/CompositionEngine/src/ClientCompositionRequestCache.cpp
index 7e020ee1c1..752257b810 100644
--- a/services/surfaceflinger/CompositionEngine/src/ClientCompositionRequestCache.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/ClientCompositionRequestCache.cpp
@@ -45,8 +45,7 @@ inline bool equalIgnoringBuffer(const renderengine::Buffer& lhs, const rendereng
lhs.useTextureFiltering == rhs.useTextureFiltering &&
lhs.textureTransform == rhs.textureTransform &&
lhs.usePremultipliedAlpha == rhs.usePremultipliedAlpha &&
- lhs.isOpaque == rhs.isOpaque && lhs.isY410BT2020 == rhs.isY410BT2020 &&
- lhs.maxLuminanceNits == rhs.maxLuminanceNits;
+ lhs.isOpaque == rhs.isOpaque && lhs.maxLuminanceNits == rhs.maxLuminanceNits;
}
inline bool equalIgnoringBuffer(const renderengine::LayerSettings& lhs,
diff --git a/services/surfaceflinger/FrontEnd/LayerSnapshot.cpp b/services/surfaceflinger/FrontEnd/LayerSnapshot.cpp
index ee589c3ce8..5d41fddd98 100644
--- a/services/surfaceflinger/FrontEnd/LayerSnapshot.cpp
+++ b/services/surfaceflinger/FrontEnd/LayerSnapshot.cpp
@@ -468,19 +468,9 @@ void LayerSnapshot::merge(const RequestedLayerState& requested, bool forceUpdate
if (forceUpdate ||
requested.what &
(layer_state_t::eBufferChanged | layer_state_t::eDataspaceChanged |
- layer_state_t::eApiChanged)) {
- isHdrY410 = requested.dataspace == ui::Dataspace::BT2020_ITU_PQ &&
- requested.api == NATIVE_WINDOW_API_MEDIA &&
- requested.bufferData->getPixelFormat() == HAL_PIXEL_FORMAT_RGBA_1010102;
- }
-
- if (forceUpdate ||
- requested.what &
- (layer_state_t::eBufferChanged | layer_state_t::eDataspaceChanged |
layer_state_t::eApiChanged | layer_state_t::eShadowRadiusChanged |
layer_state_t::eBlurRegionsChanged | layer_state_t::eStretchChanged)) {
- forceClientComposition = isHdrY410 || shadowSettings.length > 0 ||
- stretchEffect.hasEffect();
+ forceClientComposition = shadowSettings.length > 0 || stretchEffect.hasEffect();
}
if (forceUpdate ||
diff --git a/services/surfaceflinger/FrontEnd/LayerSnapshot.h b/services/surfaceflinger/FrontEnd/LayerSnapshot.h
index 19477fa419..92d23e2724 100644
--- a/services/surfaceflinger/FrontEnd/LayerSnapshot.h
+++ b/services/surfaceflinger/FrontEnd/LayerSnapshot.h
@@ -72,7 +72,6 @@ struct LayerSnapshot : public compositionengine::LayerFECompositionState {
Rect transformedBoundsWithoutTransparentRegion;
renderengine::ShadowSettings shadowSettings;
bool premultipliedAlpha;
- bool isHdrY410;
ui::Transform parentTransform;
Rect bufferSize;
Rect croppedBufferSize;
diff --git a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
index cf39187f0d..162b546426 100644
--- a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
+++ b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
@@ -870,8 +870,8 @@ void LayerSnapshotBuilder::updateSnapshot(LayerSnapshot& snapshot, const Args& a
}
// computed snapshot properties
- snapshot.forceClientComposition = snapshot.isHdrY410 || snapshot.shadowSettings.length > 0 ||
- snapshot.stretchEffect.hasEffect();
+ snapshot.forceClientComposition =
+ snapshot.shadowSettings.length > 0 || snapshot.stretchEffect.hasEffect();
snapshot.contentOpaque = snapshot.isContentOpaque();
snapshot.isOpaque = snapshot.contentOpaque && !snapshot.roundedCorner.hasRoundedCorners() &&
snapshot.color.a == 1.f;
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index cfcc424622..1737bdf04d 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -659,7 +659,7 @@ void Layer::preparePerFrameCompositionState() {
// Force client composition for special cases known only to the front-end.
// Rounded corners no longer force client composition, since we may use a
// hole punch so that the layer will appear to have rounded corners.
- if (isHdrY410() || drawShadows() || snapshot->stretchEffect.hasEffect()) {
+ if (drawShadows() || snapshot->stretchEffect.hasEffect()) {
snapshot->forceClientComposition = true;
}
// If there are no visible region changes, we still need to update blur parameters.
@@ -3887,13 +3887,6 @@ bool Layer::isSimpleBufferUpdate(const layer_state_t& s) const {
return true;
}
-bool Layer::isHdrY410() const {
- // pixel format is HDR Y410 masquerading as RGBA_1010102
- return (mBufferInfo.mDataspace == ui::Dataspace::BT2020_ITU_PQ &&
- mBufferInfo.mApi == NATIVE_WINDOW_API_MEDIA &&
- mBufferInfo.mPixelFormat == HAL_PIXEL_FORMAT_RGBA_1010102);
-}
-
sp<LayerFE> Layer::getCompositionEngineLayerFE() const {
// There's no need to get a CE Layer if the layer isn't going to draw anything.
return hasSomethingToDraw() ? mLegacyLayerFE : nullptr;
@@ -4295,7 +4288,6 @@ void Layer::updateSnapshot(bool updateGeometry) {
snapshot->contentOpaque = isOpaque(mDrawingState);
snapshot->layerOpaqueFlagSet =
(mDrawingState.flags & layer_state_t::eLayerOpaque) == layer_state_t::eLayerOpaque;
- snapshot->isHdrY410 = isHdrY410();
sp<Layer> p = mDrawingParent.promote();
if (p != nullptr) {
snapshot->parentTransform = p->getTransform();
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 5d77657415..25a684500b 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -431,8 +431,6 @@ public:
void updateCloneBufferInfo();
uint64_t mPreviousFrameNumber = 0;
- bool isHdrY410() const;
-
/*
* called after composition.
* returns true if the layer latched a new buffer this frame.
diff --git a/services/surfaceflinger/LayerFE.cpp b/services/surfaceflinger/LayerFE.cpp
index 4d3e04861b..5ae52abe7b 100644
--- a/services/surfaceflinger/LayerFE.cpp
+++ b/services/surfaceflinger/LayerFE.cpp
@@ -225,7 +225,6 @@ void LayerFE::prepareBufferStateClientComposition(
layerSettings.source.buffer.fence = mSnapshot->acquireFence;
layerSettings.source.buffer.textureName = mSnapshot->textureName;
layerSettings.source.buffer.usePremultipliedAlpha = mSnapshot->premultipliedAlpha;
- layerSettings.source.buffer.isY410BT2020 = mSnapshot->isHdrY410;
bool hasSmpte2086 = mSnapshot->hdrMetadata.validTypes & HdrMetadata::SMPTE2086;
bool hasCta861_3 = mSnapshot->hdrMetadata.validTypes & HdrMetadata::CTA861_3;
float maxLuminance = 0.f;
diff --git a/services/surfaceflinger/tests/unittests/CompositionTest.cpp b/services/surfaceflinger/tests/unittests/CompositionTest.cpp
index e8a9cfe9d7..14fa492576 100644
--- a/services/surfaceflinger/tests/unittests/CompositionTest.cpp
+++ b/services/surfaceflinger/tests/unittests/CompositionTest.cpp
@@ -600,7 +600,6 @@ struct BaseLayerProperties {
EXPECT_THAT(layer.source.buffer.buffer, Not(IsNull()));
EXPECT_THAT(layer.source.buffer.fence, Not(IsNull()));
EXPECT_EQ(DEFAULT_TEXTURE_ID, layer.source.buffer.textureName);
- EXPECT_EQ(false, layer.source.buffer.isY410BT2020);
EXPECT_EQ(true, layer.source.buffer.usePremultipliedAlpha);
EXPECT_EQ(false, layer.source.buffer.isOpaque);
EXPECT_EQ(0.0, layer.geometry.roundedCornersRadius.x);