hwc: Dump in SDM only if layer stack is valid
If a layer is created or destroyed before Dump, the layer stack
is in invalid state. Prevent SDM Dump if stack hasn't been validated.
Change-Id: I1ce14a058d05d9d4204b69ea8f8fb7e7a035448e
CRs-fixed: 2165898
diff --git a/sdm/libs/hwc2/hwc_display.cpp b/sdm/libs/hwc2/hwc_display.cpp
index 0ce1f1e..870b8b6 100644
--- a/sdm/libs/hwc2/hwc_display.cpp
+++ b/sdm/libs/hwc2/hwc_display.cpp
@@ -434,6 +434,8 @@
*out_layer_id = layer->GetId();
geometry_changes_ |= GeometryChanges::kAdded;
validated_ = false;
+ layer_stack_invalid_ = true;
+
return HWC2::Error::None;
}
@@ -466,6 +468,8 @@
geometry_changes_ |= GeometryChanges::kRemoved;
validated_ = false;
+ layer_stack_invalid_ = true;
+
return HWC2::Error::None;
}
@@ -633,6 +637,8 @@
}
// set secure display
SetSecureDisplay(secure_display_active);
+
+ layer_stack_invalid_ = false;
}
void HWCDisplay::BuildSolidFillStack() {
@@ -2040,6 +2046,11 @@
<< std::endl;
}
+ if (layer_stack_invalid_) {
+ os << "\n Layers added or removed but not reflected to SDM's layer stack yet\n";
+ return os.str();
+ }
+
if (color_mode_) {
os << "\n----------Color Modes---------\n";
color_mode_->Dump(&os);
diff --git a/sdm/libs/hwc2/hwc_display.h b/sdm/libs/hwc2/hwc_display.h
index c251944..a5e1457 100644
--- a/sdm/libs/hwc2/hwc_display.h
+++ b/sdm/libs/hwc2/hwc_display.h
@@ -257,6 +257,7 @@
};
bool validated_ = false;
+ bool layer_stack_invalid_ = true;
CoreInterface *core_intf_ = nullptr;
HWCCallbacks *callbacks_ = nullptr;
HWCBufferAllocator *buffer_allocator_ = NULL;