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

Commit e978d0b0 authored by Kyong Hwa Bae's avatar Kyong Hwa Bae Committed by Giulio Cervera
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.

(cherry picked from commit d9668f53f8c41c16588531183f3ec8d6780b234d)

Change-Id: I635481ccd7d22148d2b7ab92f4e8c0c63ef7e715
parent 417d8925
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -276,7 +276,13 @@ int SurfaceTextureClient::query(int what, int* value) const {
                *value = mDefaultHeight;
                return NO_ERROR;
            case NATIVE_WINDOW_TRANSFORM_HINT:
#ifdef QCOM_HARDWARE
                if (mSurfaceTexture->query(what, value) != NO_ERROR) {
                    *value = mTransformHint;
                }
#else
                *value = mTransformHint;
#endif
                return NO_ERROR;
        }
    }
+21 −0
Original line number Diff line number Diff line
@@ -52,6 +52,27 @@ status_t SurfaceTextureLayer::setBufferCount(int bufferCount) {
    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,
        uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {

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

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

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