[Lut HAL backend] implementation 3rd patch.

- interpret the lut and pass them into shader.

Bug: 329472856
Test: builds
Flag: EXEMPT no flag needed
Change-Id: I005600593f4a369130bf8bcaea69300758b5ae03
diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputLayer.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputLayer.h
index 0c7e4dd..bfa387d 100644
--- a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputLayer.h
+++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputLayer.h
@@ -101,7 +101,7 @@
             aidl::android::hardware::graphics::composer3::Composition from,
             aidl::android::hardware::graphics::composer3::Composition to) const;
     bool isClientCompositionForced(bool isPeekingThrough) const;
-    void updateLuts(std::shared_ptr<gui::DisplayLuts> luts,
+    void updateLuts(const LayerFECompositionState&,
                     const std::optional<std::vector<std::optional<LutProperties>>>& properties);
 };
 
diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
index 934909d..c062df3 100644
--- a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
@@ -286,8 +286,13 @@
 }
 
 void OutputLayer::updateLuts(
-        std::shared_ptr<gui::DisplayLuts> layerFEStateLut,
+        const LayerFECompositionState& layerFEState,
         const std::optional<std::vector<std::optional<LutProperties>>>& properties) {
+    auto& luts = layerFEState.luts;
+    if (!luts) {
+        return;
+    }
+
     auto& state = editState();
 
     if (!properties) {
@@ -303,7 +308,7 @@
         }
     }
 
-    for (const auto& inputLut : layerFEStateLut->lutProperties) {
+    for (const auto& inputLut : luts->lutProperties) {
         bool foundInHwcLuts = false;
         for (const auto& hwcLut : hwcLutProperties) {
             if (static_cast<int32_t>(hwcLut.dimension) ==
@@ -316,7 +321,7 @@
                 break;
             }
         }
-        // if any lut properties of layerFEStateLut can not be found in hwcLutProperties,
+        // if any lut properties of luts can not be found in hwcLutProperties,
         // GPU composition instead
         if (!foundInHwcLuts) {
             state.forceClientComposition = true;
@@ -409,10 +414,7 @@
         state.whitePointNits = layerBrightnessNits;
     }
 
-    const auto& layerFEStateLut = layerFEState->luts;
-    if (layerFEStateLut) {
-        updateLuts(layerFEStateLut, properties);
-    }
+    updateLuts(*layerFEState, properties);
 
     // These are evaluated every frame as they can potentially change at any
     // time.
diff --git a/services/surfaceflinger/FrontEnd/RequestedLayerState.cpp b/services/surfaceflinger/FrontEnd/RequestedLayerState.cpp
index 713a5c5..ee9302b 100644
--- a/services/surfaceflinger/FrontEnd/RequestedLayerState.cpp
+++ b/services/surfaceflinger/FrontEnd/RequestedLayerState.cpp
@@ -163,7 +163,7 @@
     uint64_t clientChanges = what | layer_state_t::diff(clientState);
     layer_state_t::merge(clientState);
     what = clientChanges;
-    LLOGV(layerId, "requested=%" PRIu64 "flags=%" PRIu64, clientState.what, clientChanges);
+    LLOGV(layerId, "requested=%" PRIu64 " flags=%" PRIu64 " ", clientState.what, clientChanges);
 
     if (clientState.what & layer_state_t::eFlagsChanged) {
         if ((oldFlags ^ flags) &
@@ -633,7 +633,7 @@
             layer_state_t::eEdgeExtensionChanged | layer_state_t::eBufferCropChanged |
             layer_state_t::eDestinationFrameChanged | layer_state_t::eDimmingEnabledChanged |
             layer_state_t::eExtendedRangeBrightnessChanged |
-            layer_state_t::eDesiredHdrHeadroomChanged |
+            layer_state_t::eDesiredHdrHeadroomChanged | layer_state_t::eLutsChanged |
             (FlagManager::getInstance().latch_unsignaled_with_auto_refresh_changed()
                      ? layer_state_t::eFlagsChanged
                      : 0);