drm_hwcomposer: HWC3: Implement Client buffer management recommendations
Implement [1].
[1]: https://source.android.com/docs/core/graphics/framebuffer-mgmt
Change-Id: I635d7cf5f2d4f9a773e300d73487249a29cb90b1
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
diff --git a/hwc3/ComposerClient.cpp b/hwc3/ComposerClient.cpp
index c8cb37c..ed89df9 100644
--- a/hwc3/ComposerClient.cpp
+++ b/hwc3/ComposerClient.cpp
@@ -443,6 +443,10 @@
return lp;
}
+ void ClearSlots() {
+ slots_.clear();
+ }
+
private:
std::map<int32_t /*slot*/, std::shared_ptr<Hwc3BufferHandle>> slots_;
};
@@ -1216,6 +1220,17 @@
next_config != nullptr &&
current_config->group_id ==
next_config->group_id;
+
+ /* Client framebuffer management:
+ * https://source.android.com/docs/core/graphics/framebuffer-mgmt
+ */
+ if (!same_config_group && !future_config) {
+ auto& client_layer = display->GetClientLayer();
+ auto hwc3_layer = GetHwc3Layer(client_layer);
+ hwc3_layer->ClearSlots();
+ client_layer.ClearSlots();
+ }
+
// If the contraints dictate that this is to be applied in the future, it
// must be queued. If the new config is in the same config group as the
// current one, then queue it to reduce jank.