diff options
author | Ramkumar Radhakrishnan <ramkumar@codeaurora.org> | 2012-11-07 11:30:19 -0800 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2013-03-10 22:55:44 -0700 |
commit | 31152b94cd0471a3853fb658e9aff507d4eec384 (patch) | |
tree | 041a5ab856784ee1eb4bb6b49d738847658c33f8 /libs/ui/GraphicBufferAllocator.cpp | |
parent | aed9f3c81b67ff72b92a9de18de4ff38af523e54 (diff) | |
download | frameworks_native-31152b94cd0471a3853fb658e9aff507d4eec384.zip frameworks_native-31152b94cd0471a3853fb658e9aff507d4eec384.tar.gz frameworks_native-31152b94cd0471a3853fb658e9aff507d4eec384.tar.bz2 |
Add support for custom buffer sizes.
Add native window properties NATIVE_WINDOW_SET_BUFFERS_SIZE to the
perform function of SurfaceTextureClient to set the user defined size
of graphic buffers.
Change-Id: I1dc2203990a3641fbb9ddab9a86f7e9017f05270
Diffstat (limited to 'libs/ui/GraphicBufferAllocator.cpp')
-rw-r--r-- | libs/ui/GraphicBufferAllocator.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/libs/ui/GraphicBufferAllocator.cpp b/libs/ui/GraphicBufferAllocator.cpp index 2ea5696..9ad314a 100644 --- a/libs/ui/GraphicBufferAllocator.cpp +++ b/libs/ui/GraphicBufferAllocator.cpp @@ -192,6 +192,17 @@ sp<BufferLiberatorThread> BufferLiberatorThread::sThread; status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat format, int usage, buffer_handle_t* handle, int32_t* stride) { +#ifdef QCOM_BSP + status_t err = alloc(w, h, format, usage, handle, stride, 0); + return err; +} + +status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, + PixelFormat format, int usage, + buffer_handle_t* handle, + int32_t* stride, uint32_t bufferSize) +{ +#endif ATRACE_CALL(); // make sure to not allocate a N x 0 or 0 x N buffer, since this is // allowed from an API stand-point allocate a 1x1 buffer instead. @@ -216,7 +227,13 @@ status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat forma // by the android.opengl.cts.GLSurfaceViewTest CTS test. BufferLiberatorThread::maybeWaitForLiberation(); - err = mAllocDev->alloc(mAllocDev, w, h, format, usage, handle, stride); +#ifdef QCOM_BSP + if (bufferSize) + err = mAllocDev->allocSize(mAllocDev, w, h, + format, usage, handle, stride, bufferSize); + else +#endif + err = mAllocDev->alloc(mAllocDev, w, h, format, usage, handle, stride); if (err != NO_ERROR) { ALOGW("WOW! gralloc alloc failed, waiting for pending frees!"); @@ -224,8 +241,13 @@ status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat forma err = mAllocDev->alloc(mAllocDev, w, h, format, usage, handle, stride); } +#ifdef QCOM_BSP + ALOGW_IF(err, "alloc(%u, %u, %d, %08x, %d ...) failed %d (%s)", + w, h, format, usage, bufferSize, err, strerror(-err)); +#else ALOGW_IF(err, "alloc(%u, %u, %d, %08x, ...) failed %d (%s)", w, h, format, usage, err, strerror(-err)); +#endif if (err == NO_ERROR) { Mutex::Autolock _l(sLock); |