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

Commit 18b6b49e authored by Mathias Agopian's avatar Mathias Agopian
Browse files

fix a bug that caused the PixelFormat viewed by Surface to be wrong.

what happened is that the efective pixel format is calculated by SF but Surface nevew had access to it directly.
in particular this caused query(FORMAT) to return the requested format instead of the effective format.
parent b2f8450d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -52,6 +52,9 @@ public:
    struct surface_data_t {
        int32_t             token;
        int32_t             identity;
        uint32_t            width;
        uint32_t            height;
        uint32_t            format;
        status_t readFromParcel(const Parcel& parcel);
        status_t writeToParcel(Parcel* parcel) const;
    };
+0 −8
Original line number Diff line number Diff line
@@ -730,14 +730,6 @@ sp<LayerBaseClient> LayerBaseClient::Surface::getOwner() const {
    return owner;
}


void LayerBaseClient::Surface::getSurfaceData(
        ISurfaceFlingerClient::surface_data_t* params) const 
{
    params->token = mToken;
    params->identity = mIdentity;
}

status_t LayerBaseClient::Surface::onTransact(
        uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
+2 −3
Original line number Diff line number Diff line
@@ -321,9 +321,8 @@ public:
    class Surface : public BnSurface 
    {
    public:
        
        virtual void getSurfaceData(
                ISurfaceFlingerClient::surface_data_t* params) const;
        int32_t getToken() const { return mToken; }
        int32_t getIdentity() const { return mIdentity; }
        
    protected:
        Surface(const sp<SurfaceFlinger>& flinger, 
+13 −5
Original line number Diff line number Diff line
@@ -1239,9 +1239,11 @@ sp<ISurface> SurfaceFlinger::createSurface(ClientID clientId, int pid,
    switch (flags & eFXSurfaceMask) {
        case eFXSurfaceNormal:
            if (UNLIKELY(flags & ePushBuffers)) {
                layer = createPushBuffersSurfaceLocked(client, d, id, w, h, flags);
                layer = createPushBuffersSurfaceLocked(client, d, id,
                        w, h, flags);
            } else {
                layer = createNormalSurfaceLocked(client, d, id, w, h, format, flags);
                layer = createNormalSurfaceLocked(client, d, id,
                        w, h, flags, format);
            }
            break;
        case eFXSurfaceBlur:
@@ -1255,8 +1257,13 @@ sp<ISurface> SurfaceFlinger::createSurface(ClientID clientId, int pid,
    if (layer != 0) {
        setTransactionFlags(eTransactionNeeded);
        surfaceHandle = layer->getSurface();
        if (surfaceHandle != 0)
            surfaceHandle->getSurfaceData(params);
        if (surfaceHandle != 0) { 
            params->token = surfaceHandle->getToken();
            params->identity = surfaceHandle->getIdentity();
            params->width = w;
            params->height = h;
            params->format = format;
        }
    }

    return surfaceHandle;
@@ -1264,7 +1271,8 @@ sp<ISurface> SurfaceFlinger::createSurface(ClientID clientId, int pid,

sp<LayerBaseClient> SurfaceFlinger::createNormalSurfaceLocked(
        const sp<Client>& client, DisplayID display,
        int32_t id, uint32_t w, uint32_t h, PixelFormat format, uint32_t flags)
        int32_t id, uint32_t w, uint32_t h, uint32_t flags,
        PixelFormat& format)
{
    // initialize the surfaces
    switch (format) { // TODO: take h/w into account
+2 −2
Original line number Diff line number Diff line
@@ -195,8 +195,8 @@ private:

    sp<LayerBaseClient> createNormalSurfaceLocked(
            const sp<Client>& client, DisplayID display,
            int32_t id, uint32_t w, uint32_t h, 
            PixelFormat format, uint32_t flags);
            int32_t id, uint32_t w, uint32_t h, uint32_t flags,
            PixelFormat& format);

    sp<LayerBaseClient> createBlurSurfaceLocked(
            const sp<Client>& client, DisplayID display,
Loading