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

Commit 4d8a05d3 authored by Alec Mouri's avatar Alec Mouri
Browse files

Plumb display brightness nits to composer hal.

OEM feedback was that the display brightness in nits should be known to
the Hardware Composer for correct tone-mapping behavior by the DPU.
Inteperpolating the display brightness curve that's defined in display
config files is possible, but it would require the vendor to re-implement
DisplayManager logic for interpolating a spline curve.

Bug: 220396224
Test: builds, boots
Change-Id: I28d936c118bed1184d4f742478c8862f9e0aba95
parent 5a896f35
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -221,6 +221,7 @@ void Display::beginFrame() {
        physicalDisplayId && getState().displayBrightness) {
        const status_t result =
                hwc.setDisplayBrightness(*physicalDisplayId, *getState().displayBrightness,
                                         getState().displayBrightnessNits,
                                         Hwc2::Composer::DisplayBrightnessOptions{
                                                 .applyImmediately = false})
                        .get();
+3 −1
Original line number Diff line number Diff line
@@ -640,8 +640,9 @@ TEST_F(DisplayChooseCompositionStrategyTest, normalOperationWithDisplayBrightnes
    // values, use a Sequence to control the matching so the values are returned in a known
    // order.
    constexpr float kDisplayBrightness = 0.5f;
    constexpr float kDisplayBrightnessNits = 200.f;
    EXPECT_CALL(mHwComposer,
                setDisplayBrightness(DEFAULT_DISPLAY_ID, kDisplayBrightness,
                setDisplayBrightness(DEFAULT_DISPLAY_ID, kDisplayBrightness, kDisplayBrightnessNits,
                                     Hwc2::Composer::DisplayBrightnessOptions{.applyImmediately =
                                                                                      false}))
            .WillOnce(Return(ByMove(ftl::yield<status_t>(NO_ERROR))));
@@ -650,6 +651,7 @@ TEST_F(DisplayChooseCompositionStrategyTest, normalOperationWithDisplayBrightnes
    mock::RenderSurface* renderSurface = new StrictMock<mock::RenderSurface>();
    EXPECT_CALL(*renderSurface, beginFrame(_)).Times(1);
    mDisplay->setRenderSurfaceForTest(std::unique_ptr<RenderSurface>(renderSurface));
    mDisplay->editState().displayBrightnessNits = kDisplayBrightnessNits;
    mDisplay->beginFrame();

    auto& state = mDisplay->getState();
+2 −2
Original line number Diff line number Diff line
@@ -84,8 +84,8 @@ public:
    MOCK_METHOD4(setDisplayContentSamplingEnabled, status_t(HalDisplayId, bool, uint8_t, uint64_t));
    MOCK_METHOD4(getDisplayedContentSample,
                 status_t(HalDisplayId, uint64_t, uint64_t, DisplayedFrameStats*));
    MOCK_METHOD3(setDisplayBrightness,
                 std::future<status_t>(PhysicalDisplayId, float,
    MOCK_METHOD4(setDisplayBrightness,
                 std::future<status_t>(PhysicalDisplayId, float, float,
                                       const Hwc2::Composer::DisplayBrightnessOptions&));
    MOCK_METHOD2(getDisplayBrightnessSupport, status_t(PhysicalDisplayId, bool*));

+2 −2
Original line number Diff line number Diff line
@@ -927,9 +927,9 @@ Error AidlComposer::setLayerPerFrameMetadataBlobs(
    return Error::NONE;
}

Error AidlComposer::setDisplayBrightness(Display display, float brightness,
Error AidlComposer::setDisplayBrightness(Display display, float brightness, float brightnessNits,
                                         const DisplayBrightnessOptions& options) {
    mWriter.setDisplayBrightness(translate<int64_t>(display), brightness);
    mWriter.setDisplayBrightness(translate<int64_t>(display), brightness, brightnessNits);

    if (options.applyImmediately) {
        return execute();
+1 −1
Original line number Diff line number Diff line
@@ -183,7 +183,7 @@ public:
    Error setLayerPerFrameMetadataBlobs(
            Display display, Layer layer,
            const std::vector<IComposerClient::PerFrameMetadataBlob>& metadata) override;
    Error setDisplayBrightness(Display display, float brightness,
    Error setDisplayBrightness(Display display, float brightness, float brightnessNits,
                               const DisplayBrightnessOptions& options) override;

    // Composer HAL 2.4
Loading