diff options
author | 2025-02-06 20:39:27 -0800 | |
---|---|---|
committer | 2025-02-20 11:44:22 -0800 | |
commit | 5fae4a6f739e858d4d8865728f31a6796221f12e (patch) | |
tree | 4b11f19567b68c8e56d8cb8bf9d79998e61eb817 | |
parent | 50098249722276f23cdf810459a158ad7b31a52c (diff) |
[Lut] pfd refactor
Bug: 380894872
Test: builds
Flag: EXEMPT small refactor
Change-Id: Ia72407cba0307dc5e881dd1a5345fd46ffb2b7c8
8 files changed, 12 insertions, 12 deletions
diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/OutputLayer.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/OutputLayer.h index c1b864df02..c0243b81db 100644 --- a/services/surfaceflinger/CompositionEngine/include/compositionengine/OutputLayer.h +++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/OutputLayer.h @@ -145,7 +145,7 @@ public: // Applies a HWC device layer lut virtual void applyDeviceLayerLut( - ndk::ScopedFileDescriptor, + ::android::base::unique_fd, std::vector<std::pair< int, aidl::android::hardware::graphics::composer3::LutProperties>>) = 0; diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputLayer.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputLayer.h index a1434f21cc..dea329078e 100644 --- a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputLayer.h +++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputLayer.h @@ -68,7 +68,7 @@ public: aidl::android::hardware::graphics::composer3::Composition) override; void prepareForDeviceLayerRequests() override; void applyDeviceLayerRequest(Hwc2::IComposerClient::LayerRequest request) override; - void applyDeviceLayerLut(ndk::ScopedFileDescriptor, + void applyDeviceLayerLut(::android::base::unique_fd, std::vector<std::pair<int, LutProperties>>) override; bool needsFiltering() const override; std::optional<LayerFE::LayerSettings> getOverrideCompositionSettings() const override; diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/OutputLayer.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/OutputLayer.h index 09c47f0224..be36db6fd1 100644 --- a/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/OutputLayer.h +++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/OutputLayer.h @@ -60,7 +60,7 @@ public: MOCK_CONST_METHOD0(needsFiltering, bool()); MOCK_CONST_METHOD0(getOverrideCompositionSettings, std::optional<LayerFE::LayerSettings>()); MOCK_METHOD(void, applyDeviceLayerLut, - (ndk::ScopedFileDescriptor, + (::android::base::unique_fd, (std::vector<std::pair< int, aidl::android::hardware::graphics::composer3::LutProperties>>))); MOCK_METHOD(int64_t, getPictureProfilePriority, (), (const)); diff --git a/services/surfaceflinger/CompositionEngine/src/Display.cpp b/services/surfaceflinger/CompositionEngine/src/Display.cpp index e37ce0a0eb..8364f4efa0 100644 --- a/services/surfaceflinger/CompositionEngine/src/Display.cpp +++ b/services/surfaceflinger/CompositionEngine/src/Display.cpp @@ -373,7 +373,7 @@ void Display::applyLayerLutsToLayers(const LayerLuts& layerLuts) { if (auto lutsIt = layerLuts.find(hwcLayer); lutsIt != layerLuts.end()) { if (auto mapperIt = mapper.find(hwcLayer); mapperIt != mapper.end()) { - layer->applyDeviceLayerLut(ndk::ScopedFileDescriptor(mapperIt->second.release()), + layer->applyDeviceLayerLut(::android::base::unique_fd(mapperIt->second.release()), lutsIt->second); } } diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp index d89b52d632..cf2d8c22b2 100644 --- a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp +++ b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp @@ -619,7 +619,7 @@ void OutputLayer::writeLutToHWC(HWC2::Layer* hwcLayer, lutProperties[i].samplingKey)}}); } - luts.pfd = ndk::ScopedFileDescriptor(dup(lutFileDescriptor.get())); + luts.pfd.set(dup(lutFileDescriptor.get())); luts.offsets = lutOffsets; luts.lutProperties = std::move(aidlProperties); } @@ -1006,7 +1006,7 @@ void OutputLayer::applyDeviceLayerRequest(hal::LayerRequest request) { } void OutputLayer::applyDeviceLayerLut( - ndk::ScopedFileDescriptor lutFileDescriptor, + ::android::base::unique_fd lutFd, std::vector<std::pair<int, LutProperties>> lutOffsetsAndProperties) { auto& state = editState(); LOG_FATAL_IF(!state.hwc); @@ -1025,9 +1025,9 @@ void OutputLayer::applyDeviceLayerLut( samplingKeys.emplace_back(static_cast<int32_t>(properties.samplingKeys[0])); } } - hwcState.luts = std::make_shared<gui::DisplayLuts>(base::unique_fd(lutFileDescriptor.release()), - std::move(offsets), std::move(dimensions), - std::move(sizes), std::move(samplingKeys)); + hwcState.luts = std::make_shared<gui::DisplayLuts>(std::move(lutFd), std::move(offsets), + std::move(dimensions), std::move(sizes), + std::move(samplingKeys)); } bool OutputLayer::needsFiltering() const { diff --git a/services/surfaceflinger/DisplayHardware/HWC2.cpp b/services/surfaceflinger/DisplayHardware/HWC2.cpp index 252c6b692d..01f382f0e8 100644 --- a/services/surfaceflinger/DisplayHardware/HWC2.cpp +++ b/services/surfaceflinger/DisplayHardware/HWC2.cpp @@ -638,7 +638,7 @@ Error Display::getRequestedLuts(LayerLuts* outLuts, [](int32_t i, LutProperties j) { return std::make_pair(i, j); }); outLuts->emplace_or_replace(layer.get(), lutOffsetsAndProperties); lutFileDescriptorMapper.emplace_or_replace(layer.get(), - ndk::ScopedFileDescriptor( + ::android::base::unique_fd( layerLut.luts.pfd.release())); } else { ALOGE("getRequestedLuts: invalid luts on layer %" PRIu64 " found" diff --git a/services/surfaceflinger/DisplayHardware/HWC2.h b/services/surfaceflinger/DisplayHardware/HWC2.h index c3deb8429a..7c1f8e3da0 100644 --- a/services/surfaceflinger/DisplayHardware/HWC2.h +++ b/services/surfaceflinger/DisplayHardware/HWC2.h @@ -115,7 +115,7 @@ public: using LayerLuts = ftl::SmallMap<HWC2::Layer*, LutOffsetAndProperties, kLutFileDescriptorMapperSize>; using LutFileDescriptorMapper = - ftl::SmallMap<HWC2::Layer*, ndk::ScopedFileDescriptor, kLutFileDescriptorMapperSize>; + ftl::SmallMap<HWC2::Layer*, ::android::base::unique_fd, kLutFileDescriptorMapperSize>; [[nodiscard]] virtual hal::Error acceptChanges() = 0; [[nodiscard]] virtual base::expected<std::shared_ptr<HWC2::Layer>, hal::Error> diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp index db41b9b5fc..545ed1949a 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp +++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp @@ -1068,7 +1068,7 @@ const std::unordered_map<std::string, bool>& HWComposer::getSupportedLayerGeneri return mSupportedLayerGenericMetadata; } -ftl::SmallMap<HWC2::Layer*, ndk::ScopedFileDescriptor, 20>& +ftl::SmallMap<HWC2::Layer*, ::android::base::unique_fd, 20>& HWComposer::getLutFileDescriptorMapper() { return mLutFileDescriptorMapper; } |