|
|
沙发

楼主 |
发表于 2016-4-29 20:01:17
|
只看该作者
第一步,修改buffer的大小为高度1920:
/media/doraemon/express/alps_ok/frameworks/native/libs/ui/GraphicBufferAllocator.cpp
status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat format,
int usage, buffer_handle_t* handle, int32_t* stride)
{
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.
if (!w || !h)
w = h = 1;
// we have a h/w allocator and h/w buffer is requested
status_t err;
//ALOGD("zcfdebug [GraphicBufferAllocator::alloc] the h is : %d", h); //zcfdebug++
//ALOGD("zcfdebug [GraphicBufferAllocator::alloc] the w is : %d", w); //zcfdebug++
if(h>=1 && h<=1920)h=1920; //zcfdebug++
err = mAllocDev->alloc(mAllocDev, w, h, format, usage, handle, stride);
ALOGW_IF(err, "alloc(%u, %u, %d, %08x, ...) failed %d (%s)",
w, h, format, usage, err, strerror(-err));
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] * bpp;
list.add(*handle, rec);
}
#ifdef MTK_AOSP_ENHANCEMENT
// dump call stack here after handle value got
if (true == mIsDumpCallStack) {
ALOGD("[GraphicBufferAllocator::alloc] handle:%p", *handle);
CallStack stack(" ");
}
#endif
return err;
}
|
|