[Lut HAL backend] implementation
- Add Lut in HWComposer::DeviceRequestedChanges
- parse lutProperties into overlayProperties
- Add a mapper <layer*, pfd> to store lut fd to avoid dup() ops if
passing the fds into callees.
- SurfaceComposerClient::Transaction::setLuts interface
Bug: 329472100
Test: builds
Flag: NONE HAL backend interface change
Change-Id: Ib2993ce1eab66ab456388c0d15b032201eac7e91
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.h b/services/surfaceflinger/DisplayHardware/HWC2.h
index 8e2aeaf..61f92f4 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2.h
+++ b/services/surfaceflinger/DisplayHardware/HWC2.h
@@ -20,6 +20,7 @@
#include <android-base/thread_annotations.h>
#include <ftl/expected.h>
#include <ftl/future.h>
+#include <ftl/small_map.h>
#include <gui/HdrMetadata.h>
#include <math/mat4.h>
#include <ui/HdrCapabilities.h>
@@ -107,6 +108,13 @@
virtual void onLayerDestroyed(hal::HWLayerId layerId) = 0;
virtual std::optional<ui::Size> getPhysicalSizeInMm() const = 0;
+ static const int kLutFileDescriptorMapperSize = 20;
+ using LayerLuts =
+ ftl::SmallMap<HWC2::Layer*, aidl::android::hardware::graphics::composer3::LutProperties,
+ kLutFileDescriptorMapperSize>;
+ using LutFileDescriptorMapper =
+ ftl::SmallMap<HWC2::Layer*, ndk::ScopedFileDescriptor, kLutFileDescriptorMapperSize>;
+
[[nodiscard]] virtual hal::Error acceptChanges() = 0;
[[nodiscard]] virtual base::expected<std::shared_ptr<HWC2::Layer>, hal::Error>
createLayer() = 0;
@@ -183,8 +191,7 @@
aidl::android::hardware::graphics::composer3::ClientTargetPropertyWithBrightness*
outClientTargetProperty) = 0;
[[nodiscard]] virtual hal::Error getRequestedLuts(
- std::vector<aidl::android::hardware::graphics::composer3::DisplayLuts::LayerLut>*
- outLuts) = 0;
+ LayerLuts* outLuts, LutFileDescriptorMapper& lutFileDescriptorMapper) = 0;
[[nodiscard]] virtual hal::Error getDisplayDecorationSupport(
std::optional<aidl::android::hardware::graphics::common::DisplayDecorationSupport>*
support) = 0;
@@ -268,9 +275,8 @@
hal::Error getClientTargetProperty(
aidl::android::hardware::graphics::composer3::ClientTargetPropertyWithBrightness*
outClientTargetProperty) override;
- hal::Error getRequestedLuts(
- std::vector<aidl::android::hardware::graphics::composer3::DisplayLuts::LayerLut>*
- outLuts) override;
+ hal::Error getRequestedLuts(LayerLuts* outLuts,
+ LutFileDescriptorMapper& lutFileDescriptorMapper) override;
hal::Error getDisplayDecorationSupport(
std::optional<aidl::android::hardware::graphics::common::DisplayDecorationSupport>*
support) override;