summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-07-29 16:35:41 -0700
committerMathias Agopian <mathias@google.com>2011-07-29 16:35:41 -0700
commit8bb824566fa51b7d137305d7849a81a4764c6b7e (patch)
treed5f9ba2a080aa1bfcf23cc83f72556b74d446884
parent03116780a17cb6db7c926d01630cb9f68a19539b (diff)
downloadframeworks_base-8bb824566fa51b7d137305d7849a81a4764c6b7e.zip
frameworks_base-8bb824566fa51b7d137305d7849a81a4764c6b7e.tar.gz
frameworks_base-8bb824566fa51b7d137305d7849a81a4764c6b7e.tar.bz2
improve GraphicAllocator dump method
GraphicAllocator debugging cannot deal with custom HAL formats. make this more obvious in the log. Change-Id: I202e58a7f213f32e725aa4eac62cdf6e50ca5894
-rw-r--r--libs/ui/GraphicBufferAllocator.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/libs/ui/GraphicBufferAllocator.cpp b/libs/ui/GraphicBufferAllocator.cpp
index 33ef1fc..e75415b 100644
--- a/libs/ui/GraphicBufferAllocator.cpp
+++ b/libs/ui/GraphicBufferAllocator.cpp
@@ -61,13 +61,19 @@ void GraphicBufferAllocator::dump(String8& result) const
const size_t c = list.size();
for (size_t i=0 ; i<c ; i++) {
const alloc_rec_t& rec(list.valueAt(i));
- snprintf(buffer, SIZE, "%10p: %7.2f KiB | %4u (%4u) x %4u | %8X | 0x%08x\n",
- list.keyAt(i), rec.size/1024.0f,
- rec.w, rec.s, rec.h, rec.format, rec.usage);
+ if (rec.size) {
+ snprintf(buffer, SIZE, "%10p: %7.2f KiB | %4u (%4u) x %4u | %8X | 0x%08x\n",
+ list.keyAt(i), rec.size/1024.0f,
+ rec.w, rec.s, rec.h, rec.format, rec.usage);
+ } else {
+ snprintf(buffer, SIZE, "%10p: unknown | %4u (%4u) x %4u | %8X | 0x%08x\n",
+ list.keyAt(i),
+ rec.w, rec.s, rec.h, rec.format, rec.usage);
+ }
result.append(buffer);
total += rec.size;
}
- snprintf(buffer, SIZE, "Total allocated: %.2f KB\n", total/1024.0f);
+ snprintf(buffer, SIZE, "Total allocated (estimate): %.2f KB\n", total/1024.0f);
result.append(buffer);
if (mAllocDev->common.version >= 1 && mAllocDev->dump) {
mAllocDev->dump(mAllocDev, buffer, SIZE);
@@ -101,13 +107,19 @@ status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat forma
if (err == NO_ERROR) {
Mutex::Autolock _l(sLock);
KeyedVector<buffer_handle_t, alloc_rec_t>& list(sAllocList);
+ int bpp = bytesPerPixel(format);
+ if (bpp < 0) {
+ // probably a HAL custom format. in any case, we don't know
+ // what its pixel size is.
+ bpp = 0;
+ }
alloc_rec_t rec;
rec.w = w;
rec.h = h;
rec.s = *stride;
rec.format = format;
rec.usage = usage;
- rec.size = h * stride[0] * bytesPerPixel(format);
+ rec.size = h * stride[0] * bpp;
list.add(*handle, rec);
}