summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2010-12-07 17:24:03 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2010-12-07 17:24:03 -0800
commitb5a00fcb71426492f248ed49a0514a9b8d385065 (patch)
treece78c3a966ee11c9cf86d017dc3550e1f481ecb9
parent8a84418ef17048ef7879a2a413e26d6109c22a07 (diff)
parent372c56e98b93647b7050e518c285057a8a72bc74 (diff)
downloadframeworks_native-b5a00fcb71426492f248ed49a0514a9b8d385065.zip
frameworks_native-b5a00fcb71426492f248ed49a0514a9b8d385065.tar.gz
frameworks_native-b5a00fcb71426492f248ed49a0514a9b8d385065.tar.bz2
am 48f42f8c: am 4153bf3a: Merge "[3171580] don\'t automatically log GraphicBuffer allocation failures" into gingerbread
* commit '48f42f8c3fbd33b2f46c6290ff5963dd58938cf9': [3171580] don't automatically log GraphicBuffer allocation failures
-rw-r--r--include/ui/GraphicBuffer.h5
-rw-r--r--include/ui/GraphicBufferAllocator.h1
-rw-r--r--libs/ui/GraphicBuffer.cpp5
-rw-r--r--libs/ui/GraphicBufferAllocator.cpp11
-rw-r--r--services/surfaceflinger/Layer.cpp1
5 files changed, 18 insertions, 5 deletions
diff --git a/include/ui/GraphicBuffer.h b/include/ui/GraphicBuffer.h
index c446633..aa65d93 100644
--- a/include/ui/GraphicBuffer.h
+++ b/include/ui/GraphicBuffer.h
@@ -91,12 +91,15 @@ public:
status_t lock(uint32_t usage, const Rect& rect, void** vaddr);
status_t lock(GGLSurface* surface, uint32_t usage);
status_t unlock();
-
+
android_native_buffer_t* getNativeBuffer() const;
void setIndex(int index);
int getIndex() const;
+ // for debugging
+ static void dumpAllocationsToSystemLog();
+
private:
virtual ~GraphicBuffer();
diff --git a/include/ui/GraphicBufferAllocator.h b/include/ui/GraphicBufferAllocator.h
index 54b8236..dffa788 100644
--- a/include/ui/GraphicBufferAllocator.h
+++ b/include/ui/GraphicBufferAllocator.h
@@ -68,6 +68,7 @@ public:
status_t free(buffer_handle_t handle);
void dump(String8& res) const;
+ static void dumpToSystemLog();
private:
struct alloc_rec_t {
diff --git a/libs/ui/GraphicBuffer.cpp b/libs/ui/GraphicBuffer.cpp
index 436e064..97312a6 100644
--- a/libs/ui/GraphicBuffer.cpp
+++ b/libs/ui/GraphicBuffer.cpp
@@ -114,6 +114,11 @@ status_t GraphicBuffer::initCheck() const {
return mInitCheck;
}
+void GraphicBuffer::dumpAllocationsToSystemLog()
+{
+ GraphicBufferAllocator::dumpToSystemLog();
+}
+
android_native_buffer_t* GraphicBuffer::getNativeBuffer() const
{
return static_cast<android_native_buffer_t*>(
diff --git a/libs/ui/GraphicBufferAllocator.cpp b/libs/ui/GraphicBufferAllocator.cpp
index d51664d..fa46ab7 100644
--- a/libs/ui/GraphicBufferAllocator.cpp
+++ b/libs/ui/GraphicBufferAllocator.cpp
@@ -73,6 +73,13 @@ void GraphicBufferAllocator::dump(String8& result) const
result.append(buffer);
}
+void GraphicBufferAllocator::dumpToSystemLog()
+{
+ String8 s;
+ GraphicBufferAllocator::getInstance().dump(s);
+ LOGD("%s", s.string());
+}
+
status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat format,
int usage, buffer_handle_t* handle, int32_t* stride)
{
@@ -104,10 +111,6 @@ status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat forma
rec.usage = usage;
rec.size = h * stride[0] * bytesPerPixel(format);
list.add(*handle, rec);
- } else {
- String8 s;
- dump(s);
- LOGD("%s", s.string());
}
return err;
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 145618e..15df888 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -409,6 +409,7 @@ sp<GraphicBuffer> Layer::requestBuffer(int index,
err = buffer->initCheck();
if (err || buffer->handle == 0) {
+ GraphicBuffer::dumpAllocationsToSystemLog();
LOGE_IF(err || buffer->handle == 0,
"Layer::requestBuffer(this=%p), index=%d, w=%d, h=%d failed (%s)",
this, index, w, h, strerror(-err));