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

Commit 5685a2e7 authored by Peiyong Lin's avatar Peiyong Lin Committed by android-build-merger
Browse files

Merge "[SurfaceFlinger] Make sure data space is set correctly" into pi-dev

am: c9340b63

Change-Id: I626dd5c8229d1b366d427d2a8c588f590d56509c
parents 92b1f9af c9340b63
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -515,7 +515,27 @@ Region BufferLayer::latchBuffer(bool& recomputeVisibleRegions, nsecs_t latchTime
        recomputeVisibleRegions = true;
    }

    setDataSpace(mConsumer->getCurrentDataSpace());
    // Dataspace::V0_SRGB and Dataspace::V0_SRGB_LINEAR are not legacy
    // data space, however since framework doesn't distinguish them out of
    // legacy SRGB, we have to treat them as the same for now.
    // UNKNOWN is treated as legacy SRGB when the connected api is EGL.
    ui::Dataspace dataSpace = mConsumer->getCurrentDataSpace();
    switch (dataSpace) {
        case ui::Dataspace::V0_SRGB:
            dataSpace = ui::Dataspace::SRGB;
            break;
        case ui::Dataspace::V0_SRGB_LINEAR:
            dataSpace = ui::Dataspace::SRGB_LINEAR;
            break;
        case ui::Dataspace::UNKNOWN:
            if (mConsumer->getCurrentApi() == NATIVE_WINDOW_API_EGL) {
                dataSpace = ui::Dataspace::SRGB;
            }
            break;
        default:
            break;
    }
    setDataSpace(dataSpace);

    Rect crop(mConsumer->getCurrentCrop());
    const uint32_t transform(mConsumer->getCurrentTransform());
+2 −12
Original line number Diff line number Diff line
@@ -1643,19 +1643,9 @@ bool Layer::detachChildren() {
    return true;
}

// Dataspace::UNKNOWN, Dataspace::SRGB, Dataspace::SRGB_LINEAR,
// Dataspace::V0_SRGB and Dataspace::V0_SRGB_LINEAR are considered legacy
// SRGB data space for now.
// Note that Dataspace::V0_SRGB and Dataspace::V0_SRGB_LINEAR are not legacy
// data space, however since framework doesn't distinguish them out of legacy
// SRGB, we have to treat them as the same for now.
bool Layer::isLegacySrgbDataSpace() const {
    // TODO(lpy) b/77652630, need to figure out when UNKNOWN can be treated as SRGB.
    return mDrawingState.dataSpace == ui::Dataspace::UNKNOWN ||
        mDrawingState.dataSpace == ui::Dataspace::SRGB ||
        mDrawingState.dataSpace == ui::Dataspace::SRGB_LINEAR ||
        mDrawingState.dataSpace == ui::Dataspace::V0_SRGB ||
        mDrawingState.dataSpace == ui::Dataspace::V0_SRGB_LINEAR;
    return mDrawingState.dataSpace == ui::Dataspace::SRGB ||
        mDrawingState.dataSpace == ui::Dataspace::SRGB_LINEAR;
}

void Layer::setParent(const sp<Layer>& layer) {