summaryrefslogtreecommitdiff
path: root/drmdisplaycomposition.cpp
diff options
context:
space:
mode:
authorZach Reizner <zachr@google.com>2015-07-17 14:13:28 -0700
committerZach Reizner <zachr@google.com>2015-07-20 10:01:44 -0700
commitece04894ab2d2fc3d5001a9e50a242b2d3f765da (patch)
tree77060bb74918d70e416fe01cef446d267fea8b03 /drmdisplaycomposition.cpp
parent952f70a71347df3515e43bee15132d0ce6ecea32 (diff)
downloaddrm_hwcomposer-ece04894ab2d2fc3d5001a9e50a242b2d3f765da.tar.gz
drm_hwcomposer-ece04894ab2d2fc3d5001a9e50a242b2d3f765da.tar.xz
drm_hwcomposer: make sure all fences are released for DrmDisplayComposition
This change will release the layers passed back to SurfaceFlinger even on an error in the compositor thread. Change-Id: I22f622855c8c953a058b4a08d0af1ae427e4cbbd
Diffstat (limited to 'drmdisplaycomposition.cpp')
-rw-r--r--drmdisplaycomposition.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/drmdisplaycomposition.cpp b/drmdisplaycomposition.cpp
index d8dc886..cce1d56 100644
--- a/drmdisplaycomposition.cpp
+++ b/drmdisplaycomposition.cpp
@@ -45,6 +45,7 @@ DrmDisplayComposition::DrmDisplayComposition()
type_(DRM_COMPOSITION_TYPE_EMPTY),
timeline_fd_(-1),
timeline_(0),
+ timeline_current_(0),
dpms_mode_(DRM_MODE_DPMS_ON) {
}
@@ -58,8 +59,11 @@ DrmDisplayComposition::~DrmDisplayComposition() {
close(iter->layer.acquireFenceFd);
}
- if (timeline_fd_ >= 0)
+ if (timeline_fd_ >= 0) {
+ FinishComposition();
close(timeline_fd_);
+ timeline_fd_ = -1;
+ }
}
int DrmDisplayComposition::Init(DrmResources *drm, Importer *importer) {
@@ -125,9 +129,15 @@ int DrmDisplayComposition::AddPlaneDisable(DrmPlane *plane) {
}
int DrmDisplayComposition::FinishComposition() {
- int ret = sw_sync_timeline_inc(timeline_fd_, timeline_);
+ int timeline_increase = timeline_ - timeline_current_;
+ if (timeline_increase <= 0)
+ return 0;
+
+ int ret = sw_sync_timeline_inc(timeline_fd_, timeline_increase);
if (ret)
ALOGE("Failed to increment sync timeline %d", ret);
+ else
+ timeline_current_ = timeline_;
return ret;
}