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

Commit 49d9ad3d authored by John Reck's avatar John Reck
Browse files

Allow skipping camera layers for HDR callback

Bug: 218728138
Test: make; verified callback didn't change for youtube HDR
Change-Id: I3ee4999d221052be5d8d093033b90bfe6b3aa87e
parent 7e6544bd
Loading
Loading
Loading
Loading
+16 −1
Original line number Original line 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)) {
    if (!mIsUserBuild && base::GetBoolProperty("debug.sf.enable_transaction_tracing"s, true)) {
        mTransactionTracing.emplace();
        mTransactionTracing.emplace();
    }
    }

    mIgnoreHdrCameraLayers = ignore_hdr_camera_layers(false);
}
}


LatchUnsignaledConfig SurfaceFlinger::getLatchUnsignaledConfig() {
LatchUnsignaledConfig SurfaceFlinger::getLatchUnsignaledConfig() {
@@ -2375,6 +2377,19 @@ void SurfaceFlinger::setCompositorTimingSnapped(const DisplayStatInfo& stats,
    getBE().mCompositorTiming.presentLatency = snappedCompositeToPresentLatency;
    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() {
void SurfaceFlinger::postComposition() {
    ATRACE_CALL();
    ATRACE_CALL();
    ALOGV("postComposition");
    ALOGV("postComposition");
@@ -2460,7 +2475,7 @@ void SurfaceFlinger::postComposition() {
            mDrawingState.traverse([&, compositionDisplay = compositionDisplay](Layer* layer) {
            mDrawingState.traverse([&, compositionDisplay = compositionDisplay](Layer* layer) {
                const auto layerFe = layer->getCompositionEngineLayerFE();
                const auto layerFe = layer->getCompositionEngineLayerFE();
                if (layer->isVisible() && compositionDisplay->includesLayer(layerFe)) {
                if (layer->isVisible() && compositionDisplay->includesLayer(layerFe)) {
                    if (isHdrDataspace(layer->getDataSpace())) {
                    if (isHdrLayer(layer)) {
                        const auto* outputLayer =
                        const auto* outputLayer =
                            compositionDisplay->getOutputLayerForLayer(layerFe);
                            compositionDisplay->getOutputLayerForLayer(layerFe);
                        if (outputLayer) {
                        if (outputLayer) {
+3 −0
Original line number Original line Diff line number Diff line
@@ -1120,6 +1120,8 @@ private:
    void updateInternalDisplayVsyncLocked(const sp<DisplayDevice>& activeDisplay)
    void updateInternalDisplayVsyncLocked(const sp<DisplayDevice>& activeDisplay)
            REQUIRES(mStateLock);
            REQUIRES(mStateLock);


    bool isHdrLayer(Layer* layer) const;

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


    // Set during transaction application stage to track if the input info or children
    // Set during transaction application stage to track if the input info or children
    // for a layer has changed.
    // for a layer has changed.
+4 −0
Original line number Original line Diff line number Diff line
@@ -371,5 +371,9 @@ bool enable_layer_caching(bool defaultValue) {
    return SurfaceFlingerProperties::enable_layer_caching().value_or(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 sysprop
} // namespace android
} // namespace android
+2 −0
Original line number Original line Diff line number Diff line
@@ -100,6 +100,8 @@ bool enable_layer_caching(bool defaultValue);


bool enable_sdr_dimming(bool defaultValue);
bool enable_sdr_dimming(bool defaultValue);


bool ignore_hdr_camera_layers(bool defaultValue);

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