From 4c00cc11141da7d159eb2323b186ed344115c0f1 Mon Sep 17 00:00:00 2001 From: Jesse Hall Date: Fri, 15 Mar 2013 21:34:30 -0700 Subject: [PATCH] Fix argument types in IGraphicBufferProducer methods Bug: 8384764 Change-Id: I7a3f1e1a0584a70af04f9eafef900505389d2202 --- include/gui/BufferQueue.h | 4 ++-- include/gui/IGraphicBufferProducer.h | 4 ++-- libs/gui/BufferQueue.cpp | 6 +++--- libs/gui/IGraphicBufferProducer.cpp | 10 +++++----- libs/gui/Surface.cpp | 4 ++-- libs/gui/tests/BufferQueue_test.cpp | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/gui/BufferQueue.h b/include/gui/BufferQueue.h index c59e00e0da..6a86db6ab3 100644 --- a/include/gui/BufferQueue.h +++ b/include/gui/BufferQueue.h @@ -128,7 +128,7 @@ public: // GL_MAX_VIEWPORT_DIMS and GL_MAX_TEXTURE_SIZE (see: glGetIntegerv). // An error due to invalid dimensions might not be reported until // updateTexImage() is called. - virtual status_t dequeueBuffer(int *buf, sp& fence, + virtual status_t dequeueBuffer(int *buf, sp* fence, uint32_t width, uint32_t height, uint32_t format, uint32_t usage); // queueBuffer returns a filled buffer to the BufferQueue. In addition, a @@ -139,7 +139,7 @@ public: virtual status_t queueBuffer(int buf, const QueueBufferInput& input, QueueBufferOutput* output); - virtual void cancelBuffer(int buf, sp fence); + virtual void cancelBuffer(int buf, const sp& fence); // setSynchronousMode set whether dequeueBuffer is synchronous or // asynchronous. In synchronous mode, dequeueBuffer blocks until diff --git a/include/gui/IGraphicBufferProducer.h b/include/gui/IGraphicBufferProducer.h index a3e258df3a..29c7ff371b 100644 --- a/include/gui/IGraphicBufferProducer.h +++ b/include/gui/IGraphicBufferProducer.h @@ -84,7 +84,7 @@ public: // the buffer. The contents of the buffer must not be overwritten until the // fence signals. If the fence is NULL, the buffer may be written // immediately. - virtual status_t dequeueBuffer(int *slot, sp& fence, + virtual status_t dequeueBuffer(int *slot, sp* fence, uint32_t w, uint32_t h, uint32_t format, uint32_t usage) = 0; // queueBuffer indicates that the client has finished filling in the @@ -165,7 +165,7 @@ public: // cancelBuffer indicates that the client does not wish to fill in the // buffer associated with slot and transfers ownership of the slot back to // the server. - virtual void cancelBuffer(int slot, sp fence) = 0; + virtual void cancelBuffer(int slot, const sp& fence) = 0; // query retrieves some information for this surface // 'what' tokens allowed are that of android_natives.h diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp index 41ee1be927..75a02963e6 100644 --- a/libs/gui/BufferQueue.cpp +++ b/libs/gui/BufferQueue.cpp @@ -254,7 +254,7 @@ status_t BufferQueue::requestBuffer(int slot, sp* buf) { return NO_ERROR; } -status_t BufferQueue::dequeueBuffer(int *outBuf, sp& outFence, +status_t BufferQueue::dequeueBuffer(int *outBuf, sp* outFence, uint32_t w, uint32_t h, uint32_t format, uint32_t usage) { ATRACE_CALL(); ST_LOGV("dequeueBuffer: w=%d h=%d fmt=%#x usage=%#x", w, h, format, usage); @@ -393,7 +393,7 @@ status_t BufferQueue::dequeueBuffer(int *outBuf, sp& outFence, dpy = mSlots[buf].mEglDisplay; eglFence = mSlots[buf].mEglFence; - outFence = mSlots[buf].mFence; + *outFence = mSlots[buf].mFence; mSlots[buf].mEglFence = EGL_NO_SYNC_KHR; mSlots[buf].mFence = Fence::NO_FENCE; } // end lock scope @@ -590,7 +590,7 @@ status_t BufferQueue::queueBuffer(int buf, return OK; } -void BufferQueue::cancelBuffer(int buf, sp fence) { +void BufferQueue::cancelBuffer(int buf, const sp& fence) { ATRACE_CALL(); ST_LOGV("cancelBuffer: slot=%d", buf); Mutex::Autolock lock(mMutex); diff --git a/libs/gui/IGraphicBufferProducer.cpp b/libs/gui/IGraphicBufferProducer.cpp index 54860d794c..63d7628a55 100644 --- a/libs/gui/IGraphicBufferProducer.cpp +++ b/libs/gui/IGraphicBufferProducer.cpp @@ -81,7 +81,7 @@ public: return result; } - virtual status_t dequeueBuffer(int *buf, sp& fence, + virtual status_t dequeueBuffer(int *buf, sp* fence, uint32_t w, uint32_t h, uint32_t format, uint32_t usage) { Parcel data, reply; data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); @@ -99,8 +99,8 @@ public: // If the fence was written by the callee, then overwrite the // caller's fence here. If it wasn't written then don't touch the // caller's fence. - fence = new Fence(); - reply.read(*fence.get()); + *fence = new Fence(); + reply.read(*(fence->get())); } result = reply.readInt32(); return result; @@ -121,7 +121,7 @@ public: return result; } - virtual void cancelBuffer(int buf, sp fence) { + virtual void cancelBuffer(int buf, const sp& fence) { Parcel data, reply; data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); data.writeInt32(buf); @@ -215,7 +215,7 @@ status_t BnGraphicBufferProducer::onTransact( uint32_t usage = data.readInt32(); int buf; sp fence; - int result = dequeueBuffer(&buf, fence, w, h, format, usage); + int result = dequeueBuffer(&buf, &fence, w, h, format, usage); reply->writeInt32(buf); reply->writeInt32(fence != NULL); if (fence != NULL) { diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp index ec55b57994..4a58023541 100644 --- a/libs/gui/Surface.cpp +++ b/libs/gui/Surface.cpp @@ -182,8 +182,8 @@ int Surface::dequeueBuffer(android_native_buffer_t** buffer, int reqW = mReqWidth ? mReqWidth : mUserWidth; int reqH = mReqHeight ? mReqHeight : mUserHeight; sp fence; - status_t result = mGraphicBufferProducer->dequeueBuffer(&buf, fence, reqW, reqH, - mReqFormat, mReqUsage); + status_t result = mGraphicBufferProducer->dequeueBuffer(&buf, &fence, + reqW, reqH, mReqFormat, mReqUsage); if (result < 0) { ALOGV("dequeueBuffer: IGraphicBufferProducer::dequeueBuffer(%d, %d, %d, %d)" "failed: %d", mReqWidth, mReqHeight, mReqFormat, mReqUsage, diff --git a/libs/gui/tests/BufferQueue_test.cpp b/libs/gui/tests/BufferQueue_test.cpp index 93f8fafc22..62d215ba8f 100644 --- a/libs/gui/tests/BufferQueue_test.cpp +++ b/libs/gui/tests/BufferQueue_test.cpp @@ -76,7 +76,7 @@ TEST_F(BufferQueueTest, AcquireBuffer_ExceedsMaxAcquireCount_Fails) { for (int i = 0; i < 2; i++) { ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, - mBQ->dequeueBuffer(&slot, fence, 1, 1, 0, + mBQ->dequeueBuffer(&slot, &fence, 1, 1, 0, GRALLOC_USAGE_SW_READ_OFTEN)); ASSERT_EQ(OK, mBQ->requestBuffer(slot, &buf)); ASSERT_EQ(OK, mBQ->queueBuffer(slot, qbi, &qbo)); @@ -84,7 +84,7 @@ TEST_F(BufferQueueTest, AcquireBuffer_ExceedsMaxAcquireCount_Fails) { } ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, - mBQ->dequeueBuffer(&slot, fence, 1, 1, 0, + mBQ->dequeueBuffer(&slot, &fence, 1, 1, 0, GRALLOC_USAGE_SW_READ_OFTEN)); ASSERT_EQ(OK, mBQ->requestBuffer(slot, &buf)); ASSERT_EQ(OK, mBQ->queueBuffer(slot, qbi, &qbo)); -- 2.11.0