diff options
author | Roman Stratiienko <r.stratiienko@gmail.com> | 2023-01-16 17:41:07 +0200 |
---|---|---|
committer | Roman Stratiienko <r.stratiienko@gmail.com> | 2023-01-18 14:59:55 +0200 |
commit | 359a9d397100cf531f203ded61d2578957fb526f (patch) | |
tree | 144021da2d918b2f8617066ea7ee3db63d7d7ef1 | |
parent | 76892784ac7c3dde9c7c14d4e88d17960a445740 (diff) | |
download | drm_hwcomposer-359a9d397100cf531f203ded61d2578957fb526f.tar.gz |
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>
-rw-r--r-- | compositor/LayerData.h | 9 | ||||
-rw-r--r-- | hwc2_device/HwcDisplay.cpp | 6 | ||||
-rw-r--r-- | hwc2_device/HwcLayer.cpp | 8 | ||||
-rw-r--r-- | hwc2_device/HwcLayer.h | 4 |
4 files changed, 6 insertions, 21 deletions
diff --git a/compositor/LayerData.h b/compositor/LayerData.h index a7e14f9..8f4b7aa 100644 --- a/compositor/LayerData.h +++ b/compositor/LayerData.h @@ -63,15 +63,6 @@ struct PresentInfo { }; struct LayerData { - auto Clone() { - LayerData clonned; - clonned.bi = bi; - clonned.fb = fb; - clonned.pi = pi; - clonned.acquire_fence = std::move(acquire_fence); - return clonned; - } - std::optional<BufferInfo> bi; std::shared_ptr<DrmFbIdHandle> fb; PresentInfo pi; 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 @@ HWC2::Error HwcDisplay::CreateComposition(AtomicCommitArgs &a_args) { /* 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 @@ HWC2::Error HwcDisplay::CreateComposition(AtomicCommitArgs &a_args) { */ 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 @@ HWC2::Error HwcDisplay::SetClientTarget(buffer_handle_t target, 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::SetLayerBlendMode(int32_t mode) { */ 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::ImportFb() { } } -void HwcLayer::PopulateLayerData(bool test) { +void HwcLayer::PopulateLayerData() { ImportFb(); if (!layer_data_.bi) { @@ -219,10 +219,6 @@ void HwcLayer::PopulateLayerData(bool test) { 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 @@ class HwcLayer { 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 @@ class HwcLayer { /* Layer state */ public: - void PopulateLayerData(bool test); + void PopulateLayerData(); bool IsLayerUsableAsDevice() const { return !bi_get_failed_ && !fb_import_failed_ && buffer_handle_ != nullptr; |