hwc2: Fix composition change check
Change-Id: I700d7ac67e7fab72e71a36288fc4f12433a689ff
diff --git a/sdm/libs/hwc2/hwc_display.cpp b/sdm/libs/hwc2/hwc_display.cpp
index d9b3c73..c8911d4 100644
--- a/sdm/libs/hwc2/hwc_display.cpp
+++ b/sdm/libs/hwc2/hwc_display.cpp
@@ -535,8 +535,11 @@
if (!needs_fb_refresh && composition == kCompositionGPU) {
composition = kCompositionSDE;
}
+ HWC2::Composition current_hwc_composition = hwc_layer->GetCompositionType();
+ // Convert the SDM layer composition to HWC2 type
hwc_layer->SetComposition(composition);
- if (hwc_layer->CompositionChanged()) {
+ // Update the changes list only if the HWC2 comp type changed from the previous cycle
+ if (current_hwc_composition != hwc_layer->GetCompositionType()) {
layer_changes_[hwc_layer->GetId()] = hwc_layer->GetCompositionType();
}
}
diff --git a/sdm/libs/hwc2/hwc_layers.cpp b/sdm/libs/hwc2/hwc_layers.cpp
index 9be2317..a8d8173 100644
--- a/sdm/libs/hwc2/hwc_layers.cpp
+++ b/sdm/libs/hwc2/hwc_layers.cpp
@@ -480,11 +480,7 @@
if (layer_->composition == kCompositionSDE && layer_->flags.solid_fill != 0) {
composition = HWC2::Composition::SolidColor;
}
- if (composition != composition_) {
- // Composition changed for this layer
- composition_changed_ = true;
- composition_ = composition;
- }
+ composition_ = composition;
}
void HWCLayer::PushReleaseFence(int32_t fence) {
release_fences_.push(fence);
diff --git a/sdm/libs/hwc2/hwc_layers.h b/sdm/libs/hwc2/hwc_layers.h
index de3b7bb..7e48e3b 100644
--- a/sdm/libs/hwc2/hwc_layers.h
+++ b/sdm/libs/hwc2/hwc_layers.h
@@ -71,7 +71,6 @@
HWC2::Error SetLayerVisibleRegion(hwc_region_t visible);
HWC2::Error SetLayerZOrder(uint32_t z);
void SetComposition(const LayerComposition &source);
- bool CompositionChanged(void) { return composition_changed_; }
HWC2::Composition GetCompositionType() { return composition_; }
uint32_t GetGeometryChanges() { return geometry_changes_; }
void ResetGeometryChanges() { geometry_changes_ = GeometryChanges::kNone; }
@@ -87,7 +86,6 @@
std::queue<int32_t> release_fences_;
HWC2::Composition composition_ = HWC2::Composition::Device;
- bool composition_changed_ = false;
uint32_t geometry_changes_ = GeometryChanges::kNone;
void SetRect(const hwc_rect_t &source, LayerRect *target);