SF: Use compositionInfo after HWC changedTypes
Bug: 112259502
Test: cts -m CtsViewTestCases
SurfaceFlinger_test
vrflinger_test
Change-Id: I908f439eedfab9ee8241f8ac594465527f93408a
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 37d0146..e4b7cb4 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1594,6 +1594,7 @@
void SurfaceFlinger::doDebugFlashRegions(const sp<DisplayDevice>& display, bool repaintEverything)
{
+ const auto displayId = display->getId();
// is debugging enabled
if (CC_LIKELY(!mDebugRegion))
return;
@@ -1621,7 +1622,8 @@
}
if (display->isPoweredOn()) {
- status_t result = display->prepareFrame(*getBE().mHwc);
+ status_t result = display->prepareFrame(
+ *getBE().mHwc, getBE().mCompositionInfo[displayId]);
ALOGE_IF(result != NO_ERROR,
"prepareFrame for display %d failed:"
" %d (%s)",
@@ -2020,11 +2022,13 @@
void SurfaceFlinger::prepareFrame(const sp<DisplayDevice>& display)
{
+ const auto displayId = display->getId();
if (!display->isPoweredOn()) {
return;
}
- status_t result = display->prepareFrame(*getBE().mHwc);
+ status_t result = display->prepareFrame(
+ *getBE().mHwc, getBE().mCompositionInfo[displayId]);
ALOGE_IF(result != NO_ERROR,
"prepareFrame for display %d failed:"
" %d (%s)",
@@ -2952,29 +2956,29 @@
ALOGV("Rendering client layers");
const ui::Transform& displayTransform = display->getTransform();
bool firstLayer = true;
- for (auto& layer : display->getVisibleLayersSortedByZ()) {
+ for (auto& compositionInfo : getBE().mCompositionInfo[displayId]) {
+ const Region bounds(display->bounds());
const Region clip(bounds.intersect(
- displayTransform.transform(layer->visibleRegion)));
- ALOGV("Layer: %s", layer->getName().string());
- ALOGV(" Composition type: %s", to_string(layer->getCompositionType(displayId)).c_str());
+ displayTransform.transform(compositionInfo.layer->mLayer->visibleRegion)));
+ ALOGV("Layer: %s", compositionInfo.layerName.c_str());
if (!clip.isEmpty()) {
- switch (layer->getCompositionType(displayId)) {
+ switch (compositionInfo.compositionType) {
case HWC2::Composition::Cursor:
case HWC2::Composition::Device:
case HWC2::Composition::Sideband:
case HWC2::Composition::SolidColor: {
- const Layer::State& state(layer->getDrawingState());
- if (layer->getClearClientTarget(displayId) && !firstLayer &&
- layer->isOpaque(state) && (layer->getAlpha() == 1.0f) &&
- hasClientComposition) {
+ const Layer::State& state(compositionInfo.layer->mLayer->getDrawingState());
+ const bool opaque = compositionInfo.layer->mLayer->isOpaque(state);
+ if (compositionInfo.hwc.clearClientTarget && !firstLayer &&
+ opaque && (state.color.a == 1.0f) && hasClientComposition) {
// never clear the very first layer since we're
// guaranteed the FB is already cleared
- layer->clearWithOpenGL(renderArea);
+ compositionInfo.layer->mLayer->clearWithOpenGL(renderArea);
}
break;
}
case HWC2::Composition::Client: {
- layer->draw(renderArea, clip);
+ compositionInfo.layer->mLayer->draw(renderArea, clip);
break;
}
default:
@@ -5222,7 +5226,7 @@
traverseLayers([&](Layer* layer) {
if (filtering) layer->setFiltering(true);
- layer->drawNow(renderArea, useIdentityTransform);
+ layer->draw(renderArea, useIdentityTransform);
if (filtering) layer->setFiltering(false);
});
}