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

Commit 24202f56 authored by Mathias Agopian's avatar Mathias Agopian
Browse files

update the binder protocol for connect to match that of queueBuffer

indeed, connect and queueBuffer return the same data, so it's
easier to have them use the same protocol.

Change-Id: I4f9fa3be0a80c9ab0a7a4039b282ae843aab02e1
parent a0db308c
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -143,8 +143,7 @@ public:
    //
    // This method will fail if the connect was previously called on the
    // BufferQueue and no corresponding disconnect call was made.
    virtual status_t connect(int api,
            uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform);
    virtual status_t connect(int api, QueueBufferOutput* output);

    // disconnect attempts to disconnect a producer client API from the
    // BufferQueue. Calling this method will cause any subsequent calls to other
+1 −2
Original line number Diff line number Diff line
@@ -153,8 +153,7 @@ protected:
    // outWidth, outHeight and outTransform are filled with the default width
    // and height of the window and current transform applied to buffers,
    // respectively.
    virtual status_t connect(int api,
            uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) = 0;
    virtual status_t connect(int api, QueueBufferOutput* output) = 0;

    // disconnect attempts to disconnect a client API from the SurfaceTexture.
    // Calling this method will cause any subsequent calls to other
+2 −5
Original line number Diff line number Diff line
@@ -651,8 +651,7 @@ void BufferQueue::cancelBuffer(int buf) {
    mDequeueCondition.broadcast();
}

status_t BufferQueue::connect(int api,
        uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
status_t BufferQueue::connect(int api, QueueBufferOutput* output) {
    ATRACE_CALL();
    ST_LOGV("connect: api=%d", api);
    Mutex::Autolock lock(mMutex);
@@ -679,9 +678,7 @@ status_t BufferQueue::connect(int api,
                err = -EINVAL;
            } else {
                mConnectedApi = api;
                *outWidth = mDefaultWidth;
                *outHeight = mDefaultHeight;
                *outTransform = mTransformHint;
                output->inflate(mDefaultWidth, mDefaultHeight, mDefaultHeight);
            }
            break;
        default:
+6 −11
Original line number Diff line number Diff line
@@ -145,8 +145,7 @@ public:
        return result;
    }

    virtual status_t connect(int api,
            uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
    virtual status_t connect(int api, QueueBufferOutput* output) {
        Parcel data, reply;
        data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
        data.writeInt32(api);
@@ -154,9 +153,7 @@ public:
        if (result != NO_ERROR) {
            return result;
        }
        *outWidth = reply.readInt32();
        *outHeight = reply.readInt32();
        *outTransform = reply.readInt32();
        memcpy(output, reply.readInplace(sizeof(*output)), sizeof(*output));
        result = reply.readInt32();
        return result;
    }
@@ -251,12 +248,10 @@ status_t BnSurfaceTexture::onTransact(
        case CONNECT: {
            CHECK_INTERFACE(ISurfaceTexture, data, reply);
            int api = data.readInt32();
            uint32_t outWidth, outHeight, outTransform;
            status_t res = connect(api,
                    &outWidth, &outHeight, &outTransform);
            reply->writeInt32(outWidth);
            reply->writeInt32(outHeight);
            reply->writeInt32(outTransform);
            QueueBufferOutput* const output =
                    reinterpret_cast<QueueBufferOutput *>(
                            reply->writeInplace(sizeof(QueueBufferOutput)));
            status_t res = connect(api, output);
            reply->writeInt32(res);
            return NO_ERROR;
        } break;
+3 −2
Original line number Diff line number Diff line
@@ -429,8 +429,9 @@ int SurfaceTextureClient::connect(int api) {
    ATRACE_CALL();
    ALOGV("SurfaceTextureClient::connect");
    Mutex::Autolock lock(mMutex);
    int err = mSurfaceTexture->connect(api,
            &mDefaultWidth, &mDefaultHeight, &mTransformHint);
    ISurfaceTexture::QueueBufferOutput output;
    int err = mSurfaceTexture->connect(api, &output);
    output.deflate(&mDefaultWidth, &mDefaultHeight, &mTransformHint);
    if (!err && api == NATIVE_WINDOW_API_CPU) {
        mConnectedToCpu = true;
    }
Loading