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

Commit 2a6ab2aa authored by Ady Abraham's avatar Ady Abraham
Browse files

SurfaceFlinger: fix color transfer test

Add support for color management in
LayerTransactionTest.SetColorTransformBasic.

If color management is enabled, some considerations are needed
for the expected color output.

Test: adb shell /data/nativetest64/SurfaceFlinger_test/SurfaceFlinger_test
Change-Id: I7be7d561e7683fd57db0519932c4c308a6350c0d
parent 27631c9c
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -583,6 +583,21 @@ public:
        }
        return error;
    }

    virtual bool isColorManagementUsed() const {
        Parcel data, reply;
        data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
        remote()->transact(BnSurfaceComposer::IS_COLOR_MANAGEMET_USED, data, &reply);
        int32_t result = 0;
        status_t err = reply.readInt32(&result);
        if (err != NO_ERROR) {
            ALOGE("ISurfaceComposer::isColorManagementUsed: error "
                  "retrieving result: %s (%d)",
                  strerror(-err), -err);
            return false;
        }
        return result != 0;
    }
};

// Out-of-line virtual method definition to trigger vtable emission in this
@@ -920,6 +935,12 @@ status_t BnSurfaceComposer::onTransact(
            }
            return NO_ERROR;
        }
        case IS_COLOR_MANAGEMET_USED: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            int32_t result = isColorManagementUsed() ? 1 : 0;
            reply->writeInt32(result);
            return NO_ERROR;
        }
        default: {
            return BBinder::onTransact(code, data, reply, flags);
        }
+3 −0
Original line number Diff line number Diff line
@@ -282,6 +282,8 @@ public:

    virtual status_t getCompositionPreference(ui::Dataspace* dataSpace,
                                              ui::PixelFormat* pixelFormat) const = 0;

    virtual bool isColorManagementUsed() const = 0;
};

// ----------------------------------------------------------------------------
@@ -320,6 +322,7 @@ public:
        GET_LAYER_DEBUG_INFO,
        CREATE_SCOPED_CONNECTION,
        GET_COMPOSITION_PREFERENCE,
        IS_COLOR_MANAGEMET_USED,
    };

    virtual status_t onTransact(uint32_t code, const Parcel& data,
+2 −0
Original line number Diff line number Diff line
@@ -633,6 +633,8 @@ public:
        return NO_ERROR;
    }

    virtual bool isColorManagementUsed() const { return false; }

protected:
    IBinder* onAsBinder() override { return nullptr; }

+5 −0
Original line number Diff line number Diff line
@@ -513,6 +513,10 @@ sp<IBinder> SurfaceFlinger::getBuiltInDisplay(int32_t id) {
    return mDisplayTokens[id];
}

bool SurfaceFlinger::isColorManagementUsed() const {
    return useColorManagement;
}

void SurfaceFlinger::bootFinished()
{
    if (mStartPropertySetThread->join() != NO_ERROR) {
@@ -4744,6 +4748,7 @@ status_t SurfaceFlinger::CheckTransactCodeCredentials(uint32_t code) {
        case SET_TRANSACTION_STATE:
        // Creating a scoped connection is safe, as per discussion in ISurfaceComposer.h
        case CREATE_SCOPED_CONNECTION:
        case IS_COLOR_MANAGEMET_USED:
        case GET_COMPOSITION_PREFERENCE: {
            return OK;
        }
+1 −0
Original line number Diff line number Diff line
@@ -462,6 +462,7 @@ private:
    virtual status_t getLayerDebugInfo(std::vector<LayerDebugInfo>* outLayers) const;
    status_t getCompositionPreference(ui::Dataspace* outDataSpace,
                                      ui::PixelFormat* outPixelFormat) const override;
    virtual bool isColorManagementUsed() const;

    /* ------------------------------------------------------------------------
     * DeathRecipient interface
Loading