drm_hwcomposer: Propagate acquire fence for test/validate cycle as well
Since acquire_fence is now std::shared_ptr, struct LayerData has default
copy constructor and LayerData::Clone() function is no longer required.
Also we can now remove 'test' argument from HwcLayer::PopulateLayerData
function, since copy operation for acquire_fence is now available.
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
diff --git a/hwc2_device/HwcDisplay.cpp b/hwc2_device/HwcDisplay.cpp
index d957dc3..1550e21 100644
--- a/hwc2_device/HwcDisplay.cpp
+++ b/hwc2_device/HwcDisplay.cpp
@@ -513,7 +513,7 @@
/* Import & populate */
for (std::pair<const uint32_t, HwcLayer *> &l : z_map) {
- l.second->PopulateLayerData(a_args.test_only);
+ l.second->PopulateLayerData();
}
// now that they're ordered by z, add them to the composition
@@ -528,7 +528,7 @@
*/
return HWC2::Error::BadLayer;
}
- composition_layers.emplace_back(l.second->GetLayerData().Clone());
+ composition_layers.emplace_back(l.second->GetLayerData());
}
/* Store plan to ensure shared planes won't be stolen by other display
@@ -641,7 +641,7 @@
return HWC2::Error::None;
}
- client_layer_.PopulateLayerData(/*test = */ true);
+ client_layer_.PopulateLayerData();
if (!client_layer_.IsLayerUsableAsDevice()) {
ALOGE("Client layer must be always usable by DRM/KMS");
return HWC2::Error::BadLayer;
diff --git a/hwc2_device/HwcLayer.cpp b/hwc2_device/HwcLayer.cpp
index d3936b3..dd5359f 100644
--- a/hwc2_device/HwcLayer.cpp
+++ b/hwc2_device/HwcLayer.cpp
@@ -53,7 +53,7 @@
*/
HWC2::Error HwcLayer::SetLayerBuffer(buffer_handle_t buffer,
int32_t acquire_fence) {
- acquire_fence_ = MakeUniqueFd(acquire_fence);
+ layer_data_.acquire_fence = MakeSharedFd(acquire_fence);
buffer_handle_ = buffer;
buffer_handle_updated_ = true;
@@ -202,7 +202,7 @@
}
}
-void HwcLayer::PopulateLayerData(bool test) {
+void HwcLayer::PopulateLayerData() {
ImportFb();
if (!layer_data_.bi) {
@@ -219,10 +219,6 @@
if (sample_range_ != BufferSampleRange::kUndefined) {
layer_data_.bi->sample_range = sample_range_;
}
-
- if (!test) {
- layer_data_.acquire_fence = std::move(acquire_fence_);
- }
}
/* SwapChain Cache */
diff --git a/hwc2_device/HwcLayer.h b/hwc2_device/HwcLayer.h
index 7f647a8..b69ce5b 100644
--- a/hwc2_device/HwcLayer.h
+++ b/hwc2_device/HwcLayer.h
@@ -86,8 +86,6 @@
uint32_t z_order_ = 0;
LayerData layer_data_;
- SharedFd acquire_fence_;
-
/* The following buffer data can have 2 sources:
* 1 - Mapper@4 metadata API
* 2 - HWC@2 API
@@ -107,7 +105,7 @@
/* Layer state */
public:
- void PopulateLayerData(bool test);
+ void PopulateLayerData();
bool IsLayerUsableAsDevice() const {
return !bi_get_failed_ && !fb_import_failed_ && buffer_handle_ != nullptr;