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

Commit 97c602c5 authored by Mathias Agopian's avatar Mathias Agopian
Browse files

implement: "Add an ANativeWindow API for SurfaceFlinger to suggest an optimal buffer orientation"

Bug: 4487161
Change-Id: I883f34efe542c2a566d04966f873374f40c50092
parent 933389f7
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -78,7 +78,12 @@ protected:
    // client for this buffer. The timestamp is measured in nanoseconds, and
    // must be monotonically increasing. Its other properties (zero point, etc)
    // are client-dependent, and should be documented by the client.
    virtual status_t queueBuffer(int slot, int64_t timestamp) = 0;
    //
    // outWidth, outHeight and outTransform are filed with the default width
    // default height of the window and current transform applied to buffers,
    // respectively.
    virtual status_t queueBuffer(int slot, int64_t timestamp,
            uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) = 0;

    // cancelBuffer indicates that the client does not wish to fill in the
    // buffer associated with slot and transfers ownership of the slot back to
+2 −1
Original line number Diff line number Diff line
@@ -84,7 +84,8 @@ public:
    // nanoseconds, and must be monotonically increasing. Its other semantics
    // (zero point, etc) are client-dependent and should be documented by the
    // client.
    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);
    virtual void cancelBuffer(int buf);
    virtual status_t setCrop(const Rect& reg);
    virtual status_t setTransform(uint32_t transform);
+12 −0
Original line number Diff line number Diff line
@@ -151,6 +151,18 @@ private:
    // dequeued format or to mReqFormat if no buffer was dequeued.
    uint32_t mQueryFormat;

    // mDefaultWidth is default width of the window, regardless of the
    // set_dimension call
    uint32_t mDefaultWidth;

    // mDefaultHeight is default width of the window, regardless of the
    // set_dimension call
    uint32_t mDefaultHeight;

    // mTransformHint is the transform probably applied to buffers of this
    // window. this is only a hint, actual transform may differ.
    uint32_t mTransformHint;

    // mMutex is the mutex used to prevent concurrent access to the member
    // variables of SurfaceTexture objects. It must be locked whenever the
    // member variables are accessed.
+11 −2
Original line number Diff line number Diff line
@@ -93,12 +93,16 @@ public:
        return result;
    }

    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) {
        Parcel data, reply;
        data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
        data.writeInt32(buf);
        data.writeInt64(timestamp);
        remote()->transact(QUEUE_BUFFER, data, &reply);
        *outWidth = reply.readInt32();
        *outHeight = reply.readInt32();
        *outTransform = reply.readInt32();
        status_t result = reply.readInt32();
        return result;
    }
@@ -226,7 +230,12 @@ status_t BnSurfaceTexture::onTransact(
            CHECK_INTERFACE(ISurfaceTexture, data, reply);
            int buf = data.readInt32();
            int64_t timestamp = data.readInt64();
            status_t result = queueBuffer(buf, timestamp);
            uint32_t outWidth, outHeight, outTransform;
            status_t result = queueBuffer(buf, timestamp,
                    &outWidth, &outHeight, &outTransform);
            reply->writeInt32(outWidth);
            reply->writeInt32(outHeight);
            reply->writeInt32(outTransform);
            reply->writeInt32(result);
            return NO_ERROR;
        } break;
+7 −1
Original line number Diff line number Diff line
@@ -402,7 +402,8 @@ status_t SurfaceTexture::setSynchronousMode(bool enabled) {
    return err;
}

status_t SurfaceTexture::queueBuffer(int buf, int64_t timestamp) {
status_t SurfaceTexture::queueBuffer(int buf, int64_t timestamp,
        uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
    LOGV("SurfaceTexture::queueBuffer");

    sp<FrameAvailableListener> listener;
@@ -463,6 +464,11 @@ status_t SurfaceTexture::queueBuffer(int buf, int64_t timestamp) {
    if (listener != 0) {
        listener->onFrameAvailable();
    }

    *outWidth = mDefaultWidth;
    *outHeight = mDefaultHeight;
    *outTransform = 0;

    return OK;
}

Loading