drm_hwcomposer: fix crash in hwc_set()
For each display context we need to unconditionally call emplace_back()
on layers_indices to ensure that entries in layers_indices correspond to
the correct display.
BUG=24506167
TEST=still builds and boots ok
Change-Id: I6bc0858471c9ec51615c8ed7d8613529f77cb1ab
diff --git a/hwcomposer.cpp b/hwcomposer.cpp
index 0a8b661..5181d84 100644
--- a/hwcomposer.cpp
+++ b/hwcomposer.cpp
@@ -409,6 +409,8 @@
hwc_display_contents_1_t *dc = sf_display_contents[i];
displays_contents.emplace_back();
DrmHwcDisplayContents &display_contents = displays_contents.back();
+ layers_indices.emplace_back();
+ std::vector<size_t> &indices_to_composite = layers_indices.back();
if (!sf_display_contents[i])
continue;
@@ -422,7 +424,6 @@
display_contents.retire_fence = OutputFd(&dc->retireFenceFd);
size_t num_dc_layers = dc->numHwLayers;
- std::vector<size_t> indices_to_composite;
int framebuffer_target_index = -1;
for (size_t j = 0; j < num_dc_layers; ++j) {
hwc_layer_1_t *sf_layer = &dc->hwLayers[j];
@@ -474,7 +475,6 @@
indices_to_composite.push_back(framebuffer_target_index);
}
}
- layers_indices.emplace_back(indices_to_composite);
}
if (ret)