drm_hwcomposer: Set correct size for changed composition types
Call HwcDisplay::GetChangedCompositionTypes with nullptrs to get the
correct expected number of changed composition types.
Resizing this incorrectly resulted in entries for default-initialized
layer id (0), leading to log spam and possibly impacting performance as
well.
Addresses the log spam reported in #95.
Change-Id: I84046f9bc461656214f0a1f0ca0c440a7189505b
Signed-off-by: Drew Davenport <ddavenport@google.com>
diff --git a/hwc3/ComposerClient.cpp b/hwc3/ComposerClient.cpp
index f353abb..eb4e683 100644
--- a/hwc3/ComposerClient.cpp
+++ b/hwc3/ComposerClient.cpp
@@ -202,9 +202,15 @@
return Hwc2toHwc3Error(hwc2_error);
}
+ hwc3::Error error = Hwc2toHwc3Error(
+ display.GetChangedCompositionTypes(&num_types, nullptr, nullptr));
+ if (error != hwc3::Error::kNone) {
+ return error;
+ }
+
std::vector<hwc2_layer_t> hwc_changed_layers(num_types);
std::vector<int32_t> hwc_composition_types(num_types);
- hwc3::Error error = Hwc2toHwc3Error(
+ error = Hwc2toHwc3Error(
display.GetChangedCompositionTypes(&num_types, hwc_changed_layers.data(),
hwc_composition_types.data()));
if (error != hwc3::Error::kNone) {