drm_hwcomposer: make GLCompositor delete bo with Importer
Change-Id: I4ec6111372381701c238d5333aa1c56baf301e02
diff --git a/gl_compositor.cpp b/gl_compositor.cpp
index eb255e6..dfe407f 100644
--- a/gl_compositor.cpp
+++ b/gl_compositor.cpp
@@ -149,7 +149,8 @@
hwc_drm_bo bo;
};
- GLComposition(GLCompositor *owner) : compositor(owner), target_handle(-1) {
+ GLComposition(GLCompositor *owner, Importer *imp)
+ : compositor(owner), importer(imp), target_handle(-1) {
}
virtual ~GLComposition() {
@@ -188,7 +189,7 @@
layer_datum.layer = *layer;
layer_datum.bo = *bo;
- return 0;
+ return importer->ReleaseBuffer(bo);
}
virtual unsigned GetRemainingLayers(int display, unsigned num_needed) const {
@@ -197,6 +198,7 @@
}
GLCompositor *compositor;
+ Importer *importer;
int target_handle;
std::vector<LayerData> layer_data;
};
@@ -532,12 +534,12 @@
}
}
-Composition *GLCompositor::CreateComposition() {
+Composition *GLCompositor::CreateComposition(Importer *importer) {
if (priv_->current_target >= 0 &&
(unsigned)priv_->current_target < priv_->targets.size()) {
GLTarget *target = &priv_->targets[priv_->current_target];
if (target->is_some()) {
- GLComposition *composition = new GLComposition(this);
+ GLComposition *composition = new GLComposition(this, importer);
composition->target_handle = priv_->current_target;
target->composition_count++;
priv_->compositions.push_back(composition);