drm_hwcomposer: enhance stability using various wrapper classes
This commit contains a lot of churn because it changes code to use automatic
resource lifetimes as much as possible. As more things get changed, this is
essential to maintaining stability.
In addition, this change changes how layers are passed through the compositor
API. Before each layer was passed down one at a time. Now they are passed in
all at once. This is simpler for the implementation because it makes errors
more atomic and makes decisions easier for the compositors.
Change-Id: Ic3e6b5d0089fb1631ea256adcce9910ed8f38366
diff --git a/drmresources.cpp b/drmresources.cpp
index feb5187..32fe5cc 100644
--- a/drmresources.cpp
+++ b/drmresources.cpp
@@ -467,18 +467,17 @@
return -EINVAL;
}
- DrmComposition *comp = compositor_.CreateComposition(NULL);
+ std::unique_ptr<DrmComposition> comp(compositor_.CreateComposition(NULL));
if (!comp) {
ALOGE("Failed to create composition for dpms on %d", display);
return -ENOMEM;
}
- int ret = comp->AddDpmsMode(display, mode);
+ int ret = comp->SetDpmsMode(display, mode);
if (ret) {
ALOGE("Failed to add dpms %ld to composition on %d %d", mode, display, ret);
- delete comp;
return ret;
}
- ret = compositor_.QueueComposition(comp);
+ ret = compositor_.QueueComposition(std::move(comp));
if (ret) {
ALOGE("Failed to queue dpms composition on %d %d", display, ret);
return ret;