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
This commit is contained in:
Mathias Agopian 2012-04-23 14:28:58 -07:00
parent a0db308c3d
commit 24202f5676
7 changed files with 16 additions and 28 deletions

View File

@ -143,8 +143,7 @@ public:
// //
// This method will fail if the connect was previously called on the // This method will fail if the connect was previously called on the
// BufferQueue and no corresponding disconnect call was made. // BufferQueue and no corresponding disconnect call was made.
virtual status_t connect(int api, virtual status_t connect(int api, QueueBufferOutput* output);
uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform);
// disconnect attempts to disconnect a producer client API from the // disconnect attempts to disconnect a producer client API from the
// BufferQueue. Calling this method will cause any subsequent calls to other // BufferQueue. Calling this method will cause any subsequent calls to other

View File

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

View File

@ -651,8 +651,7 @@ void BufferQueue::cancelBuffer(int buf) {
mDequeueCondition.broadcast(); mDequeueCondition.broadcast();
} }
status_t BufferQueue::connect(int api, status_t BufferQueue::connect(int api, QueueBufferOutput* output) {
uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
ATRACE_CALL(); ATRACE_CALL();
ST_LOGV("connect: api=%d", api); ST_LOGV("connect: api=%d", api);
Mutex::Autolock lock(mMutex); Mutex::Autolock lock(mMutex);
@ -679,9 +678,7 @@ status_t BufferQueue::connect(int api,
err = -EINVAL; err = -EINVAL;
} else { } else {
mConnectedApi = api; mConnectedApi = api;
*outWidth = mDefaultWidth; output->inflate(mDefaultWidth, mDefaultHeight, mDefaultHeight);
*outHeight = mDefaultHeight;
*outTransform = mTransformHint;
} }
break; break;
default: default:

View File

@ -145,8 +145,7 @@ public:
return result; return result;
} }
virtual status_t connect(int api, virtual status_t connect(int api, QueueBufferOutput* output) {
uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
Parcel data, reply; Parcel data, reply;
data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
data.writeInt32(api); data.writeInt32(api);
@ -154,9 +153,7 @@ public:
if (result != NO_ERROR) { if (result != NO_ERROR) {
return result; return result;
} }
*outWidth = reply.readInt32(); memcpy(output, reply.readInplace(sizeof(*output)), sizeof(*output));
*outHeight = reply.readInt32();
*outTransform = reply.readInt32();
result = reply.readInt32(); result = reply.readInt32();
return result; return result;
} }
@ -251,12 +248,10 @@ status_t BnSurfaceTexture::onTransact(
case CONNECT: { case CONNECT: {
CHECK_INTERFACE(ISurfaceTexture, data, reply); CHECK_INTERFACE(ISurfaceTexture, data, reply);
int api = data.readInt32(); int api = data.readInt32();
uint32_t outWidth, outHeight, outTransform; QueueBufferOutput* const output =
status_t res = connect(api, reinterpret_cast<QueueBufferOutput *>(
&outWidth, &outHeight, &outTransform); reply->writeInplace(sizeof(QueueBufferOutput)));
reply->writeInt32(outWidth); status_t res = connect(api, output);
reply->writeInt32(outHeight);
reply->writeInt32(outTransform);
reply->writeInt32(res); reply->writeInt32(res);
return NO_ERROR; return NO_ERROR;
} break; } break;

View File

@ -429,8 +429,9 @@ int SurfaceTextureClient::connect(int api) {
ATRACE_CALL(); ATRACE_CALL();
ALOGV("SurfaceTextureClient::connect"); ALOGV("SurfaceTextureClient::connect");
Mutex::Autolock lock(mMutex); Mutex::Autolock lock(mMutex);
int err = mSurfaceTexture->connect(api, ISurfaceTexture::QueueBufferOutput output;
&mDefaultWidth, &mDefaultHeight, &mTransformHint); int err = mSurfaceTexture->connect(api, &output);
output.deflate(&mDefaultWidth, &mDefaultHeight, &mTransformHint);
if (!err && api == NATIVE_WINDOW_API_CPU) { if (!err && api == NATIVE_WINDOW_API_CPU) {
mConnectedToCpu = true; mConnectedToCpu = true;
} }

View File

@ -34,10 +34,8 @@ SurfaceTextureLayer::SurfaceTextureLayer()
SurfaceTextureLayer::~SurfaceTextureLayer() { SurfaceTextureLayer::~SurfaceTextureLayer() {
} }
status_t SurfaceTextureLayer::connect(int api, status_t SurfaceTextureLayer::connect(int api, QueueBufferOutput* output) {
uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) { status_t err = BufferQueue::connect(api, output);
status_t err = BufferQueue::connect(api,
outWidth, outHeight, outTransform);
if (err == NO_ERROR) { if (err == NO_ERROR) {
switch(api) { switch(api) {
case NATIVE_WINDOW_API_MEDIA: case NATIVE_WINDOW_API_MEDIA:

View File

@ -37,8 +37,7 @@ public:
SurfaceTextureLayer(); SurfaceTextureLayer();
~SurfaceTextureLayer(); ~SurfaceTextureLayer();
virtual status_t connect(int api, virtual status_t connect(int api, QueueBufferOutput* output);
uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform);
}; };
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------