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

Commit eaaa984e authored by John Reck's avatar John Reck Committed by Automerger Merge Worker
Browse files

Merge "Allow skipping camera layers for HDR callback" into tm-dev am: e73b8065

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/16994624

Change-Id: Iff19dddabf8196529286e7c4cdc98e1e4846b7ce
parents 2bfbee0c e73b8065
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -500,6 +500,8 @@ SurfaceFlinger::SurfaceFlinger(Factory& factory) : SurfaceFlinger(factory, SkipI
    if (!mIsUserBuild && base::GetBoolProperty("debug.sf.enable_transaction_tracing"s, true)) {
        mTransactionTracing.emplace();
    }

    mIgnoreHdrCameraLayers = ignore_hdr_camera_layers(false);
}

LatchUnsignaledConfig SurfaceFlinger::getLatchUnsignaledConfig() {
@@ -2383,6 +2385,19 @@ void SurfaceFlinger::setCompositorTimingSnapped(const DisplayStatInfo& stats,
    getBE().mCompositorTiming.presentLatency = snappedCompositeToPresentLatency;
}

bool SurfaceFlinger::isHdrLayer(Layer* layer) const {
    if (!isHdrDataspace(layer->getDataSpace())) {
        return false;
    }
    if (mIgnoreHdrCameraLayers) {
        auto buffer = layer->getBuffer();
        if (buffer && (buffer->getUsage() & GRALLOC_USAGE_HW_CAMERA_WRITE) != 0) {
            return false;
        }
    }
    return true;
}

void SurfaceFlinger::postComposition() {
    ATRACE_CALL();
    ALOGV("postComposition");
@@ -2468,7 +2483,7 @@ void SurfaceFlinger::postComposition() {
            mDrawingState.traverse([&, compositionDisplay = compositionDisplay](Layer* layer) {
                const auto layerFe = layer->getCompositionEngineLayerFE();
                if (layer->isVisible() && compositionDisplay->includesLayer(layerFe)) {
                    if (isHdrDataspace(layer->getDataSpace())) {
                    if (isHdrLayer(layer)) {
                        const auto* outputLayer =
                            compositionDisplay->getOutputLayerForLayer(layerFe);
                        if (outputLayer) {
+3 −0
Original line number Diff line number Diff line
@@ -1143,6 +1143,8 @@ private:
    void updateInternalDisplayVsyncLocked(const sp<DisplayDevice>& activeDisplay)
            REQUIRES(mStateLock);

    bool isHdrLayer(Layer* layer) const;

    sp<StartPropertySetThread> mStartPropertySetThread;
    surfaceflinger::Factory& mFactory;
    pid_t mPid;
@@ -1191,6 +1193,7 @@ private:
    // Used to ensure we omit a callback when HDR layer info listener is newly added but the
    // scene hasn't changed
    bool mAddingHDRLayerInfoListener = false;
    bool mIgnoreHdrCameraLayers = false;

    // Set during transaction application stage to track if the input info or children
    // for a layer has changed.
+4 −0
Original line number Diff line number Diff line
@@ -371,5 +371,9 @@ bool enable_layer_caching(bool defaultValue) {
    return SurfaceFlingerProperties::enable_layer_caching().value_or(defaultValue);
}

bool ignore_hdr_camera_layers(bool defaultValue) {
    return SurfaceFlingerProperties::ignore_hdr_camera_layers().value_or(defaultValue);
}

} // namespace sysprop
} // namespace android
+2 −0
Original line number Diff line number Diff line
@@ -100,6 +100,8 @@ bool enable_layer_caching(bool defaultValue);

bool enable_sdr_dimming(bool defaultValue);

bool ignore_hdr_camera_layers(bool defaultValue);

} // namespace sysprop
} // namespace android
#endif // SURFACEFLINGERPROPERTIES_H_
+9 −0
Original line number Diff line number Diff line
@@ -462,3 +462,12 @@ prop {
    access: Readonly
    prop_name: "ro.surface_flinger.enable_sdr_dimming"
}

# Ignores Camera layers when calculating HDR coverage information
prop {
    api_name: "ignore_hdr_camera_layers"
    type: Boolean
    scope: Public
    access: Readonly
    prop_name: "ro.surface_flinger.ignore_hdr_camera_layers"
}
 No newline at end of file
Loading