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

Commit 492cec32 authored by Sally Qi's avatar Sally Qi
Browse files

[SurfaceFinger] Add getDisplayLuts interface.

Bug: 329472856
Test: builds
Flag: EXEMPT HAL interface change
Change-Id: I9a7fcba9f0281662c67645b47b2978f0ee9531c6
parent 9d934309
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ using hardware::Return;
using aidl::android::hardware::graphics::composer3::BnComposerCallback;
using aidl::android::hardware::graphics::composer3::Capability;
using aidl::android::hardware::graphics::composer3::ClientTargetPropertyWithBrightness;
using aidl::android::hardware::graphics::composer3::Lut;
using aidl::android::hardware::graphics::composer3::PowerMode;
using aidl::android::hardware::graphics::composer3::VirtualDisplay;

@@ -1539,6 +1540,18 @@ Error AidlComposer::getClientTargetProperty(
    return error;
}

Error AidlComposer::getDisplayLuts(Display display, std::vector<Lut>* outLuts) {
    Error error = Error::NONE;
    mMutex.lock_shared();
    if (auto reader = getReader(display)) {
        *outLuts = reader->get().takeDisplayLuts(translate<int64_t>(display));
    } 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();
+3 −0
Original line number Diff line number Diff line
@@ -244,6 +244,9 @@ public:
    Error setRefreshRateChangedCallbackDebugEnabled(Display, bool) override;
    Error notifyExpectedPresent(Display, nsecs_t expectedPresentTime,
                                int32_t frameIntervalNs) override;
    Error getDisplayLuts(
            Display display,
            std::vector<aidl::android::hardware::graphics::composer3::Lut>* outLuts) override;

private:
    // Many public functions above simply write a command into the command
+2 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
#include <aidl/android/hardware/graphics/composer3/DisplayCapability.h>
#include <aidl/android/hardware/graphics/composer3/DisplayConfiguration.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>

#include <aidl/android/hardware/graphics/common/Transform.h>
@@ -303,6 +304,7 @@ 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;
};

} // namespace Hwc2
+13 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ using aidl::android::hardware::graphics::composer3::Color;
using aidl::android::hardware::graphics::composer3::Composition;
using AidlCapability = aidl::android::hardware::graphics::composer3::Capability;
using aidl::android::hardware::graphics::composer3::DisplayCapability;
using aidl::android::hardware::graphics::composer3::Lut;
using aidl::android::hardware::graphics::composer3::OverlayProperties;

namespace android {
@@ -607,6 +608,18 @@ Error Display::getClientTargetProperty(
    return static_cast<Error>(error);
}

Error Display::getDisplayLuts(std::vector<Lut>* outLuts) {
    std::vector<Lut> tmpLuts;
    const auto error = mComposer.getDisplayLuts(mId, &tmpLuts);
    for (Lut& lut : tmpLuts) {
        if (lut.pfd.get() >= 0) {
            outLuts->push_back(
                    {lut.layer, ndk::ScopedFileDescriptor(lut.pfd.release()), lut.lutProperties});
        }
    }
    return static_cast<Error>(error);
}

Error Display::getDisplayDecorationSupport(
        std::optional<aidl::android::hardware::graphics::common::DisplayDecorationSupport>*
                support) {
+5 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@
#include <aidl/android/hardware/graphics/composer3/Color.h>
#include <aidl/android/hardware/graphics/composer3/Composition.h>
#include <aidl/android/hardware/graphics/composer3/DisplayCapability.h>
#include <aidl/android/hardware/graphics/composer3/Lut.h>
#include <aidl/android/hardware/graphics/composer3/OverlayProperties.h>
#include <aidl/android/hardware/graphics/composer3/RefreshRateChangedDebugData.h>

@@ -178,6 +179,8 @@ public:
    [[nodiscard]] virtual hal::Error getClientTargetProperty(
            aidl::android::hardware::graphics::composer3::ClientTargetPropertyWithBrightness*
                    outClientTargetProperty) = 0;
    [[nodiscard]] virtual hal::Error getDisplayLuts(
            std::vector<aidl::android::hardware::graphics::composer3::Lut>* outLuts) = 0;
    [[nodiscard]] virtual hal::Error getDisplayDecorationSupport(
            std::optional<aidl::android::hardware::graphics::common::DisplayDecorationSupport>*
                    support) = 0;
@@ -261,6 +264,8 @@ public:
    hal::Error getClientTargetProperty(
            aidl::android::hardware::graphics::composer3::ClientTargetPropertyWithBrightness*
                    outClientTargetProperty) override;
    hal::Error getDisplayLuts(
            std::vector<aidl::android::hardware::graphics::composer3::Lut>* outLuts) override;
    hal::Error getDisplayDecorationSupport(
            std::optional<aidl::android::hardware::graphics::common::DisplayDecorationSupport>*
                    support) override;
Loading