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

Commit c27991ab authored by Alec Mouri's avatar Alec Mouri Committed by Android (Google) Code Review
Browse files

Merge "Accomodate brightness space change for client target" into tm-dev

parents 7e6544bd f8d093dc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ public:
    virtual void applyChangedTypesToLayers(const ChangedTypes&);
    virtual void applyDisplayRequests(const DisplayRequests&);
    virtual void applyLayerRequestsToLayers(const LayerRequests&);
    virtual void applyClientTargetRequests(const ClientTargetProperty&, float whitePointNits);
    virtual void applyClientTargetRequests(const ClientTargetProperty&, float brightness);

    // Internal
    virtual void setConfiguration(const compositionengine::DisplayCreationArgs&);
+2 −2
Original line number Diff line number Diff line
@@ -130,8 +130,8 @@ struct OutputCompositionState {
    // SDR white point
    float sdrWhitePointNits{-1.f};

    // White point of the client target
    float clientTargetWhitePointNits{-1.f};
    // Brightness of the client target, normalized to display brightness
    float clientTargetBrightness{1.f};

    // Display brightness that will take effect this frame.
    // This is slightly distinct from nits, in that nits cannot be passed to hw composer.
+3 −4
Original line number Diff line number Diff line
@@ -266,8 +266,7 @@ void Display::chooseCompositionStrategy() {
        applyChangedTypesToLayers(changes->changedTypes);
        applyDisplayRequests(changes->displayRequests);
        applyLayerRequestsToLayers(changes->layerRequests);
        applyClientTargetRequests(changes->clientTargetProperty,
                                  changes->clientTargetWhitePointNits);
        applyClientTargetRequests(changes->clientTargetProperty, changes->clientTargetBrightness);
    }

    // Determine what type of composition we are doing from the final state
@@ -343,13 +342,13 @@ void Display::applyLayerRequestsToLayers(const LayerRequests& layerRequests) {
}

void Display::applyClientTargetRequests(const ClientTargetProperty& clientTargetProperty,
                                        float whitePointNits) {
                                        float brightness) {
    if (clientTargetProperty.dataspace == ui::Dataspace::UNKNOWN) {
        return;
    }

    editState().dataspace = clientTargetProperty.dataspace;
    editState().clientTargetWhitePointNits = whitePointNits;
    editState().clientTargetBrightness = brightness;
    getRenderSurface()->setBufferDataspace(clientTargetProperty.dataspace);
    getRenderSurface()->setBufferPixelFormat(clientTargetProperty.pixelFormat);
}
+2 −1
Original line number Diff line number Diff line
@@ -1076,7 +1076,8 @@ std::optional<base::unique_fd> Output::composeSurfaces(
            : mDisplayColorProfile->getHdrCapabilities().getDesiredMaxLuminance();
    clientCompositionDisplay.maxLuminance =
            mDisplayColorProfile->getHdrCapabilities().getDesiredMaxLuminance();
    clientCompositionDisplay.targetLuminanceNits = outputState.clientTargetWhitePointNits;
    clientCompositionDisplay.targetLuminanceNits =
            outputState.clientTargetBrightness * outputState.displayBrightnessNits;

    // Compute the global color transform matrix.
    clientCompositionDisplay.colorTransform = outputState.colorTransformMatrix;
+1 −1
Original line number Diff line number Diff line
@@ -839,7 +839,7 @@ TEST_F(DisplayApplyLayerRequestsToLayersTest, applyClientTargetRequests) {

    auto& state = mDisplay->getState();
    EXPECT_EQ(clientTargetProperty.dataspace, state.dataspace);
    EXPECT_EQ(kWhitePointNits, state.clientTargetWhitePointNits);
    EXPECT_EQ(kWhitePointNits, state.clientTargetBrightness);
}

/*
Loading