Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 11dcd58b authored by Sally Qi's avatar Sally Qi
Browse files

[LUT implementation] add Lut HAL new interface changes.

Bug: 329472856
Test: builds
Flag: EXEMPT HAL interface change
Change-Id: I724af90d585c996e09b2b1167285a854d7860999
parent c6f02fb0
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
#include "DisplayHardware/HWC2.h"

#include <aidl/android/hardware/graphics/composer3/Composition.h>
#include <aidl/android/hardware/graphics/composer3/Lut.h>

// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic pop // ignored "-Wconversion -Wextra"
@@ -77,6 +78,7 @@ public:
                 Error(const std::string&, bool, const std::vector<uint8_t>&));
    MOCK_METHOD1(setBrightness, Error(float));
    MOCK_METHOD1(setBlockingRegion, Error(const android::Region&));
    MOCK_METHOD(Error, setLuts, (std::vector<aidl::android::hardware::graphics::composer3::Lut>&));
};

} // namespace mock
+4 −0
Original line number Diff line number Diff line
@@ -151,6 +151,10 @@ public:
                getOverlaySupport, (), (const, override));
    MOCK_METHOD(status_t, setRefreshRateChangedCallbackDebugEnabled, (PhysicalDisplayId, bool));
    MOCK_METHOD(status_t, notifyExpectedPresent, (PhysicalDisplayId, TimePoint, Fps));
    MOCK_METHOD(status_t, getRequestedLuts,
                (PhysicalDisplayId,
                 std::vector<aidl::android::hardware::graphics::composer3::DisplayLuts::LayerLut>*),
                (override));
};

} // namespace mock
+13 −1
Original line number Diff line number Diff line
@@ -1540,7 +1540,7 @@ Error AidlComposer::getClientTargetProperty(
    return error;
}

Error AidlComposer::getDisplayLuts(Display display, std::vector<Lut>* outLuts) {
Error AidlComposer::getRequestedLuts(Display display, std::vector<DisplayLuts::LayerLut>* outLuts) {
    Error error = Error::NONE;
    mMutex.lock_shared();
    if (auto reader = getReader(display)) {
@@ -1552,6 +1552,18 @@ Error AidlComposer::getDisplayLuts(Display display, std::vector<Lut>* outLuts) {
    return error;
}

Error AidlComposer::setLayerLuts(Display display, Layer layer, std::vector<Lut>& luts) {
    Error error = Error::NONE;
    mMutex.lock_shared();
    if (auto writer = getWriter(display)) {
        writer->get().setLayerLuts(translate<int64_t>(display), translate<int64_t>(layer), luts);
    } else {
        error = Error::BAD_DISPLAY;
    }
    mMutex.unlock_shared();
    return error;
}

Error AidlComposer::setLayerBrightness(Display display, Layer layer, float brightness) {
    Error error = Error::NONE;
    mMutex.lock_shared();
+6 −2
Original line number Diff line number Diff line
@@ -244,9 +244,13 @@ public:
    Error setRefreshRateChangedCallbackDebugEnabled(Display, bool) override;
    Error notifyExpectedPresent(Display, nsecs_t expectedPresentTime,
                                int32_t frameIntervalNs) override;
    Error getDisplayLuts(
    Error getRequestedLuts(
            Display display,
            std::vector<aidl::android::hardware::graphics::composer3::Lut>* outLuts) override;
            std::vector<aidl::android::hardware::graphics::composer3::DisplayLuts::LayerLut>*
                    outLuts) override;
    Error setLayerLuts(
            Display display, Layer layer,
            std::vector<aidl::android::hardware::graphics::composer3::Lut>& luts) override;

private:
    // Many public functions above simply write a command into the command
+4 −1
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@
#include <aidl/android/hardware/graphics/composer3/Composition.h>
#include <aidl/android/hardware/graphics/composer3/DisplayCapability.h>
#include <aidl/android/hardware/graphics/composer3/DisplayConfiguration.h>
#include <aidl/android/hardware/graphics/composer3/DisplayLuts.h>
#include <aidl/android/hardware/graphics/composer3/IComposerCallback.h>
#include <aidl/android/hardware/graphics/composer3/Lut.h>
#include <aidl/android/hardware/graphics/composer3/OverlayProperties.h>
@@ -304,7 +305,9 @@ public:
    virtual Error setRefreshRateChangedCallbackDebugEnabled(Display, bool) = 0;
    virtual Error notifyExpectedPresent(Display, nsecs_t expectedPresentTime,
                                        int32_t frameIntervalNs) = 0;
    virtual Error getDisplayLuts(Display display, std::vector<V3_0::Lut>* outLuts) = 0;
    virtual Error getRequestedLuts(Display display,
                                   std::vector<V3_0::DisplayLuts::LayerLut>* outLuts) = 0;
    virtual Error setLayerLuts(Display display, Layer layer, std::vector<V3_0::Lut>& luts) = 0;
};

} // namespace Hwc2
Loading