drm_hwcomposer: Fix HwcLayer::GetReleaseFences()
GetReleaseFences() should return release fence for the prior buffer
(not for the one assigned to layer at the moment of GetReleaseFences call).
Once not provided, old front buffer can be damaged before new buffer
presented. (Such issues start to appear once we started using
non-blocking DRM/KMS commits).
Using present (out) fence is a perfect solution, since it is
signaled once old buffer replaced with the new one.
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
diff --git a/hwc2_device/HwcLayer.h b/hwc2_device/HwcLayer.h
index df4ce6d..ad94129 100644
--- a/hwc2_device/HwcLayer.h
+++ b/hwc2_device/HwcLayer.h
@@ -43,6 +43,14 @@
return sf_type_ != validated_type_;
}
+ bool GetPriorBufferScanOutFlag() const {
+ return prior_buffer_scanout_flag_;
+ }
+
+ void SetPriorBufferScanOutFlag(bool state) {
+ prior_buffer_scanout_flag_ = state;
+ }
+
uint32_t GetZOrder() const {
return z_order_;
}
@@ -55,10 +63,6 @@
return display_frame_;
}
- UniqueFd GetReleaseFence() {
- return std::move(release_fence_);
- }
-
void PopulateDrmLayer(DrmHwcLayer *layer);
bool RequireScalingOrPhasing() const {
@@ -107,15 +111,9 @@
DrmHwcColorSpace color_space_ = DrmHwcColorSpace::kUndefined;
DrmHwcSampleRange sample_range_ = DrmHwcSampleRange::kUndefined;
- UniqueFd acquire_fence_;
+ bool prior_buffer_scanout_flag_{};
- /*
- * Release fence is not used.
- * There is no release fence support available in the DRM/KMS. In case no
- * release fence provided application will use this buffer for writing when
- * the next frame present fence is signaled.
- */
- UniqueFd release_fence_;
+ UniqueFd acquire_fence_;
};
} // namespace android