From 8bb824566fa51b7d137305d7849a81a4764c6b7e Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Fri, 29 Jul 2011 16:35:41 -0700 Subject: improve GraphicAllocator dump method GraphicAllocator debugging cannot deal with custom HAL formats. make this more obvious in the log. Change-Id: I202e58a7f213f32e725aa4eac62cdf6e50ca5894 --- libs/ui/GraphicBufferAllocator.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'libs') 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 ; icommon.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& 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); } -- cgit v1.1