[Lut HAL backend] implementation 2nd patch
1. add gui/DisplayLuts.h structure. Mimic DisplayLuts.java.
2. add Lut parameter into Layer side. When SurfaceControl#setLuts is
called, in native code, the lut information is passed to
SurfaceFlinger and RenderEngine side via LayerState::eLutsChanged.
3. in OutputLayer::updateCompositionState, we compare the Lut
requested from the app and the Lut from the HWC to decide GPU
composition or not.
4. DPU or GPU composition? If the Lut from the app exactly matches the
Lut from the hwc, do DPU. Otherwise, GPU composition instead.
Bug: 329472856
Test: libcompositionengine_test
Flag: NONE HAL backend interface change
Change-Id: I8295fe419c6237d90b7ff9f02f62bafd6cd2cecf
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 063aabb..ebad069 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -29,6 +29,7 @@
#include <android/gui/IWindowInfosListener.h>
#include <android/gui/TrustedPresentationThresholds.h>
#include <android/os/IInputConstants.h>
+#include <gui/DisplayLuts.h>
#include <gui/FrameRateUtils.h>
#include <gui/TraceUtils.h>
#include <utils/Errors.h>
@@ -1940,15 +1941,19 @@
}
SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setLuts(
- const sp<SurfaceControl>& sc, const base::unique_fd& /*lutFd*/,
- const std::vector<int32_t>& /*offsets*/, const std::vector<int32_t>& /*dimensions*/,
- const std::vector<int32_t>& /*sizes*/, const std::vector<int32_t>& /*samplingKeys*/) {
+ const sp<SurfaceControl>& sc, const base::unique_fd& lutFd,
+ const std::vector<int32_t>& offsets, const std::vector<int32_t>& dimensions,
+ const std::vector<int32_t>& sizes, const std::vector<int32_t>& samplingKeys) {
layer_state_t* s = getLayerState(sc);
if (!s) {
mStatus = BAD_INDEX;
return *this;
}
- // TODO (b/329472856): update layer_state_t for lut(s)
+
+ s->luts = std::make_shared<gui::DisplayLuts>(base::unique_fd(dup(lutFd.get())), offsets,
+ dimensions, sizes, samplingKeys);
+ s->what |= layer_state_t::eLutsChanged;
+
registerSurfaceControlForCallback(sc);
return *this;
}