Revert "SF: Add support for screen captures"
This reverts commit dc5e0627b6217fee77af48e558dc2490941c4417.
Test: lunch sdk_phone_x86-userdebug
make -j
emulator
it should boot to homescreen
BUG: 76125889
diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp
index a6caf29..f02c5fa 100644
--- a/services/surfaceflinger/BufferLayer.cpp
+++ b/services/surfaceflinger/BufferLayer.cpp
@@ -160,8 +160,6 @@
bool useIdentityTransform) const {
ATRACE_CALL();
- CompositionInfo& compositionInfo = getBE().compositionInfo;
-
if (CC_UNLIKELY(mActiveBuffer == 0)) {
// the texture has not been created yet, this Layer has
// in fact never been drawn into. This happens frequently with
@@ -243,7 +241,6 @@
mTexture.setDimensions(mActiveBuffer->getWidth(), mActiveBuffer->getHeight());
mTexture.setFiltering(useFiltering);
mTexture.setMatrix(textureMatrix);
- compositionInfo.re.texture = mTexture;
engine.setupLayerTexturing(mTexture);
} else {
@@ -253,23 +250,6 @@
engine.disableTexturing();
}
-void BufferLayer::drawNow(const RenderArea& renderArea, bool useIdentityTransform) const {
- CompositionInfo& compositionInfo = getBE().compositionInfo;
- auto& engine(mFlinger->getRenderEngine());
-
- draw(renderArea, useIdentityTransform);
-
- engine.setupLayerTexturing(compositionInfo.re.texture);
- engine.setupLayerBlending(compositionInfo.re.preMultipliedAlpha, compositionInfo.re.opaque,
- false, compositionInfo.re.color);
- engine.setSourceDataSpace(compositionInfo.hwc.dataspace);
- engine.setSourceY410BT2020(compositionInfo.re.Y410BT2020);
- engine.drawMesh(getBE().getMesh());
- engine.disableBlending();
- engine.disableTexturing();
- engine.setSourceY410BT2020(false);
-}
-
void BufferLayer::onLayerDisplayed(const sp<Fence>& releaseFence) {
mConsumer->setReleaseFence(releaseFence);
}
@@ -830,17 +810,21 @@
texCoords[2] = vec2(right, 1.0f - bottom);
texCoords[3] = vec2(right, 1.0f - top);
- getBE().compositionInfo.re.preMultipliedAlpha = mPremultipliedAlpha;
- getBE().compositionInfo.re.opaque = isOpaque(s);
- getBE().compositionInfo.re.disableTexture = false;
- getBE().compositionInfo.re.color = getColor();
- getBE().compositionInfo.hwc.dataspace = mCurrentState.dataSpace;
+ auto& engine(mFlinger->getRenderEngine());
+ engine.setupLayerBlending(mPremultipliedAlpha, isOpaque(s), false /* disableTexture */,
+ getColor());
+ engine.setSourceDataSpace(mCurrentState.dataSpace);
if (mCurrentState.dataSpace == HAL_DATASPACE_BT2020_ITU_PQ &&
mConsumer->getCurrentApi() == NATIVE_WINDOW_API_MEDIA &&
getBE().compositionInfo.mBuffer->getPixelFormat() == HAL_PIXEL_FORMAT_RGBA_1010102) {
- getBE().compositionInfo.re.Y410BT2020 = true;
+ engine.setSourceY410BT2020(true);
}
+
+ engine.drawMesh(getBE().mMesh);
+ engine.disableBlending();
+
+ engine.setSourceY410BT2020(false);
}
uint32_t BufferLayer::getProducerStickyTransform() const {
diff --git a/services/surfaceflinger/BufferLayer.h b/services/surfaceflinger/BufferLayer.h
index c7b09ad..6b02f8c 100644
--- a/services/surfaceflinger/BufferLayer.h
+++ b/services/surfaceflinger/BufferLayer.h
@@ -101,7 +101,6 @@
*/
void onDraw(const RenderArea& renderArea, const Region& clip,
bool useIdentityTransform) const override;
- void drawNow(const RenderArea& renderArea, bool useIdentityTransform) const;
void onLayerDisplayed(const sp<Fence>& releaseFence) override;
diff --git a/services/surfaceflinger/ColorLayer.cpp b/services/surfaceflinger/ColorLayer.cpp
index 71975c8..911b5a1 100644
--- a/services/surfaceflinger/ColorLayer.cpp
+++ b/services/surfaceflinger/ColorLayer.cpp
@@ -46,27 +46,16 @@
bool useIdentityTransform) const {
const State& s(getDrawingState());
if (s.color.a > 0) {
- computeGeometry(renderArea, getBE().mMesh, useIdentityTransform);
- getBE().compositionInfo.re.preMultipliedAlpha = getPremultipledAlpha();
- getBE().compositionInfo.re.opaque = false;
- getBE().compositionInfo.re.disableTexture = true;
- getBE().compositionInfo.re.color = s.color;
+ Mesh mesh(Mesh::TRIANGLE_FAN, 4, 2);
+ computeGeometry(renderArea, mesh, useIdentityTransform);
+ auto& engine(mFlinger->getRenderEngine());
+ engine.setupLayerBlending(getPremultipledAlpha(), false /* opaque */,
+ true /* disableTexture */, s.color);
+ engine.drawMesh(mesh);
+ engine.disableBlending();
}
}
-void ColorLayer::drawNow(const RenderArea& renderArea, bool useIdentityTransform) const {
- CompositionInfo& compositionInfo = getBE().compositionInfo;
- auto& engine(mFlinger->getRenderEngine());
-
- draw(renderArea, useIdentityTransform);
-
- engine.setupLayerBlending(compositionInfo.re.preMultipliedAlpha, compositionInfo.re.opaque,
- compositionInfo.re.disableTexture, compositionInfo.re.color);
- engine.setSourceDataSpace(compositionInfo.hwc.dataspace);
- engine.drawMesh(getBE().getMesh());
- engine.disableBlending();
-}
-
bool ColorLayer::isVisible() const {
const Layer::State& s(getDrawingState());
return !isHiddenByPolicy() && s.color.a;
diff --git a/services/surfaceflinger/ColorLayer.h b/services/surfaceflinger/ColorLayer.h
index e8fb92d..0cde398 100644
--- a/services/surfaceflinger/ColorLayer.h
+++ b/services/surfaceflinger/ColorLayer.h
@@ -32,7 +32,6 @@
virtual const char* getTypeId() const { return "ColorLayer"; }
virtual void onDraw(const RenderArea& renderArea, const Region& clip,
bool useIdentityTransform) const;
- void drawNow(const RenderArea& , bool ) const;
bool isVisible() const override;
void setPerFrameData(const sp<const DisplayDevice>& displayDevice) override;
diff --git a/services/surfaceflinger/ContainerLayer.cpp b/services/surfaceflinger/ContainerLayer.cpp
index 320c0df..f259d93 100644
--- a/services/surfaceflinger/ContainerLayer.cpp
+++ b/services/surfaceflinger/ContainerLayer.cpp
@@ -30,8 +30,6 @@
void ContainerLayer::onDraw(const RenderArea&, const Region& /* clip */, bool) const {}
-void ContainerLayer::drawNow(const RenderArea&, bool) const {}
-
bool ContainerLayer::isVisible() const {
return !isHiddenByPolicy();
}
diff --git a/services/surfaceflinger/ContainerLayer.h b/services/surfaceflinger/ContainerLayer.h
index 50c0191..543f60a 100644
--- a/services/surfaceflinger/ContainerLayer.h
+++ b/services/surfaceflinger/ContainerLayer.h
@@ -32,7 +32,6 @@
const char* getTypeId() const override { return "ContainerLayer"; }
void onDraw(const RenderArea& renderArea, const Region& clip,
bool useIdentityTransform) const override;
- void drawNow(const RenderArea& renderArea, bool useIdentityTransform) const override;
bool isVisible() const override;
void setPerFrameData(const sp<const DisplayDevice>& displayDevice) override;
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index c1a4dcf..c2cdf27 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -360,16 +360,6 @@
void draw(const RenderArea& renderArea) const;
/*
- * drawNow uses the renderEngine to draw the layer. This is different than the
- * draw function as with the FE/BE split, the draw function runs in the FE and
- * sets up state for the BE to do the actual drawing. drawNow is used to tell
- * the layer to skip the state setup and just go ahead and draw the layer. This
- * is used for screen captures which happens separately from the frame
- * compositing path.
- */
- virtual void drawNow(const RenderArea& renderArea, bool useIdentityTransform) const = 0;
-
- /*
* doTransaction - process the transaction. This is a good place to figure
* out which attributes of the surface have changed.
*/
diff --git a/services/surfaceflinger/LayerBE.cpp b/services/surfaceflinger/LayerBE.cpp
index 78330fd..5287fe1 100644
--- a/services/surfaceflinger/LayerBE.cpp
+++ b/services/surfaceflinger/LayerBE.cpp
@@ -57,8 +57,7 @@
ALOGV("[%s]\tblackoutLayer=%d", tag, re.blackoutLayer);
ALOGV("[%s]\tclearArea=%d", tag, re.clearArea);
ALOGV("[%s]\tpreMultipliedAlpha=%d", tag, re.preMultipliedAlpha);
- ALOGV("[%s]\topaque=%d", tag, re.opaque);
- ALOGV("[%s]\tdisableTexture=%d", tag, re.disableTexture);
+ ALOGV("[%s]\topaque=%d\n", tag, re.opaque);
ALOGV("[%s]\ttexture:name(%d), target(%d), size(%d/%d)", tag, re.texture.getTextureName(), re.texture.getTextureTarget(), (unsigned int)re.texture.getWidth(), (unsigned int)re.texture.getHeight());
ALOGV("[%s]\tuseIdentityTransform=%d\n", tag, re.useIdentityTransform);
}
diff --git a/services/surfaceflinger/LayerBE.h b/services/surfaceflinger/LayerBE.h
index 854cdd6..981f756 100644
--- a/services/surfaceflinger/LayerBE.h
+++ b/services/surfaceflinger/LayerBE.h
@@ -87,11 +87,9 @@
bool clearArea = false;
bool preMultipliedAlpha = false;
bool opaque = false;
- bool disableTexture = false;
half4 color;
Texture texture;
bool useIdentityTransform = false;
- bool Y410BT2020 = false;
} re;
void dump(const char* tag) const;
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index f709534..5f5b71f 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -4813,7 +4813,7 @@
traverseLayers([&](Layer* layer) {
if (filtering) layer->setFiltering(true);
- layer->drawNow(renderArea, useIdentityTransform);
+ layer->draw(renderArea, useIdentityTransform);
if (filtering) layer->setFiltering(false);
});
}