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

Commit 7a772ff3 authored by Chia-I Wu's avatar Chia-I Wu Committed by android-build-merger
Browse files

Merge changes from topic "color-auto-legacy-srgb" into pi-dev

am: 96b513ce

Change-Id: I83065d71e382827bf35e810b70a36f83420145dc
parents f54bed5d 96b513ce
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -528,11 +528,9 @@ Region BufferLayer::latchBuffer(bool& recomputeVisibleRegions, nsecs_t latchTime
        recomputeVisibleRegions = true;
    }

    // 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();
    // treat modern dataspaces as legacy dataspaces whenever possible, until
    // we can trust the buffer producers
    switch (dataSpace) {
        case ui::Dataspace::V0_SRGB:
            dataSpace = ui::Dataspace::SRGB;
@@ -540,10 +538,17 @@ Region BufferLayer::latchBuffer(bool& recomputeVisibleRegions, nsecs_t latchTime
        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;
            }
        case ui::Dataspace::V0_JFIF:
            dataSpace = ui::Dataspace::JFIF;
            break;
        case ui::Dataspace::V0_BT601_625:
            dataSpace = ui::Dataspace::BT601_625;
            break;
        case ui::Dataspace::V0_BT601_525:
            dataSpace = ui::Dataspace::BT601_525;
            break;
        case ui::Dataspace::V0_BT709:
            dataSpace = ui::Dataspace::BT709;
            break;
        default:
            break;
+4 −3
Original line number Diff line number Diff line
@@ -1650,9 +1650,10 @@ bool Layer::detachChildren() {
    return true;
}

bool Layer::isLegacySrgbDataSpace() const {
    return mDrawingState.dataSpace == ui::Dataspace::SRGB ||
        mDrawingState.dataSpace == ui::Dataspace::SRGB_LINEAR;
bool Layer::isLegacyDataSpace() const {
    // return true when no higher bits are set
    return !(mDrawingState.dataSpace & (ui::Dataspace::STANDARD_MASK |
                ui::Dataspace::TRANSFER_MASK | ui::Dataspace::RANGE_MASK));
}

void Layer::setParent(const sp<Layer>& layer) {
+2 −2
Original line number Diff line number Diff line
@@ -303,8 +303,8 @@ public:
    // desaturated in order to match what they appears like visually.
    // With color management, these contents will appear desaturated, thus
    // needed to be saturated so that they match what they are designed for
    // visually. When returns true, legacy SRGB data space is passed to HWC.
    bool isLegacySrgbDataSpace() const;
    // visually.
    bool isLegacyDataSpace() const;

    // If we have received a new buffer this frame, we will pass its surface
    // damage down to hardware composer. Otherwise, we must send a region with
+1 −3
Original line number Diff line number Diff line
@@ -259,10 +259,8 @@ void GLES20RenderEngine::setupLayerBlackedOut() {
    mState.setTexture(texture);
}

mat4 GLES20RenderEngine::setupColorTransform(const mat4& colorTransform) {
    mat4 oldTransform = mState.getColorMatrix();
void GLES20RenderEngine::setupColorTransform(const mat4& colorTransform) {
    mState.setColorMatrix(colorTransform);
    return oldTransform;
}

void GLES20RenderEngine::disableTexturing() {
+1 −1
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ protected:
    virtual void setupLayerTexturing(const Texture& texture);
    virtual void setupLayerBlackedOut();
    virtual void setupFillWithColor(float r, float g, float b, float a);
    virtual mat4 setupColorTransform(const mat4& colorTransform);
    virtual void setupColorTransform(const mat4& colorTransform);
    virtual void disableTexturing();
    virtual void disableBlending();

Loading