diff options
Diffstat (limited to 'libs/gui')
-rw-r--r-- | libs/gui/BufferQueue.cpp | 9 | ||||
-rw-r--r-- | libs/gui/IGraphicBufferAlloc.cpp | 21 | ||||
-rw-r--r-- | libs/gui/ISurfaceTexture.cpp | 26 | ||||
-rw-r--r-- | libs/gui/SurfaceTextureClient.cpp | 38 |
4 files changed, 94 insertions, 0 deletions
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp index 9f9b441..5226037 100644 --- a/libs/gui/BufferQueue.cpp +++ b/libs/gui/BufferQueue.cpp @@ -195,6 +195,15 @@ status_t BufferQueue::setBufferCount(int bufferCount) { return OK; } +#ifdef QCOM_BSP +status_t BufferQueue::setBuffersSize(int size) { + ST_LOGV("setBuffersSize: size=%d", size); + Mutex::Autolock lock(mMutex); + mGraphicBufferAlloc->setGraphicBufferSize(size); + return NO_ERROR; +} +#endif + int BufferQueue::query(int what, int* outValue) { ATRACE_CALL(); diff --git a/libs/gui/IGraphicBufferAlloc.cpp b/libs/gui/IGraphicBufferAlloc.cpp index 139f219..8afb509 100644 --- a/libs/gui/IGraphicBufferAlloc.cpp +++ b/libs/gui/IGraphicBufferAlloc.cpp @@ -32,6 +32,9 @@ namespace android { enum { CREATE_GRAPHIC_BUFFER = IBinder::FIRST_CALL_TRANSACTION, +#ifdef QCOM_BSP + SET_GRAPHIC_BUFFER_SIZE, +#endif }; class BpGraphicBufferAlloc : public BpInterface<IGraphicBufferAlloc> @@ -63,6 +66,16 @@ public: *error = result; return graphicBuffer; } + +#ifdef QCOM_BSP + virtual void setGraphicBufferSize(int size) { + Parcel data, reply; + data.writeInterfaceToken( + IGraphicBufferAlloc::getInterfaceDescriptor()); + data.writeInt32(size); + remote()->transact(SET_GRAPHIC_BUFFER_SIZE, data, &reply); + } +#endif }; IMPLEMENT_META_INTERFACE(GraphicBufferAlloc, "android.ui.IGraphicBufferAlloc"); @@ -108,6 +121,14 @@ status_t BnGraphicBufferAlloc::onTransact( } return NO_ERROR; } break; +#ifdef QCOM_BSP + case SET_GRAPHIC_BUFFER_SIZE: { + CHECK_INTERFACE(IGraphicBufferAlloc, data, reply); + int size = data.readInt32(); + setGraphicBufferSize(size); + return NO_ERROR; + } break; +#endif default: return BBinder::onTransact(code, data, reply, flags); } diff --git a/libs/gui/ISurfaceTexture.cpp b/libs/gui/ISurfaceTexture.cpp index a0b1e74..4b20a36 100644 --- a/libs/gui/ISurfaceTexture.cpp +++ b/libs/gui/ISurfaceTexture.cpp @@ -38,6 +38,9 @@ enum { CANCEL_BUFFER, QUERY, SET_SYNCHRONOUS_MODE, +#ifdef QCOM_BSP + SET_BUFFERS_SIZE, +#endif CONNECT, DISCONNECT, }; @@ -156,6 +159,20 @@ public: return result; } +#ifdef QCOM_BSP + virtual status_t setBuffersSize(int size) { + Parcel data, reply; + data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); + data.writeInt32(size); + status_t result = remote()->transact(SET_BUFFERS_SIZE, data, &reply); + if (result != NO_ERROR) { + return result; + } + result = reply.readInt32(); + return result; + } +#endif + virtual status_t connect(int api, QueueBufferOutput* output) { Parcel data, reply; data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); @@ -266,6 +283,15 @@ status_t BnSurfaceTexture::onTransact( reply->writeInt32(res); return NO_ERROR; } break; +#ifdef QCOM_BSP + case SET_BUFFERS_SIZE: { + CHECK_INTERFACE(ISurfaceTexture, data, reply); + int size = data.readInt32(); + status_t res = setBuffersSize(size); + reply->writeInt32(res); + return NO_ERROR; + } break; +#endif case CONNECT: { CHECK_INTERFACE(ISurfaceTexture, data, reply); int api = data.readInt32(); diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp index afdbf04..e33b026 100644 --- a/libs/gui/SurfaceTextureClient.cpp +++ b/libs/gui/SurfaceTextureClient.cpp @@ -80,6 +80,9 @@ void SurfaceTextureClient::init() { mReqHeight = 0; mReqFormat = 0; mReqUsage = 0; +#ifdef QCOM_BSP + mReqSize = 0; +#endif mTimestamp = NATIVE_WINDOW_TIMESTAMP_AUTO; mCrop.clear(); mScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE; @@ -400,6 +403,11 @@ int SurfaceTextureClient::perform(int operation, va_list args) case NATIVE_WINDOW_SET_BUFFERS_FORMAT: res = dispatchSetBuffersFormat(args); break; +#ifdef QCOM_BSP + case NATIVE_WINDOW_SET_BUFFERS_SIZE: + res = dispatchSetBuffersSize(args); + break; +#endif case NATIVE_WINDOW_LOCK: res = dispatchLock(args); break; @@ -451,6 +459,7 @@ int SurfaceTextureClient::dispatchSetBuffersGeometry(va_list args) { int w = va_arg(args, int); int h = va_arg(args, int); int f = va_arg(args, int); + int err = setBuffersDimensions(w, h); if (err != 0) { return err; @@ -461,6 +470,7 @@ int SurfaceTextureClient::dispatchSetBuffersGeometry(va_list args) { int SurfaceTextureClient::dispatchSetBuffersDimensions(va_list args) { int w = va_arg(args, int); int h = va_arg(args, int); + return setBuffersDimensions(w, h); } @@ -475,6 +485,13 @@ int SurfaceTextureClient::dispatchSetBuffersFormat(va_list args) { return setBuffersFormat(f); } +#ifdef QCOM_BSP +int SurfaceTextureClient::dispatchSetBuffersSize(va_list args) { + int size = va_arg(args, int); + return setBuffersSize(size); +} +#endif + int SurfaceTextureClient::dispatchSetScalingMode(va_list args) { int m = va_arg(args, int); return setScalingMode(m); @@ -530,6 +547,9 @@ int SurfaceTextureClient::disconnect(int api) { mReqWidth = 0; mReqHeight = 0; mReqUsage = 0; +#ifdef QCOM_BSP + mReqSize = 0; +#endif mCrop.clear(); mScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE; mTransform = 0; @@ -630,6 +650,24 @@ int SurfaceTextureClient::setBuffersFormat(int format) return NO_ERROR; } +#ifdef QCOM_BSP +int SurfaceTextureClient::setBuffersSize(int size) +{ + ATRACE_CALL(); + ALOGV("SurfaceTextureClient::setBuffersSize"); + + if (size<0) + return BAD_VALUE; + + Mutex::Autolock lock(mMutex); + if(mReqSize != (uint32_t)size) { + mReqSize = size; + return mSurfaceTexture->setBuffersSize(size); + } + return NO_ERROR; +} +#endif + int SurfaceTextureClient::setScalingMode(int mode) { ATRACE_CALL(); |