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

Commit 1a4ffd89 authored by Brian Lindahl's avatar Brian Lindahl
Browse files

Compose a layer with a picture profile passed in by an app

Forwards the picture profile to Composer HAL during composition. The
priority of a layer's profile, passed in by an app, plays a role in
deciding which requested profile actually get sent to Composer HAL
when limited picture processing hardware resources come into play.

Bug: 337330263
Test: atest OutputLayerWriteStateToHWCTest
Test: atest OutputUpdateAndWriteCompositionStateTest
Flag: com.android.graphics.libgui.flags.apply_picture_profiles
Change-Id: I396d4928c46002844df3c707421974f30cb8d98b
parent 2c6de794
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ cc_defaults {
        "libutils",
    ],
    static_libs: [
        "libguiflags",
        "libmath",
        "librenderengine",
        "libtimestats",
+16 −0
Original line number Diff line number Diff line
@@ -46,6 +46,12 @@ struct DisplayCreationArgs {
    // content.
    bool isProtected = false;

    // True if this display has picture processing hardware and pipelines.
    bool hasPictureProcessing = false;

    // The number of layer-specific picture-processing pipelines.
    int32_t maxLayerPictureProfiles = 0;

    // Optional pointer to the power advisor interface, if one is needed for
    // this display.
    adpf::PowerAdvisor* powerAdvisor = nullptr;
@@ -82,6 +88,16 @@ public:
        return *this;
    }

    DisplayCreationArgsBuilder& setHasPictureProcessing(bool hasPictureProcessing) {
        mArgs.hasPictureProcessing = hasPictureProcessing;
        return *this;
    }

    DisplayCreationArgsBuilder& setMaxLayerPictureProfiles(int32_t maxLayerPictureProfiles) {
        mArgs.maxLayerPictureProfiles = maxLayerPictureProfiles;
        return *this;
    }

    DisplayCreationArgsBuilder& setPowerAdvisor(adpf::PowerAdvisor* powerAdvisor) {
        mArgs.powerAdvisor = powerAdvisor;
        return *this;
+9 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include <ui/BlurRegion.h>
#include <ui/FloatRect.h>
#include <ui/LayerStack.h>
#include <ui/PictureProfileHandle.h>
#include <ui/Rect.h>
#include <ui/Region.h>
#include <ui/ShadowSettings.h>
@@ -219,6 +220,14 @@ struct LayerFECompositionState {
    float currentHdrSdrRatio = 1.f;
    float desiredHdrSdrRatio = 1.f;

    // A picture profile handle refers to a PictureProfile configured on the display, which is a
    // set of parameters that configures the picture processing hardware that is used to enhance
    // the quality of buffer contents.
    PictureProfileHandle pictureProfileHandle{PictureProfileHandle::NONE};

    // A layer's priority in terms of limited picture processing pipeline utilization.
    int64_t pictureProfilePriority;

    gui::CachingHint cachingHint = gui::CachingHint::Enabled;

    std::shared_ptr<gui::DisplayLuts> luts;
+8 −3
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

#pragma once

#include <ftl/future.h>
#include <ftl/optional.h>
#include <cstdint>
#include <iterator>
#include <optional>
@@ -26,18 +28,18 @@
#include <vector>

#include <compositionengine/LayerFE.h>
#include <ftl/future.h>
#include <renderengine/LayerSettings.h>
#include <ui/DisplayIdentification.h>
#include <ui/Fence.h>
#include <ui/FenceTime.h>
#include <ui/GraphicTypes.h>
#include <ui/LayerStack.h>
#include <ui/PictureProfileHandle.h>
#include <ui/Region.h>
#include <ui/Transform.h>
#include <utils/StrongPointer.h>
#include <utils/Vector.h>

#include <ui/DisplayIdentification.h>
#include "DisplayHardware/HWComposer.h"

namespace android {
@@ -167,7 +169,7 @@ public:
    virtual bool isValid() const = 0;

    // Returns the DisplayId the output represents, if it has one
    virtual std::optional<DisplayId> getDisplayId() const = 0;
    virtual ftl::Optional<DisplayId> getDisplayId() const = 0;

    // Enables (or disables) composition on this output
    virtual void setCompositionEnabled(bool) = 0;
@@ -331,6 +333,9 @@ protected:
    virtual bool canPredictCompositionStrategy(const CompositionRefreshArgs&) = 0;
    virtual const aidl::android::hardware::graphics::composer3::OverlayProperties*
    getOverlaySupport() = 0;
    virtual bool hasPictureProcessing() const = 0;
    virtual int32_t getMaxLayerPictureProfiles() const = 0;
    virtual void applyPictureProfile() = 0;
};

} // namespace compositionengine
+11 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <string>
#include <vector>

#include <ui/PictureProfileHandle.h>
#include <ui/Transform.h>
#include <utils/StrongPointer.h>

@@ -86,6 +87,16 @@ public:
    // longer cares about.
    virtual void uncacheBuffers(const std::vector<uint64_t>& bufferIdsToUncache) = 0;

    // Get the relative priority of the layer's picture profile with respect to the importance of
    // the visual content to the user experience. Lower is higher priority.
    virtual int64_t getPictureProfilePriority() const = 0;

    // The picture profile handle for the layer.
    virtual const PictureProfileHandle& getPictureProfileHandle() const = 0;

    // Commit the picture profile to the composition state.
    virtual void commitPictureProfileToCompositionState() = 0;

    // Recalculates the state of the output layer from the output-independent
    // layer. If includeGeometry is false, the geometry state can be skipped.
    // internalDisplayRotationFlags must be set to the rotation flags for the
Loading