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

Commit d1720155 authored by Kyong Hwa Bae's avatar Kyong Hwa Bae Committed by Arne Coucheron
Browse files

SurfaceFlinger: Return the current transform value when queried

When an application queries the transform hint,
SurfaceTexture returns the value based on the previous
queueBuffer function. When query() is called before any
queueBuffer() calls, it doesn't return the current transform.
Make sure to get the current transform from a layer
whenever query() is called.

Change-Id: Id86c931dc72285cf754cc6c77219434388fc0d69
parent f0b7008a
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -276,7 +276,13 @@ int SurfaceTextureClient::query(int what, int* value) const {
                *value = mDefaultHeight;
                *value = mDefaultHeight;
                return NO_ERROR;
                return NO_ERROR;
            case NATIVE_WINDOW_TRANSFORM_HINT:
            case NATIVE_WINDOW_TRANSFORM_HINT:
#ifdef QCOM_HARDWARE
                if (mSurfaceTexture->query(what, value) != NO_ERROR) {
                    *value = mTransformHint;
                    *value = mTransformHint;
                }
#else
                *value = mTransformHint;
#endif
                return NO_ERROR;
                return NO_ERROR;
        }
        }
    }
    }
+21 −0
Original line number Original line Diff line number Diff line
@@ -52,6 +52,27 @@ status_t SurfaceTextureLayer::setBufferCount(int bufferCount) {
    return res;
    return res;
}
}


#ifdef QCOM_HARDWARE
int SurfaceTextureLayer::query(int what, int* value) {
    int ret = SurfaceTexture::query(what, value);
    if (ret != NO_ERROR) return ret;

    sp<Layer> layer(mLayer.promote());
    if (layer == NULL) return NO_INIT;

    switch (what) {
    case NATIVE_WINDOW_TRANSFORM_HINT:
        *value = layer->getTransformHint();
        break;
    default:
        // for later use
        break;
    }

    return NO_ERROR;
}
#endif

status_t SurfaceTextureLayer::queueBuffer(int buf, int64_t timestamp,
status_t SurfaceTextureLayer::queueBuffer(int buf, int64_t timestamp,
        uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
        uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {


+4 −0
Original line number Original line Diff line number Diff line
@@ -45,6 +45,10 @@ public:
    virtual status_t setBufferCount(int bufferCount);
    virtual status_t setBufferCount(int bufferCount);


protected:
protected:
#ifdef QCOM_HARDWARE
    virtual int query(int what, int* value);
#endif

    virtual status_t queueBuffer(int buf, int64_t timestamp,
    virtual status_t queueBuffer(int buf, int64_t timestamp,
            uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform);
            uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform);