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

Commit 6a3b4469 authored by Lloyd Pique's avatar Lloyd Pique
Browse files

SF: Move pickColorMode and getBestDataspace to CompositionEngine

Test: atest libsurfaceflinger_unittest libcompositionengine_test
Bug: 121291683
Change-Id: I37c39f49bf0e1c851d0d5e4040dc3aa3e433e9f8
parent d3d6988c
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@

#include <compositionengine/Display.h>
#include <compositionengine/Layer.h>
#include <compositionengine/OutputColorSetting.h>

namespace android::compositionengine {

@@ -42,6 +43,15 @@ struct CompositionRefreshArgs {
    // If true, forces the entire display to be considered dirty and repainted
    bool repaintEverything{false};

    // Controls how the color mode is chosen for an output
    OutputColorSetting outputColorSetting{OutputColorSetting::kEnhanced};

    // If not Dataspace::UNKNOWN, overrides the dataspace on each output
    ui::Dataspace colorSpaceAgnosticDataspace{ui::Dataspace::UNKNOWN};

    // Forces a color mode on the outputs being refreshed
    ui::ColorMode forceOutputColorMode{ui::ColorMode::NATIVE};

    // If set, causes the dirty regions to flash with the delay
    std::optional<std::chrono::microseconds> devOptFlashDirtyRegionsDelay;
};
+11 −2
Original line number Diff line number Diff line
@@ -63,6 +63,13 @@ public:
        std::unordered_map<HWC2::Layer*, sp<Fence>> layerFences;
    };

    struct ColorProfile {
        ui::ColorMode mode{ui::ColorMode::NATIVE};
        ui::Dataspace dataspace{ui::Dataspace::UNKNOWN};
        ui::RenderIntent renderIntent{ui::RenderIntent::COLORIMETRIC};
        ui::Dataspace colorSpaceAgnosticDataspace{ui::Dataspace::UNKNOWN};
    };

    virtual ~Output();

    // Returns true if the output is valid. This is meant to be checked post-
@@ -87,8 +94,7 @@ public:
    virtual void setColorTransform(const mat4&) = 0;

    // Sets the output color mode
    virtual void setColorMode(ui::ColorMode, ui::Dataspace, ui::RenderIntent,
                              ui::Dataspace colorSpaceAgnosticDataspace) = 0;
    virtual void setColorProfile(const ColorProfile&) = 0;

    // Outputs a string with a state dump
    virtual void dump(std::string&) const = 0;
@@ -153,6 +159,9 @@ public:
    // Takes (moves) the set of layers being released this frame.
    virtual ReleasedLayers takeReleasedLayers() = 0;

    // Updates the color mode used on this output
    virtual void updateColorProfile(const CompositionRefreshArgs&) = 0;

    // Signals that a frame is beginning on the output
    virtual void beginFrame() = 0;

+27 −0
Original line number Diff line number Diff line
/*
 * Copyright 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

namespace android::compositionengine {

enum class OutputColorSetting : int32_t {
    kManaged = 0,
    kUnmanaged = 1,
    kEnhanced = 2,
};

} // namespace android::compositionengine
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ public:
    // compositionengine::Output overrides
    void dump(std::string&) const override;
    void setColorTransform(const mat4&) override;
    void setColorMode(ui::ColorMode, ui::Dataspace, ui::RenderIntent, ui::Dataspace) override;
    void setColorProfile(const ColorProfile&) override;
    void chooseCompositionStrategy() override;
    bool getSkipColorTransform() const override;
    compositionengine::Output::FrameFences presentAndGetFrameFences() override;
+6 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ public:
    void setLayerStackFilter(uint32_t layerStackId, bool isInternal) override;

    void setColorTransform(const mat4&) override;
    void setColorMode(ui::ColorMode, ui::Dataspace, ui::RenderIntent, ui::Dataspace) override;
    void setColorProfile(const ColorProfile&) override;

    void dump(std::string&) const override;

@@ -75,6 +75,8 @@ public:
    void setReleasedLayers(ReleasedLayers&&) override;
    ReleasedLayers takeReleasedLayers() override;

    void updateColorProfile(const compositionengine::CompositionRefreshArgs&) override;

    void beginFrame() override;
    void prepareFrame() override;
    void devOptRepaintFlash(const compositionengine::CompositionRefreshArgs&) override;
@@ -100,6 +102,9 @@ protected:

private:
    void dirtyEntireOutput();
    ui::Dataspace getBestDataspace(ui::Dataspace*, bool*) const;
    compositionengine::Output::ColorProfile pickColorProfile(
            const compositionengine::CompositionRefreshArgs&) const;

    const CompositionEngine& mCompositionEngine;

Loading